[
  {
    "path": ".gitattributes",
    "content": "# Auto detect text files and perform LF normalization\n* text=auto\n\n# Custom for Visual Studio\n*.bat text\n*.config text\n*.cmd text\n*.cs text\n*.csproj text\n*.licenseheader text\n*.nuspec text\n*.proj text\n*.ps1 text\n*.psm1 text\n*.resx text\n*.ruleset text\n*.sln text\n*.sql text\n*.targets text\n*.txt text\n\n# Standard to msysgit\n*.doc\t diff=astextplain\n*.DOC\t diff=astextplain\n*.docx diff=astextplain\n*.DOCX diff=astextplain\n*.dot  diff=astextplain\n*.DOT  diff=astextplain\n*.pdf  diff=astextplain\n*.PDF\t diff=astextplain\n*.rtf\t diff=astextplain\n*.RTF\t diff=astextplain\n"
  },
  {
    "path": ".gitignore",
    "content": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User-specific files\n*.suo\n*.user\n*.sln.docstates\n\n# Build results\n\n[Dd]ebug/\n[Rr]elease/\nx64/\n[Bb]in/\n[Oo]bj/\n\n# MSTest test Results\n[Tt]est[Rr]esult*/\n[Bb]uild[Ll]og.*\n\n*_i.c\n*_p.c\n*_i.h\n*.ilk\n*.meta\n*.obj\n*.pch\n*.pdb\n*.pgc\n*.pgd\n*.rsp\n*.sbr\n*.tlb\n*.tli\n*.tlh\n*.tmp\n*.tmp_proj\n*.log\n*.vspscc\n*.vssscc\n.builds\n*.pidb\n*.log\n*.svclog\n*.scc\n\n# Visual C++ cache files\nipch/\n*.aps\n*.ncb\n*.opensdf\n*.sdf\n*.cachefile\n\n# Visual Studio profiler\n*.psess\n*.vsp\n*.vspx\n\n# Guidance Automation Toolkit\n*.gpState\n\n# ReSharper is a .NET coding add-in\n_ReSharper*/\n*.[Rr]e[Ss]harper\n*.DotSettings.user\n\n# Click-Once directory\npublish/\n\n# Publish Web Output\n*.Publish.xml\n*.pubxml\n*.azurePubxml\n\n# NuGet Packages Directory\n## TODO: If you have NuGet Package Restore enabled, uncomment the next line\npackages/\n## TODO: If the tool you use requires repositories.config, also uncomment the next line\n!packages/repositories.config\n\n# Windows Azure Build Output\ncsx/\n*.build.csdef\n\n# Windows Store app package directory\nAppPackages/\n\n# Others\nsql/\n*.Cache\nClientBin/\n[Ss]tyle[Cc]op.*\n![Ss]tyle[Cc]op.targets\n~$*\n*~\n*.dbmdl\n*.[Pp]ublish.xml\n\n*.publishsettings\n\n# RIA/Silverlight projects\nGenerated_Code/\n\n# Backup & report files from converting an old project file to a newer\n# Visual Studio version. Backup files are not needed, because we have git ;-)\n_UpgradeReport_Files/\nBackup*/\nUpgradeLog*.XML\nUpgradeLog*.htm\n\n# SQL Server files\nApp_Data/*.mdf\nApp_Data/*.ldf\n\n# =========================\n# Windows detritus\n# =========================\n\n# Windows image file caches\nThumbs.db\nehthumbs.db\n\n# Folder config file\nDesktop.ini\n\n# Recycle Bin used on file shares\n$RECYCLE.BIN/\n\n# Mac desktop service store files\n.DS_Store\n\n_NCrunch*\n"
  },
  {
    "path": ".mailmap",
    "content": "Randy Levy <randy.levy@gmail.com> randylevy <v-ralevy@microsoft.com>"
  },
  {
    "path": "BVT/SLAB.Tests/ProcessToSample/App.config",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n    <startup> \n        <supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.5.1\"/>\n    </startup>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/ProcessToSample/ProcessToSample.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"12.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{F7FC3535-8EAF-4305-A7F8-C774FE717F54}</ProjectGuid>\n    <OutputType>Exe</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>ProcessToSample</RootNamespace>\n    <AssemblyName>ProcessToSample</AssemblyName>\n    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n    <TargetFrameworkProfile />\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"Program.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"App.config\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\SemanticLogging.OutProc.Tests\\SemanticLogging.OutProc.Tests.csproj\">\n      <Project>{0d748fc4-24aa-4d3a-81b9-296df5921c14}</Project>\n      <Name>SemanticLogging.OutProc.Tests</Name>\n    </ProjectReference>\n  </ItemGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <PropertyGroup>\n    <PostBuildEvent>xcopy $(TargetPath) $(SolutionDir)\\SemanticLogging.OutProc.Tests\\$(OutDir) /Y</PostBuildEvent>\n  </PropertyGroup>\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "BVT/SLAB.Tests/ProcessToSample/Program.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\n\nnamespace ProcessToSample\n{\n    internal class Program\n    {\n        private static ManualResetEvent waitObject = new ManualResetEvent(false);\n        private static void Main(string[] args)\n        {\n            var oldActivityId = EventSource.CurrentThreadActivityId;\n            Console.Read();\n\n            EventSource.SetCurrentThreadActivityId(new Guid(\"FBA40C13-6725-42A7-92F2-47EEA6E1AD5B\"));\n            TriggerEventSource.Logger.TriggerEvent(\"Trigger event from process\");\n            Task.Run(async () => await LogEventsAsync());\n            waitObject.WaitOne();\n            EventSource.SetCurrentThreadActivityId(oldActivityId);\n        }\n\n        public static async Task LogEventsAsync()\n        {\n            SamplingEventSource.Logger.BeforeEventToSample(\"Message 1 from process\");\n            await Task.Delay(10);\n            SamplingEventSource.Logger.AfterEventToSample(\"Message 2 from process\");\n            waitObject.Set();\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/ProcessToSample/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Information about an assembly is controlled through the following \n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(\"ProcessToSample\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"\")]\n[assembly: AssemblyProduct(\"ProcessToSample\")]\n[assembly: AssemblyCopyright(\"Copyright ©  2014\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// Setting ComVisible to false makes the types in this assembly not visible \n// to COM components.  If you need to access a type in this assembly from \n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n// The following GUID is for the ID of the typelib if this project is exposed to COM\n[assembly: Guid(\"30770ce7-2ded-4ca5-a6e5-3e221e626b3b\")]\n\n// Version information for an assembly consists of the following four values:\n//\n//      Major Version\n//      Minor Version \n//      Build Number\n//      Revision\n//\n// You can specify all the values or you can default the Build and Revision Numbers \n// by using the '*' as shown below:\n// [assembly: AssemblyVersion(\"1.0.*\")]\n[assembly: AssemblyVersion(\"1.0.0.0\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n"
  },
  {
    "path": "BVT/SLAB.Tests/Readme.txt",
    "content": "﻿SEMANTIC LOGGING APPLICATION BLOCK (SLAB) BVT\nhttp://slab.codeplex.com\n\nTo run the tests follow these steps:\n1. Run as Visual Studio as administrator and then open SemanticLogging.Tests.sln.\n2. Run SQL scripts, located at source/scripts.\n3. Build the SemanticLogging source code before building the BVT solution.\n\nSome tests are configured to wait for a fixed amount of time until events are written to the SqlDatabase and to the Azure Table.\nThese tests may fail if the events are not written in time.\n\nMicrosoft patterns & practices\nhttp://microsoft.com/practices\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/App.config",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n  <connectionStrings>\n    <add name=\"valid\" connectionString=\"Data Source=(localdb)\\v11.0; Initial Catalog=Logging;Integrated Security=True\" providerName=\"System.Data.SqlClient\"/>\n    <add name=\"invalid\" connectionString=\"Data Source=(localdb)\\v11.0;Initial Catalog=Invalid;Integrated Security=True\" providerName=\"System.Data.SqlClient\"/>\n    <add name=\"noAccess\" connectionString=\"Data Source=(localdb)\\v11.0; Initial Catalog=Logging;User ID=wrong;Password=fail;\" providerName=\"System.Data.SqlClient\"/>\n  </connectionStrings>\n  <appSettings>\n    <!-- Use the Windows Azure storage emulator. Make sure to start it before running the tests. -->\n    <add key=\"StorageConnectionString\" value=\"UseDevelopmentStorage=true\"/>\n    <!-- You can also use a real Azure Storage account by configuring the connection string below. -->\n    <!--<add key=\"StorageConnectionString\" value=\"DefaultEndpointsProtocol=https;AccountName=[AccountName];AccountKey=[AccountKey]\" />-->\n\n    <add key=\"InvalidStorageConnectionString\" value=\"DefaultEndpointsProtocol=test;AccountName=test;AccountKey=test\"/>\n\n    <add key=\"ElasticsearchUri\" value=\"http://localhost:9200\" />\n  </appSettings>\n  <runtime>\n    <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">\n      <dependentAssembly>\n        <assemblyIdentity name=\"Microsoft.Data.OData\" publicKeyToken=\"31bf3856ad364e35\" culture=\"neutral\"/>\n        <bindingRedirect oldVersion=\"0.0.0.0-5.6.0.0\" newVersion=\"5.6.0.0\"/>\n      </dependentAssembly>\n    </assemblyBinding>\n  </runtime>\n<startup><supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.5.1\"/></startup></configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/Extensibility/CustomSinkFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.Extensibility\n{\n    [TestClass]\n    public class CustomSinkFixture\n    {\n        [TestMethod]\n        public void WhenUsingCustomSink()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            string message = string.Concat(\"Message \", Guid.NewGuid());\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToCustomSqlDatabase(\"TestInstanceName\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways, Keywords.All);\n                    logger.LogSomeMessage(message);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.AreEqual(1, dt.Rows.Count);\n            var dr = dt.Rows[0];\n            Assert.AreEqual(4, (int)dr[\"Level\"]);\n            Assert.AreEqual(8, (int)dr[\"EventID\"]);\n            Assert.AreEqual(\"TestInstanceName\", dr[\"InstanceName\"].ToString());\n            StringAssert.Contains((string)dr[\"Payload\"], message);\n        }\n\n        [TestMethod]\n        public void WhenUsingCustomSinkAndMultipleEvents()\n        {\n            string fileName = \"ProvidedCustomSink.log\";\n            File.Delete(fileName);\n            var logger = MockEventSource.Logger;\n\n            IEnumerable<string> entries = null;\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToMockFlatFile(fileName, \"==-==\");\n                    listener.EnableEvents(logger, EventLevel.LogAlways, Keywords.All);\n                    logger.LogSomeMessage(\"some message\");\n                    logger.LogSomeMessage(\"some message2\");\n                    logger.LogSomeMessage(\"some message3\");\n\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 3, \"==-==\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            Assert.AreEqual<int>(3, entries.Count());\n            Assert.IsNotNull(entries.SingleOrDefault(e => e.Contains(\"Payload : [message : some message]\")));\n            Assert.IsNotNull(entries.SingleOrDefault(e => e.Contains(\"Payload : [message : some message2]\")));\n            Assert.IsNotNull(entries.SingleOrDefault(e => e.Contains(\"Payload : [message : some message3]\")));\n        }\n\n        [TestMethod]\n        public void WhenMultipleCustomSinksSubscribing()\n        {\n            string fileName1 = \"mockFlatFileMutiple.log\";\n            File.Delete(fileName1);\n            string fileName2 = \"flatFileMultiple.log\";\n            File.Delete(fileName2);\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            string message = string.Concat(\"Message \", Guid.NewGuid());\n            string message2 = string.Concat(\"Message2 \", Guid.NewGuid());\n            IEnumerable<string> entries = null;\n            IEnumerable<string> entries2 = null;\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToMockFlatFile(fileName1, \"==-==\");\n                    listener.LogToFlatFile(fileName2, new EventTextFormatter(\"--==--\"));\n                    listener.LogToSqlDatabase(\"testInstance\", validConnectionString, \"Traces\", TimeSpan.Zero, 1);\n                    listener.LogToCustomSqlDatabase(\"testCustom\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways, Keywords.All);\n                    logger.LogSomeMessage(message);\n                    logger.LogSomeMessage(message2);\n\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName1, 2, \"==-==\");\n                    entries2 = FlatFileHelper.PollUntilTextEventsAreWritten(fileName2, 2, \"--==--\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName1));\n            Assert.AreEqual<int>(2, entries.Count());\n            StringAssert.Contains(entries.First().ToString(), message);\n            StringAssert.Contains(entries.Last().ToString(), message2);\n\n            Assert.IsTrue(File.Exists(fileName2));\n            Assert.AreEqual<int>(2, entries.Count());\n            StringAssert.Contains(entries.First().ToString(), message);\n            StringAssert.Contains(entries.Last().ToString(), message2);\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.AreEqual(4, dt.Rows.Count);\n        }\n\n        [TestMethod]\n        public void WhenExceptinOccursInCustomFormater1()\n        {\n            string filename = \"customFormatterException.log\";\n            File.Delete(filename);\n            var logger = MockEventSource.Logger;\n            var formatter = new CustomFormatter(true);\n\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToFlatFile(filename, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways, Keywords.All);\n                    logger.LogSomeMessage(\"testing\");\n\n                    errorsListener.WaitEvents.Wait(3000);\n                    StringAssert.Contains(errorsListener.ToString(), \"unhandled exception from formatter\");\n                });\n        }\n\n        [TestMethod]\n        public void WhenExceptionOccursInCustomFormatter()\n        {\n            string fileName = \"FlatFileInProcCustomFormatterHandleException.log\";\n            File.Delete(fileName);\n            var logger = TestEventSourceNonTransient.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToFlatFile(fileName, new MockFormatter(true));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.EventWithPayload(\"payload1\", 100);\n\n                    StringAssert.Contains(errorsListener.ToString(), \"Payload : [message : System.InvalidOperationException: Operation is not valid due to the current state of the object.\");\n                });\n        }\n\n        [TestMethod]\n        public void WhenUsingCustomFormatter()\n        {\n            string fileName = \"FlatFileInProcCustomFormatter.log\";\n            File.Delete(fileName);\n            string header = \"----------\";\n            var logger = TestEventSourceNonTransient.Logger;\n            var formatter = new CustomFormatterWithWait(header);\n            formatter.Detailed = EventLevel.LogAlways;\n\n            IEnumerable<string> entries = null;\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    logger.EventWithPayload(\"payload1\", 100);\n\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, header);\n                });\n\n            StringAssert.Contains(entries.First(), \"Mock SourceId\");\n            StringAssert.Contains(entries.First(), \"Mock EventId\");\n            StringAssert.Contains(entries.First(), \"Payload : [payload1 : payload1] [payload2 : 100]\");\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/Formatters/JsonEventTextFormatterFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing Newtonsoft.Json;\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.Formatters\n{\n    [TestClass]\n    public class JsonEventTextFormatterFixture\n    {\n        [TestMethod]\n        public void EventWithPayloadKeywrdsNoMsgIndentedInJson()\n        {\n            var logger = MockEventSrcForJson.Logger;\n\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener() { Formatter = new JsonEventTextFormatter(EventTextFormatting.Indented) })\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForJson.Keywords.Errors);\n                try\n                {\n                    logger.UsingKeywords(MockEventSrcForJson.LogMessage, long.MaxValue);\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            Assert.AreEqual(19, rawOutput.Split('\\n').Length); //Assert is indented\n            var entries = JsonConvert.DeserializeObject<TestEventEntry[]>(\"[\" + rawOutput + \"]\");\n            var entry = entries.First();\n            Assert.AreEqual<Guid>(EventSource.GetGuid(typeof(MockEventSrcForJson)), entry.ProviderId);\n            Assert.AreEqual<int>(MockEventSrcForJson.UsingKeywordsEventID, entry.EventId);\n            Assert.AreEqual<EventLevel>(EventLevel.Informational, entry.Level);\n            Assert.AreEqual<string>(\"None\", entry.EventKeywords.ToString());\n            Assert.AreEqual<EventOpcode>(EventOpcode.Start, entry.Opcode);\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, entry.ProcessId);\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), entry.ThreadId);\n            Assert.AreEqual<byte>(0, entry.Version);\n            Assert.AreEqual<EventTask>(MockEventSrcForJson.Tasks.DBQuery, entry.Task);\n            Assert.AreEqual(null, entry.Message);\n            Assert.AreEqual(2, entry.Payload.Count);\n            StringAssert.Contains(entry.Payload.First().ToString(), MockEventSrcForJson.LogMessage);\n            StringAssert.Contains(entry.Payload.Last().ToString(), long.MaxValue.ToString());\n        }\n\n        [TestMethod]\n        public void EventWithPayloadKeywrdsNoMessageInJson()\n        {\n            var logger = MockEventSrcForJson.Logger;\n\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener() { Formatter = new JsonEventTextFormatter() })\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForJson.Keywords.Errors);\n                try\n                {\n                    logger.UsingKeywords(MockEventSrcForJson.LogMessage, long.MaxValue);\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            var entries = JsonConvert.DeserializeObject<TestEventEntry[]>(\"[\" + rawOutput + \"]\");\n            var entry = entries.First();\n            Assert.IsFalse(rawOutput.StartsWith(\"{\\r\\n\")); // No Formatting (Default)\n            Assert.AreEqual<Guid>(EventSource.GetGuid(typeof(MockEventSrcForJson)), entry.ProviderId);\n            Assert.AreEqual<int>(MockEventSrcForJson.UsingKeywordsEventID, entry.EventId);\n            Assert.AreEqual<EventLevel>(EventLevel.Informational, entry.Level);\n            Assert.AreEqual<string>(\"None\", entry.EventKeywords.ToString());\n            Assert.AreEqual<EventOpcode>(EventOpcode.Start, entry.Opcode);\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, entry.ProcessId);\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), entry.ThreadId);\n            Assert.AreEqual<byte>(0, entry.Version);\n            Assert.AreEqual<EventTask>(MockEventSrcForJson.Tasks.DBQuery, entry.Task);\n            Assert.AreEqual(null, entry.Message);\n            Assert.AreEqual(2, entry.Payload.Count);\n            StringAssert.Contains(entry.Payload.First().ToString(), MockEventSrcForJson.LogMessage);\n            StringAssert.Contains(entry.Payload.Last().ToString(), long.MaxValue.ToString());\n        }\n\n        [TestMethod]\n        public void EventWithPayloadAndMessageInJson()\n        {\n            var logger = MockEventSrcForJson.Logger;\n\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener() { Formatter = new JsonEventTextFormatter() })\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForJson.Keywords.Errors);\n                try\n                {\n                    logger.LogUsingMessage(MockEventSrcForJson.LogMessage);\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            var entries = JsonConvert.DeserializeObject<TestEventEntry[]>(\"[\" + rawOutput + \"]\");\n            var entry = entries.First();\n            Assert.IsFalse(rawOutput.StartsWith(\"{\\r\\n\")); // No Formatting (Default)\n            Assert.AreEqual<Guid>(EventSource.GetGuid(typeof(MockEventSrcForJson)), entry.ProviderId);\n            Assert.AreEqual<int>(MockEventSrcForJson.LogUsingMessageEventID, entry.EventId);\n            Assert.AreEqual<EventLevel>(EventLevel.Informational, entry.Level);\n            Assert.AreEqual<EventKeywords>(EventKeywords.None, entry.EventKeywords);\n            Assert.AreEqual<EventOpcode>(EventOpcode.Start, entry.Opcode);\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, entry.ProcessId);\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), entry.ThreadId);\n            Assert.AreEqual<byte>(0, entry.Version);\n            Assert.AreEqual<EventTask>(MockEventSrcForJson.Tasks.Page, entry.Task);\n            Assert.AreEqual(MockEventSrcForJson.LogMessage, entry.Message);\n            Assert.AreEqual(1, entry.Payload.Count);\n            StringAssert.Contains(entry.Payload.First().ToString(), MockEventSrcForJson.LogMessage);\n        }\n\n        [TestMethod]\n        public void EventWithPayloadAndMessageAndDateTimeFormatInJson()\n        {\n            var logger = MockEventSrcForJson.Logger;\n            var formatter = new JsonEventTextFormatter();\n            formatter.DateTimeFormat = \"dd/MM/yyyy\";\n\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener() { Formatter = formatter })\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForJson.Keywords.Errors);\n                try\n                {\n                    logger.LogUsingMessage(MockEventSrcForJson.LogMessage);\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            string today = System.DateTime.Today.ToString(formatter.DateTimeFormat);\n            string tomorrow = System.DateTime.Today.AddDays(1).ToString(formatter.DateTimeFormat);\n            Assert.IsTrue(rawOutput.Contains(today) || rawOutput.Contains(tomorrow));\n        }\n\n        [TestMethod]\n        public void EventWithNoOpCodeNoKeywordsNoVersionNoMsgInJson()\n        {\n            var logger = MockEventSourceNoTask.Logger;\n\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener() { Formatter = new JsonEventTextFormatter() })\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways);\n                try\n                {\n                    logger.NoTaskNoOpCode1(1, 2, 3);\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            var entries = JsonConvert.DeserializeObject<TestEventEntry[]>(\"[\" + rawOutput + \"]\");\n            var entry = entries.First();\n            Assert.IsFalse(rawOutput.StartsWith(\"{\\r\\n\")); // No Formatting (Default)\n            Assert.AreEqual<EventLevel>(EventLevel.Informational, entry.Level);\n            Assert.AreEqual<EventKeywords>(EventKeywords.None, entry.EventKeywords);\n            Assert.AreEqual<EventOpcode>(0, entry.Opcode);\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, entry.ProcessId);\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), entry.ThreadId);\n            Assert.AreEqual<byte>(0, entry.Version);\n            Assert.AreEqual(null, entry.Message);\n            Assert.AreEqual(3, entry.Payload.Count);\n            StringAssert.Contains(entry.Payload.First().ToString(), \"[event3Arg0, 1]\");\n            StringAssert.Contains(entry.Payload.Last().ToString(), \"[event3Arg2, 3]\");\n        }\n\n        [TestMethod]\n        public void EventWithInformationalMessageformatDetailedInJson()\n        {\n            var logger = MockEventSourceNoTask.Logger;\n\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener() { Formatter = new JsonEventTextFormatter() })\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways);\n                try\n                {\n                    logger.InformationalMessageFormat(\"test\");\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            var entries = JsonConvert.DeserializeObject<TestEventEntry[]>(\"[\" + rawOutput + \"]\");\n            var entry = entries.FirstOrDefault();\n            Assert.IsFalse(rawOutput.StartsWith(\"{\\r\\n\")); // No Formatting (Default)\n            Assert.AreEqual<EventLevel>(EventLevel.Informational, entry.Level);\n            Assert.AreEqual<EventKeywords>(EventKeywords.None, entry.EventKeywords);\n            Assert.AreEqual<EventOpcode>(0, entry.Opcode);\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, entry.ProcessId);\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), entry.ThreadId);\n            Assert.AreEqual(\"**test**\", entry.Message);\n            Assert.AreEqual<byte>(0, entry.Version);\n            Assert.AreEqual(1, entry.Payload.Count);\n            StringAssert.Contains(entry.Payload.First().ToString(), \"test\");\n        }\n\n        [TestMethod]\n        public void EventWithActivityIdInJson()\n        {\n            var logger = MockEventSrcForJson.Logger;\n\n            var activityId = Guid.NewGuid();\n            var previousActivityId = Guid.Empty;\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener() { Formatter = new JsonEventTextFormatter() })\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForJson.Keywords.Errors);\n                try\n                {\n                    EventSource.SetCurrentThreadActivityId(activityId, out previousActivityId);\n                    logger.LogUsingMessage(MockEventSrcForJson.LogMessage);\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                    EventSource.SetCurrentThreadActivityId(previousActivityId);\n                }\n            }\n\n            var entries = JsonConvert.DeserializeObject<TestEventEntry[]>(\"[\" + rawOutput + \"]\");\n            var entry = entries.First();\n            Assert.IsFalse(rawOutput.StartsWith(\"{\\r\\n\"));\n            Assert.AreEqual(MockEventSrcForJson.LogMessage, entry.Message);\n            Assert.AreEqual(1, entry.Payload.Count);\n            StringAssert.Contains(entry.Payload.First().ToString(), MockEventSrcForJson.LogMessage);\n            Assert.AreEqual<Guid>(activityId, entry.ActivityId);\n            Assert.AreEqual<Guid>(Guid.Empty, entry.RelatedActivityId);\n        }\n\n        [TestMethod]\n        public void EventWithActivityIdAndRelatedActivityIdInJson()\n        {\n            var logger = MockEventSrcForJson.Logger;\n\n            var activityId = Guid.NewGuid();\n            var relatedActivityId = Guid.NewGuid();\n            var previousActivityId = Guid.Empty;\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener() { Formatter = new JsonEventTextFormatter() })\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForJson.Keywords.Errors);\n                try\n                {\n                    EventSource.SetCurrentThreadActivityId(activityId, out previousActivityId);\n                    logger.LogUsingMessageWithRelatedActivityId(MockEventSrcForJson.LogMessage, relatedActivityId);\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                    EventSource.SetCurrentThreadActivityId(previousActivityId);\n                }\n            }\n\n            var entries = JsonConvert.DeserializeObject<TestEventEntry[]>(\"[\" + rawOutput + \"]\");\n            var entry = entries.First();\n            Assert.IsFalse(rawOutput.StartsWith(\"{\\r\\n\"));\n            Assert.AreEqual(MockEventSrcForJson.LogMessage, entry.Message);\n            Assert.AreEqual(1, entry.Payload.Count);\n            StringAssert.Contains(entry.Payload.First().ToString(), MockEventSrcForJson.LogMessage);\n            Assert.AreEqual<Guid>(activityId, entry.ActivityId);\n            Assert.AreEqual<Guid>(relatedActivityId, entry.RelatedActivityId);\n        }\n    }\n}"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/Formatters/XmlEventTextFormatterFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Xml.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.Formatters\n{\n    [TestClass]\n    public class XmlEventTextFormatterFixture\n    {\n        [TestMethod]\n        public void EventWithPayloadKeywrdsNoMsgIndentedInXml()\n        {\n            var logger = MockEventSrcForXml.Logger;\n            var formatter = new XmlEventTextFormatter(EventTextFormatting.Indented);\n\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForXml.Keywords.Errors);\n                try\n                {\n                    logger.UsingKeywords(MockEventSrcForXml.LogMessage, long.MaxValue);\n                    rawOutput = listener.ToString();\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            Assert.AreEqual(22, rawOutput.Split('\\n').Length);\n            var entries = XDocument.Parse(\"<Events>\" + rawOutput + \"</Events>\").Root.Elements();\n            XmlFormattedEntry.Fill(entries.Single());\n            Assert.AreEqual<Guid>(EventSource.GetGuid(typeof(MockEventSrcForXml)), Guid.Parse(XmlFormattedEntry.Provider.Attribute(\"Guid\").Value));\n            Assert.AreEqual<int>(MockEventSrcForXml.UsingKeywordsEventID, Convert.ToInt32(XmlFormattedEntry.EventId.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            Assert.AreEqual<int>((int)EventLevel.Informational, Int32.Parse(XmlFormattedEntry.Level.Value));\n            Assert.AreEqual<int>((int)MockEventSrcForXml.Tasks.DBQuery, Int32.Parse(XmlFormattedEntry.Task.Value));\n            Assert.AreEqual<long>((long)MockEventSrcForXml.Keywords.Errors, Int64.Parse(XmlFormattedEntry.Keywords.Value.Replace(\"0x\", string.Empty)));\n            Assert.AreEqual<int>((int)EventOpcode.Start, Int32.Parse(XmlFormattedEntry.Opcode.Value));\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, Int32.Parse(XmlFormattedEntry.ProcessId.Value));\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), Int32.Parse(XmlFormattedEntry.ThreadId.Value));\n            DateTime dt;\n            Assert.IsTrue(DateTime.TryParseExact(XmlFormattedEntry.TimeCreated.Attribute(\"SystemTime\").Value, EventEntry.DefaultDateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt));\n            Assert.AreEqual(2, XmlFormattedEntry.Payload.Elements().Count());\n            Assert.AreEqual(\"message\", XmlFormattedEntry.Payload.Elements().First().Attribute(\"Name\").Value);\n            Assert.AreEqual(MockEventSrcForXml.LogMessage, XmlFormattedEntry.Payload.Elements().First().Value);\n            Assert.AreEqual(\"longArg\", XmlFormattedEntry.Payload.Elements().Last().Attribute(\"Name\").Value);\n            Assert.AreEqual(long.MaxValue.ToString(), XmlFormattedEntry.Payload.Elements().Last().Value);\n        }\n\n        [TestMethod]\n        public void EventWithPayloadKeywrdsNoMsgInXml()\n        {\n            var logger = MockEventSrcForXml.Logger;\n            var formatter = new XmlEventTextFormatter();\n\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForXml.Keywords.Errors);\n                try\n                {\n                    logger.UsingKeywords(MockEventSrcForXml.LogMessage, long.MaxValue);\n                    rawOutput = listener.ToString();\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            Assert.AreEqual(-1, rawOutput.IndexOf(\"\\r\\n\"));\n            var entries = XDocument.Parse(\"<Events>\" + rawOutput + \"</Events>\").Root.Elements();\n            XmlFormattedEntry.Fill(entries.Single());\n            Assert.AreEqual<Guid>(EventSource.GetGuid(typeof(MockEventSrcForXml)), Guid.Parse(XmlFormattedEntry.Provider.Attribute(\"Guid\").Value));\n            Assert.AreEqual<int>(MockEventSrcForXml.UsingKeywordsEventID, Convert.ToInt32(XmlFormattedEntry.EventId.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            Assert.AreEqual<int>((int)EventLevel.Informational, Int32.Parse(XmlFormattedEntry.Level.Value));\n            Assert.AreEqual<int>((int)MockEventSrcForXml.Tasks.DBQuery, Int32.Parse(XmlFormattedEntry.Task.Value));\n            Assert.AreEqual<long>((long)MockEventSrcForXml.Keywords.Errors, Int64.Parse(XmlFormattedEntry.Keywords.Value.Replace(\"0x\", string.Empty)));\n            Assert.AreEqual<int>((int)EventOpcode.Start, Int32.Parse(XmlFormattedEntry.Opcode.Value));\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, Int32.Parse(XmlFormattedEntry.ProcessId.Value));\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), Int32.Parse(XmlFormattedEntry.ThreadId.Value));\n            DateTime dt;\n            Assert.IsTrue(DateTime.TryParseExact(XmlFormattedEntry.TimeCreated.Attribute(\"SystemTime\").Value, EventEntry.DefaultDateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt));\n            Assert.AreEqual(2, XmlFormattedEntry.Payload.Elements().Count());\n            Assert.AreEqual(\"message\", XmlFormattedEntry.Payload.Elements().First().Attribute(\"Name\").Value);\n            Assert.AreEqual(MockEventSrcForXml.LogMessage, XmlFormattedEntry.Payload.Elements().First().Value);\n            Assert.AreEqual(\"longArg\", XmlFormattedEntry.Payload.Elements().Last().Attribute(\"Name\").Value);\n            Assert.AreEqual(long.MaxValue.ToString(), XmlFormattedEntry.Payload.Elements().Last().Value);\n        }\n\n        [TestMethod]\n        public void EventWithPayloadAndMessageInXml()\n        {\n            var logger = MockEventSrcForXml.Logger;\n            var formatter = new XmlEventTextFormatter();\n\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForXml.Keywords.Errors);\n                try\n                {\n                    logger.LogUsingMessage(MockEventSrcForXml.LogMessage);\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            var entries = XDocument.Parse(\"<Events>\" + rawOutput + \"</Events>\").Root.Elements();\n            XmlFormattedEntry.Fill(entries.First());\n            Assert.IsFalse(rawOutput.StartsWith(\"{\\r\\n\")); // No Formatting (Default)\n            Assert.AreEqual<Guid>(EventSource.GetGuid(typeof(MockEventSrcForXml)), Guid.Parse(XmlFormattedEntry.Provider.Attribute(\"Guid\").Value));\n            Assert.AreEqual<int>(MockEventSrcForXml.LogUsingMessageEventID, Convert.ToInt32(XmlFormattedEntry.EventId.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            Assert.AreEqual<int>((int)EventLevel.Informational, Int32.Parse(XmlFormattedEntry.Level.Value));\n            Assert.AreEqual<int>((int)MockEventSrcForXml.Tasks.Page, Int32.Parse(XmlFormattedEntry.Task.Value));\n            Assert.AreEqual<long>((long)EventKeywords.None, Int64.Parse(XmlFormattedEntry.Keywords.Value.Replace(\"0x\", string.Empty)));\n            Assert.AreEqual<int>((int)EventOpcode.Start, Int32.Parse(XmlFormattedEntry.Opcode.Value));\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, Int32.Parse(XmlFormattedEntry.ProcessId.Value));\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), Int32.Parse(XmlFormattedEntry.ThreadId.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            DateTime dt;\n            Assert.IsTrue(DateTime.TryParseExact(XmlFormattedEntry.TimeCreated.Attribute(\"SystemTime\").Value, EventEntry.DefaultDateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt));\n            Assert.AreEqual(1, XmlFormattedEntry.Payload.Elements().Count());\n            Assert.AreEqual(\"message\", XmlFormattedEntry.Payload.Elements().First().Attribute(\"Name\").Value);\n            Assert.AreEqual(MockEventSrcForXml.LogMessage, XmlFormattedEntry.Payload.Elements().First().Value);\n            Assert.AreEqual(MockEventSrcForXml.LogMessage, XmlFormattedEntry.Message.Elements().First().Value);\n        }\n\n        [TestMethod]\n        public void EventWithNullPayloadInXml()\n        {\n            var formatter = new XmlEventTextFormatter();\n            var logger = MockEventSrcForXml.Logger;\n\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForXml.Keywords.Errors);\n                try\n                {\n                    logger.LogUsingMessage(null);\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            var entries = XDocument.Parse(\"<Events>\" + rawOutput + \"</Events>\").Root.Elements();\n            XmlFormattedEntry.Fill(entries.First());\n            Assert.IsFalse(rawOutput.StartsWith(\"{\\r\\n\")); // No Formatting (Default)\n            Assert.AreEqual<Guid>(EventSource.GetGuid(typeof(MockEventSrcForXml)), Guid.Parse(XmlFormattedEntry.Provider.Attribute(\"Guid\").Value));\n            Assert.AreEqual<int>(MockEventSrcForXml.LogUsingMessageEventID, Convert.ToInt32(XmlFormattedEntry.EventId.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            Assert.AreEqual<int>((int)EventLevel.Informational, Int32.Parse(XmlFormattedEntry.Level.Value));\n            Assert.AreEqual<int>((int)MockEventSrcForXml.Tasks.Page, Int32.Parse(XmlFormattedEntry.Task.Value));\n            Assert.AreEqual<long>((long)EventKeywords.None, Int64.Parse(XmlFormattedEntry.Keywords.Value.Replace(\"0x\", string.Empty)));\n            Assert.AreEqual<int>((int)EventOpcode.Start, Int32.Parse(XmlFormattedEntry.Opcode.Value));\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, Int32.Parse(XmlFormattedEntry.ProcessId.Value));\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), Int32.Parse(XmlFormattedEntry.ThreadId.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            DateTime dt;\n            Assert.IsTrue(DateTime.TryParseExact(XmlFormattedEntry.TimeCreated.Attribute(\"SystemTime\").Value, EventEntry.DefaultDateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt));\n        }\n\n        [TestMethod]\n        public void EventWithNullPayloadInFormattedMessageInXml()\n        {\n            var formatter = new XmlEventTextFormatter();\n            var logger = MockEventSrcForXml.Logger;\n\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForXml.Keywords.Errors);\n                try\n                {\n                    logger.LogUsingMessageFormat(null);\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            var entries = XDocument.Parse(\"<Events>\" + rawOutput + \"</Events>\").Root.Elements();\n            XmlFormattedEntry.Fill(entries.First());\n            Assert.IsFalse(rawOutput.StartsWith(\"{\\r\\n\")); // No Formatting (Default)\n            Assert.AreEqual<Guid>(EventSource.GetGuid(typeof(MockEventSrcForXml)), Guid.Parse(XmlFormattedEntry.Provider.Attribute(\"Guid\").Value));\n            Assert.AreEqual<int>(MockEventSrcForXml.LogUsingMessageFormatEventID, Convert.ToInt32(XmlFormattedEntry.EventId.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            Assert.AreEqual<int>((int)EventLevel.Informational, Int32.Parse(XmlFormattedEntry.Level.Value));\n            Assert.AreEqual<int>((int)MockEventSrcForXml.Tasks.DBQuery, Int32.Parse(XmlFormattedEntry.Task.Value));\n            Assert.AreEqual<long>((long)EventKeywords.None, Int64.Parse(XmlFormattedEntry.Keywords.Value.Replace(\"0x\", string.Empty)));\n            Assert.AreEqual<int>((int)EventOpcode.Stop, Int32.Parse(XmlFormattedEntry.Opcode.Value));\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, Int32.Parse(XmlFormattedEntry.ProcessId.Value));\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), Int32.Parse(XmlFormattedEntry.ThreadId.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            DateTime dt;\n            Assert.IsTrue(DateTime.TryParseExact(XmlFormattedEntry.TimeCreated.Attribute(\"SystemTime\").Value, EventEntry.DefaultDateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt));\n        }\n\n        [TestMethod]\n        public void EventWithPayloadAndMessageFormatInXml()\n        {\n            var formatter = new XmlEventTextFormatter();\n            var logger = MockEventSrcForXml.Logger;\n\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForXml.Keywords.Errors);\n                try\n                {\n                    logger.LogUsingMessageFormat(\"<This is a test />\");\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            var entries = XDocument.Parse(\"<Events>\" + rawOutput + \"</Events>\").Root.Elements();\n            XmlFormattedEntry.Fill(entries.First());\n            Assert.IsFalse(rawOutput.StartsWith(\"{\\r\\n\")); // No Formatting (Default)\n            Assert.AreEqual<Guid>(EventSource.GetGuid(typeof(MockEventSrcForXml)), Guid.Parse(XmlFormattedEntry.Provider.Attribute(\"Guid\").Value));\n            Assert.AreEqual<int>(MockEventSrcForXml.LogUsingMessageFormatEventID, Convert.ToInt32(XmlFormattedEntry.EventId.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            Assert.AreEqual<int>((int)EventLevel.Informational, Int32.Parse(XmlFormattedEntry.Level.Value));\n            Assert.AreEqual<int>((int)MockEventSrcForXml.Tasks.DBQuery, Int32.Parse(XmlFormattedEntry.Task.Value));\n            Assert.AreEqual<long>((long)EventKeywords.None, Int64.Parse(XmlFormattedEntry.Keywords.Value.Replace(\"0x\", string.Empty)));\n            Assert.AreEqual<int>((int)EventOpcode.Stop, Int32.Parse(XmlFormattedEntry.Opcode.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, Int32.Parse(XmlFormattedEntry.ProcessId.Value));\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), Int32.Parse(XmlFormattedEntry.ThreadId.Value));\n            DateTime dt;\n            Assert.IsTrue(DateTime.TryParseExact(XmlFormattedEntry.TimeCreated.Attribute(\"SystemTime\").Value, EventEntry.DefaultDateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt));\n            Assert.AreEqual(1, XmlFormattedEntry.Payload.Elements().Count());\n            Assert.AreEqual(\"message\", XmlFormattedEntry.Payload.Elements().First().Attribute(\"Name\").Value);\n            Assert.AreEqual(\"<This is a test />\", XmlFormattedEntry.Payload.Elements().First().Value);\n            Assert.AreEqual(\"<This is a test />\", XmlFormattedEntry.Message.Elements().First().Value);\n        }\n\n        [TestMethod]\n        public void EventWithPayloadAndMessageWithDateTimeFormatInXml()\n        {\n            var formatter = new XmlEventTextFormatter();\n            formatter.DateTimeFormat = \"dd/MM/yyyy\";\n            var logger = MockEventSrcForXml.Logger;\n\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForXml.Keywords.Errors);\n                try\n                {\n                    logger.LogUsingMessage(MockEventSrcForXml.LogMessage);\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            var entries = XDocument.Parse(\"<Events>\" + rawOutput + \"</Events>\").Root.Elements();\n            XmlFormattedEntry.Fill(entries.First());\n            Assert.IsFalse(rawOutput.StartsWith(\"{\\r\\n\")); // No Formatting (Default)\n            string today = System.DateTime.Today.ToString(formatter.DateTimeFormat);\n            string tomorrow = System.DateTime.Today.AddDays(1).ToString(\"dd/MM/yyyy\");\n            Assert.IsTrue(rawOutput.Contains(today) || rawOutput.Contains(tomorrow));\n            Assert.AreEqual<Guid>(EventSource.GetGuid(typeof(MockEventSrcForXml)), Guid.Parse(XmlFormattedEntry.Provider.Attribute(\"Guid\").Value));\n            Assert.AreEqual<int>(MockEventSrcForXml.LogUsingMessageEventID, Convert.ToInt32(XmlFormattedEntry.EventId.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            Assert.AreEqual<int>((int)EventLevel.Informational, Int32.Parse(XmlFormattedEntry.Level.Value));\n            Assert.AreEqual<int>((int)MockEventSrcForXml.Tasks.Page, Int32.Parse(XmlFormattedEntry.Task.Value));\n            Assert.AreEqual<long>((long)EventKeywords.None, Int64.Parse(XmlFormattedEntry.Keywords.Value.Replace(\"0x\", string.Empty)));\n            Assert.AreEqual<int>((int)EventOpcode.Start, Int32.Parse(XmlFormattedEntry.Opcode.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, Int32.Parse(XmlFormattedEntry.ProcessId.Value));\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), Int32.Parse(XmlFormattedEntry.ThreadId.Value));\n            DateTime dt;\n            Assert.IsTrue(DateTime.TryParseExact(XmlFormattedEntry.TimeCreated.Attribute(\"SystemTime\").Value, formatter.DateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt));\n            Assert.AreEqual(1, XmlFormattedEntry.Payload.Elements().Count());\n            Assert.AreEqual(\"message\", XmlFormattedEntry.Payload.Elements().First().Attribute(\"Name\").Value);\n            Assert.AreEqual(MockEventSrcForXml.LogMessage, XmlFormattedEntry.Payload.Elements().First().Value);\n            Assert.AreEqual(MockEventSrcForXml.LogMessage, XmlFormattedEntry.Message.Elements().First().Value);\n        }\n\n        [TestMethod]\n        public void TwoEventsWithPayloadsAndMessageInXml()\n        {\n            var formatter = new XmlEventTextFormatter();\n            var logger = MockEventSrcForXml.Logger;\n\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForXml.Keywords.Errors);\n                try\n                {\n                    logger.LogUsingMessage(MockEventSrcForXml.LogMessage);\n                    logger.LogUsingMessage(MockEventSrcForXml.LogMessage + \"2\");\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            var entries = XDocument.Parse(\"<Events>\" + rawOutput + \"</Events>\").Root.Elements();\n            Assert.AreEqual(2, entries.Count());\n            XmlFormattedEntry.Fill(entries.First());\n            Assert.AreEqual(\"message\", XmlFormattedEntry.Payload.Elements().First().Attribute(\"Name\").Value);\n            Assert.AreEqual(MockEventSrcForXml.LogMessage, XmlFormattedEntry.Payload.Elements().First().Value);\n            XmlFormattedEntry.Fill(entries.Last());\n            Assert.AreEqual(\"message\", XmlFormattedEntry.Payload.Elements().Last().Attribute(\"Name\").Value);\n            Assert.AreEqual(MockEventSrcForXml.LogMessage + \"2\", XmlFormattedEntry.Payload.Elements().First().Value);\n            Assert.AreEqual(MockEventSrcForXml.LogMessage, XmlFormattedEntry.Message.Elements().First().Value);\n        }\n\n        [TestMethod]\n        public void EventWithPayloadAloneInXml()\n        {\n            var formatter = new XmlEventTextFormatter();\n            string payloadMsg = (\"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\n<test/>\");\n            var logger = MockEventSrcForXml.Logger;\n\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForXml.Keywords.Errors);\n                try\n                {\n                    logger.LogUsingMessage(payloadMsg);\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            var entries = XDocument.Parse(\"<Events>\" + rawOutput + \"</Events>\").Root.Elements();\n            XmlFormattedEntry.Fill(entries.First());\n            Assert.IsFalse(rawOutput.StartsWith(\"{\\r\\n\")); // No Formatting (Default)\n            Assert.AreEqual<Guid>(EventSource.GetGuid(typeof(MockEventSrcForXml)), Guid.Parse(XmlFormattedEntry.Provider.Attribute(\"Guid\").Value));\n            Assert.AreEqual<int>(MockEventSrcForXml.LogUsingMessageEventID, Convert.ToInt32(XmlFormattedEntry.EventId.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            Assert.AreEqual<int>((int)EventLevel.Informational, Int32.Parse(XmlFormattedEntry.Level.Value));\n            Assert.AreEqual<int>((int)MockEventSrcForXml.Tasks.Page, Int32.Parse(XmlFormattedEntry.Task.Value));\n            Assert.AreEqual<long>((long)EventKeywords.None, Int64.Parse(XmlFormattedEntry.Keywords.Value.Replace(\"0x\", string.Empty)));\n            Assert.AreEqual<int>((int)EventOpcode.Start, Int32.Parse(XmlFormattedEntry.Opcode.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, Int32.Parse(XmlFormattedEntry.ProcessId.Value));\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), Int32.Parse(XmlFormattedEntry.ThreadId.Value));\n            DateTime dt;\n            Assert.IsTrue(DateTime.TryParseExact(XmlFormattedEntry.TimeCreated.Attribute(\"SystemTime\").Value, EventEntry.DefaultDateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt));\n            Assert.AreEqual(1, XmlFormattedEntry.Payload.Elements().Count());\n            Assert.AreEqual(\"message\", XmlFormattedEntry.Payload.Elements().First().Attribute(\"Name\").Value);\n            Assert.AreEqual(payloadMsg, XmlFormattedEntry.Payload.Elements().First().Value);\n        }\n\n        [TestMethod]\n        public void EventWithPayloadAndEnumsInXml()\n        {\n            string fileName = \"LogUsingPayloadWithEnumsInProc\";\n            File.Delete(fileName);\n            var formatter = new XmlEventTextFormatter(EventTextFormatting.Indented, \"d\");\n            var logger = MockEventSourceInProcEnum.Logger;\n\n            using (var listener = new ObservableEventListener())\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, Keywords.All);\n                listener.LogToFlatFile(fileName, formatter);\n                try\n                {\n                    logger.SendEnumsEvent16(MockEventSourceInProcEnum.MyColor.Green, MockEventSourceInProcEnum.MyFlags.Flag1);\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            var rawOutput = FlatFileHelper.GetAllText(fileName);\n            var entries = XDocument.Parse(\"<Events>\" + rawOutput + \"</Events>\").Root.Elements();\n            Assert.AreEqual(1, entries.Count());\n            XmlFormattedEntry.Fill(entries.First());\n            Assert.AreEqual(\"a\", XmlFormattedEntry.Payload.Elements().First().Attribute(\"Name\").Value);\n            Assert.AreEqual(\"2\", XmlFormattedEntry.Payload.Elements().First().Value);\n            Assert.AreEqual(\"b\", XmlFormattedEntry.Payload.Elements().Last().Attribute(\"Name\").Value);\n            Assert.AreEqual(\"1\", XmlFormattedEntry.Payload.Elements().Last().Value);\n        }\n\n        [TestMethod]\n        public void EventWithActivityIdInXml()\n        {\n            var formatter = new XmlEventTextFormatter();\n            var logger = MockEventSrcForXml.Logger;\n\n            var activityId = Guid.NewGuid();\n            var previousActivityId = Guid.Empty;\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForXml.Keywords.Errors);\n                try\n                {\n                    EventSource.SetCurrentThreadActivityId(activityId, out previousActivityId);\n                    logger.LogUsingMessage(MockEventSrcForXml.LogMessage);\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                    EventSource.SetCurrentThreadActivityId(previousActivityId);\n                }\n            }\n\n            var entries = XDocument.Parse(\"<Events>\" + rawOutput + \"</Events>\").Root.Elements();\n            XmlFormattedEntry.Fill(entries.First());\n            Assert.AreEqual<Guid>(EventSource.GetGuid(typeof(MockEventSrcForXml)), Guid.Parse(XmlFormattedEntry.Provider.Attribute(\"Guid\").Value));\n            Assert.AreEqual(1, XmlFormattedEntry.Payload.Elements().Count());\n            Assert.AreEqual(\"message\", XmlFormattedEntry.Payload.Elements().First().Attribute(\"Name\").Value);\n            Assert.AreEqual(MockEventSrcForXml.LogMessage, XmlFormattedEntry.Payload.Elements().First().Value);\n            Assert.AreEqual<Guid>(activityId, Guid.Parse(XmlFormattedEntry.Correlation.Attribute(\"ActivityID\").Value));\n            Assert.IsNull(XmlFormattedEntry.Correlation.Attribute(\"RelatedActivityID\"));\n        }\n\n        [TestMethod]\n        public void EventWithActivityIdAndRelatedActivityIdInXml()\n        {\n            var formatter = new XmlEventTextFormatter();\n            var logger = MockEventSrcForXml.Logger;\n\n            var activityId = Guid.NewGuid();\n            var relatedActivityId = Guid.NewGuid();\n            var previousActivityId = Guid.Empty;\n            string rawOutput = string.Empty;\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(logger, EventLevel.LogAlways, MockEventSrcForXml.Keywords.Errors);\n                try\n                {\n                    EventSource.SetCurrentThreadActivityId(activityId, out previousActivityId);\n                    logger.LogUsingMessageWithRelatedActivityId(MockEventSrcForXml.LogMessage, relatedActivityId);\n                    rawOutput = Encoding.Default.GetString(listener.Stream.ToArray());\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                    EventSource.SetCurrentThreadActivityId(previousActivityId);\n                }\n            }\n\n            var entries = XDocument.Parse(\"<Events>\" + rawOutput + \"</Events>\").Root.Elements();\n            XmlFormattedEntry.Fill(entries.First());\n            Assert.AreEqual<Guid>(EventSource.GetGuid(typeof(MockEventSrcForXml)), Guid.Parse(XmlFormattedEntry.Provider.Attribute(\"Guid\").Value));\n            Assert.AreEqual(1, XmlFormattedEntry.Payload.Elements().Count());\n            Assert.AreEqual(\"message\", XmlFormattedEntry.Payload.Elements().First().Attribute(\"Name\").Value);\n            Assert.AreEqual(MockEventSrcForXml.LogMessage, XmlFormattedEntry.Payload.Elements().First().Value);\n            Assert.AreEqual<Guid>(activityId, Guid.Parse(XmlFormattedEntry.Correlation.Attribute(\"ActivityID\").Value));\n            Assert.AreEqual<Guid>(relatedActivityId, Guid.Parse(XmlFormattedEntry.Correlation.Attribute(\"RelatedActivityID\").Value));\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Information about an assembly is controlled through the following \n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(\"SemanticLogging.InProc.Tests\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"\")]\n[assembly: AssemblyProduct(\"SemanticLogging.InProc.Tests\")]\n[assembly: AssemblyCopyright(\"Copyright ©  2014\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// Setting ComVisible to false makes the types in this assembly not visible \n// to COM components.  If you need to access a type in this assembly from \n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n// The following GUID is for the ID of the typelib if this project is exposed to COM\n[assembly: Guid(\"a04fe85f-8bfb-4b8e-a982-5a058897b212\")]\n\n// Version information for an assembly consists of the following four values:\n//\n//      Major Version\n//      Minor Version \n//      Build Number\n//      Revision\n//\n// You can specify all the values or you can default the Build and Revision Numbers \n// by using the '*' as shown below:\n// [assembly: AssemblyVersion(\"1.0.*\")]\n[assembly: AssemblyVersion(\"1.0.0.0\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/SchemaReader/EventSourceSchemaReaderFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.SchemaReader\n{\n    [TestClass]\n    public class EventSourceSchemaReaderFixture\n    {\n        [TestMethod]\n        public void EventWithNoTaskIsValid()\n        {\n            var reader = new EventSourceSchemaReader();\n\n            var schemas = reader.GetSchema(MockEventSourceNoTask.Logger);\n\n            Assert.AreEqual(\"Informational\", schemas[1].TaskName);\n            Assert.AreEqual(\"Test\", schemas[4].TaskName);\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/SemanticLogging.InProc.Tests.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"12.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{FFAF719C-D4E7-4AFF-A896-3CA5605B2C88}</ProjectGuid>\n    <OutputType>Library</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests</RootNamespace>\n    <AssemblyName>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests</AssemblyName>\n    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>\n    <VisualStudioVersion Condition=\"'$(VisualStudioVersion)' == ''\">10.0</VisualStudioVersion>\n    <VSToolsPath Condition=\"'$(VSToolsPath)' == ''\">$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)</VSToolsPath>\n    <ReferencePath>$(ProgramFiles)\\Common Files\\microsoft shared\\VSTT\\$(VisualStudioVersion)\\UITestExtensionPackages</ReferencePath>\n    <IsCodedUITest>False</IsCodedUITest>\n    <TestProjectType>UnitTest</TestProjectType>\n    <SccProjectName>\n    </SccProjectName>\n    <SccLocalPath>\n    </SccLocalPath>\n    <SccAuxPath>\n    </SccAuxPath>\n    <SccProvider>\n    </SccProvider>\n    <SolutionDir Condition=\"$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'\">..\\</SolutionDir>\n    <TargetFrameworkProfile />\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"Microsoft.Data.Edm, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\Microsoft.Data.Edm.5.6.0\\lib\\net40\\Microsoft.Data.Edm.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Data.OData, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\Microsoft.Data.OData.5.6.0\\lib\\net40\\Microsoft.Data.OData.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Data.Services.Client, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\Microsoft.Data.Services.Client.5.6.0\\lib\\net40\\Microsoft.Data.Services.Client.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.WindowsAzure.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\Microsoft.WindowsAzure.ConfigurationManager.2.0.3\\lib\\net40\\Microsoft.WindowsAzure.Configuration.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.WindowsAzure.Storage, Version=3.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\..\\..\\source\\packages\\WindowsAzure.Storage.3.0.2.0\\lib\\net40\\Microsoft.WindowsAzure.Storage.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\Newtonsoft.Json.5.0.8\\lib\\net45\\Newtonsoft.Json.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Configuration\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Data.Services.Client\" />\n    <Reference Include=\"System.Spatial, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\System.Spatial.5.6.0\\lib\\net40\\System.Spatial.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Transactions\" />\n    <Reference Include=\"System.Xml\" />\n    <Reference Include=\"System.Xml.Linq\" />\n  </ItemGroup>\n  <Choose>\n    <When Condition=\"('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'\">\n      <ItemGroup>\n        <Reference Include=\"Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\" />\n      </ItemGroup>\n    </When>\n    <Otherwise>\n      <ItemGroup>\n        <Reference Include=\"Microsoft.VisualStudio.QualityTools.UnitTestFramework\" />\n      </ItemGroup>\n    </Otherwise>\n  </Choose>\n  <ItemGroup>\n    <Compile Include=\"Extensibility\\CustomSinkFixture.cs\" />\n    <Compile Include=\"Formatters\\JsonEventTextFormatterFixture.cs\" />\n    <Compile Include=\"Formatters\\XmlEventTextFormatterFixture.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n    <Compile Include=\"SchemaReader\\EventSourceSchemaReaderFixture.cs\" />\n    <Compile Include=\"Sinks\\WindowsAzureTableSinkFixture.cs\" />\n    <Compile Include=\"Sinks\\DatabaseSinkFixture.cs\" />\n    <Compile Include=\"Sinks\\ConsoleSinkFixture.cs\" />\n    <Compile Include=\"Sinks\\RollingFlatFileSinkFixture.cs\" />\n    <Compile Include=\"Sinks\\FlatFileSinkFixture.cs\" />\n    <Compile Include=\"TestObjects\\BasicTestEventSource.cs\" />\n    <Compile Include=\"TestObjects\\CustomFormatter.cs\" />\n    <Compile Include=\"TestObjects\\CustomFormatterWithWait.cs\" />\n    <Compile Include=\"TestObjects\\MockConsoleListenerEventSource.cs\" />\n    <Compile Include=\"TestObjects\\MockConsoleListenerEventSource2.cs\" />\n    <Compile Include=\"TestObjects\\MockConsoleOutputInterceptor.cs\" />\n    <Compile Include=\"TestObjects\\MockDateTimeProvider.cs\" />\n    <Compile Include=\"TestObjects\\MockEventSource.cs\" />\n    <Compile Include=\"TestObjects\\MockEventSourceNoTask.cs\" />\n    <Compile Include=\"TestObjects\\MockEventSourceOutProcEnum.cs\" />\n    <Compile Include=\"TestObjects\\MockEventSourceOutProcKeywords.cs\" />\n    <Compile Include=\"TestObjects\\MockEventSrcForJson.cs\" />\n    <Compile Include=\"TestObjects\\MockEventSrcForXml.cs\" />\n    <Compile Include=\"TestObjects\\MockFormatter.cs\" />\n    <Compile Include=\"TestObjects\\MockFormatter2.cs\" />\n    <Compile Include=\"TestObjects\\MockFormatter3.cs\" />\n    <Compile Include=\"TestObjects\\TestAttributesEventSource.cs\" />\n    <Compile Include=\"TestObjects\\TestEnum.cs\" />\n    <Compile Include=\"TestObjects\\TestEventEntry.cs\" />\n    <Compile Include=\"TestObjects\\TestEventSource.cs\" />\n    <Compile Include=\"TestObjects\\TestEventSourceNoAttributes.cs\" />\n    <Compile Include=\"TestObjects\\TestEventSourceNonTransient.cs\" />\n    <Compile Include=\"TestScenarios\\TestScenario.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\..\\..\\source\\Src\\SemanticLogging.Database\\SemanticLogging.Database.csproj\">\n      <Project>{ac34c8e7-2a5b-412c-aff7-cf7f52ee4569}</Project>\n      <Name>SemanticLogging.Database</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\..\\source\\Src\\SemanticLogging.Etw\\SemanticLogging.Etw.csproj\">\n      <Project>{8440aea2-cd55-42a0-8724-2ecce2b32374}</Project>\n      <Name>SemanticLogging.Etw</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\..\\source\\Src\\SemanticLogging.TextFile\\SemanticLogging.TextFile.csproj\">\n      <Project>{4b187511-187b-48b1-a593-18ba835b49c3}</Project>\n      <Name>SemanticLogging.TextFile</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\..\\source\\Src\\SemanticLogging.WindowsAzure\\SemanticLogging.WindowsAzure.csproj\">\n      <Project>{d7979e9b-7978-48fe-b345-3c767a20f9a1}</Project>\n      <Name>SemanticLogging.WindowsAzure</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\..\\source\\Src\\SemanticLogging\\SemanticLogging.csproj\">\n      <Project>{2cd4105b-0dd6-4c18-9b37-05d8e8f57303}</Project>\n      <Name>SemanticLogging</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\SemanticLogging.Tests.Shared\\SemanticLogging.Tests.Shared.csproj\">\n      <Project>{001e9c59-1326-48f1-9019-9e6ceeb1e458}</Project>\n      <Name>SemanticLogging.Tests.Shared</Name>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"App.config\" />\n    <None Include=\"packages.config\" />\n  </ItemGroup>\n  <ItemGroup />\n  <Choose>\n    <When Condition=\"'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'\">\n      <ItemGroup>\n        <Reference Include=\"Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n        <Reference Include=\"Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n        <Reference Include=\"Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n        <Reference Include=\"Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n      </ItemGroup>\n    </When>\n  </Choose>\n  <Import Project=\"$(VSToolsPath)\\TeamTest\\Microsoft.TestTools.targets\" Condition=\"Exists('$(VSToolsPath)\\TeamTest\\Microsoft.TestTools.targets')\" />\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <Import Project=\"..\\..\\..\\source\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets\" Condition=\"Exists('..\\..\\..\\source\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('..\\..\\..\\source\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\..\\..\\source\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets'))\" />\n  </Target>\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/Sinks/ConsoleSinkFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestScenarios;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.Sinks\n{\n    [TestClass]\n    public class ConsoleSinkFixture\n    {\n        [TestMethod]\n        public void WhenDefaultColorMappingForInformational()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"This is to log information in Console\");\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, \"100\");\n            Assert.AreEqual(DefaultConsoleColorMapper.Informational, consoleOutputInterceptor.OutputForegroundColor);\n        }\n\n        [TestMethod]\n        public void WhenDefaultColorMappingForError()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Error(\"This is to log error in Console\");\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, \"300\");\n            Assert.AreEqual(DefaultConsoleColorMapper.Error, consoleOutputInterceptor.OutputForegroundColor);\n        }\n\n        [TestMethod]\n        public void WhenDefaultColorMappingForCritical()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Critical(\"This is to log critical in Console\");\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, \"200\");\n            Assert.AreEqual(DefaultConsoleColorMapper.Critical, consoleOutputInterceptor.OutputForegroundColor);\n        }\n\n        [TestMethod]\n        public void WhenDefaultColorMappingForVerbose()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Verbose(\"This is to log verbose in Console\");\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, \"400\");\n            Assert.AreEqual(DefaultConsoleColorMapper.Verbose, consoleOutputInterceptor.OutputForegroundColor);\n        }\n\n        [TestMethod]\n        public void WhenOneSourceTwoListeners()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            string errorMessage = string.Concat(\"Error \", Guid.NewGuid());\n            string infoMessage = string.Concat(\"Message\", Guid.NewGuid());\n            TestScenario.With2Listeners(\n                logger,\n                (listener1, listener2) =>\n                {\n                    listener1.LogToConsole(new EventTextFormatter(), null);\n                    listener2.LogToConsole();\n                    listener1.EnableEvents(logger, EventLevel.Informational);\n                    listener2.EnableEvents(logger, EventLevel.Error);\n                    logger.Informational(infoMessage);\n                    logger.Error(errorMessage);\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, \"100\");\n            StringAssert.Contains(entry, \"300\");\n        }\n\n        [TestMethod]\n        public void WhenOneListenerTwoSources()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n            var logger2 = MockConsoleListenerEventSource2.Logger;\n\n            string message = string.Concat(\"Message \", Guid.NewGuid());\n            string errorMessage = string.Concat(\"Error \", Guid.NewGuid());\n            TestScenario.With1Listener(\n                new EventSource[] { logger, logger2 },\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    listener.EnableEvents(logger2, EventLevel.LogAlways);\n                    logger.Informational(message);\n                    logger2.Informational(message);\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, \"100\");\n        }\n\n        [TestMethod]\n        public void WhenMultipleEvents()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    listener.LogToConsole();\n                    for (int n = 0; n < 300; n++)\n                    {\n                        logger.Informational(\"Some message to console \" + n);\n                    }\n                });\n\n            var output = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.IsNotNull(output);\n            StringAssert.Contains(output.First(), \"Some message to console 0\");\n            StringAssert.Contains(output.First(), \"Some message to console 299\");\n        }\n\n        [TestMethod]\n        public void WhenOneSourceTwoListenersConcurrently()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            TestScenario.With2Listeners(\n                logger,\n                (listener1, listener2) =>\n                {\n                    listener1.LogToConsole();\n                    listener2.LogToConsole();\n                    int maxLoggedEntries = 9;\n                    string criticalMessage = string.Concat(\"CriticalMessage\");\n                    string infoMessage = string.Concat(\"InfoMessage\");\n                    listener1.EnableEvents(logger, EventLevel.Critical);\n                    listener2.EnableEvents(logger, EventLevel.Critical);\n                    Parallel.Invoke(Enumerable.Range(0, maxLoggedEntries).Select(i =>\n                    new Action(() =>\n                    {\n                        logger.Critical(i + criticalMessage);\n                    })).ToArray());\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n        }\n\n        [TestMethod]\n        public void WhenPayloadHasDifferentTypes()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSourceNoTask.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.DifferentTypes(\"testString\", 500000);\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, @\"strArg : testString\");\n            StringAssert.Contains(entry, @\"longArg : 500000\");\n        }\n\n        [TestMethod]\n        public void WhenPayloadHasDifferentTypesAndNull()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSourceNoTask.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.DifferentTypes(null, 500000);\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            Assert.IsTrue(entry.Count() > 0);\n            StringAssert.Contains(entry, @\"strArg : \");\n            StringAssert.Contains(entry, @\"longArg : 500000\");\n        }\n\n        [TestMethod]\n        public void WhenEventHasRawMessageAndFormattedMessage()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSourceNoTask.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"testing\");\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            Assert.IsTrue(entry.Count() > 0);\n            StringAssert.Contains(entry, \"message param\");\n        }\n\n        [TestMethod]\n        public void WhenHighEventIds()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockHighEventIdEventSource.HigheventIdLogger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.Warning);\n                    logger.Warning();\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n        }\n\n#if !EVENT_SOURCE_PACKAGE\n        [TestMethod]\n        public void WhenLowEventIds()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockNegativeEventIdEventSource.LoweventIdLogger;\n\n            try\n            {\n                TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.EnableEvents(logger, EventLevel.Warning);\n                    Assert.IsFalse(true, \"Should throw when calling EnableEvents.\");\n                });\n            }\n            catch (ArgumentException ex)\n            {\n                Assert.AreEqual(\"Event IDs must be positive integers.\", ex.Message);\n            }\n        }\n#endif\n\n        [TestMethod]\n        public void WhenLoggingErrorOCcurs()\n        {\n            var mockConsole = new MockConsoleOutputInterceptor();\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToConsole(new MockFormatter(true));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.EventWithPayload(\"payload1\", 100);\n\n                    StringAssert.Contains(errorsListener.ToString(), \"System.InvalidOperationException: Operation is not valid due to the current state of the object.\");\n                    Assert.AreEqual(string.Empty, mockConsole.Ouput);\n                });\n        }\n\n        [TestMethod]\n        public void WhenSingleLineTextFormatter()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole(formatter);\n                    listener.EnableEvents(logger, EventLevel.Error);\n                    logger.Critical(\"This is to log critical in Console\");\n                    logger.Verbose(\"This is should not be logged in Console\");\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            Assert.IsFalse(entry.Contains(\"This is should not be logged in Console\"));\n            Assert.IsTrue(entry.Contains(\"This is to log critical in Console\"));\n            Assert.IsTrue(entry.Contains(\"\\r\\nProviderId : \"));\n            Assert.IsTrue(entry.Contains(\"\\r\\nEventId : 200\\r\\nKeywords : None\\r\\nLevel : Critical\\r\\nMessage : Functional Test\\r\\nOpcode : Info\\r\\nTask : 65334\\r\\nVersion : 0\\r\\nPayload : [message : This is to log critical in Console] \\r\\nEventName : CriticalInfo\\r\\nTimestamp :\"));\n        }\n\n        [TestMethod]\n        public void WhenEnablingAllKeywords()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(\"----\", \"====\", EventLevel.LogAlways);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.EnableEvents(logger, EventLevel.LogAlways, Keywords.All);\n                    listener.LogToConsole(formatter);\n                    logger.InfoWithKeywordDiagnostic(\"Info with keyword Diagnostic\");\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            Assert.IsTrue(entry.Contains(\"ProviderId : \"));\n            Assert.IsTrue(entry.Contains(\"\\r\\nEventId : 1020\\r\\nKeywords : 4\\r\\nLevel : Informational\\r\\nMessage : \\r\\nOpcode : Info\\r\\nTask : 2\\r\\nVersion : 0\\r\\nPayload : [message : Info with keyword Diagnostic] \\r\\nEventName : DbQueryInfo\\r\\nTimestamp : \"));\n        }\n\n        [TestMethod]\n        public void WhenSourceEnabledAndNotSpecifyingKeyword()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.InfoWithKeywordDiagnostic(\"Info with keyword Diagnostic\");\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n#if EVENT_SOURCE_PACKAGE\n            Assert.IsNotNull(entry);\n#else\n            Assert.IsNull(entry);\n#endif\n            }\n\n        [TestMethod]\n        public void WhenCriticalVerbosityForFormatter()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole(formatter);\n                    formatter.VerbosityThreshold = EventLevel.Critical;\n                    listener.EnableEvents(logger, EventLevel.Critical);\n                    logger.Critical(\"This is to log critical in Console\");\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, \"200\");\n            StringAssert.Contains(entry, \"Keywords : None\");\n            Assert.AreEqual(DefaultConsoleColorMapper.Critical, consoleOutputInterceptor.OutputForegroundColor);\n        }\n\n        [TestMethod]\n        public void WhenDefaultFormatter()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.Critical);\n                    logger.Critical(\"This is to log critical in Console\");\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, \"200\");\n            StringAssert.Contains(entry, \"Keywords : None\");\n            Assert.AreEqual(DefaultConsoleColorMapper.Critical, consoleOutputInterceptor.OutputForegroundColor);\n        }\n\n        [TestMethod]\n        public void WhenActivityId()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            var activityId = Guid.NewGuid();\n            var previousActivityId = Guid.Empty;\n            EventSource.SetCurrentThreadActivityId(activityId, out previousActivityId);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.Critical);\n                    logger.Critical(\"This is to log critical in Console\");\n                });\n\n            EventSource.SetCurrentThreadActivityId(previousActivityId);\n                \n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, \"200\");\n            StringAssert.Contains(entry, \"Keywords : None\");\n            Assert.AreEqual(DefaultConsoleColorMapper.Critical, consoleOutputInterceptor.OutputForegroundColor);\n            StringAssert.Contains(entry, \"ActivityId : \" + activityId.ToString());\n            StringAssert.DoesNotMatch(entry, new Regex(\"RelatedActivityId\"));\n        }\n\n        [TestMethod]\n        public void WhenActivityIdAndRelatedActivityId()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            var activityId = Guid.NewGuid();\n            var relatedActivityId = Guid.NewGuid();\n            var previousActivityId = Guid.Empty;\n            EventSource.SetCurrentThreadActivityId(activityId, out previousActivityId);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.Critical);\n                    logger.CriticalWithRelatedActivityId(\"This is to log critical in Console\", relatedActivityId);\n                });\n            \n            EventSource.SetCurrentThreadActivityId(previousActivityId);\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, \"800\");\n            StringAssert.Contains(entry, \"Keywords : None\");\n            Assert.AreEqual(DefaultConsoleColorMapper.Critical, consoleOutputInterceptor.OutputForegroundColor);\n            StringAssert.Contains(entry, \"ActivityId : \" + activityId.ToString());\n            StringAssert.Contains(entry, \"RelatedActivityId : \" + relatedActivityId.ToString());\n        }\n\n        [TestMethod]\n        public void WhenEventWithTaskName()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.LogAlways, Keywords.All);\n                    logger.CriticalWithTaskName(\"Critical with taskname Page\");\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            Assert.IsTrue(entry.Contains(\"ProviderId : \"));\n            Assert.IsTrue(entry.Contains(\"\\r\\nEventId : 1500\\r\\nKeywords : 1\\r\\nLevel : Critical\\r\\nMessage : \\r\\nOpcode : Info\\r\\nTask : 1\\r\\nVersion : 0\\r\\nPayload : [message : Critical with taskname Page] \\r\\nEventName : PageInfo\\r\\nTimestamp : \"));\n        }\n\n        [TestMethod]\n        public void WhenEventWithTaskNone()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Critical(\"Critical with taskname or eventname as Critical\");\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            Assert.IsTrue(entry.Contains(\"ProviderId : \"));\n            Assert.IsTrue(entry.Contains(\"\\r\\nEventId : 200\\r\\nKeywords : None\\r\\nLevel : Critical\\r\\nMessage : Functional Test\\r\\nOpcode : Info\\r\\nTask : 65334\\r\\nVersion : 0\\r\\nPayload : [message : Critical with taskname or eventname as Critical] \\r\\nEventName : CriticalInfo\\r\\nTimestamp : \"));\n        }\n\n        [TestMethod]\n        public void WhenEventWithMessageInAttribute()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var eventformatter = new EventTextFormatter(\"----\", \"-----\", EventLevel.Informational);\n            eventformatter.DateTimeFormat = \"dd/MM/yyyy\";\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole(eventformatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.ObjectArrayEvent4(1000, \"stringstringarg10\", 2000, \"stringstringarg20\", 3000);\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, \"[arg0 : 1000] [arg1 : stringstringarg10] [arg2 : 2000] [arg3 : stringstringarg20] [arg4 : 3000]\");\n            StringAssert.Contains(entry, \"Message : Check if it is logged\");\n        }\n\n        [TestMethod]\n        public void WhenEventWithMessageInAttributeUsingJson()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var jsonFormatter = new JsonEventTextFormatter();\n            jsonFormatter.DateTimeFormat = \"dd/MM/yyyy\";\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole(jsonFormatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.ObjectArrayEvent4(1000, \"stringstringarg10\", 2000, \"stringstringarg20\", 3000);\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, \"{\\\"arg0\\\":1000,\\\"arg1\\\":\\\"stringstringarg10\\\",\\\"arg2\\\":2000,\\\"arg3\\\":\\\"stringstringarg20\\\",\\\"arg4\\\":3000}\");\n            StringAssert.Contains(entry, \"Check if it is logged\");\n        }\n\n        [TestMethod]\n        public void WhenEventWithMessageInAttributeUsingXml()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var xmlFormatter = new XmlEventTextFormatter();\n            xmlFormatter.DateTimeFormat = \"dd/MM/yyyy\";\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole(xmlFormatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.ObjectArrayEvent4(1000, \"stringstringarg10\", 2000, \"stringstringarg20\", 3000);\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, \"<Data Name=\\\"arg0\\\">1000</Data><Data Name=\\\"arg1\\\">stringstringarg10</Data><Data Name=\\\"arg2\\\">2000</Data><Data Name=\\\"arg3\\\">stringstringarg20</Data><Data Name=\\\"arg4\\\">3000</Data>\");\n            StringAssert.Contains(entry, \"<Message>Check if it is logged</Message>\");\n        }\n\n        [TestMethod]\n        public void WhenProcessId()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            int processId = System.Diagnostics.Process.GetCurrentProcess().Id;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.Critical);\n                    logger.Critical(\"This is to log critical in Console\");\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, \"ProcessId : \" + processId);\n        }\n\n        [TestMethod]\n        public void WhenThreadId()\n        {\n            var consoleOutputInterceptor = new MockConsoleOutputInterceptor();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockConsoleListenerEventSource.Logger;\n\n            int threadId = ThreadHelper.GetCurrentUnManagedThreadId();\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToConsole();\n                    listener.EnableEvents(logger, EventLevel.Critical);\n                    logger.Critical(\"This is to log critical in Console\");\n                });\n\n            var entry = Regex.Split(consoleOutputInterceptor.Ouput, formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c)).SingleOrDefault();\n            Assert.IsNotNull(entry);\n            StringAssert.Contains(entry, \"ThreadId : \" + threadId);\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/Sinks/DatabaseSinkFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Data;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Transactions;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.Sinks\n{\n    [TestClass]\n    public class DatabaseSinkFixture\n    {\n        [TestMethod]\n        public void WhenInformationalEvent()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            var message = string.Empty;\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    message = string.Concat(\"Message \", Guid.NewGuid());\n                    logger.Informational(message);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            Assert.AreEqual((int)EventLevel.Informational, int.Parse(dr[\"Level\"].ToString()));\n            Assert.AreEqual(1, (int)dr[\"EventID\"]);\n            Assert.AreEqual(\"mytestinstance1\", dr[\"InstanceName\"].ToString());\n            StringAssert.Contains((string)dr[\"Payload\"], message);\n        }\n\n        [TestMethod]\n        public void WhenEventWithNullArgParam()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(null);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            Assert.AreEqual((int)EventLevel.Informational, int.Parse(dr[\"Level\"].ToString()));\n            Assert.AreEqual(1, (int)dr[\"EventID\"]);\n            Assert.AreEqual(\"mytestinstance1\", dr[\"InstanceName\"].ToString());\n            StringAssert.Contains((string)dr[\"Payload\"], @\"\"\"message\"\": \"\"\"\"\");\n        }\n\n        [TestMethod]\n        public void WhenErrorEvent()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            var message = string.Empty;\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    message = string.Concat(\"Error \" + Guid.NewGuid());\n                    logger.Error(message);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            Assert.AreEqual((int)EventLevel.Error, int.Parse(dr[\"Level\"].ToString()));\n            Assert.AreEqual(3, (int)dr[\"EventID\"]);\n            StringAssert.Contains((string)dr[\"Payload\"], message);\n        }\n\n        [TestMethod]\n        public void WhenCriticalEvent()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            var message = string.Empty;\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    message = string.Concat(\"Critical \" + Guid.NewGuid());\n                    logger.Critical(message);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            Assert.AreEqual((int)EventLevel.Critical, int.Parse(dr[\"Level\"].ToString()));\n            Assert.AreEqual(2, (int)dr[\"EventID\"]);\n            StringAssert.Contains((string)dr[\"Payload\"], message);\n        }\n\n        [TestMethod]\n        public void WhenInformationalEventWithOpCode()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            var message = string.Empty;\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    message = string.Concat(\"Message \", Guid.NewGuid());\n                    logger.WriteWithOpCode(message);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            Assert.AreEqual(7, (int)dr[\"OpCode\"]);\n        }\n\n        [TestMethod]\n        public void WhenConcurrentEvents()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    var logTaskList = new List<Task>();\n                    for (int i = 0; i < 9; i++)\n                    {\n                        var messageNumber = i;\n                        logTaskList.Add(Task.Run(() => logger.Informational(messageNumber + \"Message \")));\n                    }\n\n                    Task.WaitAll(logTaskList.ToArray(), TimeSpan.FromSeconds(10));\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString, 9);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.AreEqual(dt.Rows.Count, 9);\n            DataRow[] result = dt.Select(\"Payload like '%Message%' \");\n            Assert.AreEqual(result.Length, 9);\n            for (int n = 0; n < 9; n++)\n            {\n                DataRow[] singleResult = dt.Select(string.Format(\"Payload like '%{0}Message%' \", n));\n                Assert.AreEqual(1, singleResult.Length);\n            }\n        }\n\n        [TestMethod]\n        public void WhenConcurrentEventsFromMultipleSources()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n            var loggerNoTask = MockEventSourceNoTask.Logger;\n\n            TestScenario.With1Listener(\n                new EventSource[] { logger, loggerNoTask },\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.Critical);\n                    listener.EnableEvents(loggerNoTask, EventLevel.Informational);\n                    string criticalMessage = string.Concat(\"CriticalMessage\");\n                    string infoMessage = string.Concat(\"InfoMessage\");\n                    var logTaskList = new List<Task>();\n                    for (int i = 0; i < 9; i++)\n                    {\n                        var messageNumber = i;\n                        logTaskList.Add(Task.Run(() =>\n                        {\n                            logger.Critical(messageNumber + criticalMessage);\n                            loggerNoTask.Informational(messageNumber + infoMessage);\n                        }));\n                    }\n\n                    Task.WaitAll(logTaskList.ToArray(), TimeSpan.FromSeconds(10));\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString, 18);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.AreEqual(18, dt.Rows.Count);\n            DataRow[] result1 = dt.Select(\"Payload like '%CriticalMessage%' \");\n            Assert.AreEqual(result1.Length, 9);\n            for (int n = 0; n < 9; n++)\n            {\n                DataRow[] singleResult = dt.Select(string.Format(\"Payload like '%{0}CriticalMessage%' \", n));\n                Assert.AreEqual(singleResult.Length, 1);\n            }\n\n            result1 = dt.Select(\"Payload like '%InfoMessage%' \");\n            Assert.AreEqual(result1.Length, 9);\n            for (int n = 0; n < 9; n++)\n            {\n                DataRow[] singleResult = dt.Select(string.Format(\"Payload like '%{0}InfoMessage%' \", n));\n                Assert.AreEqual(singleResult.Length, 1);\n            }\n        }\n\n        [TestMethod]\n        public void WhenMultipleEventsUsingSingleListener()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int n = 0; n < 300; n++)\n                    {\n                        logger.Informational(\"logging multiple messages \" + n.ToString());\n                    }\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString, 300);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.AreEqual(300, dt.Rows.Count);\n            StringAssert.Contains(dt.Rows[0][\"payload\"].ToString(), \"logging multiple messages 0\");\n            StringAssert.Contains(dt.Rows[299][\"payload\"].ToString(), \"logging multiple messages 299\");\n        }\n\n        [TestMethod]\n        public void WhenOneSourceTwoListeners()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            string errorMessage = string.Concat(\"Error \", Guid.NewGuid());\n            string infoMessage = string.Concat(\"Message\", Guid.NewGuid());\n            TestScenario.With2Listeners(\n                logger,\n                (listener1, listener2) =>\n                {\n                    listener1.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener2.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener1.EnableEvents(logger, EventLevel.Informational);\n                    listener2.EnableEvents(logger, EventLevel.Error);\n                    logger.Informational(infoMessage);\n                    logger.Error(errorMessage);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString, 3);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.AreEqual(3, dt.Rows.Count);\n        }\n\n        [TestMethod]\n        public void WhenOneListenerTwoSources()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n            var logger2 = MockEventSource2.Logger;\n\n            TestScenario.With1Listener(\n                new EventSource[] { logger, logger2 },\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    string message = string.Concat(\"Message \", Guid.NewGuid());\n                    string errorMessage = string.Concat(\"Error \", Guid.NewGuid());\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    listener.EnableEvents(logger2, EventLevel.LogAlways);\n                    logger.Informational(message);\n                    logger2.Error(errorMessage);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString, 2);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count == 2);\n            var dr = dt.Rows[0];\n            var dr2 = dt.Rows[1];\n            Assert.AreNotEqual(dr2[\"Level\"], dr[\"Level\"]);\n            StringAssert.Contains(dr2[\"Level\"].ToString() + \"|\" + dr[\"Level\"].ToString(), ((int)EventLevel.Error).ToString());\n            StringAssert.Contains(dr2[\"Level\"].ToString() + \"|\" + dr[\"Level\"].ToString(), ((int)EventLevel.Informational).ToString());\n            Assert.AreNotEqual((Guid)dr[\"ProviderID\"], (Guid)dr2[\"ProviderID\"]);\n        }\n\n        [TestMethod]\n        public void WhenEventWithNoTaskInSchema()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceNoTask.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.NoTaskSpecfied1(1, 2, 3);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n\n            int taskValue = 0xfffe - (int)dr[\"EventId\"];\n            Assert.AreEqual(taskValue, (int)dr[\"Task\"]);\n        }\n\n        [TestMethod]\n        public void WhenEventWithNoOpCodeNoKeywordsNoVersionNoMessage()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceNoTask.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.NoTaskNoOpCode1(1, 2, 3);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            Assert.AreEqual(0, (int)dr[\"OpCode\"]);\n            Assert.AreEqual(0, (long)dr[\"EventKeywords\"]);\n            Assert.AreEqual(0, (int)dr[\"Version\"]);\n            Assert.AreEqual(String.Empty, dr[\"FormattedMessage\"].ToString());\n        }\n\n        [TestMethod]\n        public void WhenActivityId()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            var activityId = Guid.NewGuid();\n            var previousActivityId = Guid.Empty;\n            var message = string.Empty;\n            EventSource.SetCurrentThreadActivityId(activityId, out previousActivityId);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    message = string.Concat(\"Message \", Guid.NewGuid());\n                    logger.Informational(message);\n                });\n\n            EventSource.SetCurrentThreadActivityId(previousActivityId);\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            Assert.AreEqual((int)EventLevel.Informational, int.Parse(dr[\"Level\"].ToString()));\n            Assert.AreEqual(1, (int)dr[\"EventID\"]);\n            Assert.AreEqual(\"mytestinstance1\", dr[\"InstanceName\"].ToString());\n            StringAssert.Contains((string)dr[\"Payload\"], message);\n            Assert.AreEqual(activityId, (Guid)dr[\"ActivityId\"]);\n            Assert.AreEqual(Guid.Empty, (Guid)dr[\"RelatedActivityId\"]);\n        }\n\n        [TestMethod]\n        public void WhenActivityIdAndRelatedActivityId()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            var activityId = Guid.NewGuid();\n            var relatedActivityId = Guid.NewGuid();\n            var previousActivityId = Guid.Empty;\n            var message = string.Empty;\n            EventSource.SetCurrentThreadActivityId(activityId, out previousActivityId);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    message = string.Concat(\"Message \", Guid.NewGuid());\n                    logger.InformationalWithRelatedActivityId(message, relatedActivityId);\n                });\n\n            EventSource.SetCurrentThreadActivityId(previousActivityId);\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            Assert.AreEqual((int)EventLevel.Informational, int.Parse(dr[\"Level\"].ToString()));\n            Assert.AreEqual(14, (int)dr[\"EventID\"]);\n            Assert.AreEqual(\"mytestinstance1\", dr[\"InstanceName\"].ToString());\n            StringAssert.Contains((string)dr[\"Payload\"], message);\n            Assert.AreEqual(activityId, (Guid)dr[\"ActivityId\"]);\n            Assert.AreEqual(relatedActivityId, (Guid)dr[\"RelatedActivityId\"]);\n        }\n\n        [TestMethod]\n        public void WhenMaxLengthPayload()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceNoTask.Logger;\n\n            string largeMessage = new string('*', 3900);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.MaxValues(largeMessage, long.MaxValue, int.MaxValue);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            Assert.AreEqual((int)EventLevel.Informational, int.Parse(dr[\"Level\"].ToString()));\n            StringAssert.Contains((string)dr[\"Payload\"], largeMessage);\n            StringAssert.Contains((string)dr[\"Payload\"], long.MaxValue.ToString());\n            StringAssert.Contains((string)dr[\"Payload\"], int.MaxValue.ToString());\n        }\n\n        [TestMethod]\n        public void WhenEventWithDifferentTypesPayload()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceNoTask.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.DifferentTypes(\"testString\", 500000);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            StringAssert.Contains((string)dr[\"Payload\"], @\"\"\"strArg\"\": \"\"testString\"\"\");\n            StringAssert.Contains((string)dr[\"Payload\"], @\"\"\"longArg\"\": 500000\");\n        }\n\n        [TestMethod]\n        public void WhenEventWithPayloadWithSupportedTypes()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceNoTask.Logger;\n\n            var guidArg = Guid.NewGuid();\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.AllSupportedTypes(Int16.MinValue, Int32.MaxValue, Int64.MaxValue, 10 / 3, TestEnum.value1, guidArg);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            StringAssert.Contains((string)dr[\"Payload\"], @\"\"\"srtArg\"\": \" + Int16.MinValue.ToString());\n            StringAssert.Contains((string)dr[\"Payload\"], @\"\"\"intArg\"\": \" + Int32.MaxValue.ToString());\n            StringAssert.Contains((string)dr[\"Payload\"], @\"\"\"lngArg\"\": \" + Int64.MaxValue.ToString());\n            StringAssert.Contains((string)dr[\"Payload\"], @\"\"\"fltArg\"\": 3.0\");\n            StringAssert.Contains((string)dr[\"Payload\"], @\"\"\"enumArg\"\": \" + ((int)TestEnum.value1).ToString());\n            StringAssert.Contains((string)dr[\"Payload\"], @\"\"\"guidArg\"\": \"\"\" + guidArg.ToString());\n        }\n\n        [TestMethod]\n        public void WhenEventWithPayloadDifferentTypesAndNull()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceNoTask.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.DifferentTypes(null, 500000);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            StringAssert.Contains((string)dr[\"Payload\"], @\"\"\"strArg\"\": \"\"\"\"\");\n            StringAssert.Contains((string)dr[\"Payload\"], @\"\"\"longArg\"\": 500000\");\n        }\n\n        [TestMethod]\n        public void WhenRawMessageAndFormattedMessage()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceNoTask.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"testing\");\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            Assert.AreEqual(\"message param\", dr[\"FormattedMessage\"]);\n        }\n\n        [TestMethod]\n        public void WhenEventWithEnumsInPayload()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceInProcEnum.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    string message = string.Concat(\"Message \", Guid.NewGuid());\n                    logger.SendEnumsEvent15(MockEventSourceInProcEnum.MyColor.Blue, MockEventSourceInProcEnum.MyFlags.Flag3);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            Assert.AreEqual((int)EventLevel.Informational, int.Parse(dr[\"Level\"].ToString()));\n            Assert.AreEqual(2, (int)dr[\"EventID\"]);\n            StringAssert.Contains((string)dr[\"Payload\"], @\"a\"\": 1\");\n            StringAssert.Contains((string)dr[\"Payload\"], @\"b\"\": 4\");\n        }\n\n        [TestMethod]\n        public void WhenAmbientTransactionIsDisposed()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    string message = string.Concat(\"Message \", Guid.NewGuid());\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    TransactionScope tran = new TransactionScope();\n                    logger.Informational(message);\n                    logger.Error(message);\n                    tran.Dispose();\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count == 2);\n        }\n\n        [TestMethod]\n        public void WhenSingleLineTextFormatter()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            string strGuid = Guid.NewGuid().ToString();\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.Error);\n                    logger.Informational(string.Concat(\"Informational \", strGuid));\n                    logger.Error(string.Concat(\"Error \", strGuid));\n                    logger.Critical(string.Concat(\"Critical \", strGuid));\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString, 5);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.AreEqual(dt.Rows.Count, 2);\n            var errorRow = dt.Rows[0];\n            var criticalRow = dt.Rows[1];\n            Assert.AreEqual((int)EventLevel.Error, int.Parse(errorRow[\"Level\"].ToString()));\n            Assert.AreEqual((int)EventLevel.Critical, int.Parse(criticalRow[\"Level\"].ToString()));\n            Assert.AreEqual(\"{\\r\\n  \\\"message\\\": \\\"Error \" + strGuid + \"\\\"\\r\\n}\", (string)errorRow[\"Payload\"]);\n            Assert.AreEqual(\"{\\r\\n  \\\"message\\\": \\\"Critical \" + strGuid + \"\\\"\\r\\n}\", (string)criticalRow[\"Payload\"]);\n        }\n\n        [TestMethod]\n        public void WhenWrongTableNameExceptionsAreRoutedToErrorEventSource()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString, \"WrongTable\", bufferingCount: 200, bufferingInterval: TimeSpan.FromSeconds(1));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int n = 0; n < 200; n++)\n                    {\n                        logger.Informational(\"Message: \" + n);\n                    }\n\n                    errorsListener.WaitEvents.Wait(2000);\n                    StringAssert.Contains(errorsListener.ToString(), \"Cannot access destination table 'WrongTable'.\");\n                });\n\n            var rowCount = DatabaseHelper.GetRowCount(validConnectionString);\n            Assert.AreEqual(0, rowCount);\n        }\n\n        [TestMethod]\n        public void WhenWrongDbExceptionsAreRoutedToErrorEventSource()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            var invalidConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"invalid\"].ConnectionString;\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", invalidConnectionString, bufferingCount: 1);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n\n                    errorsListener.WaitEvents.Wait(1000);\n                    StringAssert.Contains(errorsListener.ToString(), @\"Cannot open database \"\"Invalid\"\" requested by the login. The login failed.\");\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsTrue(dt.Rows.Count == 0);\n        }\n\n        [TestMethod]\n        public void WhenEnablingKeywordsAll()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            string strGuid = Guid.NewGuid().ToString();\n            var invalidConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"invalid\"].ConnectionString;\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways, Keywords.All);\n                    logger.ErrorWithKeywordDiagnostic(string.Concat(\"ErrorWithKeywordDiagnostic \", strGuid));\n                    logger.CriticalWithKeywordPage(string.Concat(\"CriticalWithKeywordPage \", strGuid));\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString, 5);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.AreEqual(2, dt.Rows.Count);\n            var errorRow = dt.Rows[0];\n            var criticalRow = dt.Rows[1];\n            Assert.AreEqual((int)EventLevel.Error, int.Parse(errorRow[\"Level\"].ToString()));\n            Assert.AreEqual((int)EventLevel.Critical, int.Parse(criticalRow[\"Level\"].ToString()));\n            Assert.AreEqual(\"4\", (string)errorRow[\"EventKeywords\"].ToString());\n            Assert.AreEqual(\"1\", (string)criticalRow[\"EventKeywords\"].ToString());\n        }\n\n        [TestMethod]\n        public void WhenNotSpecifyingKeywordsWhileEnabling()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            string strGuid = Guid.NewGuid().ToString();\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.ErrorWithKeywordDiagnostic(string.Concat(\"ErrorWithKeywordDiagnostic \", strGuid));\n                    logger.CriticalWithKeywordPage(string.Concat(\"CriticalWithKeywordPage \", strGuid));\n                });\n            int rowCount = 0;\n#if EVENT_SOURCE_PACKAGE\n            rowCount = 2;\n#endif\n            Assert.AreEqual(rowCount, DatabaseHelper.GetRowCount(validConnectionString));\n        }\n\n        [TestMethod]\n        public void WhenUnEscalatedTransactionRollsBack()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            var transaction = new TransactionScope();\n            try\n            {\n                TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.Verbose);\n                    logger.Warning(\"warning1\");\n                    logger.Informational(\"info1\");\n\n                    throw new Exception();\n                });\n            }\n            catch { }\n            finally\n            {\n                transaction.Dispose();\n            }\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.AreEqual(2, dt.Rows.Count);\n        }\n\n        [TestMethod]\n        public void WhenUnEscalatedTransactionSucceeds()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            using (var transaction = new System.Transactions.TransactionScope())\n            {\n                TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.Verbose);\n                    logger.Warning(\"warning1\");\n                    logger.Informational(\"info1\");\n\n                    transaction.Complete();\n                });\n            }\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.AreEqual(2, dt.Rows.Count);\n        }\n\n        [TestMethod]\n        public void WhenEventWithMessageInAttribute()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.ObjectArrayEvent4(10, \"stringarg1\", 20, \"stringarg3\", 30);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            StringAssert.Contains((string)dr[\"FormattedMessage\"], \"Check if it is logged\");\n            StringAssert.Contains((string)dr[\"Payload\"], \"{\\r\\n  \\\"arg0\\\": 10,\\r\\n  \\\"arg1\\\": \\\"stringarg1\\\",\\r\\n  \\\"arg2\\\": 20,\\r\\n  \\\"arg3\\\": \\\"stringarg3\\\",\\r\\n  \\\"arg4\\\": 30\\r\\n}\");\n        }\n\n        [TestMethod]\n        public void WhenConcurrentEventsToMultipleListenersWithSameSource()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With2Listeners(\n                logger,\n                (listener1, listener2) =>\n                {\n                    listener1.LogToSqlDatabase(\"WaitFor_BufferingInterval\", validConnectionString, bufferingInterval: TimeSpan.FromSeconds(30));\n                    listener2.LogToSqlDatabase(\"WaitFor_BufferingInterval\", validConnectionString);\n                    listener1.EnableEvents(logger, EventLevel.LogAlways);\n                    listener2.EnableEvents(logger, EventLevel.LogAlways);\n                    var logTaskList = new List<Task>();\n                    for (int i = 0; i < 1000; i++)\n                    {\n                        var messageNumber = i;\n                        logTaskList.Add(Task.Run(() =>\n                        {\n                            logger.Critical(messageNumber + \"Critical message\");\n                        }));\n                    }\n\n                    Task.WaitAll(logTaskList.ToArray(), TimeSpan.FromSeconds(10));\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.AreEqual(2000, dt.Rows.Count);\n        }\n\n        [TestMethod]\n        public void WhenConcurrentEventsSameListener()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"MultipleThreads\", validConnectionString, bufferingInterval: TimeSpan.FromSeconds(20));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    var threads = new System.Threading.Thread[10];\n                    for (int i = 0; i < 10; i++)\n                    {\n                        threads[i] = new System.Threading.Thread(new System.Threading.ThreadStart(() =>\n                            {\n                                for (int j = 0; j < 50; j++)\n                                {\n                                    logger.Critical(\"Test MultipleThreads\");\n                                }\n                            }));\n\n                        threads[i].Start();\n                    }\n\n                    for (int i = 0; i < 10; i++)\n                    {\n                        threads[i].Join();\n                    }\n                });\n\n            var dt = DatabaseHelper.PollUntilEventsAreWritten(validConnectionString, 500);\n            Assert.AreEqual<int>(500, dt.Rows.Count);\n        }\n\n        [TestMethod]\n        public void WhenDisposeFlushesBufferedEvents()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString, bufferingInterval: TimeSpan.FromSeconds(10), bufferingCount: 100);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int msg = 0; msg < 10; msg++)\n                    {\n                        logger.Informational(\"Message \" + msg.ToString());\n                    }\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.AreEqual(10, dt.Rows.Count);\n        }\n\n        [TestMethod]\n        public void WhenSmallBufferingInterval()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With2Listeners(\n                logger,\n                (listener1, listener2) =>\n                {\n                    var bufferingInterval = TimeSpan.FromSeconds(1);\n                    listener1.LogToSqlDatabase(\"WithMinBufferingInterval1\", validConnectionString, bufferingInterval: bufferingInterval, bufferingCount: 1000);\n                    listener2.LogToSqlDatabase(\"WithMinBufferingInterval2\", validConnectionString, bufferingInterval: bufferingInterval, bufferingCount: 1000);\n                    listener1.EnableEvents(logger, EventLevel.LogAlways);\n                    listener2.EnableEvents(logger, EventLevel.LogAlways);\n                    var logTaskList = new List<Task>();\n                    for (int i = 0; i < 50; i++)\n                    {\n                        var messageNumber = i;\n                        logTaskList.Add(Task.Run(() =>\n                        {\n                            logger.Critical(messageNumber + \"Critical message\");\n                        }));\n                    }\n\n                    Task.WaitAll(logTaskList.ToArray(), TimeSpan.FromSeconds(10));\n\n                    // Wait for the buffer to flush at end of interval\n                    Task.Delay(TimeSpan.FromSeconds(2)).Wait();\n                    var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n                    Assert.AreEqual(100, dt.Rows.Count);\n                    Assert.AreEqual(50, dt.Select(\"InstanceName = 'WithMinBufferingInterval1'\").Count());\n                    Assert.AreEqual(50, dt.Select(\"InstanceName = 'WithMinBufferingInterval2'\").Count());\n                });\n\n            // There should not be remaining events flushed during Dispose\n            var finalTable = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.AreEqual(100, finalTable.Rows.Count);\n            Assert.AreEqual(50, finalTable.Select(\"InstanceName = 'WithMinBufferingInterval1'\").Count());\n            Assert.AreEqual(50, finalTable.Select(\"InstanceName = 'WithMinBufferingInterval2'\").Count());\n        }\n\n        [TestMethod]\n        public void WhenMinBufferingCount()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With2Listeners(\n                logger,\n                (listener1, listener2) =>\n                {\n                    listener1.LogToSqlDatabase(\"WithMinBufferingCount1\", validConnectionString, bufferingInterval: TimeSpan.FromSeconds(10), bufferingCount: 1);\n                    listener2.LogToSqlDatabase(\"WithMinBufferingCount2\", validConnectionString, bufferingInterval: TimeSpan.FromSeconds(10), bufferingCount: 1);\n                    listener1.EnableEvents(logger, EventLevel.LogAlways);\n                    listener2.EnableEvents(logger, EventLevel.LogAlways);\n\n                    logger.Critical(\"Critical message 1\");\n                    logger.Critical(\"Critical message 2\");\n\n                    // Wait for the events to be written to the database in each listener\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n                    Assert.AreEqual(4, dt.Rows.Count);\n                    Assert.AreEqual(2, dt.Select(\"InstanceName = 'WithMinBufferingCount1'\").Count());\n                    Assert.AreEqual(2, dt.Select(\"InstanceName = 'WithMinBufferingCount2'\").Count());\n                });\n\n            // There should not be remaining events flushed during Dispose\n            var finalTable = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.AreEqual(4, finalTable.Rows.Count);\n            Assert.AreEqual(2, finalTable.Select(\"InstanceName = 'WithMinBufferingCount1'\").Count());\n            Assert.AreEqual(2, finalTable.Select(\"InstanceName = 'WithMinBufferingCount2'\").Count());\n        }\n\n        [TestMethod]\n        public void WhenBufferingIntervalNotReachedBufferingCountExceeded()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var longBufferingInterval = TimeSpan.FromSeconds(30);\n                    listener.LogToSqlDatabase(\"WithBuffering_IntervalNotReached_MaxLogReached\", validConnectionString, bufferingInterval: longBufferingInterval, bufferingCount: 10);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int i = 0; i < 15; i++)\n                    {\n                        logger.Critical(i + \"Critical message\");\n                    }\n\n                    // Wait for the first 10 buffered events to be written to the database in each listener\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n                    Assert.AreEqual(10, dt.Rows.Count);\n                    Assert.AreEqual(10, dt.Select(\"InstanceName = 'WithBuffering_IntervalNotReached_MaxLogReached'\").Count());\n                });\n\n            // The dispose should flush the remaining events\n            var finalTable = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.AreEqual(15, finalTable.Rows.Count);\n            Assert.AreEqual(15, finalTable.Select(\"InstanceName = 'WithBuffering_IntervalNotReached_MaxLogReached'\").Count());\n        }\n\n        [TestMethod]\n        public void WhenBufferIntervalIsReachedButBufferingCountNotExceeded()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var bufferingInterval = TimeSpan.FromSeconds(4);\n                    listener.LogToSqlDatabase(\"WithMinBufferingInterval\", validConnectionString, bufferingInterval: bufferingInterval, bufferingCount: 1000);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int i = 0; i < 50; i++)\n                    {\n                        logger.Critical(i + \"Critical message\");\n                    }\n\n                    // Before buffer interval is exceeded there should be no events written\n                    Assert.AreEqual(0, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    // Wait for the buffer to flush at end of interval\n                    Task.Delay(bufferingInterval).Wait();\n\n                    var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n                    Assert.AreEqual(50, dt.Rows.Count);\n                    Assert.AreEqual(50, dt.Select(\"InstanceName = 'WithMinBufferingInterval'\").Count());\n                });\n\n            // There should not be remaining events flushed during Dispose\n            var finalTable = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.AreEqual(50, finalTable.Rows.Count);\n            Assert.AreEqual(50, finalTable.Select(\"InstanceName = 'WithMinBufferingInterval'\").Count());\n        }\n\n        [TestMethod]\n        public void WhenBufferingIntervalAndBufferingCountIsExceeded()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var bufferingInterval = TimeSpan.FromSeconds(2);\n                    listener.LogToSqlDatabase(\"WithMinBufferingInterval\", validConnectionString, bufferingInterval: bufferingInterval, bufferingCount: 50);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    // When reaching 50 events the buffer will be flushed\n                    for (int i = 0; i < 50; i++)\n                    {\n                        logger.Critical(i + \"Critical message\");\n                    }\n\n                    // Wait for the buffer to flush at end of interval\n                    Task.Delay(bufferingInterval).Wait();\n                    var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n                    Assert.AreEqual(50, dt.Rows.Count);\n                    Assert.AreEqual(50, dt.Select(\"InstanceName = 'WithMinBufferingInterval'\").Count());\n                });\n\n            // There should not be remaining events flushed during Dispose\n            var finalTable = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.AreEqual(50, finalTable.Rows.Count);\n            Assert.AreEqual(50, finalTable.Select(\"InstanceName = 'WithMinBufferingInterval'\").Count());\n        }\n\n        [TestMethod]\n        public void WhenDefaultBufferingCountAndNonDefaultBufferInterval()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var bufferingInterval = TimeSpan.FromSeconds(2);\n                    listener.LogToSqlDatabase(\"WhenDefaultBufferingCountAndNonDefaultBufferInterval\", validConnectionString, bufferingInterval: bufferingInterval);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int i = 0; i < 50; i++)\n                    {\n                        logger.Critical(i + \"Critical message\");\n                    }\n\n                    // Wait for the buffer to flush at end of interval\n                    Task.Delay(bufferingInterval).Wait();\n                    var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n                    Assert.AreEqual(50, dt.Rows.Count);\n                    Assert.AreEqual(50, dt.Select(\"InstanceName = 'WhenDefaultBufferingCountAndNonDefaultBufferInterval'\").Count());\n                });\n\n            // There should not be remaining events flushed during Dispose\n            var finalTable = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.AreEqual(50, finalTable.Rows.Count);\n            Assert.AreEqual(50, finalTable.Select(\"InstanceName = 'WhenDefaultBufferingCountAndNonDefaultBufferInterval'\").Count());\n        }\n\n        [TestMethod]\n        public void WhenNonDefaultBufferingCountAndDefaultBufferInterval()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"WithMinBufferingInterval\", validConnectionString, bufferingCount: 50);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    // When reaching 50 events the buffer will be flushed\n                    for (int i = 0; i < 50; i++)\n                    {\n                        logger.Critical(i + \"Critical message\");\n                    }\n\n                    // Wait for the events to be written\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n                    Assert.AreEqual(50, dt.Rows.Count);\n                    Assert.AreEqual(50, dt.Select(\"InstanceName = 'WithMinBufferingInterval'\").Count());\n                });\n\n            // There should not be remaining events flushed during Dispose\n            var finalTable = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.AreEqual(50, finalTable.Rows.Count);\n            Assert.AreEqual(50, finalTable.Select(\"InstanceName = 'WithMinBufferingInterval'\").Count());\n        }\n\n        [TestMethod]\n        public void WhenInfiniteBufferingIntervalAndMinBufferingCount()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With2Listeners(\n                logger,\n                (listener1, listener2) =>\n                {\n                    listener1.LogToSqlDatabase(\"WithMinBufferingCount1\", validConnectionString, bufferingInterval: Timeout.InfiniteTimeSpan, bufferingCount: 1);\n                    listener2.LogToSqlDatabase(\"WithMinBufferingCount2\", validConnectionString, bufferingInterval: Timeout.InfiniteTimeSpan, bufferingCount: 1);\n                    listener1.EnableEvents(logger, EventLevel.LogAlways);\n                    listener2.EnableEvents(logger, EventLevel.LogAlways);\n\n                    logger.Critical(\"Critical message 1\");\n                    logger.Critical(\"Critical message 2\");\n\n                    // Wait for the events to be written to the database in each listener\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n                    Assert.AreEqual(4, dt.Rows.Count);\n                    Assert.AreEqual(2, dt.Select(\"InstanceName = 'WithMinBufferingCount1'\").Count());\n                    Assert.AreEqual(2, dt.Select(\"InstanceName = 'WithMinBufferingCount2'\").Count());\n                });\n\n            // There should not be remaining events flushed during Dispose\n            var finalTable = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.AreEqual(4, finalTable.Rows.Count);\n            Assert.AreEqual(2, finalTable.Select(\"InstanceName = 'WithMinBufferingCount1'\").Count());\n            Assert.AreEqual(2, finalTable.Select(\"InstanceName = 'WithMinBufferingCount2'\").Count());\n        }\n\n        [TestMethod]\n        public void WhenBufferingIntervalIsReachedAndBufferingCountIsZero()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With2Listeners(\n                logger,\n                (listener1, listener2) =>\n                {\n                    var bufferingInterval = TimeSpan.FromSeconds(2);\n                    listener1.LogToSqlDatabase(\"WhenBufferIntervalIsZeroAndCountIsExceeded1\", validConnectionString, bufferingInterval: bufferingInterval, bufferingCount: 0);\n                    listener2.LogToSqlDatabase(\"WhenBufferIntervalIsZeroAndCountIsExceeded2\", validConnectionString, bufferingInterval: bufferingInterval, bufferingCount: 0);\n                    listener1.EnableEvents(logger, EventLevel.LogAlways);\n                    listener2.EnableEvents(logger, EventLevel.LogAlways);\n\n                    logger.Critical(\"Critical message 1\");\n                    logger.Critical(\"Critical message 2\");\n\n                    // Wait for the buffer to flush at end of interval\n                    Task.Delay(bufferingInterval).Wait();\n                    var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n                    Assert.AreEqual(4, dt.Rows.Count);\n                    Assert.AreEqual(2, dt.Select(\"InstanceName = 'WhenBufferIntervalIsZeroAndCountIsExceeded1'\").Count());\n                    Assert.AreEqual(2, dt.Select(\"InstanceName = 'WhenBufferIntervalIsZeroAndCountIsExceeded2'\").Count());\n                });\n\n            // There should not be remaining events flushed during Dispose\n            var finalTable = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.AreEqual(4, finalTable.Rows.Count);\n            Assert.AreEqual(2, finalTable.Select(\"InstanceName = 'WhenBufferIntervalIsZeroAndCountIsExceeded1'\").Count());\n            Assert.AreEqual(2, finalTable.Select(\"InstanceName = 'WhenBufferIntervalIsZeroAndCountIsExceeded2'\").Count());\n        }\n\n        [TestMethod]\n        public void WhenErraticEventsInDifferentBufferIntervals()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceNoTask.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString, \"Traces\", TimeSpan.FromSeconds(3));\n                    listener.EnableEvents(logger, EventLevel.Informational);\n                    for (int i = 0; i < 20; i++)\n                    {\n                        logger.InformationalNoMessage(\"test\" + i);\n                    }\n\n                    Task.Delay(TimeSpan.FromSeconds(5)).Wait();\n                    var result = DatabaseHelper.GetRowCount(validConnectionString);\n                    Assert.AreEqual<int>(20, result);\n\n                    Task.Delay(TimeSpan.FromSeconds(5)).Wait();\n                    for (int i = 20; i < 50; i++)\n                    {\n                        logger.InformationalNoMessage(\"test\" + i);\n                    }\n\n                    Task.Delay(TimeSpan.FromSeconds(5)).Wait();\n                    var result2 = DatabaseHelper.GetRowCount(validConnectionString);\n                    Assert.AreEqual<int>(50, result2);\n\n                    for (int i = 50; i < 100; i++)\n                    {\n                        logger.InformationalNoMessage(\"test\" + i);\n                    }\n\n                    Task.Delay(TimeSpan.FromSeconds(5)).Wait();\n                    var result3 = DatabaseHelper.GetRowCount(validConnectionString);\n                    Assert.AreEqual<int>(100, result3);\n                    errorsListener.WaitEvents.Wait(10000);\n                    Assert.AreEqual(string.Empty, errorsListener.ToString());\n                });\n        }\n\n        [TestMethod]\n        public void FirstFlushByBufferingCountNextByBufferingIntervalNextByBufferingInterval()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceNoTask.Logger;\n\n            TimeSpan bufferingInterval = TimeSpan.FromSeconds(4);\n            int bufferCount = 10;\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString, bufferingInterval: bufferingInterval, bufferingCount: bufferCount);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    // The first 10 events reach the buffer size and should be flushed before interval ends\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for events to be written\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    Assert.AreEqual(10, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    // Wait for new next interval\n                    Task.Delay(bufferingInterval).Wait();\n                    for (int i = 0; i < 5; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for interval to flush\n                    Task.Delay(bufferingInterval).Wait();\n                    Assert.AreEqual(15, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    // Insert new events in next interval\n                    Task.Delay(bufferingInterval).Wait();\n                    for (int i = 0; i < 5; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for interval to flush\n                    Task.Delay(bufferingInterval).Wait();\n                    Assert.AreEqual(20, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    errorsListener.WaitEvents.Wait(TimeSpan.FromSeconds(1));\n                    Assert.AreEqual(string.Empty, errorsListener.ToString());\n                });\n\n            // There should not be remaining events flushed during Dispose\n            Assert.AreEqual(20, DatabaseHelper.GetRowCount(validConnectionString));\n        }\n\n        [TestMethod]\n        public void FirstFlushByBufferingCountNextByBufferingIntervalNextByBufferingCount()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceNoTask.Logger;\n\n            TimeSpan bufferingInterval = TimeSpan.FromSeconds(4);\n            int bufferCount = 10;\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString, bufferingInterval: bufferingInterval, bufferingCount: bufferCount);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    // The first 10 events reach the buffer size and should be flushed before interval ends\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for events to be written\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    Assert.AreEqual(10, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    // Wait for new next interval\n                    Task.Delay(bufferingInterval).Wait();\n                    for (int i = 0; i < 5; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for interval to flush\n                    Task.Delay(bufferingInterval).Wait();\n                    Assert.AreEqual(15, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    // The first 10 events reach the buffer size and should be flushed before interval ends\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for events to be written\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    Assert.AreEqual(25, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    errorsListener.WaitEvents.Wait(TimeSpan.FromSeconds(1));\n                    Assert.AreEqual(string.Empty, errorsListener.ToString());\n                });\n\n            // There should not be remaining events flushed during Dispose\n            Assert.AreEqual(25, DatabaseHelper.GetRowCount(validConnectionString));\n        }\n\n        [TestMethod]\n        public void FirstFlushByBufferingCountNextByBufferingCountNextByBufferingCount()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceNoTask.Logger;\n\n            TimeSpan bufferingInterval = TimeSpan.FromSeconds(4);\n            int bufferCount = 10;\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString, bufferingInterval: bufferingInterval, bufferingCount: bufferCount);\n\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    // The first 10 events reach the buffer size and should be flushed before interval ends\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for events to be written\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    Assert.AreEqual(10, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    // The first 10 events reach the buffer size and should be flushed before interval ends\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for events to be written\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    Assert.AreEqual(20, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    // The first 10 events reach the buffer size and should be flushed before interval ends\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for events to be written\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    Assert.AreEqual(30, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    errorsListener.WaitEvents.Wait(TimeSpan.FromSeconds(1));\n                    Assert.AreEqual(string.Empty, errorsListener.ToString());\n                });\n\n            // There should not be remaining events flushed during Dispose\n            Assert.AreEqual(30, DatabaseHelper.GetRowCount(validConnectionString));\n        }\n\n        [TestMethod]\n        public void FirstFlushByBufferingIntervalNextByBufferingIntervalNextByBufferingInterval()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceNoTask.Logger;\n\n            TimeSpan bufferingInterval = TimeSpan.FromSeconds(4);\n            int bufferCount = 10;\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString, bufferingInterval: bufferingInterval, bufferingCount: bufferCount);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    // Insert new events in this interval\n                    for (int i = 0; i < 5; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for interval to flush\n                    Task.Delay(bufferingInterval).Wait();\n\n                    // Wait for events to be written\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    Assert.AreEqual(5, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    // Insert new events in next interval\n                    for (int i = 0; i < 5; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for interval to flush\n                    Task.Delay(bufferingInterval).Wait();\n                    Assert.AreEqual(10, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    // Insert new events in next interval\n                    for (int i = 0; i < 5; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for interval to flush\n                    Task.Delay(bufferingInterval).Wait();\n                    Assert.AreEqual(15, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    errorsListener.WaitEvents.Wait(TimeSpan.FromSeconds(1));\n                    Assert.AreEqual(string.Empty, errorsListener.ToString());\n                });\n\n            // There should not be remaining events flushed during Dispose\n            Assert.AreEqual(15, DatabaseHelper.GetRowCount(validConnectionString));\n        }\n\n        [TestMethod]\n        public void FirstFlushByBufferingIntervalNextByBufferingCountNextByBufferingInterval()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceNoTask.Logger;\n\n            TimeSpan bufferingInterval = TimeSpan.FromSeconds(4);\n            int bufferCount = 10;\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString, bufferingInterval: bufferingInterval, bufferingCount: bufferCount);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    // Insert new events in this interval\n                    for (int i = 0; i < 5; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for interval to flush\n                    Task.Delay(bufferingInterval).Wait();\n\n                    // Wait for events to be written\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    Assert.AreEqual(5, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    // The first 10 events reach the buffer size and should be flushed before interval ends\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for events to be written\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    Assert.AreEqual(15, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    // Insert new events in next interval\n                    for (int i = 0; i < 5; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for interval to flush\n                    Task.Delay(bufferingInterval).Wait();\n                    Assert.AreEqual(20, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    errorsListener.WaitEvents.Wait(TimeSpan.FromSeconds(1));\n                    Assert.AreEqual(string.Empty, errorsListener.ToString());\n                });\n\n            // There should not be remaining events flushed during Dispose\n            Assert.AreEqual(20, DatabaseHelper.GetRowCount(validConnectionString));\n        }\n\n        [TestMethod]\n        public void FirstFlushByBufferingIntervalNextByBufferingCountNextByBufferingCount()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceNoTask.Logger;\n\n            TimeSpan bufferingInterval = TimeSpan.FromSeconds(4);\n            int bufferCount = 10;\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString, bufferingInterval: bufferingInterval, bufferingCount: bufferCount);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    // Insert new events in this interval\n                    for (int i = 0; i < 5; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for interval to flush\n                    Task.Delay(bufferingInterval).Wait();\n\n                    // Wait for events to be written\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    Assert.AreEqual(5, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    // The first 10 events reach the buffer size and should be flushed before interval ends\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for events to be written\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    Assert.AreEqual(15, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    // The first 10 events reach the buffer size and should be flushed before interval ends\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.MaxValues(\"test\", long.MaxValue, int.MaxValue);\n                    }\n\n                    // Wait for events to be written\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    Assert.AreEqual(25, DatabaseHelper.GetRowCount(validConnectionString));\n\n                    errorsListener.WaitEvents.Wait(TimeSpan.FromSeconds(1));\n                    Assert.AreEqual(string.Empty, errorsListener.ToString());\n                });\n\n            // There should not be remaining events flushed during Dispose\n            Assert.AreEqual(25, DatabaseHelper.GetRowCount(validConnectionString));\n        }\n\n        [TestMethod]\n        public void WhenProcessId()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            int processId = System.Diagnostics.Process.GetCurrentProcess().Id;\n            var message = string.Empty;\n \n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    message = string.Concat(\"Message \", Guid.NewGuid());\n                    logger.Informational(message);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            Assert.AreEqual(processId, (int)dr[\"ProcessId\"]);\n        }\n\n        [TestMethod]\n        public void WhenThreadId()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSource.Logger;\n\n            int threadId = ThreadHelper.GetCurrentUnManagedThreadId();\n            var message = string.Empty;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToSqlDatabase(\"mytestinstance1\", validConnectionString);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    message = string.Concat(\"Message \", Guid.NewGuid());\n                    logger.Informational(message);\n                });\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.IsNotNull(dt, \"No data logged\");\n            Assert.IsTrue(dt.Rows.Count > 0);\n            var dr = dt.Rows[0];\n            Assert.AreEqual(threadId, (int)dr[\"ThreadId\"]);\n        }\n    }\n}"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/Sinks/FlatFileSinkFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\nusing System.Security.AccessControl;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.Sinks\n{\n    [TestClass]\n    public class FlatFileSinkFixture\n    {\n        [TestMethod]\n        public void WhenFileDoesNotExist()\n        {\n            var fileName = \"newflatfile.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(1, entries.Count());\n        }\n\n        [TestMethod]\n        public void WhenFileIsDeletedBetweenSessions()\n        {\n            var fileName = \"newflatfile.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(1, entries.Count());\n\n            File.Delete(fileName);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n        }\n\n        [TestMethod]\n        public void WhenMultipleEventsAreRaised()\n        {\n            var fileName = \"multipleMessages.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(\"------======------\");\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int n = 0; n < 300; n++)\n                    {\n                        logger.Informational(\"some message to flat file \" + n.ToString());\n                    }\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(300, entries.Count());\n            StringAssert.Contains(entries.First(), \"some message to flat file 0\");\n            StringAssert.Contains(entries.Last(), \"some message to flat file 299\");\n        }\n\n        [TestMethod]\n        public void WhenFileExistsEventIsAppended()\n        {\n            var fileName = \"sampleflatfile.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(1, entries.Count());\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 2\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries2 = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(2, entries2.Count());\n        }\n\n        [TestMethod]\n        public void WhenAbsolutePathFileNameIsUsed()\n        {\n            var absolutePath = Directory.GetCurrentDirectory();\n            string fileName = Path.Combine(absolutePath, \"newflatfileAbsPath.log\");\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(1, entries.Count());\n        }\n\n        [TestMethod]\n        public void WhenRelativePathFileNameIsUsed()\n        {\n            var fileName = \"../../newflatfileRelativePath.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(1, entries.Count());\n            File.Delete(fileName);\n        }\n\n        [TestMethod]\n        public void WhenDriveDoesNotExist()\n        {\n            string filepath = string.Empty;\n            string[] strDrives = Directory.GetLogicalDrives();\n            string strAlphabets = \"A B C D E F G H I J K L M N O P Q R S T U V W X Y Z\";\n            string[] alphabet = strAlphabets.Split(' ');\n            foreach (string noDriveExists in alphabet)\n            {\n                bool notExists = strDrives.Contains(noDriveExists + \":\\\\\");\n                if (!notExists)\n                {\n                    // Drive does not exist \n                    filepath = noDriveExists + \":\\\\\";\n                    break;\n                }\n            }\n\n            var fileName = filepath + \"newflatfileDriveNotExists.log\";\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            try\n            {\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                }\n            }\n            catch (DirectoryNotFoundException ex)\n            {\n                StringAssert.StartsWith(ex.Message, \"Could not find a part of the path '\" + filepath);\n            }\n        }\n\n        [TestMethod]\n        public void WhenFileIsReadOnlyErrorOccursDuringEarly()\n        {\n            string fileName = \"newflatfileReadOnly1.log\";\n            DeleteReadOnlyFile(fileName);\n            File.Create(fileName);\n            File.SetAttributes(fileName, FileAttributes.ReadOnly);\n            string path = Directory.GetCurrentDirectory();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n\n            try\n            {\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                }\n            }\n            catch (UnauthorizedAccessException ex)\n            {\n                Assert.AreEqual(\"Access to the path '\" + path + \"\\\\\" + fileName + \"' is denied.\", ex.Message);\n            }\n        }\n\n        [TestMethod]\n        public void WhenFileIsReadOnlyErrorOccursEarly2()\n        {\n            var fileName = \"newflatfileReadOnly2.log\";\n            DeleteReadOnlyFile(fileName);\n            string path = Directory.GetCurrentDirectory();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            try\n            {\n                TestScenario.With1Listener(\n                    logger,\n                    listener =>\n                    {\n                        listener.LogToFlatFile(fileName, formatter);\n                        listener.EnableEvents(logger, EventLevel.LogAlways);\n                        logger.Informational(\"Message 1\");\n                        listener.DisableEvents(logger);\n\n                        Assert.IsTrue(File.Exists(fileName));\n                        var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n                        Assert.AreEqual<int>(1, entries.Count());\n\n                        // Make file readonly\n                        File.SetAttributes(fileName, FileAttributes.ReadOnly);\n\n                        TestScenario.With1Listener(\n                            logger,\n                            listener2 =>\n                            {\n                                listener2.LogToFlatFile(fileName, formatter);\n\n                                // Try logging into readonly file\n                                listener.EnableEvents(logger, EventLevel.LogAlways);\n                                logger.Verbose(\"Message 2\");\n                            });\n\n                        var entries2 = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n                        Assert.AreEqual<int>(1, entries2.Count());\n                    });\n            }\n            catch (UnauthorizedAccessException ex)\n            {\n                Assert.AreEqual(\"Access to the path '\" + path + \"\\\\\" + fileName + \"' is denied.\", ex.Message);\n            }\n        }\n\n        [TestMethod]\n        public void WhenFileNameHasSpace()\n        {\n            var fileName = \"newflatfile With Space.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(1, entries.Count());\n        }\n\n        [TestMethod]\n        public void WhenFolderNameHasSpace()\n        {\n            var fileName = \"newflatfileInFolderNameWithSpace.log\";\n            var folderName = \"Folder With Space\";\n            var completePath = DeleteFolder(folderName);\n            Directory.CreateDirectory(completePath);\n            var folderfilePath = Path.Combine(completePath, fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(folderfilePath, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                });\n\n            Assert.IsTrue(File.Exists(folderName + \"\\\\\" + fileName));\n            var entries = Regex.Split(ReadFileWithoutLock(folderName + \"\\\\\" + fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(1, entries.Count());\n            fileName = folderName + \"\\\\\" + fileName;\n        }\n\n        [TestMethod]\n        public void WhenNonExistingFolder()\n        {\n            var fileName = \"CreateFlatFileInNonExistingFolder.log\";\n            var folderName = \"CreateNewFolder\";\n            var completePath = DeleteFolder(folderName);\n            var folderfilePath = Path.Combine(completePath, fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(folderfilePath, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                });\n\n            Assert.IsTrue(File.Exists(folderName + \"\\\\\" + fileName));\n            var entries = Regex.Split(ReadFileWithoutLock(folderName + \"\\\\\" + fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(1, entries.Count());\n        }\n\n        [TestMethod]\n        public void WhenReadOnlyFolder()\n        {\n            var fileName = \"newflatfileInReadOnlyFolder.log\";\n            var folderName = \"ReadOnlyFolder\";\n            string path = Directory.GetCurrentDirectory();\n            string completePath = Path.Combine(path, folderName);\n            DirectoryInfo dir = new DirectoryInfo(completePath);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            if (Directory.Exists(completePath))\n            {\n                dir.Attributes &= ~FileAttributes.ReadOnly;\n                Directory.Delete(completePath, true);\n            }\n\n            try\n            {\n                Directory.CreateDirectory(completePath);\n                dir.Attributes |= FileAttributes.ReadOnly;\n                var folderfilePath = Path.Combine(completePath, fileName);\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToFlatFile(folderfilePath, formatter);\n                }\n\n                Assert.IsFalse(File.Exists(fileName));\n            }\n            finally\n            {\n                dir.Attributes &= ~FileAttributes.ReadOnly;\n                Directory.Delete(completePath, true);\n            }\n        }\n\n        [TestMethod]\n        public void WhenNoAccessFolder()\n        {\n            var fileName = \"newflatfileInFolderWithNoAccess.log\";\n            var folderName = \"FolderWithNoAccessToLoggedInUser\";\n            string path = Directory.GetCurrentDirectory();\n            string completePath = Path.Combine(path, folderName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n            DirectoryInfo dir = new DirectoryInfo(completePath);\n            if (Directory.Exists(completePath))\n            {\n                // Give full access to the folder for the loggedin user\n                DirectorySecurity dirSecurity = dir.GetAccessControl();\n                dirSecurity.AddAccessRule(new FileSystemAccessRule(System.Security.Principal.WindowsIdentity.GetCurrent().Name, FileSystemRights.FullControl, AccessControlType.Allow));\n                dir.SetAccessControl(dirSecurity);\n                Directory.Delete(completePath, true);\n            }\n\n            Directory.CreateDirectory(completePath);\n\n            try\n            {\n                DirectorySecurity dirSecurityNew = dir.GetAccessControl();\n                // Deny access to the folder for the loggedin user\n                dirSecurityNew.AddAccessRule(new FileSystemAccessRule(System.Security.Principal.WindowsIdentity.GetCurrent().Name, FileSystemRights.ReadPermissions, AccessControlType.Deny));\n                dir.SetAccessControl(dirSecurityNew);\n                var folderfilePath = completePath + \"\\\\\" + fileName;\n                try\n                {\n                    TestScenario.With1Listener(\n                        logger,\n                        listener =>\n                        {\n                            listener.LogToFlatFile(folderfilePath, formatter);\n                            listener.EnableEvents(logger, EventLevel.LogAlways);\n                            logger.Informational(\"Message 1\");\n                        });\n\n                    Assert.IsTrue(File.Exists(folderfilePath));\n                    var entries = Regex.Split(ReadFileWithoutLock(folderfilePath), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n                    Assert.AreEqual<int>(1, entries.Count());\n                }\n                catch (UnauthorizedAccessException ex)\n                {\n                    Assert.AreEqual(\"Access to the path '\" + folderfilePath + \"' is denied.\", ex.Message);\n                }\n            }\n            finally\n            {\n                DirectorySecurity dirSecurity = dir.GetAccessControl();\n                dirSecurity.AddAccessRule(new FileSystemAccessRule(System.Security.Principal.WindowsIdentity.GetCurrent().Name, FileSystemRights.FullControl, AccessControlType.Allow));\n                dir.SetAccessControl(dirSecurity);\n                Directory.Delete(completePath, true);\n            }\n        }\n\n        [TestMethod]\n        public void WhenUsingTextFormatter()\n        {\n            var fileName = \"newflatfileCheckTextFormatter.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            formatter.VerbosityThreshold = EventLevel.LogAlways;\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    string strDateTime = DateTimeOffset.Now.ToString();\n                    logger.Verbose(\"Message 1\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            string strLog = ReadFileWithoutLock(fileName);\n            StringAssert.Contains(strLog, \"----------------------------------------\\r\\nProviderId : \");\n            // Task used to be \"Task : 65530\"\n            StringAssert.Contains(strLog, \"\\r\\nEventId : 4\\r\\nKeywords : None\\r\\nLevel : Verbose\\r\\nMessage : Functional Test\\r\\nOpcode : Info\\r\\nTask : 1\\r\\nVersion : 1\\r\\nPayload : [message : Message 1] \\r\\nEventName : PageInfo\\r\\nTimestamp :\");\n        }\n\n        [TestMethod]\n        public void WhenErrorInLogging()\n        {\n            var fileName = \"ErrorInFormatterIsHandled.log\";\n            File.Delete(fileName);\n            var logger = TestEventSourceNonTransient.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToFlatFile(fileName, new MockFormatter(true));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.EventWithPayload(\"payload1\", 100);\n\n                    StringAssert.Contains(errorsListener.ToString(), \"Payload : [message : System.InvalidOperationException: Operation is not valid due to the current state of the object.\");\n                });\n        }\n\n        [TestMethod]\n        public void WhenExceptionInFormatter()\n        {\n            var fileName = \"OtherExceptionInFormatterIsHandled.log\";\n            File.Delete(fileName);\n            var logger = TestEventSourceNonTransient.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToFlatFile(fileName, new MockFormatter2(true));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.EventWithPayload(\"TryingToLog\", 100);\n\n                    StringAssert.Contains(errorsListener.ToString(), \"Payload : [message : System.ObjectDisposedException: Cannot write to a closed TextWriter.\");\n                });\n        }\n\n        [TestMethod]\n        public void WhenErrorAndValidMessageAfterError()\n        {\n            var fileName = \"AfterExceptionInFormatterResultIsOk.log\";\n            File.Delete(fileName);\n            var logger = TestEventSourceNonTransient.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, new MockFormatter3(\"header\"));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.EventWithPayload(\"error\", 100);\n                    logger.EventWithPayload(\"not an error\", 100);\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            string strLog = ReadFileWithoutLock(fileName);\n            //There should not be two headers\n            Assert.IsFalse(strLog.Contains(\"This is an entry containing and error and should not be logged\"));\n        }\n\n        [TestMethod]\n        public void WhenDisposeFileIsUnlocked()\n        {\n            var fileName = \"newflatfileLockingDeletion.log\";\n            File.Delete(fileName);\n            string path = Directory.GetCurrentDirectory();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                    logger.Verbose(\"Message 2\");\n                });\n\n            File.Delete(fileName);\n            Assert.IsFalse(File.Exists(fileName));\n        }\n\n        [TestMethod]\n        public void WhenFileIsAppendedToAfterDispose()\n        {\n            var fileName = \"newflatfileLockingEditing.log\";\n            File.Delete(fileName);\n            string path = Directory.GetCurrentDirectory();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                    logger.Verbose(\"Message 2\");\n                });\n\n            // Edit file\n            File.AppendText(fileName);\n            Assert.IsTrue(File.Exists(fileName));\n        }\n\n        [TestMethod]\n        public void WhenFilePathLengthExceedsMaxExceptionOccursEarly()\n        {\n            try\n            {\n                var folderName = \"a\";\n                string completePath = string.Empty;\n                int countLength = Directory.GetCurrentDirectory().Length;\n                int folderNameLength = 246 - countLength;\n                for (int l = 1; l < folderNameLength; l++)\n                {\n                    folderName = folderName + \"a\";\n                }\n\n                completePath = DeleteFolder(folderName);\n                Directory.CreateDirectory(completePath);\n                var fileName = \"longpath.log\";\n                var folderfilePath = completePath + \"\\\\\" + fileName;\n\n                var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToFlatFile(folderfilePath, formatter);\n                }\n\n                Assert.IsFalse(File.Exists(folderfilePath));\n            }\n            catch (PathTooLongException ex)\n            {\n                Assert.AreEqual(ex.Message, \"The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.\");\n            }\n        }\n\n        [TestMethod]\n        public void WhenSourceIsRenabled()\n        {\n            var fileName = @\".\\Renabled.Log\";\n            File.Delete(fileName);\n            var logger = BasicTestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, new EventTextFormatter());\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.RaiseBasicTestEventSourceEvent(\"Test message1\");\n                    listener.DisableEvents(logger);\n\n                    logger.RaiseBasicTestEventSourceEvent(\"Test message2\");\n\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.RaiseBasicTestEventSourceEvent(\"Test message3\");\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.IsTrue(fileContents.Count == 2);\n            Assert.AreEqual<string>(\"[message : Test message1]\", fileContents[0][\"Payload\"]);\n            Assert.AreEqual<string>(\"[message : Test message3]\", fileContents[1][\"Payload\"]);\n        }\n\n        [TestMethod]\n        public void WhenVerbosityIsLowFilteringOccurs()\n        {\n            var fileName = @\".\\Verbosity.Log\";\n            File.Delete(fileName);\n            var logger = BasicTestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, new EventTextFormatter());\n                    listener.EnableEvents(logger, EventLevel.Error);\n                    logger.RaiseEventWithMaxVerbosityAsError(\"Error message\");\n                    logger.RaiseEventWithMaxVerbosityAsInformational(\"Informational message\");\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.RaiseEventWithMaxVerbosityAsCritical(\"Critical message\");\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.IsTrue(fileContents.Count == 2);\n            Assert.AreEqual<string>(\"[message : Error message]\", fileContents[0][\"Payload\"]);\n            Assert.AreEqual<string>(\"[message : Critical message]\", fileContents[1][\"Payload\"]);\n            Assert.AreEqual<string>(\"Error\", fileContents[0][\"Level\"]);\n            Assert.AreEqual<string>(\"Critical\", fileContents[1][\"Level\"]);\n        }\n\n        [TestMethod]\n        public void WhenFileNameIsNull()\n        {\n            try\n            {\n                var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToFlatFile(null, formatter);\n                }\n            }\n            catch (ArgumentNullException ex)\n            {\n                Assert.AreEqual(\"Value cannot be null.\\r\\nParameter name: fileName\", ex.Message);\n            }\n        }\n\n        [TestMethod]\n        public void WhenFileNameIsEmpty()\n        {\n            try\n            {\n                var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToFlatFile(string.Empty, formatter);\n                }\n            }\n            catch (ArgumentException ex)\n            {\n                Assert.AreEqual(\"Argument is empty\\r\\nParameter name: fileName\", ex.Message);\n            }\n        }\n\n        [TestMethod]\n        public void WhenInvalidCharactersInFileName()\n        {\n            try\n            {\n                var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToFlatFile(@\">\", formatter);\n                }\n            }\n            catch (ArgumentException ex)\n            {\n                Assert.AreEqual(\"Illegal characters in path.\", ex.Message);\n            }\n        }\n\n        [TestMethod]\n        public void WhenInvalidCharactersInFileName1()\n        {\n            try\n            {\n                var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToFlatFile(@\"|\", formatter);\n                }\n            }\n            catch (ArgumentException ex)\n            {\n                Assert.AreEqual(\"Illegal characters in path.\", ex.Message);\n            }\n        }\n\n        [TestMethod]\n        public void WhenInvalidCharactersInFileName2()\n        {\n            try\n            {\n                var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToFlatFile(@\"..\\\", formatter);\n                }\n            }\n            catch (ArgumentException ex)\n            {\n                Assert.AreEqual(\"A file name with a relative path is not allowed. Provide only the file name or the full path of the file.\", ex.Message);\n            }\n        }\n\n        [TestMethod]\n        public void WhenFileNameIsFolder()\n        {\n            try\n            {\n                var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToFlatFile(\".\", formatter);\n                }\n            }\n            catch (ArgumentException ex)\n            {\n                Assert.AreEqual(\"A file name with a relative path is not allowed. Provide only the file name or the full path of the file.\", ex.Message);\n            }\n        }\n\n        [TestMethod]\n        public void WhenUsingNullFormatter()\n        {\n            var fileName = \"textFormatterAsNull.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, null);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(1, entries.Count());\n            Assert.IsFalse(File.ReadAllText(fileName).Contains(EventTextFormatter.DashSeparator));\n        }\n\n        [TestMethod]\n        public void WhenFormatterIsNotSpecified()\n        {\n            var fileName = \"NotextFormatter.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(1, entries.Count());\n            Assert.IsFalse(File.ReadAllText(fileName).Contains(EventTextFormatter.DashSeparator));\n        }\n\n        [TestMethod]\n        public void WhenPayloadIsLarge()\n        {\n            var fileName = \"MaxString.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(new string('a', 50000000));\n                });\n\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(new string('a', 50000000)));\n        }\n\n        [TestMethod]\n        public void WhenSingleLineTextFormatter()\n        {\n            var fileName = \"singleLine.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator, EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Error);\n                    logger.Informational(\"Message 1\");\n                    logger.Error(\"Error 1\");\n                    logger.Critical(\"Critical 1\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            string fileText = File.ReadAllText(fileName);\n            Assert.IsFalse(fileText.Contains(\"Message 1\"));\n            Assert.IsTrue(fileText.Contains(\"Error 1\"));\n            Assert.IsTrue(fileText.Contains(\"Critical 1\"));\n            Assert.IsTrue(fileText.Contains(\"Payload : [message : Error 1]\"));\n        }\n\n        [TestMethod]\n        public void WhenKeywordsAllIsEnabled()\n        {\n            var fileName = \"KeywordsAll.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator, EventTextFormatter.DashSeparator, EventLevel.LogAlways);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways, Keywords.All);\n                    logger.VerboseWithKeywordPage(\"VerboseWithKeywordPage\");\n                    logger.InfoWithKeywordDiagnostic(\"InfoWithKeywordDiagnostic\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            string fileText = ReadFileWithoutLock(fileName);\n            Assert.IsTrue(fileText.Contains(\"Keywords : 1\"));\n            Assert.IsTrue(fileText.Contains(\"Keywords : 4\"));\n        }\n\n        [TestMethod]\n        public void WhenKeywordIsNotSpecifedWhenEnabled()\n        {\n            var fileName = \"KeywordsAllKeywordAsNotNone.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator, EventTextFormatter.DashSeparator);\n            formatter.VerbosityThreshold = EventLevel.Error;\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Error);\n                    logger.ErrorWithKeywordDiagnostic(\"ErrorWithKeywordDiagnostic\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            string fileText = File.ReadAllText(fileName);\n            Assert.IsTrue(fileText.Contains(string.Empty));\n        }\n\n        [TestMethod]\n        public void WhenVerbosityThresholdIsSet()\n        {\n            var fileName = \"CheckAllProperties.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator, EventTextFormatter.DashSeparator);\n            formatter.VerbosityThreshold = EventLevel.Error;\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Error(\"Error message\");\n                    logger.Warning(\"Warning message\");\n                    logger.Critical(\"Critical message\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            string fileText = File.ReadAllText(fileName);\n            // Task used to be \"Task : 65531\"\n            Assert.IsTrue(fileText.Contains(\"\\r\\nEventId : 3\\r\\nKeywords : None\\r\\nLevel : Error\\r\\nMessage : Test Error\\r\\nOpcode : Stop\\r\\nTask : 2\\r\\nVersion : 3\\r\\nPayload : [message : Error message] \\r\\nEventName : DBQueryStop\\r\\nTimestamp :\"));\n            // Task used to be \"Task : 65532\"\n            Assert.IsTrue(fileText.Contains(\"\\r\\nEventId : 2\\r\\nKeywords : None\\r\\nLevel : Critical\\r\\nMessage : Functional Test\\r\\nOpcode : Info\\r\\nTask : 2\\r\\nVersion : 0\\r\\nPayload : [message : Critical message] \\r\\nEventName : DBQueryInfo\\r\\nTimestamp :\"));\n            Assert.IsTrue(fileText.Contains(\"----------------------------------------\\r\\nEventId : 6, Level : Warning, Message : Test Warning, Payload : [message : Warning message] , EventName : DBQuerySend, Timestamp :\"));\n        }\n\n        [TestMethod]\n        public void WhenEventWithTaskName()\n        {\n            var fileName = \"CheckTaskName.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator, EventTextFormatter.DashSeparator, EventLevel.LogAlways);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways, Keywords.All);\n                    logger.CriticalWithTaskName(\"CriticalWithTaskName\");\n                    logger.InfoWithKeywordDiagnostic(\"InfoWithKeywordDiagnostic\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            string fileText = ReadFileWithoutLock(fileName);\n            Assert.IsTrue(fileText.Contains(\"Task : 1\\r\\nVersion : 0\\r\\nPayload : [message : CriticalWithTaskName] \\r\\nEventName : PageSuspend\"));\n            Assert.IsTrue(fileText.Contains(\"Task : 64512\\r\\nVersion : 0\\r\\nPayload : [message : InfoWithKeywordDiagnostic] \\r\\nEventName : InfoWithKeywordDiagnosticInfo\"));\n        }\n\n        [TestMethod]\n        public void WhenSinkIsAsync()\n        {\n            var fileName = \"CanLogToFlatFileAsync.log\";\n            int count = 2;\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator, EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter, true);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    var loggerTasks = new Task[count];\n                    for (int i = 0; i < count; i++)\n                    {\n                        loggerTasks[i] = Task.Run(() => logger.Informational(i + \"some message in parallel\"));\n                    }\n\n                    Task.WaitAll(loggerTasks);\n                });\n\n            var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual(count, entries.Count());\n        }\n\n        [TestMethod]\n        public void WhenDisposeFlushOccurs()\n        {\n            var fileName = \"TestDispose.log\";\n            File.Delete(fileName);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    Thread[] threads = new Thread[10];\n                    for (int i = 0; i < 10; i++)\n                    {\n                        threads[i] = new Thread(new ThreadStart(() =>\n                        {\n                            for (int j = 0; j < 1000; j++)\n                            {\n                                logger.Critical(\"TestMsg \" + j);\n                            }\n                        }));\n\n                        threads[i].Start();\n                    }\n\n                    for (int i = 0; i < 10; i++)\n                    {\n                        threads[i].Join();\n                    }\n                });\n\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(\"TestMsg 0\"));\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(\"TestMsg 999\"));\n        }\n\n        [TestMethod]\n        public void WhenUsingStaticCreate()\n        {\n            var fileName = \"TestingCreateListener.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(\"------\");\n            var logger = MockEventSource.Logger;\n\n            using (var listener = FlatFileLog.CreateListener(fileName, formatter, false))\n            {\n                try\n                {\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int n = 0; n < 2; n++)\n                    {\n                        logger.Informational(\"some message to flat file \" + n.ToString());\n                    }\n                }\n                finally\n                {\n                    listener.DisableEvents(logger);\n                }\n            }\n\n            Assert.IsTrue(File.Exists(fileName));\n            string fileContents = File.ReadAllText(fileName);\n            Assert.IsTrue(fileContents.Contains(\"------\\r\\nEventId : 1, Level : Informational, Message : , Payload : [message : some message to flat file 0] , EventName : InformationalInfo, Timestamp :\"), \"File contents: \" + fileContents);\n        }\n\n        [TestMethod]\n        public void WhenPositionalParametersInMessageInText()\n        {\n            var fileName = \"Task1557.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.ObjectArrayEvent4(10, \"stringarg1\", 20, \"stringarg3\", 30);\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(1, entries.Count());\n            string readFile = File.ReadAllText(fileName);\n            Assert.IsTrue(readFile.Contains(\"Check if it is logged\"));\n            Assert.IsTrue(readFile.Contains(\"[arg0 : 10] [arg1 : stringarg1] [arg2 : 20] [arg3 : stringarg3] [arg4 : 30]\"));\n        }\n\n        [TestMethod]\n        public void WhenPositionalParametersInMessageInJson()\n        {\n            var fileName = \"Task1557.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var jsonformatter = new JsonEventTextFormatter();\n            jsonformatter.DateTimeFormat = \"dd/MM/yyyy\";\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, jsonformatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.ObjectArrayEvent4(10, \"stringarg1\", 20, \"stringarg3\", 30);\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(1, entries.Count());\n            string readFile = File.ReadAllText(fileName);\n            Assert.IsTrue(readFile.Contains(\"Check if it is logged\"));\n            Assert.IsTrue(readFile.Contains(\"{\\\"arg0\\\":10,\\\"arg1\\\":\\\"stringarg1\\\",\\\"arg2\\\":20,\\\"arg3\\\":\\\"stringarg3\\\",\\\"arg4\\\":30}\"));\n        }\n\n        [TestMethod]\n        public void WhenPositonalParametersInMessageInXml()\n        {\n            var fileName = \"Task1557.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var xmlformat = new XmlEventTextFormatter();\n            xmlformat.DateTimeFormat = \"dd/MM/yyyy\";\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, xmlformat);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.ObjectArrayEvent4(20, \"stringarg1\", 30, \"stringarg3\", 40);\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(1, entries.Count());\n            string readFile = File.ReadAllText(fileName);\n            Assert.IsTrue(readFile.Contains(\"<Message>Check if it is logged</Message>\"));\n            Assert.IsTrue(readFile.Contains(\"<Data Name=\\\"arg0\\\">20</Data><Data Name=\\\"arg1\\\">stringarg1</Data><Data Name=\\\"arg2\\\">30</Data><Data Name=\\\"arg3\\\">stringarg3</Data><Data Name=\\\"arg4\\\">40</Data>\"));\n        }\n\n        // Bug 916\n        [TestMethod]\n        public void WhenFileAttributesChangeDuringLogging()\n        {\n            var fileName = \"CheckDeny_Then_ReenableAccess_LogsData.log\";\n            DeleteReadOnlyFile(fileName);\n            string path = Directory.GetCurrentDirectory();\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(1, entries.Count());\n\n            File.SetAttributes(fileName, FileAttributes.ReadOnly);\n            Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    File.SetAttributes(fileName, FileAttributes.Normal);\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Verbose(\"Message 2\");\n                });\n\n            var entries2 = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(2, entries2.Count());\n        }\n\n        [TestMethod]\n        public void WhenEnumsInPayload()\n        {\n            var fileName = \"TextFormatterAndEnums.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator, EventTextFormatter.DashSeparator);\n            var logger = MockEventSourceInProcEnum.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter, true);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.SendEnumsEvent16(MockEventSourceInProcEnum.MyColor.Green, MockEventSourceInProcEnum.MyFlags.Flag2);\n                });\n\n            var entries = Regex.Split(ReadFileWithoutLock(fileName), formatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual(1, entries.Count());\n            StringAssert.Contains(entries.First(), \"Payload : [a : Green] [b : Flag2]\");\n        }\n\n        [TestMethod]\n        public void WhenMultipleSourcesAreEnabledForSameListener()\n        {\n            EventTextFormatter eventTextFormatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var fileName = \"newflatfile.log\";\n            File.Delete(fileName);\n            var logger1 = MockEventSource.Logger;\n            var logger2 = MockEventSource2.Logger;\n            var logger3 = MockEventSource3.Logger;\n\n            TestScenario.With1Listener(\n                new EventSource[] { logger1, logger2, logger3 },\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, eventTextFormatter);\n                    listener.EnableEvents(logger1, EventLevel.LogAlways);\n                    listener.EnableEvents(logger2, EventLevel.LogAlways);\n                    listener.EnableEvents(logger3, EventLevel.LogAlways);\n                    logger1.Informational(\"message 1\");\n                    logger2.Error(\"error 1\");\n                    logger3.Critical(\"critical 1\");\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries = Regex.Split(LogFileReader.ReadFileWithoutLock(fileName), eventTextFormatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(3, entries.Count());\n            StringAssert.Contains(entries.ToArray()[0], \"Informational\");\n            StringAssert.Contains(entries.ToArray()[0], \"message 1\");\n            StringAssert.Contains(entries.ToArray()[1], \"Error\");\n            StringAssert.Contains(entries.ToArray()[1], \"error 1\");\n            StringAssert.Contains(entries.ToArray()[2], \"Critical\");\n            StringAssert.Contains(entries.ToArray()[2], \"critical 1\");\n        }\n\n        [TestMethod]\n        public void WhenSourceHasNoAttributes()\n        {\n            string fileName = @\".\\NoAttribEvent1.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            List<EventSchema> events = new List<EventSchema>();\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n                    for (int i = 1; i < 16; i++)\n                    {\n                        events.Add(EventSourceSchemaCache.Instance.GetSchema(i, logger));\n                    }\n                });\n\n            Assert.AreEqual<string>(\"NoArgEvent1\", events[0].TaskName);\n            Assert.AreEqual<string>(\"IntArgEvent2\", events[1].TaskName);\n            Assert.AreEqual<string>(\"LongArgEvent3\", events[2].TaskName);\n            Assert.AreEqual<string>(\"ObjectArrayEvent4\", events[3].TaskName);\n            Assert.AreEqual<string>(\"StringArgEvent5\", events[4].TaskName);\n            Assert.AreEqual<string>(\"TwoIntArgEvent6\", events[5].TaskName);\n            Assert.AreEqual<string>(\"TwoLongArgEvent7\", events[6].TaskName);\n            Assert.AreEqual<string>(\"StringAndIntArgEvent8\", events[7].TaskName);\n            Assert.AreEqual<string>(\"StringAndLongArgEvent9\", events[8].TaskName);\n            Assert.AreEqual<string>(\"StringAndStringArgEvent10\", events[9].TaskName);\n            Assert.AreEqual<string>(\"ThreeIntArgEvent11\", events[10].TaskName);\n            Assert.AreEqual<string>(\"ThreeLongArgEvent12\", events[11].TaskName);\n            Assert.AreEqual<string>(\"StringAndTwoIntArgEvent13\", events[12].TaskName);\n            Assert.AreEqual<string>(\"ThreeStringArgEvent14\", events[13].TaskName);\n            Assert.AreEqual<string>(\"SendEnumsEvent15\", events[14].TaskName);\n        }\n\n        [TestMethod]\n        public void WhenNoArgPayload()\n        {\n            string fileName = @\".\\NoArgEvent.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n                    logger.NoArgEvent1();\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual<string>(\"1\", fileContents[0][\"EventId\"]);\n            Assert.AreEqual<string>(string.Empty, fileContents[0][\"Payload\"]);\n        }\n\n        [TestMethod]\n        public void WhenIntArgPayload()\n        {\n            string fileName = @\".\\IntArgEventIsLogged.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n                    logger.IntArgEvent2(10);\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual<string>(\"2\", fileContents[0][\"EventId\"]);\n            var payLoad = PayloadParser.GetPayload(fileContents[0][\"Payload\"]);\n            Assert.AreEqual<string>(\"10\", payLoad[\"arg\"]);\n        }\n\n        [TestMethod]\n        public void WhenLongArgPayload()\n        {\n            string fileName = @\".\\LongArgEventIsLogged\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n                    logger.LongArgEvent3((long)10);\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual<string>(\"3\", fileContents[0][\"EventId\"]);\n            var payLoad = PayloadParser.GetPayload(fileContents[0][\"Payload\"]);\n            Assert.AreEqual<string>(\"10\", payLoad[\"arg\"]);\n        }\n\n        [TestMethod]\n        public void WhenObjectArgPayload()\n        {\n            string fileName = @\".\\ObjectArgsEventIsLogged\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n                    logger.ObjectArrayEvent4(10, \"stringarg1\", 20, \"stringarg3\", 30);\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual<string>(\"4\", fileContents[0][\"EventId\"]);\n            var payLoad = PayloadParser.GetPayload(fileContents[0][\"Payload\"]);\n            Assert.AreEqual<string>(\"10\", payLoad[\"arg0\"]);\n            Assert.AreEqual<string>(\"stringarg1\", payLoad[\"arg1\"]);\n            Assert.AreEqual<string>(\"20\", payLoad[\"arg2\"]);\n            Assert.AreEqual<string>(\"stringarg3\", payLoad[\"arg3\"]);\n            Assert.AreEqual<string>(\"30\", payLoad[\"arg4\"]);\n        }\n\n        [TestMethod]\n        public void WhenTwoIntArgPayload()\n        {\n            string fileName = @\".\\TwoIntArgsEventIsLogged\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n                    logger.TwoIntArgEvent6(10, 30);\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual<string>(\"6\", fileContents[0][\"EventId\"]);\n            var payLoad = PayloadParser.GetPayload(fileContents[0][\"Payload\"]);\n            Assert.AreEqual<string>(\"10\", payLoad[\"arg1\"]);\n            Assert.AreEqual<string>(\"30\", payLoad[\"arg2\"]);\n        }\n\n        [TestMethod]\n        public void WhenThreeStringPayload()\n        {\n            string fileName = @\".\\ThreeStringArgsIsLogged\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n                    logger.ThreeStringArgEvent14(\"message1\", \"message2\", \"message3\");\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual<string>(\"14\", fileContents[0][\"EventId\"]);\n            var payLoad = PayloadParser.GetPayload(fileContents[0][\"Payload\"]);\n            Assert.AreEqual<string>(\"message1\", payLoad[\"arg1\"]);\n            Assert.AreEqual<string>(\"message2\", payLoad[\"arg2\"]);\n            Assert.AreEqual<string>(\"message3\", payLoad[\"arg3\"]);\n        }\n\n        [TestMethod]\n        public void WhenStringAndLongPayload()\n        {\n            string fileName = @\".\\StringAndLongArgEventIsLogged\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n                    logger.StringAndLongArgEvent9(\"message1\", 20);\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual<string>(\"9\", fileContents[0][\"EventId\"]);\n            var payLoad = PayloadParser.GetPayload(fileContents[0][\"Payload\"]);\n            Assert.AreEqual<string>(\"message1\", payLoad[\"arg1\"]);\n            Assert.AreEqual<string>(\"20\", payLoad[\"arg2\"]);\n        }\n\n        [TestMethod]\n        public void WhenEnumAndFlagPayload()\n        {\n            string fileName = @\".\\EnumAndFlagIsLogged\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n                    logger.SendEnumsEvent15(MyColor.Green, MyFlags.Flag1 | MyFlags.Flag3);\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual<string>(\"15\", fileContents[0][\"EventId\"]);\n            var payLoad = PayloadParser.GetPayload(fileContents[0][\"Payload\"]);\n            Assert.AreEqual<string>(((int)MyColor.Green).ToString(), payLoad[\"color\"]);\n            Assert.AreEqual<string>(\"5\", payLoad[\"flags\"]);\n        }\n\n        [TestMethod]\n        public void WhenSourceEventHasNoTask()\n        {\n            string fileName = @\".\\EventAttributeUsedAndNoTaskSpecified.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestAttributesEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Verbose);\n                    logger.NoTaskSpecfied(1, 3, 5);\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual(\"104\", fileContents[0][\"EventId\"]);\n        }\n\n        [TestMethod]\n        public void WhenNonDefaultOpCode()\n        {\n            string fileName = @\".\\NonDefaultOpCodeIsLogged.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestAttributesEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Verbose);\n                    logger.NonDefaultOpcodeNonDefaultVersionEvent(1, 3, 5);\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual(\"103\", fileContents[0][\"EventId\"]);\n            Assert.AreEqual(\"Reply\", fileContents[0][\"Opcode\"]);\n        }\n\n        [TestMethod]\n        public void WhenNonDefaultVersion()\n        {\n            string fileName = @\".\\NonDefaultVersionIsLogged.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestAttributesEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Verbose);\n                    logger.NonDefaultOpcodeNonDefaultVersionEvent(1, 3, 5);\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual(\"2\", fileContents[0][\"Version\"]);\n        }\n\n        [TestMethod]\n        public void WhenNonDefaultMessage()\n        {\n            string fileName = @\".\\NonDefaultMessageIsLogged.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestAttributesEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Verbose);\n                    logger.NonDefaultOpcodeNonDefaultVersionEvent(1, 3, 5);\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual(\"arg1- 1,arg2- 3,arg3- 5\", fileContents[0][\"Message\"]);\n        }\n\n        [TestMethod]\n        public void WhenActivityId()\n        {\n            string fileName = @\".\\IntArgEventIsLogged.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            var activityId = Guid.NewGuid();\n            var previousActivityId = Guid.Empty;\n            EventSource.SetCurrentThreadActivityId(activityId, out previousActivityId);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n                    logger.IntArgEvent2(10);\n                });\n\n            EventSource.SetCurrentThreadActivityId(previousActivityId);\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual<string>(\"2\", fileContents[0][\"EventId\"]);\n            var payLoad = PayloadParser.GetPayload(fileContents[0][\"Payload\"]);\n            Assert.AreEqual<string>(\"10\", payLoad[\"arg\"]);\n            Assert.AreEqual(activityId, Guid.Parse(fileContents[0][\"ActivityId\"]));\n            Assert.IsNull(fileContents[0].Keys.SingleOrDefault(k => k == \"RelatedActivityId\"));\n        }\n\n        [TestMethod]\n        public void WhenActivityIdAndRelatedActivityId()\n        {\n            string fileName = @\".\\IntArgEventIsLogged.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            var activityId = Guid.NewGuid();\n            var relatedActivityId = Guid.NewGuid();\n            var previousActivityId = Guid.Empty;\n            EventSource.SetCurrentThreadActivityId(activityId, out previousActivityId);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n                    logger.IntArgEventWithRelatedActivityId(10, relatedActivityId);\n                });\n\n            EventSource.SetCurrentThreadActivityId(previousActivityId);\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual<string>(\"16\", fileContents[0][\"EventId\"]);\n            var payLoad = PayloadParser.GetPayload(fileContents[0][\"Payload\"]);\n            Assert.AreEqual<string>(\"10\", payLoad[\"arg\"]);\n            Assert.AreEqual(activityId, Guid.Parse(fileContents[0][\"ActivityId\"]));\n            Assert.AreEqual(relatedActivityId, Guid.Parse(fileContents[0][\"RelatedActivityId\"]));\n        }\n\n        [TestMethod]\n        public void WhenProcessId()\n        {\n            string fileName = @\".\\IntArgEventIsLogged.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            int processId = System.Diagnostics.Process.GetCurrentProcess().Id;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n                    logger.IntArgEvent2(10);\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual<string>(\"2\", fileContents[0][\"EventId\"]);\n            var payLoad = PayloadParser.GetPayload(fileContents[0][\"Payload\"]);\n            Assert.AreEqual<string>(\"10\", payLoad[\"arg\"]);\n            Assert.AreEqual(processId, Convert.ToInt32(fileContents[0][\"ProcessId\"]));\n        }\n\n        [TestMethod]\n        public void WhenThreadId()\n        {\n            string fileName = @\".\\IntArgEventIsLogged.log\";\n            File.Delete(fileName);\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            int threadId = ThreadHelper.GetCurrentUnManagedThreadId();\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToFlatFile(fileName, formatter);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n                    logger.IntArgEvent2(10);\n                });\n\n            var fileContents = LogFileReader.GetEntries(fileName);\n            Assert.AreEqual<string>(\"2\", fileContents[0][\"EventId\"]);\n            var payLoad = PayloadParser.GetPayload(fileContents[0][\"Payload\"]);\n            Assert.AreEqual<string>(\"10\", payLoad[\"arg\"]);\n            Assert.AreEqual(threadId, Convert.ToInt32(fileContents[0][\"ThreadId\"]));\n        }\n\n        private string ReadFileWithoutLock(string fileName)\n        {\n            using (var reader = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))\n            {\n                return reader.ReadToEnd();\n            }\n        }\n\n        private void DeleteReadOnlyFile(string fileName)\n        {\n            if (File.Exists(fileName))\n            {\n                File.SetAttributes(fileName, FileAttributes.Normal);\n            }\n\n            File.Delete(fileName);\n        }\n\n        private string DeleteFolder(string folderName)\n        {\n            string path = Directory.GetCurrentDirectory();\n            string completePath = Path.Combine(path, folderName);\n            if (Directory.Exists(completePath))\n            {\n                Directory.Delete(completePath, true);\n            }\n\n            return completePath;\n        }\n\n        public static class PayloadParser\n        {\n            public static Dictionary<string, string> GetPayload(string payload)\n            {\n                payload = payload.Trim();\n                var retArgs = new Dictionary<string, string>();\n                if (payload != null || payload != string.Empty)\n                {\n                    payload = payload.Replace('[', ' ');\n                    payload = payload.Replace(']', ',');\n                }\n                payload = payload.Trim();\n                string[] args = payload.Split(',');\n                foreach (var arg in args)\n                {\n                    if (arg.Contains(':'))\n                    {\n                        string[] keyValue = arg.Split(':');\n                        retArgs[keyValue[0].Trim()] = keyValue[1].Trim();\n                    }\n                }\n                return retArgs;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/Sinks/RollingFlatFileSinkFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.Sinks\n{\n    [TestClass]\n    public class RollingFlatFileSinkFixture\n    {\n        [TestMethod]\n        public void WhenMaxArchivedFilesExceedsAndRollForSize()\n        {\n            var fileNameWithoutExtension = @\".\\Logs11\\TestMaxArchivedFiles_RollSize\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs11\");\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 4, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.None, new EventTextFormatter(EventTextFormatter.DashSeparator), 2);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int msg = 0; msg < 40; msg++)\n                    {\n                        logger.Informational(\"The quick brown fox jumps over the lazy dog.  And then the fox did it again and again for time #  \" + msg.ToString());\n                    }\n                });\n\n            var files = FlatFileHelper.GetFileNames(fileNameWithoutExtension + \"*.log\");\n            Assert.AreEqual<int>(3, files.Count());\n\n            Assert.IsFalse(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".1\" + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".2\" + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".3\" + \".log\"));\n        }\n\n        [TestMethod]\n        public void WhenRollSizeMetAndRollIntervalProvidedNotMet()\n        {\n            var fileNameWithoutExtension = \"RollForSize_WhenSizeMet_RollIntervalProvidedNotMet\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n                    logger.Informational(\"Message 3\");\n                    logger.Informational(\"Message 4\");\n                    logger.Informational(\"Message 5\");\n                    logger.Informational(\"Message 6\");\n                    logger.Informational(\"Message 7\");\n                    logger.Informational(\"Message 8\");\n                    logger.Informational(\"Message 9\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".1\" + \".log\"));\n        }\n\n        [TestMethod]\n        public void WhenRollForSizeWithNegativeSize()\n        {\n            var fileNameWithoutExtension = \"RollForSize_WithnegativeValue\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, -1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.None, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n                    logger.Informational(\"Message 3\");\n                    logger.Informational(\"Message 4\");\n                    logger.Informational(\"Message 5\");\n                    logger.Informational(\"Message 6\");\n                    logger.Informational(\"Message 7\");\n                    logger.Informational(\"Message 8\");\n                    logger.Informational(\"Message 9\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsFalse(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".1\" + \".log\"));\n        }\n\n        [TestMethod]\n        public void WhenLoggingBeforeRollOccurs()\n        {\n            var fileNameWithoutExtension = \"LogInConfiguredFileName\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n\n                    Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n                });\n\n            StringAssert.Contains(File.ReadAllText(fileNameWithoutExtension + \".log\"), \"Payload : [message : Message 2]\");\n            StringAssert.Contains(File.ReadAllText(fileNameWithoutExtension + \".log\"), \"Payload : [message : Message 1]\");\n        }\n\n        [TestMethod]\n        public void WhenRollIntervalExceedsBeforeEvents()\n        {\n            var fileNameWithoutExtension = @\".\\Logs1\\Roll_WhenNoEntryInLogFile\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs1\");\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.ToLocalTime();\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    subscription.Sink.RollingHelper.UpdateRollingInformationIfNecessary();\n\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddDays(1);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + dateTimeProvider.OverrideCurrentDateTime.Value.Year + \".1\" + \".log\"));\n            StringAssert.Contains(File.ReadAllText(fileNameWithoutExtension + \".log\"), \"Payload : [message : Message 2]\");\n        }\n\n        [TestMethod]\n        public void RollFileDateUsesFileCreationDate()\n        {\n            var fileNameWithoutExtension = \"RollDateBasedOnLogCreationDate\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n\n            string existingMessage = \"Existing Message\";\n            DateTime currentDateTime = new DateTime(2011, 1, 1);\n            File.WriteAllText(fileName, existingMessage);\n            File.SetCreationTime(fileName, currentDateTime);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, new EventTextFormatter());\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    dateTimeProvider.OverrideCurrentDateTime = currentDateTime;\n                    dateTimeProvider.OverrideCurrentDateTime = currentDateTime.AddDays(2);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n\n                    logger.Informational(\"New message\");\n                });\n\n            Assert.AreEqual(existingMessage, File.ReadAllText(fileNameWithoutExtension + \".2011.1\" + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(\"New message\"));\n        }\n\n        [TestMethod]\n        public void WhenRollWithSizeAndRollIntervalNoneWithOverwrite()\n        {\n            var fileNameWithoutExtension = \"RollOverwrite_Timestamp_RollSize_RollIntervalNone\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n\n            string existingMessage = \"Existing Message\";\n            File.WriteAllText(fileName, existingMessage);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Overwrite, RollInterval.None, new EventTextFormatter());\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    for (int msg = 0; msg < 26; msg++)\n                    {\n                        logger.Informational(\"Message \" + msg.ToString());\n                    }\n                });\n\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(\"Message 25\"));\n            Assert.IsFalse(File.ReadAllText(fileName).Contains(\"Existing Message\"));\n        }\n\n        [TestMethod]\n        public void WhenRollWithSizeAndRollIntervalNoneWithOverwriteTimeStampIsNotMandatory()\n        {\n            var fileNameWithoutExtension = \"RollOverwrite_TimestampNone_RollSize_RollIntervalNone\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n\n            string existingMessage = \"Existing Message\";\n            File.WriteAllText(fileName, existingMessage);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 1, string.Empty, RollFileExistsBehavior.Overwrite, RollInterval.None, new EventTextFormatter());\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n                    logger.Informational(\"Message 3\");\n                    logger.Informational(\"Message 4\");\n                    logger.Informational(\"Message 5\");\n                    logger.Informational(\"Message 6\");\n                    logger.Informational(\"Message 7\");\n                    logger.Informational(\"Message 8\");\n                    logger.Informational(\"Message 9\");\n                    logger.Informational(\"Message 10\");\n                });\n\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(\"Message 10\"));\n            Assert.IsFalse(File.ReadAllText(fileName).Contains(\"Existing Message\"));\n        }\n\n        [TestMethod]\n        public void WhenRollOverwrite_TimestampNone_RollSizeNone_RollIntervalNone()\n        {\n            var fileNameWithoutExtension = \"RollOverwrite_TimestampNone_RollSizeNone_RollIntervalNone\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n\n            string existingMessage = \"Existing Message\";\n            File.WriteAllText(fileName, existingMessage);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 0, string.Empty, RollFileExistsBehavior.Overwrite, RollInterval.None, new EventTextFormatter());\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n                    logger.Informational(\"Message 3\");\n                    logger.Informational(\"Message 4\");\n                    logger.Informational(\"Message 5\");\n                    logger.Informational(\"Message 6\");\n                    logger.Informational(\"Message 7\");\n                    logger.Informational(\"Message 8\");\n                    logger.Informational(\"Message 9\");\n                    logger.Informational(\"Message 10\");\n                });\n\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(\"Message 10\"));\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(\"Existing Message\"));\n        }\n\n        [TestMethod]\n        public void WhenRollOverwrite_Timestamp_RollSizeNone_RollIntervalNone()\n        {\n            var fileNameWithoutExtension = \"RollOverwrite_Timestamp_RollSizeNone_RollIntervalNone\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n\n            string existingMessage = \"Existing Message\";\n            File.WriteAllText(fileName, existingMessage);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 0, \"yyyy\", RollFileExistsBehavior.Overwrite, RollInterval.None, new EventTextFormatter());\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n                    logger.Informational(\"Message 3\");\n                    logger.Informational(\"Message 4\");\n                    logger.Informational(\"Message 5\");\n                    logger.Informational(\"Message 6\");\n                    logger.Informational(\"Message 7\");\n                    logger.Informational(\"Message 8\");\n                    logger.Informational(\"Message 9\");\n                    logger.Informational(\"Message 10\");\n                });\n\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(\"Message 10\"));\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(\"Existing Message\"));\n        }\n\n        [TestMethod]\n        public void WhenRollInIncrementModeBasedOnInterval()\n        {\n            var fileNameWithoutExtension = @\".\\Logs2\\RollFileIncrement\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs2\");\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 10, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n\n                    MockDateTimeProvider dtp = new MockDateTimeProvider();\n                    dtp.OverrideCurrentDateTime = DateTime.Now.AddDays(1);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dtp;\n\n                    logger.Informational(\"Message 2\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 2\"));\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".1\" + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".1\" + \".log\").Contains(\"Message 1\"));\n        }\n\n        [TestMethod]\n        public void WhenRollIntervalIsMinute()\n        {\n            var fileNameWithoutExtension = @\".\\Logs3\\RollForSize_WhenRollInterval_Minute\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs3\");\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 1000, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Minute, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddMinutes(2);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n\n                    logger.Informational(\"Message 3\");\n                    logger.Informational(\"Message 4\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + dateTimeProvider.OverrideCurrentDateTime.Value.Year + \".1\" + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 4\"));\n            Assert.IsFalse(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 1\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".\" + dateTimeProvider.OverrideCurrentDateTime.Value.Year + \".1\" + \".log\").Contains(\"Message 1\"));\n        }\n\n        [TestMethod]\n        public void WhenRollIntervalIsHour()\n        {\n            var fileNameWithoutExtension = @\".\\Logs4\\RollForSize_WhenRollInterval_Hour\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs4\");\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 1000, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Hour, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddHours(1);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 3\");\n                    logger.Informational(\"Message 4\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 4\"));\n            Assert.IsFalse(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 1\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".1\" + \".log\").Contains(\"Message 1\"));\n        }\n\n        [TestMethod]\n        public void WhenRollIntervalIsDay()\n        {\n            var fileNameWithoutExtension = @\".\\Logs5\\RollForSize_WhenRollInterval_Day\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs5\");\n\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 1000, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddDays(1);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    subscription.Sink.RollingHelper.UpdateRollingInformationIfNecessary();\n\n                    logger.Informational(\"Message 3\");\n                    logger.Informational(\"Message 4\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + dateTimeProvider.OverrideCurrentDateTime.Value.Year + \".1\" + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 4\"));\n            Assert.IsFalse(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 1\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".\" + dateTimeProvider.OverrideCurrentDateTime.Value.Year + \".1\" + \".log\").Contains(\"Message 1\"));\n        }\n\n        [TestMethod]\n        public void WhenRollIntervalIsWeek()\n        {\n            var fileNameWithoutExtension = @\".\\Logs6\\RollForSize_WhenRollInterval_Week\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs6\");\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 1000, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Week, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddDays(7);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 3\");\n                    logger.Informational(\"Message 4\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + dateTimeProvider.OverrideCurrentDateTime.Value.Year + \".1\" + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 4\"));\n            Assert.IsFalse(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 1\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".\" + dateTimeProvider.OverrideCurrentDateTime.Value.Year + \".1\" + \".log\").Contains(\"Message 1\"));\n        }\n\n        [TestMethod]\n        public void WhenRollIntervalIsMonth()\n        {\n            var fileNameWithoutExtension = @\".\\Logs7\\RollForSize_WhenRollInterval_Month\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs7\");\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 1000, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Month, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddMonths(2);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 3\");\n                    logger.Informational(\"Message 4\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + dateTimeProvider.OverrideCurrentDateTime.Value.Year + \".1\" + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 4\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".\" + dateTimeProvider.OverrideCurrentDateTime.Value.Year + \".1\" + \".log\").Contains(\"Message 1\"));\n        }\n\n        [TestMethod]\n        public void WhenRollIntervalIsYear()\n        {\n            var fileNameWithoutExtension = @\".\\Logs8\\RollForSize_WhenRollInterval_Year\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs8\");\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 0, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Year, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddYears(1);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 3\");\n                    logger.Informational(\"Message 4\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + dateTimeProvider.OverrideCurrentDateTime.Value.Year + \".1\" + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 4\"));\n            Assert.IsFalse(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 1\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".\" + dateTimeProvider.OverrideCurrentDateTime.Value.Year + \".1\" + \".log\").Contains(\"Message 1\"));\n        }\n\n        [TestMethod]\n        public void WhenRollAtMidnight()\n        {\n            var fileNameWithoutExtension = @\".\\Logs9\\WhenRollInterval_Midnight\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs9\");\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n            DateTime? nextRoll = null;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 0, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Midnight, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n\n                    nextRoll = DateTime.Now.AddDays(1);\n\n                    dateTimeProvider.OverrideCurrentDateTime = nextRoll;\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n\n                    logger.Informational(\"Message 3\");\n                    logger.Informational(\"Message 4\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + dateTimeProvider.OverrideCurrentDateTime.Value.Year + \".1\" + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 4\"));\n            Assert.IsFalse(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 1\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".\" + dateTimeProvider.OverrideCurrentDateTime.Value.Year + \".1\" + \".log\").Contains(\"Message 1\"));\n        }\n\n        [TestMethod]\n        public void WhenRollForSize()\n        {\n            var fileNameWithoutExtension = \"Reset_RollForSize\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 4, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int msg = 0; msg < 100; msg++)\n                    {\n                        logger.Informational(\"Message \" + msg.ToString());\n                    }\n                });\n\n            var files = FlatFileHelper.GetFileNames(fileNameWithoutExtension + \"*.log\");\n            string result = FlatFileHelper.ReadFromFiles(fileNameWithoutExtension + \"*.log\");\n\n            Assert.IsTrue(files.Count() >= 5);\n            for (int i = 0; i < 100; i++)\n            {\n                Assert.IsTrue(result.Contains(\"Message \" + i.ToString()));\n            }\n\n            foreach (var file in files)\n            {\n                FileInfo fileInfo = new FileInfo(file);\n                if ((fileInfo.Length >= 4300) && (fileInfo.Length <= 3200))\n                {\n                    Assert.Fail(\"Reset_RollForSize failed as the flatfile size exceeds the maximum limit for rolling\");\n                }\n            }\n        }\n\n        [TestMethod]\n        public void WhenRollIntervalExceedsMultipleTimes()\n        {\n            var fileNameWithoutExtension = @\".\\Logs10\\RollForTime_MultipleLogs\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs10\");\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 10, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Minute, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddMinutes(2);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 3\");\n                    logger.Informational(\"Message 4\");\n\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddMinutes(4);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 5\");\n                    logger.Informational(\"Message 6\");\n                });\n\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 6\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".2\" + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".2\" + \".log\").Contains(\"Message 3\"));\n        }\n\n        [TestMethod]\n        public void WhenRollWithHyphenInTimestampPattern()\n        {\n            var fileNameWithoutExtension = \"TimestamppatternWithHyphen\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, \"MM-dd-yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n                    logger.Informational(\"Message 3\");\n                    logger.Informational(\"Message 4\");\n                    logger.Informational(\"Message 5\");\n                    logger.Informational(\"Message 6\");\n                    logger.Informational(\"Message 7\");\n                    logger.Informational(\"Message 8\");\n                    Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n                });\n\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message 8\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.ToString(\"MM-dd-yyyy\") + \".1\" + \".log\"));\n        }\n\n        [TestMethod]\n        public void WhenMaxArchivedFilesExceedsAndRollForInterval()\n        {\n            var fileNameWithoutExtension = @\".\\Logs12\\TestMaxArchivedFiles_RollInterval\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs12\");\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 0, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, new EventTextFormatter(EventTextFormatter.DashSeparator), 2);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message 1\");\n                    logger.Informational(\"Message 2\");\n\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddDays(2);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 3\");\n                    logger.Informational(\"Message 4\");\n\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddDays(4);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 5\");\n                    logger.Informational(\"Message 6\");\n\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddDays(6);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 7\");\n                    logger.Informational(\"Message 8\");\n\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddDays(8);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 9\");\n                    logger.Informational(\"Message 10\");\n                });\n\n            Assert.AreEqual<int>(3, FlatFileHelper.GetFileNames(fileNameWithoutExtension + \"*.log\").Count());\n            Assert.IsFalse(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".1\" + \".log\"));\n            Assert.IsFalse(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".2\" + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".3\" + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".4\" + \".log\"));\n        }\n\n        [TestMethod]\n        public void WhenMaxArchivedFilesExceedsAndRollingACrossDifferentDatesWithRollInterval()\n        {\n            var fileNameWithoutExtension = @\".\\Logs13\\TestMaxArchivedFiles_RollInterval_CreatedOnDifferentDates\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs13\");\n            var logger = MockEventSource.Logger;\n            var dateTimeProvider = new MockDateTimeProvider();\n\n            string existingMessage = \"Existing Message\";\n            DateTime currentDateTime = new DateTime(2010, 1, 1);\n            Directory.CreateDirectory(@\".\\Logs13\");\n            File.WriteAllText(fileName, existingMessage);\n            File.SetCreationTime(fileName, currentDateTime);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var subscription = listener.LogToRollingFlatFile(fileName, 0, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, new EventTextFormatter(EventTextFormatter.DashSeparator), 2);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    dateTimeProvider.OverrideCurrentDateTime = currentDateTime;\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 1\");\n                    dateTimeProvider.OverrideCurrentDateTime = currentDateTime.AddDays(4);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n\n                    logger.Informational(\"Message 2\");\n\n                    dateTimeProvider.OverrideCurrentDateTime = currentDateTime.AddDays(6);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 3\");\n\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddDays(4);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 4\");\n\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddDays(6);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 5\");\n\n                    dateTimeProvider.OverrideCurrentDateTime = DateTime.Now.AddDays(8);\n                    subscription.Sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    logger.Informational(\"Message 6\");\n                });\n\n            var files = FlatFileHelper.GetFileNames(fileNameWithoutExtension + \"*.log\");\n            Assert.IsFalse(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".1\" + \".log\"));\n            Assert.AreEqual<int>(3, files.Count());\n        }\n\n        [TestMethod]\n        public void WhenMaxArchivedFileSizeIsNegativeFilesAreNotDeleted()\n        {\n            var fileNameWithoutExtension = \"TestMaxArchivedFilesNegative_RollSize\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.None, new EventTextFormatter(EventTextFormatter.DashSeparator), -2);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int msg = 0; msg < 30; msg++)\n                    {\n                        logger.Informational(\"Message \" + msg.ToString());\n                    }\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".1\" + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".2\" + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".3\" + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".4\" + \".log\"));\n        }\n\n        [TestMethod]\n        public void WhenMaxArchivedFilesIsZeroFilesAreNotDeleted()\n        {\n            var fileNameWithoutExtension = \"TestMaxArchivedFilesAsZero_RollSize\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.None, new EventTextFormatter(EventTextFormatter.DashSeparator), 0);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int msg = 0; msg < 30; msg++)\n                    {\n                        logger.Informational(\"Message \" + msg.ToString());\n                    }\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".1\" + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".2\" + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".3\" + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".4\" + \".log\"));\n        }\n\n        [TestMethod]\n        public void WhenLoggingEventsInDifferentLevels()\n        {\n            var fileNameWithoutExtension = \"TestAllEventLevels\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 2, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.None, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message Info\");\n                    logger.Verbose(\"Message Verb\");\n                    logger.Critical(\"Message Critic\");\n                    logger.Error(\"Message Err\");\n                    logger.Warning(\"Message Warn\");\n                    logger.LogAlways(\"Message Log\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message Info\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message Verb\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message Critic\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message Err\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message Warn\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message Log\"));\n        }\n\n        [TestMethod]\n        public void WhenFileNameIsNull()\n        {\n            using (var listener = new ObservableEventListener())\n            {\n                var subscription = listener.LogToRollingFlatFile(null, 2, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.None, new EventTextFormatter(EventTextFormatter.DashSeparator));\n\n                Assert.IsNotNull(subscription);\n            }\n        }\n\n        [TestMethod]\n        public void WhenFileNameIsEmpty()\n        {\n            using (var listener = new ObservableEventListener())\n            {\n                var subscription = listener.LogToRollingFlatFile(string.Empty, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.None, new EventTextFormatter(EventTextFormatter.DashSeparator));\n\n                Assert.IsNotNull(subscription);\n            }\n        }\n\n        [TestMethod]\n        public void WhenTimestampPatternIsEmpty()\n        {\n            var excpectionThrown = ExceptionAssertHelper.Throws<ArgumentException>(() =>\n                {\n                    using (var listener = new ObservableEventListener())\n                    {\n                        listener.LogToRollingFlatFile(\"TestForTimestampAsEmptyString.log\", 0, string.Empty, RollFileExistsBehavior.Increment, RollInterval.Midnight, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    }\n                });\n\n            Assert.AreEqual(\"Argument is empty\\r\\nParameter name: timestampPattern\", excpectionThrown.Message);\n        }\n\n        [TestMethod]\n        public void WhenFilenameInvalidErrorOCcursEarly()\n        {\n            var excpectionThrown = ExceptionAssertHelper.Throws<ArgumentException>(() =>\n                {\n                    using (var listener = new ObservableEventListener())\n                    {\n                        listener.LogToRollingFlatFile(@\">\", 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.None, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    }\n                });\n\n            Assert.AreEqual(\"Illegal characters in path.\", excpectionThrown.Message);\n        }\n\n        [TestMethod]\n        public void WhenFilenameInvalidErrorOCcursEarly1()\n        {\n            var excpectionThrown = ExceptionAssertHelper.Throws<ArgumentException>(() =>\n                {\n                    using (var listener = new ObservableEventListener())\n                    {\n                        listener.LogToRollingFlatFile(@\"|\", 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.None, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    }\n                });\n\n            Assert.AreEqual(\"Illegal characters in path.\", excpectionThrown.Message);\n        }\n\n        [TestMethod]\n        public void WhenFilenameInvalidErrorOCcursEarly2()\n        {\n            var excpectionThrown = ExceptionAssertHelper.Throws<ArgumentException>(() =>\n                {\n                    using (var listener = new ObservableEventListener())\n                    {\n                        listener.LogToRollingFlatFile(@\"..\\\", 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.None, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    }\n                });\n\n            Assert.AreEqual(\"A file name with a relative path is not allowed. Provide only the file name or the full path of the file.\", excpectionThrown.Message);\n        }\n\n        [TestMethod]\n        public void WhenEventTextFormatterIsNull()\n        {\n            var fileNameWithoutExtension = \"RFFLWhenEventTextFormatterIsNull\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 2, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.None, null);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message Info\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Message Info\"));\n            Assert.IsFalse(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(EventTextFormatter.DashSeparator));\n        }\n\n        [TestMethod]\n        public void WhenTimeStampPatternIsNull()\n        {\n            var fileNameWithoutExtension = \"TestForTimeStampPatternAsNull\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, null, RollFileExistsBehavior.Increment, RollInterval.None);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Informational(\"Message Info1\");\n                    logger.Informational(\"Message Info2\");\n                    logger.Informational(\"Message Info3\");\n                    logger.Informational(\"Message Info4\");\n                    logger.Informational(\"Message Info5\");\n                    logger.Informational(\"Message Info6\");\n                    logger.Informational(\"Message Info7\");\n                    logger.Informational(\"Message Info8\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".1\" + \".log\"));\n        }\n\n        [TestMethod]\n        public void WhenFormattingErrorExceptionIsRoutedToBuiltInSource()\n        {\n            var fileNameWithoutExtension = \"ErrorInFormatterIsHandled\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = TestEventSourceNonTransient.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, null, RollFileExistsBehavior.Increment, RollInterval.None, new MockFormatter(true));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    logger.EventWithPayload(\"payload1\", 100);\n\n                    StringAssert.Contains(errorsListener.ToString(), \"Payload : [message : System.InvalidOperationException: Operation is not valid due to the current state of the object.\");\n                });\n        }\n\n        [TestMethod]\n        public void WhenAllKeywordsAreEnabled()\n        {\n            var fileNameWithoutExtension = \"RollingFlatFileEL_For_Keywords_All\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var formatter = new EventTextFormatter(\"====\", \"=====\", EventLevel.LogAlways);\n                    listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways, Keywords.All);\n                    logger.VerboseWithKeywordPage(\"VerboseWithKeywordPage\");\n                    logger.InfoWithKeywordDiagnostic(\"InfoWithKeywordDiagnostic\");\n                    Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n                });\n\n            StringAssert.Contains(File.ReadAllText(fileNameWithoutExtension + \".log\"), \"Keywords : 1\");\n            StringAssert.Contains(File.ReadAllText(fileNameWithoutExtension + \".log\"), \"Keywords : 4\");\n        }\n\n        [TestMethod]\n        public void WhenKeywordsAreNotSpecifiedWithEnabled()\n        {\n            var fileNameWithoutExtension = \"RollingFlatFileEL_Without_Keywords_All_KeywordAsNotNone\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.VerboseWithKeywordPage(\"VerboseWithKeywordPage\");\n                    logger.Critical(\"Critical\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            string fileText = File.ReadAllText(fileNameWithoutExtension + \".log\");\n            Assert.IsTrue(fileText.Contains(\"Payload : [message : Critical]\"));\n            bool doesContainText = fileText.Contains(\"Payload : [message : VerboseWithKeywordPage]\");\n#if !EVENT_SOURCE_PACKAGE\n            Assert.IsFalse(doesContainText);\n#else\n            Assert.IsTrue(doesContainText);\n#endif\n        }\n\n        [TestMethod]\n        public void WhenActivityId()\n        {\n            var fileNameWithoutExtension = \"RollingFlatFileEL_WhenActivityId\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            var activityId = Guid.NewGuid();\n            var previousActivityId = Guid.Empty;\n            EventSource.SetCurrentThreadActivityId(activityId, out previousActivityId);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Critical(\"Critical\");\n                });\n\n            EventSource.SetCurrentThreadActivityId(previousActivityId);\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Payload : [message : Critical]\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"ActivityId : \" + activityId.ToString()));\n            Assert.IsFalse(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"RelatedActivityId : \"));\n        }\n\n        [TestMethod]\n        public void WhenActivityIdAndRelatedActivityId()\n        {\n            var fileNameWithoutExtension = \"RollingFlatFileEL_WhenActivityId\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            var activityId = Guid.NewGuid();\n            var relatedActivityId = Guid.NewGuid();\n            var previousActivityId = Guid.Empty;\n            EventSource.SetCurrentThreadActivityId(activityId, out previousActivityId);\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.CriticalWithRelatedActivityId(\"Critical\", relatedActivityId);\n                });\n\n            EventSource.SetCurrentThreadActivityId(previousActivityId);\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Payload : [message : Critical]\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"ActivityId : \" + activityId.ToString()));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"RelatedActivityId : \" + relatedActivityId.ToString()));\n        }\n\n        [TestMethod]\n        public void WhenTaskNameIsSpecifiedForEvent()\n        {\n            var fileNameWithoutExtension = \"RollingFlatFileEL_For_TaskName\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n            var eventTextFormatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            eventTextFormatter.VerbosityThreshold = EventLevel.LogAlways;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, eventTextFormatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways, Keywords.All);\n                    logger.CriticalWithTaskName(\"CriticalWithTaskName\");\n                    logger.InfoWithKeywordDiagnostic(\"InfoWithKeywordDiagnostic\");\n                    Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n                });\n\n            StringAssert.Contains(File.ReadAllText(fileNameWithoutExtension + \".log\"), \"Task : 1\\r\\nVersion : 0\\r\\nPayload : [message : CriticalWithTaskName] \\r\\nEventName : PageSuspend\");\n            StringAssert.Contains(File.ReadAllText(fileNameWithoutExtension + \".log\"), \"Task : 64512\\r\\nVersion : 0\\r\\nPayload : [message : InfoWithKeywordDiagnostic] \\r\\nEventName : InfoWithKeywordDiagnosticInfo\");\n        }\n\n        [TestMethod]\n        public void WhenMultipleEventsAreLogged()\n        {\n            var fileNameWithoutExtension = \"CanLogMultipleMessages\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n            EventTextFormatter formatter = new EventTextFormatter(\"------======------\");\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 300000, \"d\", RollFileExistsBehavior.Increment, RollInterval.Year, formatter);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int n = 0; n < 300; n++)\n                    {\n                        logger.Informational(\"some message to flat file \" + n.ToString());\n                    }\n                });\n\n            Assert.IsTrue(File.Exists(fileName));\n            var entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 300, formatter.Header);\n            Assert.AreEqual<int>(300, entries.Count());\n            StringAssert.Contains(entries.First(), \"some message to flat file 0\");\n            StringAssert.Contains(entries.Last(), \"some message to flat file 299\");\n        }\n\n        [TestMethod]\n        public void WhenPositionalParametersInPayload()\n        {\n            var fileNameWithoutExtension = \"Task1557_ForRollingFlatFile_EventLogFormatter\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = TestEventSourceNoAttributes.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.None, new EventTextFormatter(EventTextFormatter.DashSeparator), 0);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int i = 0; i < 7; i++)\n                    {\n                        logger.ObjectArrayEvent4(100, \"stringstringarg1\", 200, \"stringstringarg2\", 300);\n                    }\n\n                    Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".1.log\"));\n                });\n\n            string readFile = File.ReadAllText(fileName);\n            Assert.IsTrue(readFile.Contains(\"Check if it is logged\"));\n            Assert.IsTrue(readFile.Contains(\"[arg0 : 100] [arg1 : stringstringarg1] [arg2 : 200] [arg3 : stringstringarg2] [arg4 : 300]\"));\n        }\n\n        [TestMethod]\n        public void WhenPositionalParametersInPayloadInJson()\n        {\n            var fileNameWithoutExtension = \"Task1557_ForRollingFlatFile_JsonFormatter\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = TestEventSourceNoAttributes.Logger;\n            var jsonFormatter = new JsonEventTextFormatter();\n            jsonFormatter.DateTimeFormat = \"dd/MM/yyyy\";\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.None, jsonFormatter, 0);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int i = 0; i < 7; i++)\n                    {\n                        logger.ObjectArrayEvent4(1000, \"stringstringarg10\", 2000, \"stringstringarg20\", 3000);\n                    }\n\n                    Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".1.log\"));\n                });\n\n            string readFile = File.ReadAllText(fileName);\n            Assert.IsTrue(readFile.Contains(\"Check if it is logged\"));\n            Assert.IsTrue(readFile.Contains(\"{\\\"arg0\\\":1000,\\\"arg1\\\":\\\"stringstringarg10\\\",\\\"arg2\\\":2000,\\\"arg3\\\":\\\"stringstringarg20\\\",\\\"arg4\\\":3000}\"));\n        }\n\n        [TestMethod]\n        public void WhenPositionalParametersInPayloadInXml()\n        {\n            var fileNameWithoutExtension = \"Task1557_ForRollingFlatFile_XmlFormatter\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = TestEventSourceNoAttributes.Logger;\n            var xmlFormatter = new XmlEventTextFormatter();\n            xmlFormatter.DateTimeFormat = \"dd/MM/yyyy\";\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.None, xmlFormatter, 0);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int i = 0; i < 7; i++)\n                    {\n                        logger.ObjectArrayEvent4(1000, \"stringstringarg10\", 2000, \"stringstringarg20\", 3000);\n                    }\n\n                    Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".\" + DateTime.Now.Year + \".1.log\"));\n                });\n\n            string readFile = File.ReadAllText(fileName);\n            Assert.IsTrue(readFile.Contains(\"<Message>Check if it is logged</Message>\"));\n            Assert.IsTrue(readFile.Contains(\"<Data Name=\\\"arg0\\\">1000</Data><Data Name=\\\"arg1\\\">stringstringarg10</Data><Data Name=\\\"arg2\\\">2000</Data><Data Name=\\\"arg3\\\">stringstringarg20</Data><Data Name=\\\"arg4\\\">3000</Data>\"));\n        }\n\n        [TestMethod]\n        public void WhenProcessId()\n        {\n            var fileNameWithoutExtension = \"RollingFlatFileEL_WhenProcessId\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            int processId = System.Diagnostics.Process.GetCurrentProcess().Id;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Critical(\"Critical\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Payload : [message : Critical]\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"ProcessId : \" + processId.ToString()));\n        }\n\n        public void WhenThreadId()\n        {\n            var fileNameWithoutExtension = \"RollingFlatFileEL_WhenThreadId\";\n            var fileName = fileNameWithoutExtension + \".log\";\n            FlatFileHelper.DeleteCreatedLogFiles(fileNameWithoutExtension);\n            var logger = MockEventSource.Logger;\n\n            int threadId = ThreadHelper.GetCurrentUnManagedThreadId();\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToRollingFlatFile(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, new EventTextFormatter(EventTextFormatter.DashSeparator));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Critical(\"Critical\");\n                });\n\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".log\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"Payload : [message : Critical]\"));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".log\").Contains(\"ThreadId : \" + threadId.ToString()));\n        }\n    }\n}"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/Sinks/WindowsAzureTableSinkFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.Sinks\n{\n    [TestClass]\n    public class WindowsAzureTableSinkFixture\n    {\n        private string tableName;\n\n        [TestInitialize]\n        public void Initialize()\n        {\n            this.tableName = string.Empty;\n        }\n\n        [TestCleanup]\n        public void Teardown()\n        {\n            if (!string.IsNullOrWhiteSpace(this.tableName))\n            {\n                AzureTableHelper.DeleteTable(System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"], this.tableName);\n            }\n        }\n\n        [TestMethod]\n        public void WhenEventsWithDifferentLevels()\n        {\n            this.tableName = \"WhenEventsWithDifferentLevels\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(1));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Critical(\"This is a critical message\");\n                    logger.Error(\"This is an error message\");\n                    logger.Informational(\"This is informational\");\n                });\n\n            var events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 3);\n            Assert.AreEqual(3, events.Count());\n            Assert.AreEqual(TestEventSource.InformationalEventId, events.ElementAt(0).EventId);\n            Assert.AreEqual(TestEventSource.ErrorEventId, events.ElementAt(1).EventId);\n            Assert.AreEqual(TestEventSource.CriticalEventId, events.ElementAt(2).EventId);\n        }\n\n        [TestMethod]\n        public void WhenLoggingMultipleMessages()\n        {\n            this.tableName = \"WhenLoggingMultipleMessages\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    for (int n = 0; n < 300; n++)\n                    {\n                        logger.Informational(\"logging multiple messages \" + n.ToString());\n                    }\n                });\n\n            var events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 300);\n            Assert.AreEqual(300, events.Count());\n        }\n\n        [TestMethod]\n        public void WhenNoPayload()\n        {\n            this.tableName = \"WhenNoPayload\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(1));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.EventWithoutPayloadNorMessage();\n                });\n\n            var events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 1);\n            Assert.AreEqual(1, events.Count());\n            Assert.AreEqual(TestEventSource.EventWithoutPayloadNorMessageId, events.ElementAt(0).EventId);\n        }\n\n        [TestMethod]\n        public void WhenEventHasAllValuesForAttribute()\n        {\n            this.tableName = \"WhenEventHasAllValuesForAttribute\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(1));\n                    listener.EnableEvents(logger, EventLevel.LogAlways, Keywords.All);\n                    logger.AllParametersWithCustomValues();\n                });\n\n            var events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 1);\n            Assert.AreEqual(1, events.Count());\n            Assert.AreEqual(10001, events.ElementAt(0).EventId);\n        }\n\n        [TestMethod]\n        public void WhenSourceIsEnabledAndDisabled()\n        {\n            this.tableName = \"WhenSourceIsEnabledAndDisabled\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(1));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Critical(\"This is a critical message\");\n                    var events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 1);\n                    Assert.AreEqual(1, events.Count());\n\n                    listener.DisableEvents(logger);\n                    logger.Critical(\"This is a critical message\");\n                });\n\n            var eventsCount = AzureTableHelper.GetEventsCount(connectionString, this.tableName);\n            Assert.AreEqual(1, eventsCount);\n        }\n\n        [TestMethod]\n        public void WhenEventHasMultiplePayloads()\n        {\n            this.tableName = \"WhenEventHasMultiplePayloads\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(20));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.EventWithMultiplePayloads(\"TestPayload 1\", \"TestPayload 2\", \"TestPayload 3\");\n                });\n\n            var events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 1);\n            Assert.AreEqual(1, events.Count());\n            StringAssert.Contains(events.First().Payload, @\"\"\"payload1\"\": \"\"TestPayload 1\"\"\");\n            StringAssert.Contains(events.First().Payload, @\"\"\"payload2\"\": \"\"TestPayload 2\"\"\");\n            StringAssert.Contains(events.First().Payload, @\"\"\"payload3\"\": \"\"TestPayload 3\"\"\");\n        }\n\n        [TestMethod]\n        public void WhenDefaultTableNameIsUsed()\n        {\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, WindowsAzureTableLog.DefaultTableName);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, bufferingInterval: TimeSpan.FromSeconds(1));\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    logger.Error(\"This is an error message\");\n                });\n\n            var events = AzureTableHelper.PollForEvents(connectionString, WindowsAzureTableLog.DefaultTableName, 1);\n            Assert.AreEqual(1, events.Count());\n        }\n\n        [TestMethod]\n        public void WhenTableNameIsNull()\n        {\n            var ex = ExceptionAssertHelper.Throws<ArgumentNullException>(() =>\n            {\n                this.tableName = null;\n                var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(1));\n                }\n            });\n\n            StringAssert.Contains(ex.Message, \"Value cannot be null\");\n            StringAssert.Contains(ex.Message, \"Parameter name: tableAddress\");\n        }\n\n        [TestMethod]\n        public void WhenTableNameIsEmpty()\n        {\n            var ex = ExceptionAssertHelper.Throws<ArgumentException>(() =>\n            {\n                this.tableName = string.Empty;\n                var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(1));\n                }\n            });\n\n            StringAssert.Contains(ex.Message, \"Argument is empty\");\n            StringAssert.Contains(ex.Message, \"Parameter name: tableAddress\");\n        }\n\n        [TestMethod]\n        public void WhenTableNameIsInvalid()\n        {\n            var ex = ExceptionAssertHelper.Throws<ArgumentException>(() =>\n            {\n                this.tableName = \"$$$$\";\n                var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(1));\n                }\n            });\n\n            StringAssert.Contains(ex.Message, \"Table names may contain only alphanumeric characters, cannot begin with a numeric character and must be from 3 to 63 characters long.\");\n            StringAssert.Contains(ex.Message, \"Parameter name: tableAddress\");\n        }\n\n        [TestMethod]\n        public void WhenConnectionStringIsEmpty()\n        {\n            var ex = ExceptionAssertHelper.Throws<ArgumentException>(() =>\n            {\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", string.Empty);\n                }\n            });\n\n            StringAssert.Contains(ex.Message, \"Argument is empty\");\n            StringAssert.Contains(ex.Message, \"Parameter name: connectionString\");\n        }\n\n        [TestMethod]\n        public void WhenConnectionStringIsNull()\n        {\n            var ex = ExceptionAssertHelper.Throws<ArgumentNullException>(() =>\n            {\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", null);\n                }\n            });\n\n            StringAssert.Contains(ex.Message, \"Value cannot be null\");\n            StringAssert.Contains(ex.Message, \"Parameter name: connectionString\");\n        }\n\n        [TestMethod]\n        public void WhenInstanceIsEmpty()\n        {\n            var ex = ExceptionAssertHelper.Throws<ArgumentException>(() =>\n            {\n                var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToWindowsAzureTable(string.Empty, connectionString);\n                }\n            });\n\n            StringAssert.Contains(ex.Message, \"Argument is empty\");\n            StringAssert.Contains(ex.Message, \"Parameter name: instanceName\");\n        }\n\n        [TestMethod]\n        public void WhenInstanceIsNull()\n        {\n            var ex = ExceptionAssertHelper.Throws<ArgumentNullException>(() =>\n            {\n                var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n\n                using (var listener = new ObservableEventListener())\n                {\n                    listener.LogToWindowsAzureTable(null, connectionString);\n                }\n            });\n\n            StringAssert.Contains(ex.Message, \"Value cannot be null\");\n            StringAssert.Contains(ex.Message, \"Parameter name: instanceName\");\n        }\n\n        [TestMethod]\n        public void WhenBatchSizeIsExceeded()\n        {\n            this.tableName = \"WhenBatchSizeIsExceeded\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n            IEnumerable<WindowsAzureTableEventEntry> events = null;\n\n            TestScenario.With2Listeners(\n                logger,\n                (listener1, listener2) =>\n                {\n                    listener1.LogToWindowsAzureTable(\"mytestinstance1\", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(20));\n                    listener2.LogToWindowsAzureTable(\"mytestinstance2\", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(20));\n                    listener1.EnableEvents(logger, EventLevel.LogAlways);\n                    listener2.EnableEvents(logger, EventLevel.LogAlways);\n\n                    // 100 events or more will be flushed by count before the buffering interval elapses\n                    var logTaskList = new List<Task>();\n                    for (int i = 0; i < 120; i++)\n                    {\n                        var messageNumber = i;\n                        logTaskList.Add(Task.Run(() => logger.Critical(messageNumber + \"Critical message\")));\n                    }\n\n                    Task.WaitAll(logTaskList.ToArray(), TimeSpan.FromSeconds(10));\n\n                    // Wait less than the buffering interval for the events to be written and assert\n                    // Only the first batch of 100 is written for each listener\n                    events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 200, waitFor: TimeSpan.FromSeconds(10));\n                    Assert.AreEqual(200, events.Count());\n                    Assert.AreEqual(100, events.Where(e => e.InstanceName == \"mytestinstance1\").Count());\n                    Assert.AreEqual(100, events.Where(e => e.InstanceName == \"mytestinstance2\").Count());\n                });\n\n            // The rest of the events are written during the Dispose flush\n            events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 240, waitFor: TimeSpan.FromSeconds(2));\n            Assert.AreEqual(240, events.Count());\n            Assert.AreEqual(120, events.Where(e => e.InstanceName == \"mytestinstance1\").Count());\n            Assert.AreEqual(120, events.Where(e => e.InstanceName == \"mytestinstance2\").Count());\n        }\n\n        [TestMethod]\n        public void WhenBufferingWithMinimumNonDefaultInterval()\n        {\n            this.tableName = \"WhenBufferingWithMinimalNonDefaultInterval\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    // Minimum buffering interval is 500 ms\n                    var minimumBufferingInterval = TimeSpan.FromMilliseconds(500);\n                    listener.LogToWindowsAzureTable(\"mytestinstance1\", connectionString, this.tableName, bufferingInterval: minimumBufferingInterval);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n                    var logTaskList = new List<Task>();\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.Critical(\"Critical message\");\n                    }\n\n                    // Wait for the events to be written and assert\n                    Task.Delay(TimeSpan.FromSeconds(3)).Wait();\n                    var eventsCount = AzureTableHelper.GetEventsCount(connectionString, this.tableName);\n                    Assert.AreEqual(10, eventsCount);\n                });\n\n            // No more events should be written during the Dispose flush\n            var eventsCountFinal = AzureTableHelper.GetEventsCount(connectionString, this.tableName);\n            Assert.AreEqual(10, eventsCountFinal);\n        }\n\n        [TestMethod]\n        public void WhenUsingNonDefaultBufferInterval()\n        {\n            this.tableName = \"WhenUsingNonDefaultBufferInterval\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var bufferingInterval = TimeSpan.FromSeconds(5);\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName, bufferingInterval: bufferingInterval);\n                    listener.EnableEvents(logger, EventLevel.LogAlways);\n\n                    // Pre-condition: Wait for the events to be written and assert\n                    Task.Delay(TimeSpan.FromSeconds(2)).Wait();\n                    Assert.AreEqual(0, AzureTableHelper.GetEventsCount(connectionString, this.tableName));\n\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.Critical(\"Critical Message\");\n                    }\n\n                    // Event must not be written before the interval has elapsed\n                    Task.Delay(TimeSpan.FromSeconds(2)).Wait();\n                    Assert.AreEqual(0, AzureTableHelper.GetEventsCount(connectionString, this.tableName));\n\n                    // Wait for the buffer to flush at end of interval\n                    Task.Delay(bufferingInterval).Wait();\n\n                    // 1st interval: Wait for the events to be written and assert\n                    Task.Delay(TimeSpan.FromSeconds(2)).Wait();\n                    Assert.AreEqual(10, AzureTableHelper.GetEventsCount(connectionString, this.tableName));\n                });\n        }\n\n        [TestMethod]\n        public void WhenInternalBufferCountIsExceededAndIntervalExceeded()\n        {\n            this.tableName = \"WhenInternalBufferCountIsExceededAndIntervalExceeded\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var bufferingInterval = TimeSpan.FromSeconds(5);\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName, bufferingInterval: bufferingInterval);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n\n                    // When reachiing 100 events buffer will be flushed\n                    for (int i = 0; i < 110; i++)\n                    {\n                        logger.Informational(\"Message1\");\n                    }\n\n                    // Wait for buffer interval to elapse\n                    Task.Delay(bufferingInterval).Wait();\n                    var events = AzureTableHelper.GetEventsCount(connectionString, this.tableName);\n                    Assert.AreEqual(100, events);\n                });\n\n            // Last events should be written during the Dispose flush\n            var eventsCountFinal = AzureTableHelper.GetEventsCount(connectionString, this.tableName);\n            Assert.AreEqual(110, eventsCountFinal);\n        }\n\n        [TestMethod]\n        public void WhenBufferIntervalExceedsAndLessEntriesThanBufferCount()\n        {\n            this.tableName = \"WhenBufferIntervalExceedsAndLessEntriesThanBufferCount\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n                logger,\n                listener =>\n                {\n                    var bufferingInterval = TimeSpan.FromSeconds(2);\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName, bufferingInterval: bufferingInterval);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n\n                    // 100 events or more will be flushed by count before the buffering interval elapses\n                    for (int i = 0; i < 90; i++)\n                    {\n                        logger.Informational(\"Message1\");\n                    }\n\n                    // Wait for buffer interval to elapse and allow time for events to be written\n                    Task.Delay(bufferingInterval.Add(TimeSpan.FromSeconds(5))).Wait();\n                    var events = AzureTableHelper.GetEventsCount(connectionString, this.tableName);\n                    Assert.AreEqual(90, events);\n                });\n        }\n\n        [TestMethod]\n        public void WhenEventsInThreeConsecutiveIntervals()\n        {\n            this.tableName = \"WhenEventsInThreeConsecutiveIntervals\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n\n            var bufferingInterval = TimeSpan.FromSeconds(6);\n            var insertionInterval = TimeSpan.FromSeconds(2);\n            TestScenario.With1Listener(\n                logger,\n                (listener, errorsListener) =>\n                {\n                    listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName, bufferingInterval: bufferingInterval);\n                    listener.EnableEvents(logger, EventLevel.Informational);\n\n                    // 1st interval: Log 10 events\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.Informational(\"Message1\");\n                    }\n\n                    // 1st interval: Wait for the buffer to flush at end of interval\n                    Task.Delay(bufferingInterval).Wait();\n                    // 2nd interval: start\n\n                    // 1st interval: Wait for the events to be written and assert\n                    Task.Delay(insertionInterval).Wait();\n                    Assert.AreEqual(10, AzureTableHelper.GetEventsCount(connectionString, this.tableName));\n\n                    // 2nd interval: Log 10 events\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.Informational(\"Message1\");\n                    }\n\n                    // 2nd interval: Wait for the buffer to flush at end of interval\n                    Task.Delay(bufferingInterval).Wait();\n                    // 3rd interval: start\n\n                    // 2nd interval: Wait for the events to be written and assert\n                    Task.Delay(insertionInterval).Wait();\n                    Assert.AreEqual(20, AzureTableHelper.GetEventsCount(connectionString, this.tableName));\n\n                    // 3rd interval: Log 10 events\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.Informational(\"Message1\");\n                    }\n\n                    // 3rd interval: Wait for the buffer to flush at end of interval\n                    Task.Delay(bufferingInterval).Wait();\n                    // 4th interval: start\n\n                    // 3rd interval: Wait for the events to be written and assert\n                    Task.Delay(insertionInterval).Wait();\n                    Assert.AreEqual(30, AzureTableHelper.GetEventsCount(connectionString, this.tableName));\n\n                    // No errors should have been reported\n                    Assert.AreEqual(string.Empty, errorsListener.ToString());\n                });\n\n            // No more events should have been written during the last flush in the Dispose\n            Assert.AreEqual(30, AzureTableHelper.GetEventsCount(connectionString, this.tableName));\n        }\n\n        [TestMethod]\n        public void WhenSourceEnabledWitKeywordsAll()\n        {\n            this.tableName = \"WhenSourceEnabledWitKeywordsAll\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n               logger,\n               listener =>\n               {\n                   listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(10));\n                   listener.EnableEvents(logger, EventLevel.LogAlways, Keywords.All);\n                   logger.ErrorWithKeywordDiagnostic(\"Error with keyword Diagnostic\");\n                   logger.CriticalWithKeywordPage(\"Critical with keyword Page\");\n               });\n\n            var events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 2);\n            Assert.AreEqual(2, events.Count());\n            Assert.AreEqual(\"1\", events.First().Keywords.ToString());\n            Assert.AreEqual(\"4\", events.ElementAt(1).Keywords.ToString());\n        }\n\n        [TestMethod]\n        public void WhenNotEnabledWithKeywordsAndEventWithSpecificKeywordIsRaised()\n        {\n            this.tableName = \"WhenNotEnabledWithKeywordsAndEventWithSpecificKeywordIsRaised\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n               logger,\n               listener =>\n               {\n                   listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(10));\n                   listener.EnableEvents(logger, EventLevel.LogAlways);\n                   logger.ErrorWithKeywordDiagnostic(\"Error with keyword EventlogClassic\");\n               });\n\n            var eventsCount = AzureTableHelper.GetEventsCount(connectionString, this.tableName);\n            int eventCount = 0;\n#if EVENT_SOURCE_PACKAGE\n            eventCount = 1;\n#endif\n            Assert.AreEqual(eventCount, eventsCount);\n        }\n\n        [TestMethod]\n        public void WhenListenerIsDisposed()\n        {\n            this.tableName = \"WhenListenerIsDisposed\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With2Listeners(\n               logger,\n               (listener1, listener2) =>\n               {\n                   listener1.LogToWindowsAzureTable(\"mytestinstance1\", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(20));\n                   listener2.LogToWindowsAzureTable(\"mytestinstance2\", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(20));\n                   listener1.EnableEvents(logger, EventLevel.LogAlways);\n                   listener2.EnableEvents(logger, EventLevel.LogAlways);\n                   var logTaskList = new List<Task>();\n                   for (int i = 0; i < 105; i++)\n                   {\n                       var messageNumber = i;\n                       logTaskList.Add(Task.Run(() => logger.Critical(messageNumber + \"Critical message\")));\n                   }\n\n                   Task.WaitAll(logTaskList.ToArray(), TimeSpan.FromSeconds(10));\n                   listener1.Dispose();\n                   listener2.Dispose();\n\n                   var events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 600);\n                   Assert.AreEqual(210, events.Count());\n               });\n        }\n\n        [TestMethod]\n        public void WhenEventWithTaskNameInAttributeIsRaised()\n        {\n            this.tableName = \"WhenEventWithTaskNameInAttributeIsRaised\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = TestEventSource.Logger;\n\n            TestScenario.With1Listener(\n               logger,\n               listener =>\n               {\n                   listener.LogToWindowsAzureTable(\"mytestinstance\", connectionString, this.tableName, bufferingInterval: TimeSpan.FromSeconds(10));\n                   listener.EnableEvents(logger, EventLevel.LogAlways, Keywords.All);\n                   logger.CriticalWithTaskName(\"Critical with task name\");\n                   logger.CriticalWithKeywordPage(\"Critical with no task name\");\n               });\n\n            var events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 2);\n            Assert.AreEqual(2, events.Count());\n            Assert.AreEqual(\"64513\", events.First().Task.ToString());\n            Assert.AreEqual(\"2\", events.ElementAt(1).Task.ToString());\n        }\n\n        [TestMethod]\n        public void WhenEventWithEnumsInPayloadIsRaised()\n        {\n            this.tableName = \"WhenEventWithEnumsInPayloadIsRaised\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = MockEventSourceInProcEnum.Logger;\n\n            TestScenario.With1Listener(\n               logger,\n               listener =>\n               {\n                   listener.LogToWindowsAzureTable(\"mytestinstance1\", connectionString, this.tableName, bufferingInterval: TimeSpan.Zero);\n                   listener.EnableEvents(logger, EventLevel.LogAlways);\n                   logger.SendEnumsEvent17(MockEventSourceInProcEnum.MyColor.Green, MockEventSourceInProcEnum.MyFlags.Flag2);\n               });\n\n            var events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 1);\n            Assert.AreEqual(1, events.Count());\n            Assert.AreEqual((int)MockEventSourceInProcEnum.Tasks.DBQuery, events.ElementAt(0).Task);\n            Assert.AreEqual((int)EventOpcode.Resume, events.ElementAt(0).Opcode);\n            StringAssert.Contains(events.ElementAt(0).Payload, @\"\"\"a\"\": 2\");\n            StringAssert.Contains(events.ElementAt(0).Payload, @\"\"\"b\"\": 2\");\n        }\n\n        [TestMethod]\n        public void WhenProcessId()\n        {\n            this.tableName = \"WhenProcessId\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = MockEventSourceInProcEnum.Logger;\n\n            int processId = System.Diagnostics.Process.GetCurrentProcess().Id;\n\n            TestScenario.With1Listener(\n               logger,\n               listener =>\n               {\n                   listener.LogToWindowsAzureTable(\"mytestinstance1\", connectionString, this.tableName, bufferingInterval: TimeSpan.Zero);\n                   listener.EnableEvents(logger, EventLevel.LogAlways);\n                   logger.SendEnumsEvent17(MockEventSourceInProcEnum.MyColor.Green, MockEventSourceInProcEnum.MyFlags.Flag2);\n               });\n\n            var events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 1);\n            Assert.AreEqual(1, events.Count());\n            Assert.AreEqual(processId, events.ElementAt(0).ProcessId);\n        }\n\n        [TestMethod]\n        public void WhenThreadId()\n        {\n            this.tableName = \"WhenThreadId\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = MockEventSourceInProcEnum.Logger;\n\n            int threadId = ThreadHelper.GetCurrentUnManagedThreadId();\n\n            TestScenario.With1Listener(\n               logger,\n               listener =>\n               {\n                   listener.LogToWindowsAzureTable(\"mytestinstance1\", connectionString, this.tableName, bufferingInterval: TimeSpan.Zero);\n                   listener.EnableEvents(logger, EventLevel.LogAlways);\n                   logger.SendEnumsEvent17(MockEventSourceInProcEnum.MyColor.Green, MockEventSourceInProcEnum.MyFlags.Flag2);\n               });\n\n            var events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 1);\n            Assert.AreEqual(1, events.Count());\n            Assert.AreEqual(threadId, events.ElementAt(0).ThreadId);\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/BasicTestEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public sealed class BasicTestEventSource : EventSource\n    {\n        public static readonly BasicTestEventSource Logger = new BasicTestEventSource();\n\n        [Event(100, Level = EventLevel.LogAlways)]\n        public void RaiseBasicTestEventSourceEvent(string message) \n        {\n            if (this.IsEnabled())\n            { \n                this.WriteEvent(100, message); \n            }\n        }\n\n        [Event(200, Level = EventLevel.Error)]\n        public void RaiseEventWithMaxVerbosityAsError(string message) \n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(200, message); \n            }\n        }\n\n        [Event(300, Level = EventLevel.Informational)]\n        public void RaiseEventWithMaxVerbosityAsInformational(string message) \n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(300, message);\n            }\n        }\n\n        [Event(400, Level = EventLevel.Critical)]\n        public void RaiseEventWithMaxVerbosityAsCritical(string message) \n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(400, message);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/CustomFormatter.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.IO;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public class CustomFormatter : IEventTextFormatter\n    {\n        private bool throwOnWrite;\n\n        public CustomFormatter()\n            : this(false)\n        {\n        }\n\n        public CustomFormatter(bool throwOnWrite)\n        {\n            this.throwOnWrite = throwOnWrite;\n        }\n\n        public List<Tuple<EventEntry, TextWriter>> WriteEventCalls = new List<Tuple<EventEntry, TextWriter>>();\n\n        public string Header { get; set; }\n        public string Footer { get; set; }\n\n        public void WriteEvent(EventEntry eventEntry, TextWriter writer)\n        {\n            if (throwOnWrite)\n            { \n                SemanticLoggingEventSource.Log.CustomFormatterUnhandledFault(\"unhandled exception from formatter\"); \n            }\n\n            this.WriteEventCalls.Add(Tuple.Create(eventEntry, writer));\n            if (eventEntry.Payload.Count > 0)\n            { \n                writer.Write(eventEntry.Payload[0]); \n            }\n        }\n\n        public EventLevel Detailed { get; set; }\n\n        public string DateTimeFormat { get; set; }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/CustomFormatterWithWait.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public class CustomFormatterWithWait : IEventTextFormatter, IDisposable\n    {\n        /// <summary>\n        /// The dash separator\n        /// </summary>\n        public const string DashSeparator = \"----------------------------------------\";\n        private ManualResetEventSlim waitEvents;\n        private const string TextSerializationError = \"Cannot serialize the payload: {0}\";\n        private bool disposed;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventTextFormatter\" /> class.\n        /// </summary>\n        public CustomFormatterWithWait()\n            : this(null, null)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventTextFormatter\" /> class.\n        /// </summary>\n        /// <param name=\"header\">The header.</param>\n        public CustomFormatterWithWait(string header)\n            : this(header, null)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventTextFormatter\" /> class.\n        /// </summary>\n        /// <param name=\"header\">The header.</param>\n        /// <param name=\"footer\">The footer.</param>\n        public CustomFormatterWithWait(string header, string footer)\n        {\n            waitEvents = new ManualResetEventSlim();\n\n            this.Header = header;\n            this.Footer = footer;\n            this.Detailed = EventLevel.Informational;\n        }\n\n        /// <summary>\n        /// Gets or sets the header\n        /// </summary>\n        public string Header { get; set; }\n\n        /// <summary>\n        /// Gets or sets the footer\n        /// </summary>\n        public string Footer { get; set; }\n\n        /// <summary>\n        /// Gets or sets the lowest <see cref=\"EventLevel\" /> value where the formatted output provides all the event entry information.\n        /// Otherwise a summarized content of the event entry will be written.\n        /// </summary>\n        public EventLevel Detailed { get; set; }\n\n        /// <summary>\n        /// Gets or sets the date time format used for timestamp value.\n        /// </summary>\n        /// <value>\n        /// The date time format.\n        /// </value>\n        public string DateTimeFormat { get; set; }\n\n        public ManualResetEventSlim WaitEvents\n        {\n            get { return this.waitEvents; }\n        }\n\n        /// <summary>\n        /// Writes the event.\n        /// </summary>\n        /// <param name=\"eventData\">The <see cref=\"EventWrittenEventArgs\" /> instance containing the event data.</param>\n        /// <param name=\"writer\">The writer.</param>\n        public void WriteEvent(EventEntry eventEntry, TextWriter writer)\n        {\n            // Write header\n            if (!string.IsNullOrWhiteSpace(this.Header))\n            {\n                writer.WriteLine(this.Header); \n            }\n\n            if (eventEntry.Payload.First().ToString() == \"error\")\n            {\n                writer.WriteLine(\"This is an entry containing and error and should not be logged\");\n                throw new InvalidOperationException(\"error\");\n            }\n\n            if (eventEntry.Schema.Level >= this.Detailed)\n            {\n                // Write properties\n                writer.WriteLine(\"Mock SourceId : {0}\", eventEntry.ProviderId);\n                writer.WriteLine(\"Mock EventId : {0}\", eventEntry.EventId);\n                writer.WriteLine(\"Keywords : {0}\", eventEntry.Schema.Keywords);\n                writer.WriteLine(\"Level : {0}\", eventEntry.Schema.Level);\n                writer.WriteLine(\"Message : {0}\", eventEntry.FormattedMessage);\n                writer.WriteLine(\"Opcode : {0}\", eventEntry.Schema.Opcode);\n                writer.WriteLine(\"Task : {0} {1}\", eventEntry.Schema.Task, eventEntry.Schema.EventName);\n                writer.WriteLine(\"Version : {0}\", eventEntry.Schema.Version);\n                writer.WriteLine(\"Payload :{0}\", FormatPayload(eventEntry));\n                writer.WriteLine(\"Timestamp : {0}\", eventEntry.GetFormattedTimestamp(this.DateTimeFormat));\n            }\n            else\n            {\n                writer.WriteLine(\"EventId : {0}, Level : {1}, Message : {2}, Payload :{3}, Timestamp : {4}\",\n                    eventEntry.EventId,\n                    eventEntry.Schema.Level,\n                    eventEntry.FormattedMessage,\n                    FormatPayload(eventEntry),\n                    eventEntry.GetFormattedTimestamp(this.DateTimeFormat));\n            }\n\n            if (!string.IsNullOrWhiteSpace(this.Footer))\n            {\n                writer.WriteLine(this.Footer); \n            }\n\n            writer.WriteLine();\n\n            if (this.waitEvents != null)\n            {\n                waitEvents.Reset(); \n            }\n        }\n\n        public void Dispose()\n        {\n            this.Dispose(true);\n            GC.SuppressFinalize(this);\n        }\n\n        protected virtual void Dispose(bool disposing)\n        {\n            if (!this.disposed)\n            {\n                if (disposing)\n                {\n                    if (this.waitEvents != null)\n                    {\n                        this.waitEvents.Dispose();\n                    }\n                }\n\n                this.waitEvents = null;\n                this.disposed = true;\n            }\n        }\n\n        private static string FormatPayload(EventEntry entry)\n        {\n            var eventSchema = entry.Schema;\n            var sb = new StringBuilder();\n            for (int i = 0; i < entry.Payload.Count; i++)\n            {\n                try\n                {\n                    sb.AppendFormat(\" [{0} : {1}]\", eventSchema.Payload[i], entry.Payload[i]);\n                }\n                catch (Exception e)\n                {\n                    SemanticLoggingEventSource.Log.EventEntryTextWriterFailed(e.ToString());\n                    sb.AppendFormat(\" [{0} : {1}]\", \"Exception\", string.Format(CultureInfo.CurrentCulture, TextSerializationError, e.Message));\n                }\n            }\n            return sb.ToString();\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/MockConsoleListenerEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public sealed class MockConsoleListenerEventSource : EventSource\n    {\n        public const int InfoWithKeywordDiagnosticEventId = 1020;\n        public const int CriticalWithTaskNameEventId = 1500;\n\n        public static readonly MockConsoleListenerEventSource Logger = new MockConsoleListenerEventSource();\n\n        public class Keywords\n        {\n            public const EventKeywords Diagnostic = (EventKeywords)4;\n            public const EventKeywords Page = (EventKeywords)1;\n        }\n\n        public class Tasks\n        {\n            public const EventTask Page = (EventTask)1;\n            public const EventTask DbQuery = (EventTask)2;\n        }\n\n        [Event(401, Level = EventLevel.Informational, Keywords = EventKeywords.None, Message = \"Functional Test\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 1)]\n        public void InfoTest(string message) { this.WriteEvent(401, message); }\n\n        //There is no default color mapped to to Informational\n        [Event(100, Level = EventLevel.Informational)]\n        public void Informational(string message)\n        {\n            if (this.IsEnabled(EventLevel.Informational, EventKeywords.None))\n            {\n                this.WriteEvent(100, message); \n            }\n        }\n\n        [Event(200, Level = EventLevel.Critical, Keywords = EventKeywords.None, Message = \"Functional Test\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 0)]\n        public void Critical(string message) { this.WriteEvent(200, message); }\n\n        [Event(300, Level = EventLevel.Error, Keywords = EventKeywords.None, Message = \"Test Error\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 3)]\n        public void Error(string message) { this.WriteEvent(300, message); }\n\n        [Event(400, Level = EventLevel.Verbose, Keywords = EventKeywords.None, Message = \"Functional Test\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 1)]\n        public void Verbose(string message) { this.WriteEvent(400, message); }\n\n        [Event(500, Level = EventLevel.LogAlways, Keywords = EventKeywords.None, Message = \"Test LogAlways\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 5)]\n        public void LogAlways(string message) { this.WriteEvent(500, message); }\n\n        [Event(600, Level = EventLevel.Warning, Keywords = EventKeywords.None, Message = \"Test Warning\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 6)]\n        public void Warning(string message) { this.WriteEvent(600, message); }\n\n        [Event(InfoWithKeywordDiagnosticEventId, Level = EventLevel.Informational, Keywords = Keywords.Diagnostic, Task = Tasks.DbQuery)]\n        public void InfoWithKeywordDiagnostic(string message)\n        {\n            if (this.IsEnabled(EventLevel.Informational, Keywords.Diagnostic))\n            {\n                this.WriteEvent(InfoWithKeywordDiagnosticEventId, message); \n            }\n        }\n\n        [Event(CriticalWithTaskNameEventId, Level = EventLevel.Critical, Keywords = Keywords.Page, Task = Tasks.Page)]\n        public void CriticalWithTaskName(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(CriticalWithTaskNameEventId, message); \n            }\n        }\n\n        [Event(700, Level = EventLevel.Informational)]\n        public void Informational2(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(700, message); \n            }\n        }\n\n        [Event(800, Level = EventLevel.Critical, Keywords = EventKeywords.None, Message = \"Functional Test\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 0)]\n        public void CriticalWithRelatedActivityId(string message, Guid relatedActivityId)\n        {\n            this.WriteEventWithRelatedActivityId(800, relatedActivityId, message); \n        }\n    }\n\n    public sealed class MockHighEventIdEventSource : EventSource\n    {\n#if !EVENT_SOURCE_PACKAGE\n        private const int MaxEventId = 65535;\n#else\n        private const int MaxEventId = 65533;\n#endif\n\n        public static readonly MockHighEventIdEventSource HigheventIdLogger = new MockHighEventIdEventSource();\n\n        [Event(MaxEventId, Level = EventLevel.Warning, Keywords = EventKeywords.None, Message = \"Test Warning\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 6)]\n        public void Warning() { this.WriteEvent(MaxEventId); }\n    }\n\n#if !EVENT_SOURCE_PACKAGE\n    public sealed class MockNegativeEventIdEventSource : EventSource\n    {\n        public static readonly MockNegativeEventIdEventSource LoweventIdLogger = new MockNegativeEventIdEventSource();\n\n        [Event(-100, Level = EventLevel.Warning, Keywords = EventKeywords.None, Message = \"Test Warning\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 6)]\n        public void Warning() { this.WriteEvent(-100); }\n    }\n#endif\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/MockConsoleListenerEventSource2.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public sealed class MockConsoleListenerEventSource2 : EventSource\n    {\n        public static readonly MockConsoleListenerEventSource2 Logger = new MockConsoleListenerEventSource2();\n\n        //There is no default color mapped to to Informational\n        [Event(100, Level = EventLevel.Informational)]\n        public void Informational(string message)\n        {\n            if (this.IsEnabled(EventLevel.Informational, EventKeywords.None))\n            {\n                this.WriteEvent(100, message); \n            }\n        }\n\n        [Event(200, Level = EventLevel.Critical, Keywords = EventKeywords.None, Message = \"Functional Test\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 0)]\n        public void Critical(string message) { this.WriteEvent(200, message); }\n\n        [Event(300, Level = EventLevel.Error, Keywords = EventKeywords.None, Message = \"Test Error\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 3)]\n        public void Error(string message) { this.WriteEvent(300, message); }\n\n        [Event(400, Level = EventLevel.Verbose, Keywords = EventKeywords.None, Message = \"Functional Test\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 1)]\n        public void Verbose(string message) { this.WriteEvent(400, message); }\n\n        [Event(500, Level = EventLevel.LogAlways, Keywords = EventKeywords.None, Message = \"Test LogAlways\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 5)]\n        public void LogAlways(string message) { this.WriteEvent(500, message); }\n\n        [Event(600, Level = EventLevel.Warning, Keywords = EventKeywords.None, Message = \"Test Warning\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 6)]\n        public void Warning(string message) { this.WriteEvent(600, message); }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/MockConsoleOutputInterceptor.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.IO;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public class MockConsoleOutputInterceptor : IDisposable\n    {\n        private ConsoleWriter writer;\n        private TextWriter originalOutput;\n        private bool disposed;\n\n        public MockConsoleOutputInterceptor()\n        {\n            writer = new ConsoleWriter();\n            originalOutput = Console.Out;\n            Console.SetOut(writer);\n        }\n\n        public string Ouput\n        {\n            get { return writer.ToString(); }\n        }\n\n        public ConsoleColor OutputForegroundColor\n        {\n            get { return writer.ForegroundColor; }\n        }\n\n        public void Dispose()\n        {\n            this.Dispose(true);\n            GC.SuppressFinalize(this);\n        }\n\n        protected virtual void Dispose(bool disposing)\n        {\n            if (!this.disposed)\n            {\n                Console.SetOut(originalOutput);\n                if (disposing)\n                {\n                    if (this.writer != null)\n                    {\n                        this.writer.Dispose();\n                    }\n\n                    if (this.originalOutput != null)\n                    {\n                        this.originalOutput.Dispose();\n                    }\n                }\n\n                this.writer = null;\n                this.originalOutput = null;\n\n                this.disposed = true;\n            }\n        }\n\n        private class ConsoleWriter : StringWriter\n        {\n            public ConsoleColor ForegroundColor { get; private set; }\n\n            public override void Flush()\n            {\n                base.Flush();\n                this.ForegroundColor = Console.ForegroundColor;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/MockDateTimeProvider.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing System;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public class MockDateTimeProvider : RollingFlatFileSink.DateTimeProvider\n    {\n        public DateTime? OverrideCurrentDateTime = null;\n\n        public override DateTime CurrentDateTime\n        {\n            get\n            {\n                if (this.OverrideCurrentDateTime != null)\n                {\n                    return this.OverrideCurrentDateTime.Value; \n                }\n\n                return base.CurrentDateTime;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/MockEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public sealed class MockEventSource : EventSource\n    {\n        public const int ErrorWithKeywordDiagnosticEventId = 1020;\n        public const int CriticalWithKeywordPageEventId = 1021;\n        public const int InfoWithKeywordDiagnosticEventId = 1022;\n        public const int VerboseWithKeywordPageEventId = 1023;\n        public const int CriticalWithTaskNameEventId = 1500;\n\n        public static readonly MockEventSource Logger = new MockEventSource();\n\n        public class Keywords\n        {\n            public const EventKeywords Page = (EventKeywords)1;\n            public const EventKeywords Diagnostic = (EventKeywords)4;\n        }\n\n        public class Tasks\n        {\n            public const EventTask Page = (EventTask)1;\n            public const EventTask DBQuery = (EventTask)2;\n        }\n\n        [Event(1, Level = EventLevel.Informational)]\n        public void Informational(string message)\n        {\n            if (this.IsEnabled(EventLevel.Informational, EventKeywords.None))\n            {\n                this.WriteEvent(1, message); \n            }\n        }\n\n        [Event(2, Level = EventLevel.Critical, Keywords = EventKeywords.None, Message = \"Functional Test\", Opcode = EventOpcode.Info, Task = Tasks.DBQuery, Version = 0)]\n        public void Critical(string message) { this.WriteEvent(2, message); }\n\n        [Event(3, Level = EventLevel.Error, Keywords = EventKeywords.None, Message = \"Test Error\", Opcode = EventOpcode.Stop, Task = Tasks.DBQuery, Version = 3)]\n        public void Error(string message)\n        {\n            if (this.IsEnabled(EventLevel.Error, EventKeywords.None))\n            {\n                this.WriteEvent(3, message); \n            }\n        }\n\n        [Event(4, Level = EventLevel.Verbose, Keywords = EventKeywords.None, Message = \"Functional Test\", Opcode = EventOpcode.Info, Task = Tasks.Page, Version = 1)]\n        public void Verbose(string message) { this.WriteEvent(4, message); }\n\n        [Event(5, Level = EventLevel.LogAlways, Keywords = EventKeywords.None, Message = \"Test LogAlways\", Opcode = EventOpcode.Reply, Task = Tasks.DBQuery, Version = 5)]\n        public void LogAlways(string message) { this.WriteEvent(5, message); }\n\n        [Event(6, Level = EventLevel.Warning, Keywords = EventKeywords.None, Message = \"Test Warning\", Opcode = EventOpcode.Send, Task = Tasks.DBQuery, Version = 6)]\n        public void Warning(string message) { this.WriteEvent(6, message); }\n\n        [Event(7, Level = EventLevel.Warning, Keywords = EventKeywords.None, Message = \"Test OpCode\", Opcode = EventOpcode.Resume, Task = Tasks.DBQuery, Version = 6)]\n        public void WriteWithOpCode(string message) { this.WriteEvent(7, message); }\n\n        [Event(8, Level = EventLevel.Informational)]\n        public void LogSomeMessage(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(8, message); \n            }\n        }\n\n        [Event(ErrorWithKeywordDiagnosticEventId, Level = EventLevel.Error, Keywords = Keywords.Diagnostic)]\n        public void ErrorWithKeywordDiagnostic(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(ErrorWithKeywordDiagnosticEventId, message); \n            }\n        }\n\n        [Event(CriticalWithKeywordPageEventId, Level = EventLevel.Critical, Keywords = Keywords.Page)]\n        public void CriticalWithKeywordPage(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(CriticalWithKeywordPageEventId, message); \n            }\n        }\n\n        [Event(InfoWithKeywordDiagnosticEventId, Level = EventLevel.Informational, Keywords = Keywords.Diagnostic)]\n        public void InfoWithKeywordDiagnostic(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(InfoWithKeywordDiagnosticEventId, message); \n            }\n        }\n\n        [Event(VerboseWithKeywordPageEventId, Level = EventLevel.Verbose, Keywords = Keywords.Page)]\n        public void VerboseWithKeywordPage(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(VerboseWithKeywordPageEventId, message); \n            }\n        }\n\n        [Event(CriticalWithTaskNameEventId, Level = EventLevel.Critical, Keywords = Keywords.Page, Task = Tasks.Page, Opcode = EventOpcode.Suspend)]\n        public void CriticalWithTaskName(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(CriticalWithTaskNameEventId, message); \n            }\n        }\n\n        [Event(14, Level = EventLevel.Informational)]\n        public void InformationalWithRelatedActivityId(string message, Guid relatedActivityId)\n        {\n            if (this.IsEnabled(EventLevel.Informational, EventKeywords.None))\n            {\n                this.WriteEventWithRelatedActivityId(14, relatedActivityId, message);\n            }\n        }\n\n        [Event(15, Level = EventLevel.Critical, Keywords = EventKeywords.None, Message = \"Functional Test\", Opcode = EventOpcode.Resume, Task = Tasks.Page, Version = 0)]\n        public void CriticalWithRelatedActivityId(string message, Guid relatedActivityId)\n        {\n            this.WriteEventWithRelatedActivityId(15, relatedActivityId, message);\n        }\n    }\n\n    public sealed class MockEventSource2 : EventSource\n    {\n        public static readonly MockEventSource2 Logger = new MockEventSource2();\n\n        [Event(1, Level = EventLevel.Error, Keywords = EventKeywords.None, Message = \"Test Error\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 3)]\n        public void Error(string message) { this.WriteEvent(1, message); }\n    }\n    public sealed class MockEventSource3 : EventSource\n    {\n        public static readonly MockEventSource3 Logger = new MockEventSource3();\n\n        [Event(1, Level = EventLevel.Critical, Keywords = EventKeywords.None, Message = \"Functional Test\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 0)]\n        public void Critical(string message) { this.WriteEvent(1, message); }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/MockEventSourceNoTask.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public sealed class MockEventSourceNoTask : EventSource\n    {\n#if !EVENT_SOURCE_PACKAGE\n        private const int MaxEventId = 65535;\n#else\n        private const int MaxEventId = 65533;\n#endif\n\n        [Event(1, Level = EventLevel.Informational, Message = \"message param\")]\n        public void Informational(string message)\n        {\n            if (this.IsEnabled(EventLevel.Informational, EventKeywords.None))\n            {\n                this.WriteEvent(1, message); \n            }\n        }\n\n        [Event(2)]\n        public void NoTaskSpecfied1(int event3Arg0, int event3Arg1, int event3Arg2)\n        {\n            if (this.IsEnabled(EventLevel.Informational, EventKeywords.None))\n            {\n                this.WriteEvent(2, event3Arg0, event3Arg0, event3Arg2); \n            }\n        }\n\n        [Event(3)]\n        public void NoTaskSpecfied2(int event3Arg0, int event3Arg1, int event3Arg2)\n        {\n        }\n\n        public void Test(int event3Arg0, int event3Arg1, int event3Arg2)\n        {\n        }\n\n        public void NoTaskNoOpCode1(int event3Arg0, int event3Arg1, int event3Arg2)\n        {\n            if (this.IsEnabled(EventLevel.Informational, EventKeywords.None))\n            {\n                this.WriteEvent(5, event3Arg0, event3Arg0, event3Arg2); \n            }\n        }\n\n        [Event(6)]\n        public void DifferentTypes(string strArg, int longArg)\n        {\n            if (this.IsEnabled(EventLevel.Informational, EventKeywords.None))\n            {\n                this.WriteEvent(6, strArg, longArg); \n            }\n        }\n\n        [Event(7)]\n        public void DifferentTypesInverted(string strArg, long longArg, int intArg)\n        {\n            if (this.IsEnabled(EventLevel.Informational, EventKeywords.None))\n            {\n                this.WriteEvent(7, intArg, strArg, longArg); \n            }\n        }\n\n        [Event(8)]\n        public void AllSupportedTypes(short srtArg, int intArg, long lngArg, float fltArg, TestEnum enumArg, Guid guidArg)\n        {\n            if (this.IsEnabled(EventLevel.Informational, EventKeywords.None))\n            {\n                this.WriteEvent(8, srtArg, intArg, lngArg, fltArg, (int)enumArg, guidArg); \n            }\n        }\n\n        [Event(MaxEventId)]\n        public void MaxValues(string strArg, long longArg, int intArg)\n        {\n            if (this.IsEnabled(EventLevel.Informational, EventKeywords.None))\n            {\n                this.WriteEvent(MaxEventId, intArg, strArg, longArg); \n            }\n        }\n\n        [Event(9, Level = EventLevel.Informational)]\n        public void InformationalNoMessage(string message)\n        {\n            if (this.IsEnabled(EventLevel.Informational, EventKeywords.None))\n            {\n                this.WriteEvent(9, message); \n            }\n        }\n\n        [Event(10, Level = EventLevel.Informational, Message = \"**{0}**\")]\n        public void InformationalMessageFormat(string message)\n        {\n            if (this.IsEnabled(EventLevel.Informational, EventKeywords.None))\n            {\n                this.WriteEvent(10, message); \n            }\n        }\n\n        public static readonly MockEventSourceNoTask Logger = new MockEventSourceNoTask();\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/MockEventSourceOutProcEnum.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public sealed class MockEventSourceInProcEnum : EventSource\n    {\n        public static readonly MockEventSourceInProcEnum Logger = new MockEventSourceInProcEnum();\n\n        public class Tasks\n        {\n            public const EventTask Page = (EventTask)1;\n            public const EventTask DBQuery = (EventTask)2;\n        }\n\n        [Event(1)]\n        public void InformationalWithEnum(Message message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(1, message.ToString());\n            }\n        }\n\n        [Event(2)]\n        public void SendEnumsEvent15(MyColor a, MyFlags b)\n        {\n            this.WriteEvent(2, (int)a, (int)b);\n        }\n\n        [Event(3, Opcode = EventOpcode.Resume, Task = Tasks.Page)]\n        public void SendEnumsEvent16(MyColor a, MyFlags b)\n        {\n            this.WriteEvent(3, a, b);\n        }\n\n        [Event(4)]\n        public void SaveExpenseStarted(Guid expenseId)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(4, expenseId);\n            }\n        }\n\n        [Event(5, Opcode = EventOpcode.Resume, Task = Tasks.DBQuery)]\n        public void SendEnumsEvent17(MyColor a, MyFlags b)\n        {\n            this.WriteEvent(5, (int)a, (int)b);\n        }\n\n        public enum Message { LightMessage = 1, FullMessage = 2 }\n\n        public enum MyColor { Red, Blue, Green }\n\n        public enum MyFlags { Flag1 = 1, Flag2 = 2, Flag3 = 4 }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/MockEventSourceOutProcKeywords.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    [EventSource(Name = \"MockEventSourceInProcKeywords\")]\n    public sealed class MockEventSourceInProcKeywords : EventSource\n    {\n        public static readonly MockEventSourceInProcKeywords Logger = new MockEventSourceInProcKeywords();\n\n        [Event(1, Level = EventLevel.Informational, Keywords = Keywords.Page)]\n        public void InformationalPage(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(1, message); \n            }\n        }\n\n        [Event(2, Level = EventLevel.Informational, Keywords = Keywords.Database)]\n        public void InformationalDatabase(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(2, message); \n            }\n        }\n\n        [Event(3, Level = EventLevel.Informational, Keywords = Keywords.Diagnostic)]\n        public void InformationalDiagnostic(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(3, message); \n            }\n        }\n\n        public class Keywords\n        {\n            public const EventKeywords Page = (EventKeywords)1;\n            public const EventKeywords Database = (EventKeywords)2;\n            public const EventKeywords Diagnostic = (EventKeywords)4;\n            public const EventKeywords Perf = (EventKeywords)8;\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/MockEventSrcForJson.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public sealed class MockEventSrcForJson : EventSource\n    {\n        public const int UsingKeywordsEventID = 1;\n        public const int LogUsingMessageEventID = 2;\n        public const int LogUsingMessageWithRelatedActivityIdEventID = 3;\n        public const string LogMessage = @\" Test Message\";\n\n        public static readonly MockEventSrcForJson Logger = new MockEventSrcForJson();\n\n        public class Keywords\n        {\n            public const EventKeywords Errors = (EventKeywords)0x0001;\n            public const EventKeywords Trace = (EventKeywords)0x0002;\n        }\n\n        public class Tasks\n        {\n            public const EventTask Page = (EventTask)1;\n            public const EventTask DBQuery = (EventTask)2;\n        }\n\n        [Event(UsingKeywordsEventID, Level = EventLevel.Informational, Opcode = EventOpcode.Start, Task = Tasks.DBQuery, Keywords = Keywords.Errors)]\n        public void UsingKeywords(string message, long longArg)\n        {\n            if (this.IsEnabled(EventLevel.Informational, Keywords.Errors))\n            {\n                this.WriteEvent(UsingKeywordsEventID, message, longArg);\n            }\n        }\n\n        [Event(LogUsingMessageEventID, Level = EventLevel.Informational, Opcode = EventOpcode.Start, Task = Tasks.Page, Message = LogMessage)]\n        public void LogUsingMessage(string message)\n        {\n            if (this.IsEnabled(EventLevel.Informational, Keywords.Errors))\n            {\n                this.WriteEvent(LogUsingMessageEventID, message);\n            }\n        }\n\n        [Event(LogUsingMessageWithRelatedActivityIdEventID, Level = EventLevel.Informational, Opcode = EventOpcode.Stop, Task = Tasks.DBQuery, Message = LogMessage)]\n        public void LogUsingMessageWithRelatedActivityId(string message, Guid relatedActivityId)\n        {\n            if (this.IsEnabled(EventLevel.Informational, Keywords.Errors))\n            {\n                this.WriteEventWithRelatedActivityId(LogUsingMessageWithRelatedActivityIdEventID, relatedActivityId, message);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/MockEventSrcForXml.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public sealed class MockEventSrcForXml : EventSource\n    {\n        public const int UsingKeywordsEventID = 1;\n        public const int LogUsingMessageEventID = 2;\n        public const int LogUsingMessageFormatEventID = 3;\n        public const int LogMessageEventID = 4;\n        public const int LogUsingMessageWithRelatedActivityIdEventID = 5;\n        public const string LogMessage = @\"Test Message /\";\n\n        public static readonly MockEventSrcForXml Logger = new MockEventSrcForXml();\n\n        public class Keywords\n        {\n            public const EventKeywords Errors = (EventKeywords)0x0001;\n            public const EventKeywords Trace = (EventKeywords)0x0002;\n        }\n\n        public class Tasks\n        {\n            public const EventTask Page = (EventTask)1;\n            public const EventTask DBQuery = (EventTask)2;\n        }\n\n        [Event(UsingKeywordsEventID, Level = EventLevel.Informational, Opcode = EventOpcode.Start, Task = Tasks.DBQuery, Keywords = Keywords.Errors)]\n        public void UsingKeywords(string message, long longArg)\n        {\n            if (this.IsEnabled(EventLevel.Informational, Keywords.Errors))\n            {\n                this.WriteEvent(UsingKeywordsEventID, message, longArg); \n            }\n        }\n\n        [Event(LogUsingMessageEventID, Level = EventLevel.Informational, Opcode = EventOpcode.Start, Task = Tasks.Page, Message = LogMessage)]\n        public void LogUsingMessage(string message)\n        {\n            if (this.IsEnabled(EventLevel.Informational, Keywords.Errors))\n            {\n                this.WriteEvent(LogUsingMessageEventID, message); \n            }\n        }\n\n        [Event(LogUsingMessageFormatEventID, Level = EventLevel.Informational, Opcode = EventOpcode.Stop, Task = Tasks.DBQuery, Message = \"{0}\")]\n        public void LogUsingMessageFormat(string message)\n        {\n            if (this.IsEnabled(EventLevel.Informational, Keywords.Errors))\n            {\n                this.WriteEvent(LogUsingMessageFormatEventID, message); \n            }\n        }\n\n        [Event(LogUsingMessageWithRelatedActivityIdEventID, Level = EventLevel.Informational, Opcode = EventOpcode.Stop, Task = Tasks.Page, Message = LogMessage)]\n        internal void LogUsingMessageWithRelatedActivityId(string message, Guid relatedActivityId)\n        {\n            if (this.IsEnabled(EventLevel.Informational, Keywords.Errors))\n            {\n                this.WriteEventWithRelatedActivityId(LogUsingMessageWithRelatedActivityIdEventID, relatedActivityId, message);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/MockFormatter.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.IO;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public class MockFormatter : IEventTextFormatter\n    {\n        private bool throwOnWrite;\n\n        public MockFormatter()\n            : this(false)\n        {\n        }\n\n        public MockFormatter(bool throwOnWrite)\n        {\n            this.throwOnWrite = throwOnWrite;\n        }\n\n        public List<Tuple<EventEntry, TextWriter>> WriteEventCalls = new List<Tuple<EventEntry, TextWriter>>();\n\n        public string Header { get; set; }\n        public string Footer { get; set; }\n\n        public void WriteEvent(EventEntry eventEntry, TextWriter writer)\n        {\n            if (throwOnWrite)\n            {\n                throw new InvalidOperationException(); \n            }\n\n            this.WriteEventCalls.Add(Tuple.Create(eventEntry, writer));\n            if (eventEntry.Payload.Count > 0)\n            {\n                writer.Write(eventEntry.Payload[0]); \n            }\n        }\n\n        public EventLevel Detailed { get; set; }\n\n        public string DateTimeFormat { get; set; }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/MockFormatter2.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.IO;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public class MockFormatter2 : IEventTextFormatter\n    {\n        private bool throwOnWrite;\n\n        public MockFormatter2()\n            : this(false)\n        {\n        }\n\n        public MockFormatter2(bool throwOnWrite)\n        {\n            this.throwOnWrite = throwOnWrite;\n        }\n\n        public List<Tuple<EventEntry, TextWriter>> WriteEventCalls = new List<Tuple<EventEntry, TextWriter>>();\n\n        public string Header { get; set; }\n        public string Footer { get; set; }\n\n        public void WriteEvent(EventEntry eventEntry, TextWriter writer)\n        {\n            writer.Close();\n            writer.Write(eventEntry.FormattedMessage ?? (object)eventEntry.Payload);\n        }\n\n        public EventLevel Detailed { get; set; }\n\n        public string DateTimeFormat { get; set; }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/MockFormatter3.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public class MockFormatter3 : IEventTextFormatter\n    {\n        /// <summary>\n        /// The dash separator\n        /// </summary>\n        public const string DashSeparator = \"----------------------------------------\";\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventTextFormatter\" /> class.\n        /// </summary>\n        public MockFormatter3()\n            : this(null, null)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventTextFormatter\" /> class.\n        /// </summary>\n        /// <param name=\"header\">The header.</param>\n        public MockFormatter3(string header)\n            : this(header, null)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventTextFormatter\" /> class.\n        /// </summary>\n        /// <param name=\"header\">The header.</param>\n        /// <param name=\"footer\">The footer.</param>\n        public MockFormatter3(string header, string footer)\n        {\n            this.Header = header;\n            this.Footer = footer;\n            this.Detailed = EventLevel.Informational;\n        }\n\n        /// <summary>\n        /// Gets or sets the header\n        /// </summary>\n        public string Header { get; set; }\n\n        /// <summary>\n        /// Gets or sets the footer\n        /// </summary>\n        public string Footer { get; set; }\n\n        /// <summary>\n        /// Gets or sets the lowest <see cref=\"EventLevel\" /> value where the formatted output provides all the event entry information.\n        /// Otherwise a summarized content of the event entry will be written.\n        /// </summary>\n        public EventLevel Detailed { get; set; }\n\n        /// <summary>\n        /// Gets or sets the date time format used for timestamp value.\n        /// </summary>\n        /// <value>\n        /// The date time format.\n        /// </value>\n        public string DateTimeFormat { get; set; }\n\n        /// <summary>\n        /// Writes the event.\n        /// </summary>\n        /// <param name=\"eventData\">The <see cref=\"EventWrittenEventArgs\" /> instance containing the event data.</param>\n        /// <param name=\"writer\">The writer.</param>\n        public void WriteEvent(EventEntry eventEntry, TextWriter writer)\n        {\n            // Write header\n            if (!string.IsNullOrWhiteSpace(this.Header))\n            {\n                writer.WriteLine(this.Header); \n            }\n\n            if (eventEntry.Payload.First().ToString() == \"error\")\n            {\n                writer.WriteLine(\"This is an entry containing and error and should not be logged\");\n                throw new InvalidOperationException(\"error\");\n            }\n\n            if (eventEntry.Schema.Level >= this.Detailed)\n            {\n                // Write properties\n                writer.WriteLine(\"SourceId : {0}\", eventEntry.ProviderId);\n                writer.WriteLine(\"EventId : {0}\", eventEntry.EventId);\n                writer.WriteLine(\"Keywords : {0}\", eventEntry.Schema.Keywords);\n                writer.WriteLine(\"Level : {0}\", eventEntry.Schema.Level);\n                writer.WriteLine(\"Message : {0}\", eventEntry.FormattedMessage);\n                writer.WriteLine(\"Opcode : {0}\", eventEntry.Schema.Opcode);\n                writer.WriteLine(\"Task : {0} {1}\", eventEntry.Schema.Task, eventEntry.Schema.EventName);\n                writer.WriteLine(\"Version : {0}\", eventEntry.Schema.Version);\n                writer.WriteLine(\"Payload :{0}\", FormatPayload(eventEntry));\n                writer.WriteLine(\"Timestamp : {0}\", eventEntry.GetFormattedTimestamp(this.DateTimeFormat));\n            }\n            else\n            {\n                writer.WriteLine(\"EventId : {0}, Level : {1}, Message : {2}, Payload :{3}, Timestamp : {4}\",\n                    eventEntry.EventId,\n                    eventEntry.Schema.Level,\n                    eventEntry.FormattedMessage,\n                    FormatPayload(eventEntry),\n                    eventEntry.GetFormattedTimestamp(this.DateTimeFormat));\n            }\n\n            // Write footer\n            if (!string.IsNullOrWhiteSpace(this.Footer))\n            {\n                writer.WriteLine(this.Footer); \n            }\n\n            writer.WriteLine();\n        }\n\n        private static string FormatPayload(EventEntry entry)\n        {\n            var eventSchema = entry.Schema;\n            var sb = new StringBuilder();\n            for (int i = 0; i < entry.Payload.Count; i++)\n            {\n                try\n                {\n                    sb.AppendFormat(\" [{0} : {1}]\", eventSchema.Payload[i], entry.Payload[i]);\n                }\n                catch (Exception e)\n                {\n                    SemanticLoggingEventSource.Log.EventEntryTextWriterFailed(e.ToString());\n                    sb.AppendFormat(\" [{0} : {1}]\", \"Exception\", string.Format(CultureInfo.CurrentCulture, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Properties.Resources.TextSerializationError, e.Message));\n                }\n            }\n\n            return sb.ToString();\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/TestAttributesEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public sealed class TestAttributesEventSource : EventSource\n    {\n        public static readonly TestAttributesEventSource Logger = new TestAttributesEventSource();\n\n        [Event(103, Opcode = EventOpcode.Reply, Version = 0x02, Task = Tasks.DBQuery, Message = \"arg1- {0},arg2- {1},arg3- {2}\")]\n        public void NonDefaultOpcodeNonDefaultVersionEvent(int arg1, int arg2, int arg3)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(103, arg1, arg2, arg3);\n            }\n        }\n        [Event(104)]\n        public void NoTaskSpecfied(int arg1, int arg2, int arg3)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(104, arg1, arg3, arg3);\n            }\n        }\n\n        [Event(105)]\n        public void NoTaskSpecfied2(int arg1, int arg2, int arg3)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(105, arg1, arg3, arg3);\n            }\n        }\n\n        public class Keywords\n        {\n            public const EventKeywords Database = (EventKeywords)0x0001;\n            public const EventKeywords UILayer = (EventKeywords)0x0002;\n            public const EventKeywords BusinessLayer = (EventKeywords)0x0004;\n        }\n\n        public class Tasks\n        {\n            public const EventTask DBQuery = (EventTask)1;\n            public const EventTask PageLoad = (EventTask)2;\n            public const EventTask Transaction = (EventTask)3;\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/TestEnum.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public enum TestEnum\n    {\n        value1,\n        value2,\n        value3\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/TestEventEntry.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public class TestEventEntry\n    {\n        public int EventId { get; set; }\n\n        public Guid ProviderId { get; set; }\n\n        public string ProviderName { get; set; }\n\n        public string Message { get; set; }\n\n        public EventKeywords EventKeywords { get; set; }\n\n        public EventLevel Level { get; set; }\n\n        public EventOpcode Opcode { get; set; }\n\n        public EventTask Task { get; set; }\n\n        public byte Version { get; set; }\n\n        public Dictionary<string, object> Payload { get; set; }\n\n        public DateTimeOffset Timestamp { get; set; }\n\n        public Guid ActivityId { get; set; }\n\n        public Guid RelatedActivityId { get; set; }\n\n        public int ProcessId { get; set; }\n\n        public int ThreadId { get; set; }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/TestEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public sealed class TestEventSource : EventSource\n    {\n        public const int InformationalEventId = 4;\n        public const int AuditSuccessEventId = 20;\n        public const int ErrorEventId = 5;\n        public const int CriticalEventId = 6;\n        public const int LogAlwaysEventId = 7;\n        public const int VerboseEventId = 100;\n        public const int NonDefaultOpcodeNonDefaultVersionEventId = 103;\n        public const int EventWithoutPayloadNorMessageId = 200;\n        public const int EventWithPayloadId = 201;\n        public const int EventWithMessageId = 202;\n        public const int EventWithPayloadAndMessageId = 203;\n        public const int EventIdForAllParameters = 150;\n        public const int EventWithMultiplePayloadsId = 205;\n        public const int ErrorWithKeywordDiagnosticEventId = 1020;\n        public const int CriticalWithKeywordPageEventId = 1021;\n        public const int CriticalWithTaskNameEventId = 1500;\n\n        public static readonly TestEventSource Logger = new TestEventSource();\n\n        public class Keywords\n        {\n            public const EventKeywords Page = (EventKeywords)1;\n            public const EventKeywords DataBase = (EventKeywords)2;\n            public const EventKeywords Diagnostic = (EventKeywords)4;\n            public const EventKeywords Perf = (EventKeywords)8;\n        }\n\n        public class Tasks\n        {\n            public const EventTask Page = (EventTask)1;\n            public const EventTask DBQuery = (EventTask)2;\n        }\n\n        [Event(InformationalEventId, Level = EventLevel.Informational)]\n        public void Informational(string message)\n        {\n            if (this.IsEnabled(EventLevel.Informational, EventKeywords.None))\n            {\n                this.WriteEvent(InformationalEventId, message); \n            }\n        }\n\n        [Event(ErrorEventId, Level = EventLevel.Error)]\n        public void Error(string message)\n        {\n            if (this.IsEnabled(EventLevel.Error, EventKeywords.None))\n            {\n                this.WriteEvent(ErrorEventId, message); \n            }\n        }\n\n        [Event(CriticalEventId, Level = EventLevel.Critical)]\n        public void Critical(string message)\n        {\n            if (this.IsEnabled(EventLevel.Critical, EventKeywords.None))\n            {\n                this.WriteEvent(CriticalEventId, message); \n            }\n        }\n\n        [Event(VerboseEventId, Level = EventLevel.Verbose)]\n        public void Write(string message) { this.WriteEvent(VerboseEventId, message); }\n\n        [Event(EventWithoutPayloadNorMessageId, Level = EventLevel.Warning)]\n        public void EventWithoutPayloadNorMessage()\n        {\n            if (this.IsEnabled(EventLevel.Warning, EventKeywords.None))\n            {\n                this.WriteEvent(EventWithoutPayloadNorMessageId); \n            }\n        }\n\n        [Event(EventWithPayloadId, Level = EventLevel.Warning)]\n        public void EventWithPayload(string payload1, int payload2)\n        {\n            if (this.IsEnabled(EventLevel.Warning, EventKeywords.None))\n            {\n                this.WriteEvent(EventWithPayloadId, payload1, payload2); \n            }\n        }\n\n        [Event(EventWithMultiplePayloadsId, Level = EventLevel.Warning)]\n        public void EventWithMultiplePayloads(string payload1, string payload2, string payload3)\n        {\n            if (this.IsEnabled(EventLevel.Warning, EventKeywords.None))\n            {\n                this.WriteEvent(EventWithMultiplePayloadsId, payload1, payload2, payload3); \n            }\n        }\n\n        [Event(EventWithMessageId, Level = EventLevel.Warning, Message = \"Test message\")]\n        public void EventWithMessage()\n        {\n            if (this.IsEnabled(EventLevel.Warning, EventKeywords.None))\n            {\n                this.WriteEvent(EventWithMessageId); \n            }\n        }\n\n        [Event(EventWithPayloadAndMessageId, Level = EventLevel.Warning, Message = \"Test message {0} {1}\")]\n        public void EventWithPayloadAndMessage(string payload1, int payload2)\n        {\n            if (this.IsEnabled(EventLevel.Warning, EventKeywords.None))\n            {\n                this.WriteEvent(EventWithPayloadAndMessageId, payload1, payload2); \n            }\n        }\n\n        [Event(EventIdForAllParameters, Keywords = EventKeywords.None, Level = EventLevel.Informational, Message = \"Test All Parameters\", Opcode = EventOpcode.Info, Task = EventTask.None, Version = 3)]\n        public void AllParameters()\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(EventIdForAllParameters); \n            }\n        }\n\n        [Event(10001, Keywords = Keywords.Page, Level = EventLevel.Informational, Message = \"Test All Parameters with custom values\", Opcode = EventOpcode.Info, Task = Tasks.Page, Version = 3)]\n        public void AllParametersWithCustomValues()\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(10001); \n            }\n        }\n\n        [Event(ErrorWithKeywordDiagnosticEventId, Level = EventLevel.Error, Keywords = Keywords.Diagnostic)]\n        public void ErrorWithKeywordDiagnostic(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(ErrorWithKeywordDiagnosticEventId, message); \n            }\n        }\n\n        [Event(CriticalWithKeywordPageEventId, Level = EventLevel.Critical, Keywords = Keywords.Page)]\n        public void CriticalWithKeywordPage(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(CriticalWithKeywordPageEventId, message); \n            }\n        }\n\n        [Event(CriticalWithTaskNameEventId, Level = EventLevel.Critical, Keywords = Keywords.Page, Task = Tasks.DBQuery)]\n        public void CriticalWithTaskName(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(CriticalWithTaskNameEventId, message); \n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/TestEventSourceNoAttributes.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public sealed class TestEventSourceNoAttributes : EventSource\n    {\n        public static readonly TestEventSourceNoAttributes Logger = new TestEventSourceNoAttributes();\n\n        public void NoArgEvent1() \n        { \n            if (this.IsEnabled())\n            {\n                this.WriteEvent(1);  \n            }\n        }\n\n        public void IntArgEvent2(int arg) \n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(2, arg); \n            }\n        }\n\n        public void LongArgEvent3(long arg) \n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(3, arg); \n            }\n        }\n\n        [Event(4, Message = \"Check if it is logged\")]\n        public void ObjectArrayEvent4(int arg0, string arg1, int arg2, string arg3, int arg4)\n        {\n            if (this.IsEnabled())\n            {\n                object[] args = new object[5];\n                args[0] = arg0; \n                args[1] = (object)arg1; \n                args[2] = arg2; \n                args[3] = arg3; \n                args[4] = arg4;\n                this.WriteEvent(4, args);\n            }\n        }\n\n        public void StringArgEvent5(string arg) \n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(5, arg); \n            }\n        }\n\n        public void TwoIntArgEvent6(int arg1, int arg2)\n        { \n            if (this.IsEnabled())\n            {\n                this.WriteEvent(6, arg1, arg2); \n            }\n        }\n\n        public void TwoLongArgEvent7(long arg1, long arg2) \n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(7, arg1, arg2); \n            }\n        }\n\n        public void StringAndIntArgEvent8(string arg1, int arg2) \n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(8, arg1, arg2); \n            }\n        }\n\n        public void StringAndLongArgEvent9(string arg1, long arg2) \n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(9, arg1, arg2); \n            }\n        }\n\n        public void StringAndStringArgEvent10(string arg1, string arg2) \n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(10, arg1, arg2); \n            }\n        }\n\n        public void ThreeIntArgEvent11(int arg1, int arg2, int arg3) \n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(11, arg1, arg2, arg3); \n            }\n        }\n\n        public void ThreeLongArgEvent12(long arg1, long arg2, long arg3) \n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(12, arg1, arg2, arg3); \n            }\n        }\n\n        public void StringAndTwoIntArgEvent13(string arg1, int arg2, int arg3) \n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(13, arg1, arg2, arg3); \n            }\n        }\n\n        public void ThreeStringArgEvent14(string arg1, string arg2, string arg3) \n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(14, arg1, arg2, arg3); \n            }\n        }\n\n        public void SendEnumsEvent15(MyColor color, MyFlags flags) \n        {\n            this.WriteEvent(15, (int)color, (int)flags);\n        }\n\n        public void IntArgEventWithRelatedActivityId(int arg, Guid relatedActivityId)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEventWithRelatedActivityId(16, relatedActivityId, arg);\n            }\n        }\n    }\n\n    public enum MyColor\n    {\n        Red,\n        Blue,\n        Green,\n    }\n\n    [Flags]\n    public enum MyFlags\n    {\n        Flag1 = 1,\n        Flag2 = 2,\n        Flag3 = 4,\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestObjects/TestEventSourceNonTransient.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestObjects\n{\n    public sealed class TestEventSourceNonTransient : EventSource\n    {\n        public const int InformationalEventId = 4;\n        public const int AuditSuccessEventId = 20;\n        public const int ErrorEventId = 5;\n        public const int CriticalEventId = 6;\n        public const int LogAlwaysEventId = 7;\n        public const int VerboseEventId = 100;\n        public const int NonDefaultOpcodeNonDefaultVersionEventId = 103;\n        public const int EventWithoutPayloadNorMessageId = 200;\n        public const int EventWithPayloadId = 201;\n        public const int EventWithMessageId = 202;\n        public const int EventWithPayloadAndMessageId = 203;\n        public const int EventIdForAllParameters = 150;\n        public const int EventWithMultiplePayloadsId = 205;\n\n        public static readonly TestEventSourceNonTransient Logger = new TestEventSourceNonTransient();\n\n        public class Keywords\n        {\n            public const EventKeywords Page = (EventKeywords)1;\n            public const EventKeywords DataBase = (EventKeywords)2;\n            public const EventKeywords Diagnostic = (EventKeywords)4;\n            public const EventKeywords Perf = (EventKeywords)8;\n        }\n\n        public class Tasks\n        {\n            public const EventTask Page = (EventTask)1;\n            public const EventTask DBQuery = (EventTask)2;\n        }\n\n        [Event(EventWithPayloadId, Level = EventLevel.Warning)]\n        public void EventWithPayload(string payload1, int payload2)\n        {\n            if (this.IsEnabled(EventLevel.Warning, EventKeywords.None))\n            {\n                this.WriteEvent(EventWithPayloadId, payload1, payload2); \n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/TestScenarios/TestScenario.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests.TestScenarios\n{\n    internal static class TestScenario\n    {\n        public static void With1Listener(EventSource logger, Action<ObservableEventListener> scenario)\n        {\n            With1Listener(new[] { logger }, scenario);\n        }\n\n        public static void With1Listener(EventSource logger, Action<ObservableEventListener, InMemoryEventListener> scenario)\n        {\n            With1Listener(new[] { logger }, scenario);\n        }\n\n        public static void With1Listener(IEnumerable<EventSource> loggers, Action<ObservableEventListener> scenario)\n        {\n            With1Listener(loggers, (listener, notUsedErrorListener) => scenario(listener));\n        }\n\n        public static void With1Listener(IEnumerable<EventSource> loggers, Action<ObservableEventListener, InMemoryEventListener> scenario)\n        {\n            using (var errorsListener = new InMemoryEventListener())\n            using (var listener = new ObservableEventListener())\n            {\n                try\n                {\n                    errorsListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Verbose, Keywords.All);\n\n                    scenario(listener, errorsListener);\n                }\n                finally\n                {\n                    foreach (var logger in loggers)\n                    {\n                        try\n                        { listener.DisableEvents(logger); }\n                        catch\n                        { }\n                    }\n\n                    errorsListener.DisableEvents(SemanticLoggingEventSource.Log);\n                }\n            }\n        }\n\n        public static void With2Listeners(EventSource logger, Action<ObservableEventListener, ObservableEventListener> scenario)\n        {\n            using (var listener1 = new ObservableEventListener())\n            using (var listener2 = new ObservableEventListener())\n            {\n                try\n                {\n                    scenario(listener1, listener2);\n                }\n                finally\n                {\n                    try\n                    { listener1.DisableEvents(logger); }\n                    catch\n                    { }\n\n                    try\n                    { listener2.DisableEvents(logger); }\n                    catch\n                    { }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.InProc.Tests/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"Microsoft.Data.Edm\" version=\"5.6.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Data.OData\" version=\"5.6.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Data.Services.Client\" version=\"5.6.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.WindowsAzure.ConfigurationManager\" version=\"2.0.3\" targetFramework=\"net45\" />\n  <package id=\"Newtonsoft.Json\" version=\"5.0.8\" targetFramework=\"net45\" />\n  <package id=\"System.Spatial\" version=\"5.6.0\" targetFramework=\"net45\" />\n  <package id=\"WindowsAzure.Storage\" version=\"3.0.2.0\" targetFramework=\"net45\" />\n  <package id=\"StyleCop.MSBuild\" version=\"4.7.49.0\" targetFramework=\"net45\" developmentDependency=\"true\" />\n</packages>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/App.config",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n  <connectionStrings>\n    <add name=\"valid\" connectionString=\"Data Source=(localdb)\\v11.0; Initial Catalog=Logging;Integrated Security=True\" providerName=\"System.Data.SqlClient\"/>\n  </connectionStrings>\n  <appSettings>\n    <!-- Use the Windows Azure storage emulator. Make sure to start it before running the tests. -->\n    <add key=\"StorageConnectionString\" value=\"UseDevelopmentStorage=true\"/>\n    <!-- You can also use a real Azure Storage account by configuring the connection string below. -->\n    <!--<add key=\"StorageConnectionString\" value=\"DefaultEndpointsProtocol=https;AccountName=[AccountName];AccountKey=[AccountKey]\" />-->\n\n    <add key=\"ElasticsearchUri\" value=\"http://localhost:9200\" />\n  </appSettings>\n  <runtime>\n    <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">\n      <dependentAssembly>\n        <assemblyIdentity name=\"Microsoft.Data.OData\" publicKeyToken=\"31bf3856ad364e35\" culture=\"neutral\"/>\n        <bindingRedirect oldVersion=\"0.0.0.0-5.6.0.0\" newVersion=\"5.6.0.0\"/>\n      </dependentAssembly>\n      <dependentAssembly>\n        <assemblyIdentity name=\"System.Spatial\" publicKeyToken=\"31bf3856ad364e35\" culture=\"neutral\"/>\n        <bindingRedirect oldVersion=\"0.0.0.0-5.2.0.0\" newVersion=\"5.2.0.0\"/>\n      </dependentAssembly>\n    </assemblyBinding>\n  </runtime>\n<startup><supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.5.1\"/></startup></configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/AzureTables/AzureTables.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <windowsAzureTableSink name=\"AzureTablesEventListener\" instanceName=\"mytestinstance\" bufferingIntervalInSeconds=\"1\" sortKeysAscending=\"0\" connectionString=\"UseDevelopmentStorage=true\" tableAddress=\"outProcazuretablesusingconfig\" bufferingFlushAllTimeoutInSeconds=\"1\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    </windowsAzureTableSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/AzureTables/AzureTablesEmptyConnectionString.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <windowsAzureTableSink name=\"AzureTablesEventListener\" tableAddress=\"testingTableName\" instanceName=\"mytestinstance\" bufferingIntervalInSeconds=\"1\" sortKeysAscending=\"0\" connectionString=\"\" >\n      <sources>\n        <eventSource name=\"MyEventSource\" id=\"659518be-d338-564b-2759-c63c10ef82e2\" />\n      </sources>\n    </windowsAzureTableSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/AzureTables/AzureTablesEmptyInstanceName.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <windowsAzureTableSink name=\"AzureTablesEventListener\" tableAddress=\"testingTableName\" instanceName=\"\" bufferingIntervalInSeconds=\"1\" sortKeysAscending=\"0\" connectionString=\"UseDevelopmentStorage=true\" >\n      <sources>\n        <eventSource name=\"MyEventSource\" id=\"659518be-d338-564b-2759-c63c10ef82e2\" />\n      </sources>\n    </windowsAzureTableSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/AzureTables/AzureTablesEmptyTableAddress.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <windowsAzureTableSink name=\"AzureTablesEventListener\" tableAddress=\"\" instanceName=\"mytestinstance\" bufferingIntervalInSeconds=\"1\" sortKeysAscending=\"0\" connectionString=\"UseDevelopmentStorage=true\" >\n      <sources>\n        <eventSource name=\"MyEventSource\" id=\"659518be-d338-564b-2759-c63c10ef82e2\" />\n      </sources>\n    </windowsAzureTableSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/AzureTables/AzureTablesMaxBufferSize.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <windowsAzureTableSink name=\"AzureTablesEventListener\" instanceName=\"mytestinstance\" sortKeysAscending=\"0\" connectionString=\"UseDevelopmentStorage=true\" maxBufferSize=\"10000\"  bufferingIntervalInSeconds=\"3600\" >\n      <sources>\n        <eventSource name=\"MyEventSource\" />\n      </sources>\n    </windowsAzureTableSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/AzureTables/AzureTablesMaxBufferSizeEmpty.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <windowsAzureTableSink name=\"AzureTablesEventListener\" instanceName=\"mytestinstance\" sortKeysAscending=\"0\" connectionString=\"UseDevelopmentStorage=true\" maxBufferSize=\"\"  bufferingIntervalInSeconds=\"3600\" >\n      <sources>\n        <eventSource name=\"MyEventSource\" />\n      </sources>\n    </windowsAzureTableSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/AzureTables/AzureTablesMaxBufferSizeValidation.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <windowsAzureTableSink name=\"AzureTablesEventListener\" instanceName=\"mytestinstance\" sortKeysAscending=\"0\" connectionString=\"UseDevelopmentStorage=true\" maxBufferSize=\"200\" >\n      <sources>\n        <eventSource name=\"MyEventSource\" />\n      </sources>\n    </windowsAzureTableSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/AzureTables/AzureTablesMissingConnectionString.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <windowsAzureTableSink name=\"AzureTablesEventListener\" tableAddress=\"testingTableName\" instanceName=\"mytestinstance\" bufferingIntervalInSeconds=\"1\" sortKeysAscending=\"0\"  >\n      <sources>\n        <eventSource name=\"MyEventSource\"  />\n      </sources>\n    </windowsAzureTableSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/AzureTables/AzureTablesMissingInstanceName.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <windowsAzureTableSink name=\"AzureTablesEventListener\" tableAddress=\"testingTableName\" bufferingIntervalInSeconds=\"1\" sortKeysAscending=\"0\" connectionString=\"UseDevelopmentStorage=true\" >\n      <sources>\n        <eventSource name=\"MyEventSource\"  />\n      </sources>\n    </windowsAzureTableSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/AzureTables/AzureTablesMissingTableAddress.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <windowsAzureTableSink name=\"AzureTablesEventListener\"  instanceName=\"mytestinstance\" bufferingIntervalInSeconds=\"1\" sortKeysAscending=\"0\" connectionString=\"UseDevelopmentStorage=true\" >\n      <sources>\n        <eventSource name=\"MyEventSource\"  />\n      </sources>\n    </windowsAzureTableSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/BasicConfig.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <consoleSink name=\"consoleSink\" >\n      <sources>\n        <eventSource  name=\"TestEventSource\" />\n      </sources>\n    </consoleSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/BasicConfigError.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <customSink name=\"customListener\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects.Foo, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests\" >\n      <sources>\n        <eventSource  name=\"MyEventSource\" id=\"659518be-d338-564b-2759-c63c10ef82e2\" />\n      </sources>\n    </customSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/BasicConfigMissingAssembly.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <customSink name=\"customListener\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Mocks.InMemoryEventListener, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\">\n      <sources>\n        <eventSource  name=\"MyEventSource\" id=\"659518be-d338-564b-2759-c63c10ef82e2\" />\n      </sources>\n    </customSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/BasicConfigNoEventSourceIdentifier.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <consoleSink name=\"consoleSink\">\n      <sources>\n        <eventSource />\n      </sources>\n    </consoleSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/BasicConfigOnylGuid.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <consoleSink name=\"consoleSink\">\n      <sources>\n        <eventSource id=\"659518be-d338-564b-2759-c63c10ef82e2\" />\n      </sources>\n    </consoleSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/BasicConfigSourceNameAndId.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <consoleSink name=\"consoleSink\" >\n      <sources>\n        <eventSource  name=\"MockEventSourceOutProc\" id=\"bae7ce7c-69bf-5ff9-af64-84f174de2d45\" />\n      </sources>\n    </consoleSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/BasicConfigWithNoGuid.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <consoleSink name=\"consoleSink\">\n      <sources>\n        <eventSource  name=\"TestEventSource\" />\n      </sources>\n    </consoleSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/BasicConfigWrongType.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <customSink name=\"customListener\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects.Foo, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests\">\n      <sources>\n        <eventSource  name=\"MyEventSource\" id=\"659518be-d338-564b-2759-c63c10ef82e2\" />\n      </sources>\n    </customSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/ConfigSessionNameEmpty.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"\"/>\n  <sinks>\n    <customSink name=\"customListener\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Mocks.InMemoryEventListenerDual, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\">\n      <sources>\n        <eventSource  name=\"MyEventSource\" id=\"659518be-d338-564b-2759-c63c10ef82e2\" />\n      </sources>\n    </customSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Console/Console.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <consoleSink name=\"ConsoleEventListener\" colorMapperType=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.DefaultConsoleColorMapper, Microsoft.Practices.EnterpriseLibrary.SemanticLogging\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <eventTextFormatter footer=\"********\" dateTimeFormat=\"d\" header=\"================================================================================\" verbosityThreshold=\"LogAlways\"/>\n    </consoleSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Console/ConsoleEmptyDateTimeFormat.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <consoleSink name=\"ConsoleEventListener\" colorMapperType=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.DefaultConsoleColorMapper, Microsoft.Practices.EnterpriseLibrary.SemanticLogging\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <eventTextFormatter footer=\"********\" dateTimeFormat=\"\" header=\"================================================================================\" verbosityThreshold=\"LogAlways\"/>\n    </consoleSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Console/ConsoleFormatterNoParam.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <consoleSink name=\"ConsoleEventListener\" colorMapperType=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.DefaultConsoleColorMapper, Microsoft.Practices.EnterpriseLibrary.SemanticLogging\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <eventTextFormatter />\n    </consoleSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Console/ConsoleNoParams.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <consoleSink name=\"ConsoleEventListener\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </consoleSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/CustomSink/CustomSinkDiffOrder.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <customSink name=\"MockFlatFileSink2\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects.MockFlatFileSink2, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <parameters>\n        <parameter name=\"headerCount\" type=\"System.Int32\" value=\"5\"></parameter>\n        <parameter name=\"fileName\" type=\"System.String\" value=\"testFileName.log\"></parameter>\n      </parameters>\n    </customSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/CustomSink/CustomSinkMissingParam.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <customSink name=\"MockFlatFileSink\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects.MockFlatFileSink, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <parameters>\n        <parameter name=\"fileName\" type=\"System.String\" value=\"testFileName.log\"></parameter>\n      </parameters>\n    </customSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/CustomSink/CustomSqlDBNotAllParams.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <cqs:CustomSqlSink name=\"myCustomSqlSink\" xmlns:cqs=\"urn:sqlTest\" connectionString=\"Data Source=.\\sqlexpress; Initial Catalog=Logging;Integrated Security=True\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    </cqs:CustomSqlSink>\n\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/CustomSink/CustomSqlSink.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <cqs:CustomSqlSink name=\"myCustomSqlSink\" xmlns:cqs=\"urn:sqlTest\" instanceName=\"testingInstance\" connectionString=\"Data Source=(localdb)\\v11.0; Initial Catalog=Logging;Integrated Security=True\" bufferingCount=\"1\" bufferingIntervalInSeconds=\"1\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    </cqs:CustomSqlSink>\n  \n</sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/CustomSink/FlatFileCustomFormatter.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"flatFileSinkCustomFormatter.log\" name=\"flatFileSinkCustomFormatter\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <customEventTextFormatter type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects.MockFormatter, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests\">\n        <parameters>\n          <parameter name=\"throwOnWrite\" type=\"System.Boolean\" value=\"true\"></parameter>\n        </parameters>\n      </customEventTextFormatter>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/CustomSink/FlatFileCustomFormatter2.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService/>\n  <sinks>\n    <flatFileSink  fileName=\"FlatFileOutProcConfigCF2.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <customEventTextFormatter type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects.CustomFormatterWithWait, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests\">\n        <parameters>\n          <parameter name=\"header\" type=\"System.String\" value=\"----------\"></parameter>\n        </parameters>\n      </customEventTextFormatter>\n    </flatFileSink>\n  </sinks>\n</configuration>\n\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/CustomSink/MockFlatFileSink.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <customSink name=\"MockFlatFileSink\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects.MockFlatFileSink, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <parameters>\n        <parameter name=\"fileName\" type=\"System.String\" value=\"ProvidedCustomSink.log\"></parameter>\n        <parameter name=\"header\" type=\"System.String\" value=\"==-==\"></parameter>\n      </parameters>\n    </customSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/CustomSink/Multiple.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <cqs:CustomSqlSink name=\"myCustomSqlSink\" xmlns:cqs=\"urn:sqlTest\" instanceName=\"testingInstance\" connectionString=\"Data Source=(localdb)\\v11.0; Initial Catalog=Logging;Integrated Security=True\" bufferingCount=\"1\" bufferingIntervalInSeconds=\"1\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    </cqs:CustomSqlSink>\n    <customSink name=\"MockFlatFileSink\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects.MockFlatFileSink, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <parameters>\n        <parameter name=\"fileName\" type=\"System.String\" value=\"multipleMockFlatFile.log\"></parameter>\n        <parameter name=\"header\" type=\"System.String\" value=\"==-==\"></parameter>\n      </parameters>\n    </customSink>\n    <sqlDatabaseSink name=\"sqlListener\" connectionString=\"Data Source=(localdb)\\v11.0; Initial Catalog=Logging;Integrated Security=True\" instanceName=\"testingInstance\" bufferingCount=\"1\" bufferingIntervalInSeconds=\"1\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </sqlDatabaseSink>\n    <flatFileSink  fileName=\"multipleFlatFile.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"d\" verbosityThreshold=\"LogAlways\" footer=\"-------------------------\" header=\"--==--\" />\n    </flatFileSink>\n</sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/DataCorrectness/FlatFile.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\".\\Logs\\OutProcFlatFileData.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"replaceEventSource\"/>\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"dMyyyy\" verbosityThreshold=\"LogAlways\" />\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/EmptyKeyword.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"keywordFiltering.log\" name=\"listener1\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" matchAnyKeyword=\"\"/>\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"\\\\\\wefwfwf\" verbosityThreshold=\"LogAlways\" footer=\"-------------------------\" header=\"/////////\" />\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/ExternalSchemaValidation.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\"\n               xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n               xsi:schemaLocation=\"urn:test2 ExternalSchemas/MyCustomSinkElement.xxsd\">\n\n  <traceEventService/>\n\n  <sinks>\n    <mySink name=\"my\" xmlns=\"urn:test2\" attr=\"foo\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <jsonEventTextFormatter name=\"json\" dateTimeFormat=\"d\" />\n    </mySink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/ExternalSchemas/MyCustomSinkElement.xxsd",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\n           xmlns=\"urn:test2\"\n           targetNamespace=\"urn:test2\"\n           elementFormDefault=\"qualified\"\n           attributeFormDefault=\"unqualified\">\n  \n  <xs:element name=\"mySink\">\n    <xs:complexType>\n      <xs:sequence>\n        <xs:any minOccurs=\"0\" maxOccurs=\"unbounded\" processContents=\"skip\"/>\n      </xs:sequence>\n      <xs:attribute name=\"name\" type=\"xs:string\" use=\"required\" />\n      <xs:attribute name=\"attr\" type=\"EventTextFormatting\" use=\"required\" />\n      <xs:attribute name=\"formatterName\" type=\"xs:string\" use=\"optional\" />    \n    </xs:complexType>\n  </xs:element>\n\n  <xs:simpleType name=\"EventTextFormatting\">\n    <xs:restriction base=\"xs:string\">\n      <xs:enumeration value=\"None\" />\n      <xs:enumeration value=\"Indented\" />\n    </xs:restriction>\n  </xs:simpleType>\n  \n</xs:schema>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/FlatFile/FlatFile.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"FlatFileOutProcCfg.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"\\\\\\wefwfwf\" verbosityThreshold=\"LogAlways\" footer=\"-------------------------\" header=\"/////////\" />\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/FlatFile/FlatFileCustomFormatter.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"flatFileSinkCustomFormatter.log\" name=\"flatFileSinkCustomFormatter\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <customEventTextFormatter type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects.MockFormatter, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests\">\n        <parameters>\n          <parameter name=\"throwOnWrite\" type=\"System.Boolean\" value=\"true\"></parameter>\n        </parameters>\n      </customEventTextFormatter>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/FlatFile/FlatFileEmptyFileName.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"\\\\\\wefwfwf\" verbosityThreshold=\"LogAlways\" footer=\"-------------------------\" header=\"/////////\" />\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/FlatFile/FlatFileEmptyName.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink fileName=\"emptyName.log\" name=\"\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/FlatFile/FlatFileFormatterOutProc.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService />\n  <sinks>\n   <flatFileSink fileName=\"FlatFileFormatterOutProc.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n     <eventTextFormatter dateTimeFormat=\"d\" verbosityThreshold=\"LogAlways\" footer=\"==\" header=\"=======\" />\n    </flatFileSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/FlatFile/FlatFileJsonFormatter.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"FlatFileJsonFormatter.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <jsonEventTextFormatter dateTimeFormat=\"d\" formatting=\"None\" />\n    </flatFileSink>\n  </sinks>\n</configuration>\n\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/FlatFile/FlatFileJsonFormatterMissingParams.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"FlatFileOutProcConfigJson.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <jsonEventTextFormatter  />\n    </flatFileSink>\n  </sinks>\n</configuration>\n\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/FlatFile/FlatFileNoFormatter.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"FlatFileOutProc.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </flatFileSink>\n  </sinks>\n</configuration>\n\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/FlatFile/FlatFileNoParams.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink>\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/FlatFile/FlatFileXmlFormatter.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"FlatFileOutProcConfigXml.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <xmlEventTextFormatter dateTimeFormat=\"d\" formatting=\"None\" />\n    </flatFileSink>\n  </sinks>\n</configuration>\n\n\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/FlatFile/FlatFileXmlFormatterMissingParams.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"FlatFileOutProcConfig.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <xmlEventTextFormatter />\n    </flatFileSink>\n  </sinks>\n</configuration>\n\n\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/FlatFile/FlatWrongFormatInFile.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"c:\\flatFile\\c:\\flatFile\\FlatFileOutProcCfgWS.log\"  name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <customEventTextFormatter type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects.CustomFormatterWithWait, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests\">\n        <parameters>\n          <parameter name=\"header\" type=\"System.String\" value=\"----------\"></parameter>\n        </parameters>\n      </customEventTextFormatter>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/InnerSchemaValidation.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService/>\n  <sinks>\n    <mySink name=\"my\" xmlns=\"urn:test\" attr=\"Indented\" foo=\"someValue\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <jsonEventTextFormatter name=\"json\" dateTimeFormat=\"d\" />\n    </mySink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/InnerSchemaValidation2.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService/>\n  <sinks>\n    <mySink xmlns=\"urn:test\" attr=\"Indented\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <jsonEventTextFormatter name=\"json\" dateTimeFormat=\"d\" />\n    </mySink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/KeywordFiltering/KeywordFiltering.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"keywordFiltering.log\" name=\"listener1\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProcKeywords\" matchAnyKeyword=\"3\"/>\n      </sources>\n      <eventTextFormatter header=\"======\" verbosityThreshold=\"LogAlways\" />\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/LevelFiltering/LevelFiltering.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"levelFiltering.log\" name=\"listener1\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProcFiltering\" level=\"Critical\"/>\n      </sources>\n      <eventTextFormatter header=\"======\"/>\n    </flatFileSink>\n    <flatFileSink  fileName=\"levelFiltering2.log\" name=\"listener2\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProcFiltering\" level=\"Error\"/>\n      </sources>\n      <eventTextFormatter header=\"======\"/>\n    </flatFileSink>\n    <flatFileSink  fileName=\"levelFiltering3.log\" name=\"listener3\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProcFiltering\" level=\"Warning\"/>\n      </sources>\n      <eventTextFormatter header=\"======\"/>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/LongSessionPrefix.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567891\"/>\n\n  <sinks>\n    <consoleSink  name=\"dummyListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    </consoleSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/LongSinkName.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig\"/>\n\n  <sinks>\n    <flatFileSink  name=\"flatFileLst\" fileName=\"sessionLength.log\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"d\" verbosityThreshold=\"LogAlways\" header=\"==--==--==\"/>\n    </flatFileSink>\n    <consoleSink  name=\"123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    </consoleSink>\n    <flatFileSink  name=\"flatFileLst2\" fileName=\"sessionLength2.log\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    <eventTextFormatter dateTimeFormat=\"d\" verbosityThreshold=\"LogAlways\" header=\"==--==--==\"/>\n    </flatFileSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/MyCustomSinkElement.cs",
    "content": "﻿using System;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Mocks\n{\n    public class MyCustomSinkElement : ISinkElement\n    {\n        private readonly XName sinkName = XName.Get(\"mySink\", \"urn:test\");\n\n        public bool CanCreateSink(XElement element)\n        {\n            return element.Name == this.sinkName;\n        }\n\n        public IObserver<EventEntry> CreateSink(XElement element)\n        {\n            var sink = new MyCustomSink(FormatterElementFactory.Get(element));\n            MyCustomSink.Instance = sink;\n            return sink;\n        }\n    }\n\n    public class MyCustomSink : IObserver<EventEntry>\n    {\n        public static MyCustomSink Instance { get; set; }\n\n        public MyCustomSink(IEventTextFormatter formatter)\n        {\n            this.Formatter = formatter;\n        }\n\n        public IEventTextFormatter Formatter { get; set; }\n\n        public void OnCompleted()\n        {\n        }\n\n        public void OnError(Exception error)\n        {\n        }\n\n        public void OnNext(EventEntry value)\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/MyCustomSinkElement.xsd",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\n           xmlns=\"urn:test\"\n           targetNamespace=\"urn:test\"\n           elementFormDefault=\"qualified\"\n           attributeFormDefault=\"unqualified\">\n\n  <xs:element name=\"mySink\">\n    <xs:complexType>\n      <xs:sequence>\n        <xs:any minOccurs=\"0\" maxOccurs=\"unbounded\" processContents=\"skip\"/>\n      </xs:sequence>\n      <xs:attribute name=\"name\" type=\"xs:string\" use=\"required\" />\n      <xs:attribute name=\"attr\" type=\"EventTextFormatting\" use=\"required\" />\n      <xs:attribute name=\"formatterName\" type=\"xs:string\" use=\"optional\" />\n    </xs:complexType>\n  </xs:element>\n\n  <xs:simpleType name=\"EventTextFormatting\">\n    <xs:restriction base=\"xs:string\">\n      <xs:enumeration value=\"None\" />\n      <xs:enumeration value=\"Indented\" />\n    </xs:restriction>\n  </xs:simpleType>\n\n</xs:schema>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/NoEventSourceName.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService/>\n  <sinks>\n    <consoleSink name=\"consoleSink\" >\n      <sources>\n        <eventSource />\n      </sources>\n    </consoleSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Reconfiguration/FlatFileListener.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig\"/>\n  \n    <sinks>\n      <consoleSink  name=\"dummyListener\">\n        <sources>\n          <eventSource name=\"MockEventSourceOutProc\" />\n        </sources>\n      </consoleSink>\n      <flatFileSink  fileName=\"flatFileReconfig.log\" name=\"flatFileListener\">\n        <sources>\n          <eventSource name=\"MockEventSourceOutProc\" />\n        </sources>\n        <eventTextFormatter dateTimeFormat=\"d\" header=\"=======\"/>\n      </flatFileSink>\n    </sinks>\n  </configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Reconfiguration/FlatFileListenerDiffSession.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig2\"/>\n\n  <sinks>\n    <consoleSink  name=\"dummyListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    </consoleSink>\n    <flatFileSink  fileName=\"flatFileReconfig.log\" name=\"flatFileListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"d\" header=\"=======\"/>\n    </flatFileSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Reconfiguration/FlatFileListenerError.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig\"/>\n\n  <sinks>\n    <consoleSink  name=\"dummyListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    </consoleSink>\n    <flatFileSink fileName=\"c:\\c:\\flatfile.log\" name=\"flatFileListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"d\" header=\"=======\"/>\n    </flatFileSink>\n    <flatFileSink fileName=\"c:\\c:\\flatfile2.log\" name=\"4flatFileListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"d\" header=\"=======\"/>\n    </flatFileSink>\n    <flatFileSink  fileName=\"flatfileListenerOk.log\" name=\"2flatFileListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"d\" header=\"=======\"/>\n    </flatFileSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Reconfiguration/FlatFileListenerKeywordFiltered.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig\"/>\n\n  <sinks>\n    <consoleSink  name=\"dummyListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProcKeywords\" />\n      </sources>\n    </consoleSink>\n    <flatFileSink  fileName=\"flatFileReconfig.log\" name=\"flatFileListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProcKeywords\" matchAnyKeyword=\"3\" />\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"d\" header=\"=======\"/>\n    </flatFileSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Reconfiguration/FlatFileListenerLevelFiltered.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig\"/>\n\n  <sinks>\n    <consoleSink  name=\"dummyListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    </consoleSink>\n    <flatFileSink  fileName=\"flatFileReconfig.log\" name=\"flatFileListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProcLevelFiltered\" level=\"Critical\" />\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"d\" header=\"=======\"/>\n    </flatFileSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Reconfiguration/FlatFileListenerNoFormatterEnd.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig\"/>\n\n    <sinks>\n      <consoleSink  name=\"dummyListener\">\n        <sources>\n          <eventSource name=\"MockEventSourceOutProc\" />\n        </sources>\n      </consoleSink>\n      <flatFileSink  fileName=\"flatFileReconfigNoFormatter.log\" name=\"flatFileListener\">\n        <sources>\n          <eventSource name=\"MockEventSourceOutProc\" />\n        </sources>\n      </flatFileSink>\n    </sinks>\n  </configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Reconfiguration/FlatFileListenerNoFormatterStart.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig\"/>\n\n    <sinks>\n      <consoleSink  name=\"dummyListener\">\n        <sources>\n          <eventSource name=\"MockEventSourceOutProc\" />\n        </sources>\n      </consoleSink>\n      <flatFileSink  fileName=\"flatFileReconfigNoFormatter.log\" name=\"flatFileListener\">\n        <sources>\n          <eventSource name=\"MockEventSourceOutProc\" />\n        </sources>\n        <eventTextFormatter dateTimeFormat=\"d\" header=\"=======\"/>\n      </flatFileSink>\n    </sinks>\n  </configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Reconfiguration/FlatFileListenerNoKeywordFiltered.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig\"/>\n\n  <sinks>\n    <consoleSink  name=\"dummyListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProcKeywords\" />\n      </sources>\n    </consoleSink>\n    <flatFileSink  fileName=\"flatFileReconfig.log\" name=\"flatFileListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProcKeywords\" />\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"d\" header=\"=======\"/>\n    </flatFileSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Reconfiguration/FlatFileListenerTwoSources.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig\"/>\n  <sinks>\n    <consoleSink name=\"dummyListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    </consoleSink>\n    <flatFileSink fileName=\"flatFileReconfig.log\" name=\"flatFileListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"d\" header=\"=======\"/>\n    </flatFileSink>\n    <consoleSink name=\"dummyListener2\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc2\" />\n      </sources>\n    </consoleSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Reconfiguration/FlatFileListenerTwoSourcesNoListener.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig\"/>\n  <sinks>\n    <consoleSink name=\"dummyListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    </consoleSink>\n    <consoleSink name=\"dummyListener2\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc2\" />\n      </sources>\n    </consoleSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Reconfiguration/FlatFileListenerTwoSourcesSameListener.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig\"/>\n  <sinks>\n    <consoleSink name=\"dummyListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    </consoleSink>\n    <flatFileSink fileName=\"flatFileReconfig.log\" name=\"flatFileListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n        <eventSource name=\"MockEventSourceOutProc2\" />\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"d\" header=\"=======\"/>\n    </flatFileSink>\n    <consoleSink name=\"dummyListener2\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc2\" />\n      </sources>\n    </consoleSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Reconfiguration/FlatFileListenerXml.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig\"/>\n\n    <sinks>\n      <consoleSink  name=\"dummyListener\">\n        <sources>\n          <eventSource name=\"MockEventSourceOutProc\" />\n        </sources>\n      </consoleSink>\n      <flatFileSink  fileName=\"flatFileReconfig.log\" name=\"flatFileListener\">\n        <sources>\n          <eventSource name=\"MockEventSourceOutProc\" />\n        </sources>\n        <xmlEventTextFormatter dateTimeFormat=\"d\" formatting=\"Indented\"></xmlEventTextFormatter>\n      </flatFileSink>\n    </sinks>\n  </configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Reconfiguration/NoListener.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig\"/>\n\n  <sinks>\n    <consoleSink  name=\"dummyListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    </consoleSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Reconfiguration/Temp/configFile.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig\"/>\n\n  </configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Reconfiguration/TwoFlatFileListeners.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfig\"/>\n\n    <sinks>\n      <flatFileSink  fileName=\"twoflatFileListeners.log\" name=\"flatFileListener\">\n        <sources>\n          <eventSource name=\"MyNewCompanyEventSource\" />\n        </sources>\n        <eventTextFormatter dateTimeFormat=\"d\" header=\"=======\"/>\n      </flatFileSink>\n      <flatFileSink  fileName=\"twoflatFileListeners2.log\" name=\"flatFileListener2\">\n        <sources>\n          <eventSource name=\"MyNewCompanyEventSource\" />\n        </sources>\n        <eventTextFormatter dateTimeFormat=\"d\" header=\"=======\"/>\n      </flatFileSink>\n    </sinks>\n  </configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/RollingFlatFile/RollingFlatFile.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <rollingFlatFileSink  fileName=\"RollingFlatFileOutProcCfg.log\" name=\"RollingFlatFileEventListener\" rollFileExistsBehavior=\"Overwrite\" rollInterval=\"Month\" rollSizeKB=\"1024\" timeStampPattern=\"d\" maxArchivedFiles=\"10\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"\\\\\\wefwfwf\" verbosityThreshold=\"LogAlways\" footer=\"-------------------------\" header=\"/////////\" />\n    </rollingFlatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/RollingFlatFile/RollingFlatFileEmptyFileName.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <rollingFlatFileSink  fileName=\"\" name=\"RollingFlatFileEventListener\" rollFileExistsBehavior=\"Overwrite\" rollInterval=\"Month\" rollSizeKB=\"1024\" timeStampPattern=\"d\" maxArchivedFiles=\"10\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"\\\\\\wefwfwf\" verbosityThreshold=\"LogAlways\" footer=\"-------------------------\" header=\"/////////\" />\n    </rollingFlatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/RollingFlatFile/RollingFlatFileEmptyMaxArchiveFiles.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <rollingFlatFileSink  fileName=\"FlatFileOutProcConfig.log\" name=\"RollingFlatFileEventListener\" rollFileExistsBehavior=\"Overwrite\" rollInterval=\"Month\" rollSizeKB=\"1024\" timeStampPattern=\"d\" maxArchivedFiles=\"\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"\\\\\\wefwfwf\" verbosityThreshold=\"LogAlways\" footer=\"-------------------------\" header=\"/////////\" />\n    </rollingFlatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/RollingFlatFile/RollingFlatFileEmptyRollFileExistsBehavior.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <rollingFlatFileSink  fileName=\"FlatFileOutProcConfig.log\" name=\"RollingFlatFileEventListener\" rollFileExistsBehavior=\"\" rollInterval=\"Month\" rollSizeKB=\"1024\" timeStampPattern=\"d\" maxArchivedFiles=\"10\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"\\\\\\wefwfwf\" verbosityThreshold=\"LogAlways\" footer=\"-------------------------\" header=\"/////////\" />\n    </rollingFlatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/RollingFlatFile/RollingFlatFileEmptyRollInterval.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <rollingFlatFileSink  fileName=\"FlatFileOutProcConfig.log\" name=\"RollingFlatFileEventListener\" rollFileExistsBehavior=\"Overwrite\" rollInterval=\"\" rollSizeKB=\"1024\" timeStampPattern=\"d\" maxArchivedFiles=\"10\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"\\\\\\wefwfwf\" verbosityThreshold=\"LogAlways\" footer=\"-------------------------\" header=\"/////////\" />\n    </rollingFlatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/RollingFlatFile/RollingFlatFileEmptyRollSizeKB.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <rollingFlatFileSink  fileName=\"FlatFileOutProcConfig.log\" name=\"RollingFlatFileEventListener\" rollFileExistsBehavior=\"Overwrite\" rollInterval=\"1\" rollSizeKB=\"\" timeStampPattern=\"d\" maxArchivedFiles=\"10\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"\\\\\\wefwfwf\" verbosityThreshold=\"LogAlways\" footer=\"-------------------------\" header=\"/////////\" />\n    </rollingFlatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/RollingFlatFile/RollingFlatFileEmptyTimeStampPattern.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <rollingFlatFileSink  fileName=\"FlatFileOutProcConfig.log\" name=\"RollingFlatFileEventListener\" rollFileExistsBehavior=\"Overwrite\" rollInterval=\"Month\" rollSizeKB=\"1024\" timeStampPattern=\"\" maxArchivedFiles=\"10\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"\\\\\\wefwfwf\" verbosityThreshold=\"LogAlways\" footer=\"-------------------------\" header=\"/////////\" />\n    </rollingFlatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/RollingFlatFile/RollingFlatFileMissingParams.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <rollingFlatFileSink  fileName=\"RollingFlatFileMissingParams.log\" name=\"RollingFlatFileEventListener\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"\\\\\\wefwfwf\" verbosityThreshold=\"LogAlways\" footer=\"-------------------------\" header=\"/////////\" />\n    </rollingFlatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/RollingFlatFile/RollingFlatFileNoFormatter.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <rollingFlatFileSink  fileName=\"FlatFileOutProcConfig.log\" name=\"RollingFlatFileEventListener\" rollFileExistsBehavior=\"Overwrite\" rollInterval=\"Month\" rollSizeKB=\"1024\" timeStampPattern=\"d\" maxArchivedFiles=\"10\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </rollingFlatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Sampling/WhenEnablingSamplingAndTPLEventsAndMultipleSources.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink fileName=\"errorsandWarnings.log\" name=\"ErrorFlatFileEventListener\">\n      <sources>\n        <eventSource name=\"Microsoft-SemanticLogging\" level=\"LogAlways\" />\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>\n    <flatFileSink  fileName=\"WhenEnablingSamplingAndTPLEventsAndMultipleSources.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"SamplingEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>\n        </eventSource>\n        <eventSource name=\"SamplingEventSource1\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>\n        </eventSource>\n        <eventSource name=\"TriggerEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySamplingStartEvent\" value=\"TriggerEvent:1\"/>\n          </arguments>\n          <filter>\n            <process name=\"vstest.executionengine.x86.exe\"/>\n          </filter>\n        </eventSource>\n        <eventSource id=\"2e5dba47-a3d2-4d16-8ee0-6671ffdcd7b5\" level=\"Informational\" matchAnyKeyword=\"1\">\n          <arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>\n        </eventSource>\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Sampling/WhenEnablingSamplingForAProcessAndProcessIsNotRunning.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"WhenEnablingSamplingForAProcessWithNoTPLEventsEnabledActivityIDChainIsLogged.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"SamplingEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>\n        </eventSource>\n        <eventSource name=\"TriggerEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySamplingStartEvent\" value=\"TriggerEvent:1\"/>\n          </arguments>\n          <filter>\n            <process name=\"someprocess.exe\"/>\n          </filter>\n        </eventSource>\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Sampling/WhenEnablingSamplingForAProcessAndProcessIsRunning.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"WhenEnablingSamplingForAPRocessAndPRocessIsRunning.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"SamplingEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>\n        </eventSource>\n        <eventSource name=\"TriggerEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySamplingStartEvent\" value=\"TriggerEvent:1\"/>\n          </arguments>\n          <filter>\n            <process name=\"vstest.executionengine.x86.exe\"/>\n          </filter>\n        </eventSource>\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Sampling/WhenEnablingSamplingForAProcessAndTPLEvents.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"WhenEnablingSamplingForAPRocessAndTPLEvents.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"SamplingEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>\n        </eventSource>\n        <eventSource name=\"TriggerEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySamplingStartEvent\" value=\"TriggerEvent:1\"/>\n          </arguments>\n          <filter>\n            <process name=\"vstest.executionengine.x86.exe\"/>\n          </filter>\n        </eventSource>\n        <eventSource id=\"2e5dba47-a3d2-4d16-8ee0-6671ffdcd7b5\" level=\"Informational\" matchAnyKeyword=\"1\">\n          <arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>\n        </eventSource>\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Sampling/WhenFilteringMultipleProcessesSameEventSource.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"WhenFilteringMultipleProcessesSameEventSource.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"SamplingEventSource\" level=\"LogAlways\">\n          <!--<arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>-->\n          <filter>\n            <process name=\"ProcessToSample.exe\"/>\n            <process name=\"vstest.executionengine.x86.exe\"/>\n          </filter>\n        </eventSource>\n        <eventSource name=\"TriggerEventSource\" level=\"LogAlways\">\n          <!--<arguments>\n            <add key=\"ActivitySamplingStartEvent\" value=\"TriggerEvent:1\"/>\n          </arguments>-->\n          <filter>\n            <process name=\"none\"/>\n          </filter>\n        </eventSource>\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>\n    <flatFileSink  fileName=\"WhenFilteringMultipleProcessesSameEventSource2.log\" name=\"FlatFileEventListener2\">\n      <sources>\n        <eventSource name=\"SamplingEventSource\" level=\"LogAlways\">\n          <!--<arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>-->\n          <filter>\n            <process name=\"vstest.executionengine.x86.exe\"/>\n          </filter>\n        </eventSource>\n        <eventSource name=\"TriggerEventSource\" level=\"LogAlways\">\n          <!--<arguments>\n            <add key=\"ActivitySamplingStartEvent\" value=\"TriggerEvent:1\"/>\n          </arguments>-->\n          <filter>\n            <process name=\"ignore\"/>\n          </filter>\n        </eventSource>\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Sampling/WhenInvalidKeyValueInConfiguration.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink fileName=\"ErrorsWhenInvalidKeyValueInConfiguration.log\" name=\"ErrorFlatFileEventListener\">\n      <sources>\n        <eventSource name=\"Microsoft-SemanticLogging\" level=\"LogAlways\" />\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>\n    <flatFileSink  fileName=\"WhenInvalidKeyValueInConfiguration.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"SamplingEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>\n        </eventSource>\n        <eventSource name=\"TriggerEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySamplingStartEvent\" value=\"TriggerEvent:asdf\"/>\n          </arguments>\n          <filter>\n            <process name=\"vstest.executionengine.x86.exe\"/>\n          </filter>\n        </eventSource>\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Sampling/WhenInvalidKeysInConfiguration.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <!--<flatFileSink fileName=\"ErrorsWhenInvalidKeyInConfiguration.log\" name=\"ErrorFlatFileEventListener\">\n      <sources>\n        <eventSource name=\"Microsoft-SemanticLogging\" level=\"LogAlways\" />\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>-->\n    <flatFileSink  fileName=\"WhenInvalidKeysInConfiguration.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"SamplingEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySamplingInvalidKey\" value=\"true\"/>\n          </arguments>\n        </eventSource>\n        <eventSource name=\"TriggerEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySamplingStartEventInvalidKey\" value=\"TriggerEvent:2\"/>\n          </arguments>\n          <filter>\n            <process name=\"vstest.executionengine.x86.exe\"/>\n          </filter>\n        </eventSource>\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Sampling/WhenMultipleProcessesShareSameEventSource.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"WhenMultipleProcessesShareSameEventSource1.log\" name=\"FlatFileEventListener1\">\n      <sources>\n        <eventSource name=\"SamplingEventSource\" level=\"LogAlways\">\n          <!--<arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>-->\n          <filter>\n            <process name=\"ProcessToSample.exe\"/>\n          </filter>\n        </eventSource>\n        <eventSource name=\"TriggerEventSource\" level=\"LogAlways\">\n          <!--<arguments>\n            <add key=\"ActivitySamplingStartEvent\" value=\"TriggerEvent:1\"/>\n          </arguments>-->\n          <filter>\n            <process name=\"ignore\"/>\n          </filter>\n        </eventSource>\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>\n    <flatFileSink  fileName=\"WhenMultipleProcessesShareSameEventSource2.log\" name=\"FlatFileEventListener2\">\n      <sources>\n        <eventSource name=\"SamplingEventSource\" level=\"LogAlways\">\n          <!--<arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>-->\n          <filter>\n            <process name=\"vstest.executionengine.x86.exe\"/>\n          </filter>\n        </eventSource>\n        <eventSource name=\"TriggerEventSource\" level=\"LogAlways\">\n          <!--<arguments>\n            <add key=\"ActivitySamplingStartEvent\" value=\"TriggerEvent:1\"/>\n          </arguments>-->\n          <filter>\n            <process name=\"ignore\"/>\n          </filter>\n        </eventSource>\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Sampling/WhenSamplingIsEnabledAndDisabledAtRunTime.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"WhenSamplingIsEnabledAndDisabledAtRunTime.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"SamplingEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>\n        </eventSource>\n        <eventSource name=\"TriggerEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySamplingStartEvent\" value=\"TriggerEvent:2\"/>\n          </arguments>\n        </eventSource>\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Sampling/WhenServiceStartedAfterProcessStarted.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"WhenServiceStartedAfterPRocessStarted.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"SamplingEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>\n        </eventSource>\n        <eventSource name=\"TriggerEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySamplingStartEvent\" value=\"TriggerEvent:1\"/>\n          </arguments>\n          <filter>\n            <process name=\"ProcessToSample.exe\"/>\n          </filter>\n        </eventSource>\n        <eventSource id=\"2e5dba47-a3d2-4d16-8ee0-6671ffdcd7b5\" level=\"Informational\" matchAnyKeyword=\"1\">\n          <arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>\n        </eventSource>\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/Sampling/WhenServiceStartedBeforeProcessStarted.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"WhenServiceStartedBeforeProcessStarted.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"SamplingEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>\n        </eventSource>\n        <eventSource name=\"TriggerEventSource\" level=\"LogAlways\">\n          <arguments>\n            <add key=\"ActivitySamplingStartEvent\" value=\"TriggerEvent:1\"/>\n          </arguments>\n          <filter>\n            <process name=\"ProcessToSample.exe\"/>\n          </filter>\n        </eventSource>\n        <eventSource id=\"2e5dba47-a3d2-4d16-8ee0-6671ffdcd7b5\" level=\"Informational\" matchAnyKeyword=\"1\">\n          <arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>\n        </eventSource>\n      </sources>\n      <jsonEventTextFormatter/>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/SessionNameLongInOneSink.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"ServiceReconfigServiceReconfigServiceReconfigServiceReconfigServiceReconfigServiceReconfigServiceReconfigServiceReconfigServiceReconfigServiceReconfigServiceReconfigServiceReconfig\"/>\n\n  <sinks>\n    <flatFileSink  name=\"flatFileLst\" fileName=\"sessionLength.log\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <eventTextFormatter dateTimeFormat=\"d\" verbosityThreshold=\"LogAlways\" header=\"==--==--==\"/>\n    </flatFileSink>\n    <flatFileSink  name=\"FlatFileSinkIsLongerThanTheOthers\" fileName=\"sessionLength2.log\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    <eventTextFormatter dateTimeFormat=\"d\" verbosityThreshold=\"LogAlways\" header=\"==--==--==\"/>\n    </flatFileSink>\n    <consoleSink  name=\"consolesSink\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n    </consoleSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/SqlDatabase/SqlBufferingCountEmpty.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <sqlDatabaseSink name=\"sqlListener\" connectionString=\"Data Source=.\\sqlexpress; Initial Catalog=LoggingDB;Integrated Security=True\" instanceName=\"testingInstance\" bufferingCount=\"\" bufferingIntervalInSeconds=\"10\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </sqlDatabaseSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/SqlDatabase/SqlBufferingIntervalEmpty.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <sqlDatabaseSink name=\"sqlListener\" connectionString=\"Data Source=.\\sqlexpress; Initial Catalog=LoggingDB;Integrated Security=True\" instanceName=\"testingInstance\" bufferingCount=\"10\" bufferingIntervalInSeconds=\"\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </sqlDatabaseSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/SqlDatabase/SqlDB.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <sqlDatabaseSink name=\"sqlListener\" connectionString=\"Data Source=(localdb)\\v11.0; Initial Catalog=Logging;Integrated Security=True\" instanceName=\"testingInstance\" bufferingCount=\"1\" bufferingIntervalInSeconds=\"1\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </sqlDatabaseSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/SqlDatabase/SqlDBEmptyConnStr.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <sqlDatabaseSink name=\"sqlListener\" connectionString=\"\" instanceName=\"testingInstance\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </sqlDatabaseSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/SqlDatabase/SqlDBEmptyInstance.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <sqlDatabaseSink name=\"sqlListener\" connectionString=\"Data Source=.\\sqlexpress; Initial Catalog=LoggingDB;Integrated Security=True\" instanceName=\"\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </sqlDatabaseSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/SqlDatabase/SqlDBEmptyName.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <sqlDatabaseSink name=\"\" connectionString=\"Data Source=.\\sqlexpress; Initial Catalog=LoggingDB;Integrated Security=True\" instanceName=\"testingInstance\" bufferingIntervalInSeconds=\"10\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </sqlDatabaseSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/SqlDatabase/SqlDBMissingConnStr.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <sqlDatabaseSink name=\"sqlListener\" instanceName=\"testingInstance\" bufferingCount=\"1\" bufferingIntervalInSeconds=\"10\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </sqlDatabaseSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/SqlDatabase/SqlDBMissingInstance.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <sqlDatabaseSink name=\"sqlListener\" connectionString=\"Data Source=.\\sqlexpress; Initial Catalog=LoggingDB;Integrated Security=True\" bufferingCount=\"1\" bufferingIntervalInSeconds=\"10\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </sqlDatabaseSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/SqlDatabase/SqlDBMissingName.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <sqlDatabaseSink connectionString=\"Data Source=.\\sqlexpress; Initial Catalog=LoggingDB;Integrated Security=True\" instanceName=\"testingInstance\" bufferingCount=\"1\" bufferingIntervalInSeconds=\"10\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </sqlDatabaseSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/SqlDatabase/SqlDBTableEmpty.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <sqlDatabaseSink name=\"sqlListener\" connectionString=\"Data Source=.\\sqlexpress; Initial Catalog=LoggingDB;Integrated Security=True\" instanceName=\"testingInstance\" bufferingCount=\"1\" bufferingIntervalInSeconds=\"10\" tableName=\"\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </sqlDatabaseSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/SqlDatabase/SqlDatabaseCustomTable.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <sqlDatabaseSink tableName=\"Traces\" name=\"DatabaseListener\" connectionString=\"Data Source=(localdb)\\v11.0; Initial Catalog=Logging;Integrated Security=True\" instanceName=\"testingInstance\" bufferingCount=\"1\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </sqlDatabaseSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/SqlDatabase/SqlDatabaseHappyPath.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <sqlDatabaseSink name=\"sqlListener\" connectionString=\"Data Source=(localdb)\\v11.0; Initial Catalog=Logging;Integrated Security=True\" instanceName=\"testingInstance\" bufferingCount=\"1\" bufferingIntervalInSeconds=\"1\" >\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </sqlDatabaseSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/StringKeyword.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"keywordFiltering.log\" name=\"listener1\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProcKeywords\" matchAnyKeyword=\"Database\"/>\n      </sources>\n      <eventTextFormatter header=\"======\"/>\n    </flatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/TwoSinksSameName.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <customSink name=\"listener1\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Mocks.InMemoryEventListenerDual, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\">\n      <sources>\n        <eventSource  name=\"MyEventSource\" id=\"659518be-d338-564b-2759-c63c10ef82e2\" />\n      </sources>\n    </customSink>\n    <flatFileSink name=\"listener1\" fileName=\"TwoListenersSameName.log\">\n      <sources>\n        <eventSource  name=\"MyEventSource\" id=\"659518be-d338-564b-2759-c63c10ef82e2\" />\n      </sources>\n    </flatFileSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WinService/AzureTablesWinService.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <windowsAzureTableSink name=\"AzureTablesEventListener\" tableAddress=\"azuretablese2eusingwindowsservice\" instanceName=\"mytestinstance\" bufferingIntervalInSeconds=\"1\" sortKeysAscending=\"0\" connectionString=\"UseDevelopmentStorage=true\"  bufferingFlushAllTimeoutInSeconds=\"1\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"  />\n      </sources>\n    </windowsAzureTableSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WinService/FlatFileWinService.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"FlatFileOutProcCfgWS.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n      <customEventTextFormatter type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects.CustomFormatterWithWait, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests\">\n        <parameters>\n          <parameter name=\"header\" type=\"System.String\" value=\"----------\">\n          </parameter>\n        </parameters>\n      </customEventTextFormatter>\n    </flatFileSink>\n  </sinks>\n</configuration>\n\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WinService/RollingFlatFileWinService.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <rollingFlatFileSink  fileName=\"RollingFlatFileOutProcCfgWS.log\" name=\"RollingFlatFileEventListener\" rollFileExistsBehavior=\"Increment\" rollInterval=\"Day\" rollSizeKB=\"1\" timeStampPattern=\"yyyy\" maxArchivedFiles=\"10\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </rollingFlatFileSink>\n  </sinks>\n</configuration>\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WinService/SqlDB.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <sqlDatabaseSink name=\"sqlListener\" connectionString=\"Data Source=(localdb)\\v11.0; Initial Catalog=Logging;Integrated Security=True\" instanceName=\"testingInstance\" bufferingCount=\"1\" bufferingIntervalInSeconds=\"1\" bufferingFlushAllTimeoutInSeconds=\"1\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\"/>\n      </sources>\n    </sqlDatabaseSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WinService/VeryBasicConfig.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WithFormatter/FlatFileJsonAndEnums.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService />\n  <sinks>\n    <flatFileSink fileName=\".\\Logs\\FlatFileJsonAndEnums.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProcEnum\" />\n      </sources>\n      <jsonEventTextFormatter formatting=\"Indented\" dateTimeFormat=\"dMyyyy\" />\n    </flatFileSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WithFormatter/FlatFileJsonFormatterDateTimeFormat.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService />\n  <sinks>\n    <flatFileSink fileName=\"FlatFileJsonFormatterDateTimeFormat.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <jsonEventTextFormatter formatting=\"Indented\" dateTimeFormat=\"dMyyyy\" />\n    </flatFileSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WithFormatter/FlatFileJsonFormatterIndentedOutProc.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService />\n  <sinks>\n    <flatFileSink fileName=\"FlatFileJsonFormatterIndentedOutProc.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <jsonEventTextFormatter formatting=\"Indented\" dateTimeFormat=\"d\" />\n    </flatFileSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WithFormatter/FlatFileJsonFormatterOutProc.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService />\n  <sinks>\n    <flatFileSink fileName=\"FlatFileJsonFormatterOutProc.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <jsonEventTextFormatter formatting=\"None\" dateTimeFormat=\"d\" />\n    </flatFileSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WithFormatter/FlatFileXmlFormatterAndEnums.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService />\n  <sinks>\n    <flatFileSink fileName=\"FlatFileXmlFormatterAndEnums.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProcEnum\" />\n      </sources>\n      <xmlEventTextFormatter formatting=\"Indented\" dateTimeFormat=\"dMyyyy\" />\n    </flatFileSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WithFormatter/FlatFileXmlFormatterAndGuids.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService />\n  <sinks>\n    <flatFileSink fileName=\"FlatFileXmlFormatterAndGuids.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProcEnum\" />\n      </sources>\n      <xmlEventTextFormatter formatting=\"Indented\" dateTimeFormat=\"dMyyyy\" />\n    </flatFileSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WithFormatter/FlatFileXmlFormatterDateTimeFormat.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService />\n  <sinks>\n    <flatFileSink fileName=\"FlatFileXmlFormatterDateTimeFormat.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <xmlEventTextFormatter formatting=\"Indented\" dateTimeFormat=\"dMyyyy\" />\n    </flatFileSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WithFormatter/FlatFileXmlFormatterIndentedOutProc.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService />\n  <sinks>\n    <flatFileSink fileName=\"FlatFileXmlFormatterIndentedOutProc.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <xmlEventTextFormatter formatting=\"Indented\" dateTimeFormat=\"d\" />\n    </flatFileSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WithFormatter/FlatFileXmlFormatterInvalidDateTimeFormat.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService />\n  <sinks>\n    <flatFileSink fileName=\"FlatFileXmlFormatterIndentedOutProc.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <xmlEventTextFormatter formatting=\"Indented\" dateTimeFormat=\"0\" />\n    </flatFileSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WithFormatter/FlatFileXmlFormatterOutProc.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService />\n  <sinks>\n    <flatFileSink fileName=\"FlatFileXmlFormatterOutProc.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <xmlEventTextFormatter formatting=\"None\" dateTimeFormat=\"d\" />\n    </flatFileSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WithFormatter/FlatFileXmlWrongDateTime.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService />\n  <sinks>\n    <flatFileSink fileName=\"FlatFileXmlFormatterIndentedOutProc.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProc\" />\n      </sources>\n      <xmlEventTextFormatter formatting=\"Indented\" dateTimeFormat=\"0\" />\n    </flatFileSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WithWrongFormatter.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <traceEventService sessionNamePrefix=\"MySession\"/>\n  <sinks>\n    <flatFileSink name=\"FlatFileEventListener\" fileName=\"FlatFileOutProcConfigCF2.log\" >\n      <sources>\n        <eventSource name=\"MyEventSource\" id=\"659518be-d338-564b-2759-c63c10ef82e2\" />\n      </sources>\n      <customEventTextFormatter type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.CustomFormatterWithWait, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests\">\n        <parameters>\n          <parameter name=\"header\" type=\"System.String\" value=\"----------\"></parameter>\n        </parameters>\n      </customEventTextFormatter>\n    </flatFileSink>\n  </sinks>\n</configuration>\n\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WithWrongFormatterParameter.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink name=\"customListener\" fileName=\"customFormatterError.log\">\n      <sources>\n        <eventSource name=\"MyEventSource\" />\n      </sources>\n      <customEventTextFormatter type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.Foo, Microsoft.Practices.EnterpriseLibrary.SemanticLogging\">\n        <parameters>\n          <parameter name=\"header\" type=\"System.String\" value=\"----------\"></parameter>\n        </parameters>\n      </customEventTextFormatter>\n    </flatFileSink>\n  </sinks>\n</configuration>\n\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Configurations/WithWrongFormatterParameter2.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink name=\"customListener\" fileName=\"customFormatterError.log\">\n      <sources>\n        <eventSource name=\"MyEventSource\"  />\n      </sources>\n      <customEventTextFormatter type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters, Microsoft.Practices.EnterpriseLibrary.SemanticLogging\">\n        <parameters>\n          <parameter name=\"header\" type=\"System.String\" value=\"----------\"></parameter>\n        </parameters>\n      </customEventTextFormatter>\n    </flatFileSink>\n  </sinks>\n</configuration>\n\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/End2End/End2EndFixtureBase.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Management;\nusing System.ServiceProcess;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.End2End\n{\n    public class End2EndFixtureBase\n    {\n        protected static readonly string SemanticLoggingServiceExecutableFilePath = Path.Combine(Environment.CurrentDirectory, \"SemanticLogging-svc.exe\");\n        protected const string AzureTableName = \"azuretablese2eusingwindowsservice\";\n        protected const string ElasticsearchIndexPrefix = \"elasticsearch2eusingwindowsservice\";\n\n        public virtual void TestCleanup()\n        {\n            AzureTableHelper.DeleteTable(System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"], AzureTableName);\n\n            StopAllSemanticSvcInstances();\n        }\n\n        public virtual void Initialize()\n        {\n            StopAllSemanticSvcInstances();\n        }\n\n        protected void StopAllSemanticSvcInstances()\n        {\n            try\n            {\n                uint serviceId = GetSemanticLoggingServiceId();\n                foreach (var proc in Process.GetProcessesByName(\"SemanticLogging-svc\").Where(p => p.Id != serviceId))\n                {\n                    if (proc != null)\n                    {\n                        proc.Kill();\n                        proc.WaitForExit((int)TimeSpan.FromMinutes(1).TotalMilliseconds);\n                        proc.Dispose();\n                    }\n                }\n            }\n            catch\n            { }\n        }\n\n        protected void StartServiceWithConfig(string configFileName)\n        {\n            string path = Path.Combine(Environment.CurrentDirectory, \"SemanticLogging-svc.exe.config\");\n            string appConfigContent = File.ReadAllText(path);\n            try\n            {\n                string appConfigContentReplace = appConfigContent.Replace(\"slabsvcTest.xml\", configFileName);\n                File.WriteAllText(path, appConfigContentReplace);\n                StartWindowsService();\n            }\n            finally\n            {\n                File.WriteAllText(path, appConfigContent);\n            }\n        }\n\n        protected static void InstallService()\n        {\n            var semanticLoggingService = GetSemanticLoggingService();\n            if (semanticLoggingService == null)\n            {\n                RunSemanticLoggingServiceExecutable(\"-i\");\n            }\n        }\n\n        protected static void UninstallService()\n        {\n            RunSemanticLoggingServiceExecutable(\"-u\");\n        }\n\n        protected static void StartWindowsService()\n        {\n            //            InstallService();\n            RunSemanticLoggingServiceExecutable(\"-s\");\n\n            var semanticLoggingService = GetSemanticLoggingService();\n            Assert.IsNotNull(semanticLoggingService, \"Service was not installed started. Make sure Visual Studio is ran as Administrator.\");\n        }\n\n        protected static void RunSemanticLoggingServiceExecutable(string argument)\n        {\n            using (var semanticLoggingServiceProcess = new Process())\n            {\n                semanticLoggingServiceProcess.StartInfo.FileName = SemanticLoggingServiceExecutableFilePath;\n                semanticLoggingServiceProcess.StartInfo.Arguments = argument;\n                semanticLoggingServiceProcess.StartInfo.UseShellExecute = false;\n                semanticLoggingServiceProcess.Start();\n                semanticLoggingServiceProcess.WaitForExit();\n            }\n        }\n\n        protected static bool StopService()\n        {\n            var svc = GetSemanticLoggingService();\n            try\n            {\n                svc.Stop();\n                svc.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(30));\n            }\n            catch (System.ServiceProcess.TimeoutException)\n            {\n            }\n\n            return svc.Status == ServiceControllerStatus.Stopped;\n        }\n\n        protected static void ValidateAndInitSemanticLoggingService()\n        {\n            string query = string.Format(\"SELECT ProcessId, PathName FROM Win32_Service WHERE Name='{0}'\",\n                Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Constants.ServiceName);\n\n            var searcher = new ManagementObjectSearcher(query);\n            ManagementBaseObject service = searcher.Get().Cast<ManagementBaseObject>().FirstOrDefault();\n\n            if (service == null)\n            {\n                Assert.Fail(\"The \" + Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Constants.ServiceName +\n                    \" is not installed.  This test requires manually installing and starting located at \" + SemanticLoggingServiceExecutableFilePath);\n\n                //wasServiceInstalled = true;\n                //InstallService();\n            }\n            else\n            {\n                object path = service[\"PathName\"];\n                string fullServicePath = service[\"PathName\"].ToString().Substring(1).TrimEnd('\"', '\\\\');\n\n                if (String.Compare(SemanticLoggingServiceExecutableFilePath, fullServicePath, StringComparison.OrdinalIgnoreCase) != 0)\n                {\n                    Assert.Fail(\"The \" + Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Constants.ServiceName +\n                        \" is not installed from the correct location to run the code built for the BVTs.  Install and start the service located at \" + SemanticLoggingServiceExecutableFilePath);\n                }\n                object pid = service[\"ProcessId\"];\n\n                if (pid == null || Convert.ToUInt32(pid) == 0)\n                {\n                    //Assert.Fail(\"The \" + Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Constants.ServiceName +\n                    //    \" is not started.  This test requires the service to be manually started.\");\n\n                    StartWindowsService();\n                }\n            }\n        }\n\n        protected static uint GetSemanticLoggingServiceId()\n        {\n            string query = string.Format(\"SELECT ProcessId FROM Win32_Service WHERE Name='{0}'\",\n                Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Constants.ServiceName);\n\n            var searcher = new ManagementObjectSearcher(query);\n            ManagementBaseObject service = searcher.Get().Cast<ManagementBaseObject>().FirstOrDefault();\n\n            if (service != null)\n            {\n                object pid = service[\"ProcessId\"];\n\n                if (pid != null)\n                {\n                    return Convert.ToUInt32(pid);\n                }\n            }\n\n            return 0;\n        }\n\n        protected static ServiceController GetSemanticLoggingService()\n        {\n            return\n                ServiceController\n                    .GetServices()\n                    .FirstOrDefault(s =>\n                        s.ServiceName.Equals(\n                            Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Constants.ServiceName,\n                            StringComparison.OrdinalIgnoreCase));\n        }\n\n        protected Process StartServiceAsConsoleWithConfig(string configFileName)\n        {\n            string path = Path.Combine(Environment.CurrentDirectory, \"SemanticLogging-svc.exe.config\");\n            string appConfigContent = File.ReadAllText(path);\n            var semanticLoggingServiceProcess = new Process();\n            try\n            {\n                string appConfigContentReplace = appConfigContent.Replace(\"slabsvcTest.xml\", configFileName);\n                File.WriteAllText(path, appConfigContentReplace);\n                semanticLoggingServiceProcess.StartInfo.FileName = SemanticLoggingServiceExecutableFilePath;\n                semanticLoggingServiceProcess.StartInfo.Arguments = \"-c\";\n                semanticLoggingServiceProcess.StartInfo.UseShellExecute = false;\n                semanticLoggingServiceProcess.Start();\n\n                // Wait for the configuration to be loaded\n                System.Threading.Tasks.Task.Delay(TimeSpan.FromSeconds(5)).Wait();\n            }\n            catch\n            {\n                if (semanticLoggingServiceProcess != null)\n                {\n                    semanticLoggingServiceProcess.Kill();\n                    semanticLoggingServiceProcess.WaitForExit((int)TimeSpan.FromMinutes(1).TotalMilliseconds);\n                    semanticLoggingServiceProcess.Dispose();\n                }\n\n                throw;\n            }\n            finally\n            {\n                File.WriteAllText(path, appConfigContent);\n            }\n\n            return semanticLoggingServiceProcess;\n        }\n\n        protected static string CopyConfigFileToWhereServiceExeFileIsLocatedAndReturnNewConfigFilePath(string configFileDirectory, string configFileName)\n        {\n            var sourceConfigFile = Path.Combine(configFileDirectory, configFileName);\n            var configFile = Path.Combine(Environment.CurrentDirectory, configFileName);\n            File.Copy(sourceConfigFile, configFile, true);\n\n            return configFile;\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/End2End/IntegrationFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Configuration;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.ServiceProcess;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.End2End\n{\n    [TestClass]\n    public class IntegrationFixture : End2EndFixtureBase\n    {\n        [TestInitialize]\n        public override void Initialize()\n        {\n            base.Initialize();\n        }\n\n        [TestCleanup]\n        public override void TestCleanup()\n        {\n            base.TestCleanup();\n        }\n\n        [TestMethod]\n        public void WhenUsingBasicConfig()\n        {\n            string configFile = \"Configurations\\\\WinService\\\\VeryBasicConfig.xml\";\n\n            this.ExecuteServiceTest(configFile, () =>\n            {\n                var proc = Process.GetProcessesByName(\"SemanticLogging-svc\").FirstOrDefault();\n                Assert.IsNotNull(proc);\n            });\n        }\n\n        [TestMethod]\n        public void WhenUsingFlatFile()\n        {\n            string fileName = \"FlatFileOutProcCfgWS.log\";\n\n            File.Delete(fileName);\n            string configFile = CopyConfigFileToWhereServiceExeFileIsLocatedAndReturnNewConfigFilePath(\"Configurations\\\\WinService\", \"FlatFileWinService.xml\");\n//            string configFile = \"Configurations\\\\WinService\\\\FlatFileWinService.xml\";\n\n            IEnumerable<string> entries = null;\n            var logger = MockEventSourceOutProc.Logger;\n\n            this.ExecuteServiceTest(configFile, () =>\n            {\n                logger.LogSomeMessage(\"logging to the windows service\");\n                logger.LogSomeMessage(\"logging to the windows service 2\");\n\n                entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 2, \"----------\");\n            });\n\n            Assert.AreEqual(2, entries.Count());\n            StringAssert.Contains(entries.First(), \"Payload : [message : logging to the windows service]\");\n            StringAssert.Contains(entries.Last(), \"Payload : [message : logging to the windows service 2]\");\n        }\n\n        [TestMethod]\n        public void WhenUsingDatabase()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            string configFile = CopyConfigFileToWhereServiceExeFileIsLocatedAndReturnNewConfigFilePath(\"Configurations\\\\WinService\", \"sqlDB.xml\");\n\n            System.Data.DataTable logsTable = null;\n            var logger = MockEventSourceOutProc.Logger;\n\n            this.ExecuteServiceTest(configFile, () =>\n                {\n                    logger.LogSomeMessage(\"logging to the windows service\");\n                    logger.LogSomeMessage(\"logging to the windows service 2\");\n\n                    logsTable = DatabaseHelper.PollUntilEventsAreWritten(validConnectionString, 2);\n                });\n\n            Assert.IsNotNull(logsTable, \"No data logged\");\n            Assert.AreEqual(2, logsTable.Rows.Count);\n            var dr = logsTable.Rows[0];\n            StringAssert.Contains((string)dr[\"Payload\"], \"logging to the windows service\");\n            dr = logsTable.Rows[1];\n            StringAssert.Contains((string)dr[\"Payload\"], \"logging to the windows service 2\");\n        }\n\n        [TestMethod]\n        public void WhenUsingAzureTable()\n        {\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, End2EndFixtureBase.AzureTableName);\n            string configFile = CopyConfigFileToWhereServiceExeFileIsLocatedAndReturnNewConfigFilePath(\"Configurations\\\\WinService\", \"AzureTablesWinService.xml\");\n\n            IEnumerable<WindowsAzureTableEventEntry> events = null;\n            var logger = MockEventSourceOutProc.Logger;\n\n            this.ExecuteServiceTest(configFile, () =>\n                {\n                    logger.LogSomeMessage(\"logging using windows service to azure tables\");\n                    logger.LogSomeMessage(\"logging using windows service to azure tables 2\");\n\n                    events = AzureTableHelper.PollForEvents(connectionString, AzureTableName, 2);\n                });\n\n            Assert.AreEqual(2, events.Count());\n            var event1 = events.SingleOrDefault(e => e.Payload.Contains(@\"\"\"message\"\": \"\"logging using windows service to azure tables\"\"\"));\n            Assert.IsNotNull(event1);\n            var event2 = events.SingleOrDefault(e => e.Payload.Contains(@\"\"\"message\"\": \"\"logging using windows service to azure tables 2\"\"\"));\n            Assert.IsNotNull(event2);\n        }\n\n        private void ExecuteServiceTest(string configFile, Action runTest)\n        {\n            using (var semanticLoggingServiceProcess = this.StartServiceAsConsoleWithConfig(configFile))\n            {\n                StringAssert.Contains(semanticLoggingServiceProcess.ProcessName, \"SemanticLogging-svc\");\n\n                try\n                {\n                    runTest();\n                }\n                finally\n                {\n                    if (semanticLoggingServiceProcess != null)\n                    {\n                        semanticLoggingServiceProcess.Kill();\n                        semanticLoggingServiceProcess.WaitForExit((int)TimeSpan.FromMinutes(1).TotalMilliseconds);\n                    }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/End2End/WindowsServiceIntegrationFixture.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Configuration;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.End2End\n{\n    [TestClass]\n    public class WindowsServiceIntegrationFixture : End2EndFixtureBase\n    {\n        private const string FlatFileName = \"FlatFileOutProcSvc.log\";\n\n        [ClassInitialize]\n        public static void ClassInitialize(TestContext context)\n        {\n            CleanElasticsearch();\n            CleanFlatFile();\n            CleanAzure();\n\n            End2EndFixtureBase.ValidateAndInitSemanticLoggingService();\n\n            LogMessages();\n        }\n\n        [ClassCleanup]\n        public static void ClassCleanup()\n        {\n            End2EndFixtureBase.StopService();\n        }\n\n        // Ignore until permission issue for Windows service is sorted\n        [Ignore]\n        [TestMethod]\n        public void WhenUsingFlatFile()\n        {\n            IEnumerable<string> entries = null;\n\n            entries = FlatFileHelper.PollUntilTextEventsAreWritten(FlatFileName, 2, \"----------\");\n\n            Assert.AreEqual(2, entries.Count());\n            StringAssert.Contains(entries.First(), \"Payload : [message : logging to the windows service]\");\n            StringAssert.Contains(entries.Last(), \"Payload : [message : logging to the windows service 2]\");\n        }\n\n        // Ignore until permission issue for Windows service is sorted\n        [Ignore]\n        [TestMethod]\n        public void WhenUsingAzureTable()\n        {\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n\n            IEnumerable<WindowsAzureTableEventEntry> events = null;\n\n            events = AzureTableHelper.PollForEvents(connectionString, End2EndFixtureBase.AzureTableName, 2);\n\n            Assert.AreEqual(2, events.Count());\n            var event1 = events.SingleOrDefault(e => e.Payload.Contains(@\"\"\"message\"\": \"\"logging to the windows service\"\"\"));\n            Assert.IsNotNull(event1);\n            var event2 = events.SingleOrDefault(e => e.Payload.Contains(@\"\"\"message\"\": \"\"logging to the windows service 2\"\"\"));\n            Assert.IsNotNull(event2);\n        }\n\n        private static void CleanAzure()\n        {\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, End2EndFixtureBase.AzureTableName);\n        }\n\n        private static void CleanElasticsearch()\n        {\n            var elasticsearchUri = ConfigurationManager.AppSettings[\"ElasticsearchUri\"];\n            try\n            {\n                ElasticsearchHelper.DeleteIndex(elasticsearchUri);\n            }\n            catch (Exception exp)\n            {\n                Assert.Inconclusive(String.Format(\"Error occured connecting to ES: Message{0}, StackTrace: {1}\", exp.Message, exp.StackTrace));\n            }\n        }\n\n        private static void CleanFlatFile()\n        {\n            File.Delete(FlatFileName);\n        }\n\n        private static void LogMessages()\n        {\n            var logger = MockEventSourceOutProcSvc.Logger;\n            logger.LogSomeMessage(\"logging to the windows service\");\n            logger.LogSomeMessage(\"logging to the windows service 2\");\n        }\n    }\n}"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Extensibility/CustomSinkFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.Extensibility\n{\n    [TestClass]\n    public class CustomSinkFixture\n    {\n        [ClassInitialize]\n        public static void Setup(TestContext testContext)\n        {\n            AssemblyLoaderHelper.EnsureAllAssembliesAreLoadedForSinkTest();\n        }\n\n        [TestMethod]\n        public void WhenUsingCustomSinkWithSchema()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\CustomSink\\\\CustomSqlSink.xml\");\n\n            System.Data.DataTable eventsDataTable = null;\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    var logger = MockEventSourceOutProc.Logger;\n                    for (int n = 0; n < 10; n++)\n                    {\n                        logger.LogSomeMessage(\"some message\" + n.ToString());\n                    }\n\n                    eventsDataTable = DatabaseHelper.PollUntilEventsAreWritten(validConnectionString, 10);\n                });\n\n            Assert.AreEqual(10, eventsDataTable.Rows.Count);\n            StringAssert.Contains((string)eventsDataTable.Rows[0][\"payload\"], @\"\"\"message\"\": \"\"some message0\"\"\");\n        }\n\n        [TestMethod]\n        public void WhenUsingCustomSinkBuiltInSinksForSameSource()\n        {\n            string fileName1 = \"multipleFlatFile.log\";\n            File.Delete(fileName1);\n            string fileName2 = \"multipleMockFlatFile.log\";\n            File.Delete(fileName2);\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n\n            string message = string.Concat(\"Message \", Guid.NewGuid());\n            string message2 = string.Concat(\"Message2 \", Guid.NewGuid());\n            IEnumerable<string> entries = null;\n            IEnumerable<string> entries2 = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\CustomSink\\\\Multiple.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    var logger = MockEventSourceOutProc.Logger;\n                    logger.LogSomeMessage(message);\n                    logger.LogSomeMessage(message2);\n\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName1, 10, \"--==--\");\n                    entries2 = FlatFileHelper.PollUntilTextEventsAreWritten(fileName2, 10, \"==-==\");\n                    DatabaseHelper.PollUntilEventsAreWritten(validConnectionString, 4);\n                });\n\n            Assert.IsTrue(File.Exists(fileName1));\n            Assert.AreEqual<int>(2, entries.Count());\n            StringAssert.Contains(entries.First().ToString(), message);\n            StringAssert.Contains(entries.Last().ToString(), message2);\n\n            Assert.IsTrue(File.Exists(fileName2));\n            Assert.AreEqual<int>(2, entries2.Count());\n            StringAssert.Contains(entries2.First().ToString(), message);\n            StringAssert.Contains(entries2.Last().ToString(), message2);\n\n            var dt = DatabaseHelper.GetLoggedTable(validConnectionString);\n            Assert.AreEqual(4, dt.Rows.Count);\n\n            var rowsWithMessage1 = dt.Select(string.Format(\"Payload like '%{0}%'\", message));\n            Assert.AreEqual(2, rowsWithMessage1.Count());\n            var dr = rowsWithMessage1[0];\n            Assert.AreEqual(4, (int)dr[\"Level\"]);\n            Assert.AreEqual(8, (int)dr[\"EventID\"]);\n            Assert.AreEqual(\"testingInstance\", dr[\"InstanceName\"].ToString());\n            StringAssert.Contains((string)dr[\"Payload\"], message);\n            dr = rowsWithMessage1[1];\n            Assert.AreEqual(4, (int)dr[\"Level\"]);\n            Assert.AreEqual(8, (int)dr[\"EventID\"]);\n            Assert.AreEqual(\"testingInstance\", dr[\"InstanceName\"].ToString());\n            StringAssert.Contains((string)dr[\"Payload\"], message);\n\n            var rowsWithMessage2 = dt.Select(string.Format(\"Payload like '%{0}%'\", message2));\n            Assert.AreEqual(2, rowsWithMessage2.Count());\n            dr = rowsWithMessage2[0];\n            Assert.AreEqual(4, (int)dr[\"Level\"]);\n            Assert.AreEqual(8, (int)dr[\"EventID\"]);\n            Assert.AreEqual(\"testingInstance\", dr[\"InstanceName\"].ToString());\n            StringAssert.Contains((string)dr[\"Payload\"], message2);\n            dr = rowsWithMessage2[1];\n            Assert.AreEqual(4, (int)dr[\"Level\"]);\n            Assert.AreEqual(8, (int)dr[\"EventID\"]);\n            Assert.AreEqual(\"testingInstance\", dr[\"InstanceName\"].ToString());\n            StringAssert.Contains((string)dr[\"Payload\"], message2);\n        }\n\n        [TestMethod]\n        public void WhenUsingCustomSinkWithoutSchema()\n        {\n            string fileName = \"ProvidedCustomSink.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n\n            IEnumerable<string> entries = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\CustomSink\\\\MockFlatFileSink.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.LogSomeMessage(\"some message\");\n                    logger.LogSomeMessage(\"some message2\");\n                    logger.LogSomeMessage(\"some message3\");\n\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 3, \"==-==\");\n                });\n\n            Assert.AreEqual<int>(3, entries.Count());\n            Assert.IsNotNull(entries.SingleOrDefault(e => e.Contains(\"Payload : [message : some message]\")));\n            Assert.IsNotNull(entries.SingleOrDefault(e => e.Contains(\"Payload : [message : some message2]\")));\n            Assert.IsNotNull(entries.SingleOrDefault(e => e.Contains(\"Payload : [message : some message3]\")));\n        }\n\n        [TestMethod]\n        public void WhenUsingCustomSinkProgrammatically()\n        {\n            string fileName = \"ProvidedCustomSink.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n            var formatter = new EventTextFormatter();\n\n            IEnumerable<string> entries = null;\n            var subject = new EventEntrySubject();\n            subject.LogToMockFlatFile(fileName, \"==-==\");\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProc\", null, EventLevel.LogAlways);\n            SinkSettings sinkSettings = new SinkSettings(\"MockFlatFileSink\", subject, new List<EventSourceSettings>() { { settings } });\n            List<SinkSettings> sinks = new List<SinkSettings>() { { sinkSettings } };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.LogSomeMessage(\"some message\");\n                    logger.LogSomeMessage(\"some message2\");\n                    logger.LogSomeMessage(\"some message3\");\n\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 3, \"==-==\");\n                });\n\n            Assert.AreEqual<int>(3, entries.Count());\n            Assert.IsNotNull(entries.SingleOrDefault(e => e.Contains(\"Payload : [message : some message]\")));\n            Assert.IsNotNull(entries.SingleOrDefault(e => e.Contains(\"Payload : [message : some message2]\")));\n            Assert.IsNotNull(entries.SingleOrDefault(e => e.Contains(\"Payload : [message : some message3]\")));\n        }\n\n        [TestMethod]\n        public void WhenCustomSinkConstructionFails()\n        {\n            var exc = ExceptionAssertHelper.Throws<Exception>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\CustomSink\\\\CustomSqlDBNotAllParams.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"Value cannot be null\");\n            StringAssert.Contains(exc.ToString(), \"Parameter name: instanceName\");\n        }\n\n        [TestMethod]\n        public void WhenUsingCustomSinkWithSchemaAndNotAllParametersProvided()\n        {\n            var exc = ExceptionAssertHelper.Throws<Exception>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\CustomSink\\\\CustomSinkMissingParam.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The parameters specified in this element does not map to an existing type member. All paramters are required in the same order of the defined type member\");\n        }\n\n        [TestMethod]\n        public void WhenUsingCustomSinkAndParamsAreNotInOrder()\n        {\n            var exc = ExceptionAssertHelper.Throws<Exception>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\CustomSink\\\\CustomSinkDiffOrder.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The parameters specified in this element does not map to an existing type member. All paramters are required in the same order of the defined type member\");\n        }\n\n        [TestMethod]\n        public void WhenUsingCustomFormatter()\n        {\n            string fileName = \"FlatFileOutProcConfigCF2.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n\n            IEnumerable<string> entries = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\CustomSink\\\\FlatFileCustomFormatter2.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.LogSomeMessage(\"some message using formatter\");\n\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, \"----------\");\n                });\n\n            StringAssert.Contains(entries.First(), \"Mock SourceId\");\n            StringAssert.Contains(entries.First(), \"Mock EventId\");\n            StringAssert.Contains(entries.First(), \"Payload : [message : some message using formatter]\");\n        }\n\n        [TestMethod]\n        public void WhenUsingCustomFormatterProgramatically()\n        {\n            string fileName = \"FlatFileCustomFormatterProgrammatic.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n            CustomFormatterWithWait formatter = new CustomFormatterWithWait();\n            formatter.Detailed = EventLevel.LogAlways;\n            formatter.Header = \"---------------\";\n            formatter.DateTimeFormat = \"d\";\n\n            IEnumerable<string> entries = null;\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProc\", null, EventLevel.Critical);\n            var subject = new EventEntrySubject();\n            subject.LogToFlatFile(fileName, formatter);\n            SinkSettings sinkSettings = new SinkSettings(\"flatFileSink\", subject, new List<EventSourceSettings>() { { settings } });\n            List<SinkSettings> sinks = new List<SinkSettings>() { { sinkSettings } };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.Critical(\"some message using formatter\");\n\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, \"---------------\");\n                });\n\n            StringAssert.Contains(entries.First(), \"Mock SourceId\");\n            StringAssert.Contains(entries.First(), \"Mock EventId\");\n            StringAssert.Contains(entries.First(), \"Payload : [message : some message using formatter]\");\n        }\n\n        [TestMethod]\n        public void WhenCustomFormatterThrowsAnExceptionAndUsedProgramatically()\n        {\n            string fileName = \"FlatFileOutProcCustomFormatterHandleException.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n            MockFormatter formatter = new MockFormatter(true); //this formatter throws\n\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProc\", null, EventLevel.Informational);\n            var subject = new EventEntrySubject();\n            subject.LogToFlatFile(fileName, formatter);\n            SinkSettings sinkSettings = new SinkSettings(\"flatFileSink\", subject, new List<EventSourceSettings>() { { settings } });\n            List<SinkSettings> sinks = new List<SinkSettings>() { { sinkSettings } };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    using (var collectErrorsListener = new InMemoryEventListener())\n                    {\n                        try\n                        {\n                            collectErrorsListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.LogAlways, Keywords.All);\n\n                            logger.LogSomeMessage(\"some message using formatter that throws\");\n                            collectErrorsListener.WaitEvents.Wait(5000);\n\n                            StringAssert.Contains(collectErrorsListener.ToString(), \"Payload : [message : System.InvalidOperationException: Operation is not valid due to the current state of the object.\");\n                        }\n                        finally\n                        {\n                            collectErrorsListener.DisableEvents(SemanticLoggingEventSource.Log);\n                        }\n                    }\n                });\n        }\n\n        [TestMethod]\n        public void WhenCustomFormatterThrowsAnExceptionAndUsedConfig()\n        {\n            string fileName = \"FlatFileOutProcCustomFormatterHandleExceptionViaConfig.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n            MockFormatter formatter = new MockFormatter(true); //this formatter throws\n\n            TraceEventServiceConfiguration svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\CustomSink\\\\FlatFileCustomFormatter.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    using (InMemoryEventListener collectErrorsListener = new InMemoryEventListener())\n                    {\n                        try\n                        {\n                            collectErrorsListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Error, Keywords.All);\n                            logger.LogSomeMessage(\"some message using formatter that throws\");\n                            collectErrorsListener.WaitEvents.Wait(5000);\n\n                            StringAssert.Contains(collectErrorsListener.ToString(), \"Payload : [message : System.InvalidOperationException: Operation is not valid due to the current state of the object.\");\n                        }\n                        finally\n                        {\n                            collectErrorsListener.DisableEvents(SemanticLoggingEventSource.Log);\n                        }\n                    }\n                });\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Formatters/JsonEventTextFormatterFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.Formatters\n{\n    [TestClass]\n    public class JsonEventTextFormatterFixture\n    {\n        [TestMethod]\n        public void WhenUsingJsonFormatterIndented()\n        {\n            string fileName = @\".\\FlatFileJsonFormatterIndentedOutProc.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n\n            IEnumerable<TestEventEntry> entries = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\WithFormatter\\\\FlatFileJsonFormatterIndentedOutProc.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.LogSomeMessage(\"logging using Json Formatter indented\");\n                    entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName, 1);\n                });\n\n            Assert.AreEqual(1, entries.Count());\n            var entry = entries.First();\n            Assert.AreEqual(MockEventSourceOutProc.Logger.Guid, entry.ProviderId);\n            Assert.AreEqual(8, entry.EventId);\n            Assert.AreEqual(EventLevel.Informational, entry.Level);\n            Assert.AreEqual(EventKeywords.None, entry.EventKeywords);\n            Assert.AreEqual(EventOpcode.Info, entry.Opcode);\n            Assert.AreEqual(System.Diagnostics.Process.GetCurrentProcess().Id, entry.ProcessId);\n            Assert.AreEqual(ThreadHelper.GetCurrentUnManagedThreadId(), entry.ThreadId);\n            Assert.AreEqual(EventOpcode.Info, entry.Opcode);\n            Assert.AreEqual(0, entry.Version);\n            Assert.IsNull(entry.Message);\n            Assert.AreEqual(1, entry.Payload.Count);\n            Assert.AreEqual(\"logging using Json Formatter indented\", (string)entry.Payload[\"message\"]);\n        }\n\n        [TestMethod]\n        public void WhenUsingJsonFormatterNotIndented()\n        {\n            string fileName = \"FlatFileJsonFormatterOutProc.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n\n            IEnumerable<TestEventEntry> entries = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\WithFormatter\\\\FlatFileJsonFormatterOutProc.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.LogSomeMessage(\"logging using Json Formatter not indented\");\n                    entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName, 1);\n                });\n\n            Assert.AreEqual(1, entries.Count());\n            var entry = entries.First();\n            Assert.AreEqual(MockEventSourceOutProc.Logger.Guid, entry.ProviderId);\n            Assert.AreEqual(8, entry.EventId);\n            Assert.AreEqual(EventLevel.Informational, entry.Level);\n            Assert.AreEqual(EventKeywords.None, entry.EventKeywords);\n            Assert.AreEqual(EventOpcode.Info, entry.Opcode);\n            Assert.AreEqual(System.Diagnostics.Process.GetCurrentProcess().Id, entry.ProcessId);\n            Assert.AreEqual(ThreadHelper.GetCurrentUnManagedThreadId(), entry.ThreadId);\n            Assert.AreEqual(0, entry.Version);\n            Assert.AreEqual(1, entry.Payload.Count);\n            Assert.AreEqual(\"logging using Json Formatter not indented\", (string)entry.Payload[\"message\"]);\n        }\n\n        [TestMethod]\n        public void WhenUsingJsonFormatterWithCustomDateTimeFormat()\n        {\n            string fileName = \"FlatFileJsonFormatterDateTimeFormat.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n\n            IEnumerable<TestEventEntryCustomTimeStamp> entries = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\WithFormatter\\\\FlatFileJsonFormatterDateTimeFormat.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.LogSomeMessage(\"logging using custom DateTime format\");\n                    entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntryCustomTimeStamp>(fileName, 1);\n                });\n\n            var dt = DateTime.UtcNow;\n            string expectedTimestamp = dt.Day.ToString() + dt.Month.ToString() + dt.Year.ToString();\n            Assert.AreEqual(expectedTimestamp, entries.First().Timestamp);\n        }\n\n        [TestMethod]\n        public void WhenEnumsInPayloadInJson()\n        {\n            string fileName = @\".\\Logs\\FlatFileJsonAndEnums.log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs\");\n            var logger = MockEventSourceOutProcEnum.Logger;\n\n            IEnumerable<TestEventEntryCustomTimeStamp> entries = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\WithFormatter\\\\FlatFileJsonAndEnums.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.SendEnumsEvent15(MockEventSourceOutProcEnum.MyColor.Blue, MockEventSourceOutProcEnum.MyFlags.Flag2);\n                    entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntryCustomTimeStamp>(fileName, 1);\n                });\n\n            Assert.AreEqual(1, entries.Count());\n            var entry = entries.First();\n            Assert.AreEqual(2, entry.Payload.Count);\n            Assert.AreEqual((long)MockEventSourceOutProcEnum.MyColor.Blue, (long)entry.Payload[\"a\"]);\n            Assert.AreEqual((long)MockEventSourceOutProcEnum.MyFlags.Flag2, (long)entry.Payload[\"b\"]);\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Formatters/XmlEventTextFormatterFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\nusing System.Xml.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.Formatters\n{\n    [TestClass]\n    public class XmlEventTextFormatterFixture\n    {\n        [TestMethod]\n        public void WhenUsingXmlFormatterInIndented()\n        {\n            string fileName = \"FlatFileXmlFormatterIndentedOutProc.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n\n            IEnumerable<XElement> entries = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\WithFormatter\\\\FlatFileXmlFormatterIndentedOutProc.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.LogSomeMessage(\"logging using xml Formatter indented\");\n                    entries = FlatFileHelper.PollUntilXmlEventsAreWritten(fileName, 1);\n                });\n\n            XmlFormattedEntry.Fill(entries.Single());\n            Assert.AreEqual<Guid>(MockEventSourceOutProc.Logger.Guid, Guid.Parse(XmlFormattedEntry.Provider.Attribute(\"Guid\").Value));\n            Assert.AreEqual<int>(8, Convert.ToInt32(XmlFormattedEntry.EventId.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            Assert.AreEqual<int>((int)EventLevel.Informational, Int32.Parse(XmlFormattedEntry.Level.Value));\n            Assert.AreEqual<int>(65526, Int32.Parse(XmlFormattedEntry.Task.Value));\n            Assert.AreEqual<long>(0, Int64.Parse(XmlFormattedEntry.Keywords.Value.Replace(\"0x\", string.Empty)));\n            Assert.AreEqual<int>(0, Int32.Parse(XmlFormattedEntry.Opcode.Value));\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, Int32.Parse(XmlFormattedEntry.ProcessId.Value));\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), Int32.Parse(XmlFormattedEntry.ThreadId.Value));\n            Assert.AreEqual(1, XmlFormattedEntry.Payload.Elements().Count());\n            Assert.AreEqual(\"message\", XmlFormattedEntry.Payload.Elements().First().Attribute(\"Name\").Value);\n            Assert.AreEqual(\"logging using xml Formatter indented\", XmlFormattedEntry.Payload.Elements().First().Value);\n        }\n\n        [TestMethod]\n        public void WhenUsingXmlFormatterWithInvalidDateTimeFormate()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\WithFormatter\\\\FlatFileXmlWrongDateTime.xml\"));\n\n            StringAssert.Contains(exc.InnerException.Message, \"The date time format is invalid.\");\n        }\n\n        [TestMethod]\n        public void WhenEventWithGuidPramLoggedInXml()\n        {\n            string fileName = \"FlatFileXmlFormatterAndGuids.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProcEnum.Logger;\n\n            var testGuid = Guid.NewGuid();\n            IEnumerable<XElement> entries = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\WithFormatter\\\\FlatFileXmlFormatterAndGuids.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.SaveExpenseStarted(testGuid);\n                    entries = FlatFileHelper.PollUntilXmlEventsAreWritten(fileName, 1);\n                });\n\n            Assert.AreEqual(1, entries.Count());\n            XmlFormattedEntry.Fill(entries.Single());\n            Assert.AreEqual<Guid>(MockEventSourceOutProcEnum.Logger.Guid, Guid.Parse(XmlFormattedEntry.Provider.Attribute(\"Guid\").Value));\n            Assert.AreEqual<int>(4, Convert.ToInt32(XmlFormattedEntry.EventId.Value));\n            StringAssert.Contains(XmlFormattedEntry.Payload.ToString(), testGuid.ToString());\n        }\n\n        [TestMethod]\n        public void WhenEnumsInPayloadInXml()\n        {\n            string fileName = \"FlatFileXmlFormatterAndEnums.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProcEnum.Logger;\n\n            IEnumerable<XElement> entries = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\WithFormatter\\\\FlatFileXmlFormatterAndEnums.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.SendEnumsEvent16(MockEventSourceOutProcEnum.MyColor.Red, MockEventSourceOutProcEnum.MyFlags.Flag3);\n                    entries = FlatFileHelper.PollUntilXmlEventsAreWritten(fileName, 1);\n                });\n\n            Assert.AreEqual(1, entries.Count());\n            XmlFormattedEntry.Fill(entries.Single());\n            Assert.AreEqual<Guid>(MockEventSourceOutProcEnum.Logger.Guid, Guid.Parse(XmlFormattedEntry.Provider.Attribute(\"Guid\").Value));\n            Assert.AreEqual<int>(3, Convert.ToInt32(XmlFormattedEntry.EventId.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            Assert.AreEqual<int>((int)EventLevel.Informational, Int32.Parse(XmlFormattedEntry.Level.Value));\n            Assert.AreEqual<int>((int)MockEventSourceOutProcEnum.Tasks.Opcode, Int32.Parse(XmlFormattedEntry.Task.Value));\n            Assert.AreEqual<long>(0, Int64.Parse(XmlFormattedEntry.Keywords.Value.Replace(\"0x\", string.Empty)));\n            Assert.AreEqual<int>((int)EventOpcode.Resume, Int32.Parse(XmlFormattedEntry.Opcode.Value));\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, Int32.Parse(XmlFormattedEntry.ProcessId.Value));\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), Int32.Parse(XmlFormattedEntry.ThreadId.Value));           \n            Assert.AreEqual(2, XmlFormattedEntry.Payload.Elements().Count());\n            StringAssert.Contains(XmlFormattedEntry.Payload.ToString(), @\"<Data Name=\"\"a\"\">\" + ((int)MockEventSourceOutProcEnum.MyColor.Red).ToString() + \"</Data>\");\n            StringAssert.Contains(XmlFormattedEntry.Payload.ToString(), @\"<Data Name=\"\"b\"\">\" + ((int)MockEventSourceOutProcEnum.MyFlags.Flag3).ToString() + \"</Data>\");\n        }\n\n        [TestMethod]\n        public void WhenNotIndentedInXml()\n        {\n            string fileName = \"FlatFileXmlFormatterOutProc.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n\n            IEnumerable<XElement> entries = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\WithFormatter\\\\FlatFileXmlFormatterOutProc.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.LogSomeMessage(\"logging using xml Formatter not indented\");\n                    entries = FlatFileHelper.PollUntilXmlEventsAreWritten(fileName, 1);\n                });\n\n            Assert.AreEqual(1, entries.Count());\n            XmlFormattedEntry.Fill(entries.Single());\n            Assert.AreEqual<Guid>(MockEventSourceOutProc.Logger.Guid, Guid.Parse(XmlFormattedEntry.Provider.Attribute(\"Guid\").Value));\n            Assert.AreEqual<int>(8, Convert.ToInt32(XmlFormattedEntry.EventId.Value));\n            Assert.AreEqual<byte>(0, Convert.ToByte(XmlFormattedEntry.Version.Value));\n            Assert.AreEqual<int>((int)EventLevel.Informational, Int32.Parse(XmlFormattedEntry.Level.Value));\n            Assert.AreEqual<int>(65526, Int32.Parse(XmlFormattedEntry.Task.Value));\n            Assert.AreEqual<long>(0, Int64.Parse(XmlFormattedEntry.Keywords.Value.Replace(\"0x\", string.Empty)));\n            Assert.AreEqual<int>(0, Int32.Parse(XmlFormattedEntry.Opcode.Value));\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, Int32.Parse(XmlFormattedEntry.ProcessId.Value));\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), Int32.Parse(XmlFormattedEntry.ThreadId.Value));           \n            Assert.AreEqual(1, XmlFormattedEntry.Payload.Elements().Count());\n            Assert.AreEqual(\"message\", XmlFormattedEntry.Payload.Elements().First().Attribute(\"Name\").Value);\n            Assert.AreEqual(\"logging using xml Formatter not indented\", XmlFormattedEntry.Payload.Elements().First().Value);\n        }\n\n        [TestMethod]\n        public void WhenCustomDateTimeFormatInXml()\n        {\n            string fileName = \"FlatFileXmlFormatterDateTimeFormat.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n\n            IEnumerable<XElement> entries = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\WithFormatter\\\\FlatFileXmlFormatterDateTimeFormat.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.LogSomeMessage(\"logging using xml Formatter not indented\");\n                    entries = FlatFileHelper.PollUntilXmlEventsAreWritten(fileName, 1);\n                });\n\n            Assert.AreEqual(1, entries.Count());\n            XmlFormattedEntry.Fill(entries.Single());\n            var dt = DateTime.UtcNow;\n            string expectedTimestamp = dt.Day.ToString() + dt.Month.ToString() + dt.Year.ToString();\n            StringAssert.Contains(XmlFormattedEntry.TimeCreated.ToString(), @\"SystemTime=\"\"\" + expectedTimestamp + @\"\"\"\");\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Information about an assembly is controlled through the following \n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(\"SemanticLogging.OutProc.Tests\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"\")]\n[assembly: AssemblyProduct(\"SemanticLogging.OutProc.Tests\")]\n[assembly: AssemblyCopyright(\"Copyright ©  2014\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// Setting ComVisible to false makes the types in this assembly not visible \n// to COM components.  If you need to access a type in this assembly from \n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n// The following GUID is for the ID of the typelib if this project is exposed to COM\n[assembly: Guid(\"4c9ecee9-8918-4bc6-816e-81af804c3b9f\")]\n\n// Version information for an assembly consists of the following four values:\n//\n//      Major Version\n//      Minor Version \n//      Build Number\n//      Revision\n//\n// You can specify all the values or you can default the Build and Revision Numbers \n// by using the '*' as shown below:\n// [assembly: AssemblyVersion(\"1.0.*\")]\n[assembly: AssemblyVersion(\"1.0.0.0\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/SamplingFixture.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests\n{\n    [TestClass]\n    public class SamplingFixture\n    {\n        private ManualResetEvent waitObject = new ManualResetEvent(false);\n\n        [ClassInitialize]\n        public static void Setup(TestContext testContext)\n        {\n            AssemblyLoaderHelper.EnsureAllAssembliesAreLoadedForSinkTest();\n        }\n\n        [TestMethod]\n        public void WhenEnablingSamplingForAProcessAndProcessIsRunning()\n        {\n            var serviceConfigFile = \"Configurations\\\\Sampling\\\\WhenEnablingSamplingForAPRocessAndPRocessIsRunning.xml\";\n            string fileName = \"WhenEnablingSamplingForAPRocessAndPRocessIsRunning.log\";\n\n            IEnumerable<TestEventEntry> entries = null;\n            Guid activityId;\n            Guid oldActivityId;\n            TraceEventServiceConfiguration svcConfiguration;\n\n            InitializeTest(serviceConfigFile, fileName, out svcConfiguration, out activityId, out oldActivityId);\n            try\n            {\n                TestScenario.WithConfiguration(svcConfiguration, () =>\n                {\n                    var triggerLogger = TriggerEventSource.Logger;\n                    triggerLogger.TriggerEvent(\"triggermessage\");\n                    SamplingEventSource.Logger.EventToSample(\"mainmessage\");\n\n                    entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName, 2);\n                });\n            }\n            finally\n            {\n                EventSource.SetCurrentThreadActivityId(oldActivityId);\n            }\n\n            Assert.AreEqual(2, entries.Count());\n        }\n\n        [TestMethod]\n        public void WhenEnablingSamplingForAProcessAndProcessIsNotRunning()\n        {\n            var serviceConfigFile = \"Configurations\\\\Sampling\\\\WhenEnablingSamplingForAProcessAndProcessIsNotRunning.xml\";\n            string fileName = \"WhenEnablingSamplingForAProcessAndProcessIsNotRunning.log\";\n\n            IEnumerable<TestEventEntry> entries = null;\n            Guid activityId;\n            Guid oldActivityId;\n            TraceEventServiceConfiguration svcConfiguration;\n\n            InitializeTest(serviceConfigFile, fileName, out svcConfiguration, out activityId, out oldActivityId);\n            try\n            {\n                TestScenario.WithConfiguration(svcConfiguration, () =>\n                {\n                    var triggerLogger = TriggerEventSource.Logger;\n                    triggerLogger.TriggerEvent(\"triggermessage\");\n                    SamplingEventSource.Logger.EventToSample(\"mainmessage\");\n\n                    entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName, 2);\n                });\n            }\n            finally\n            {\n                EventSource.SetCurrentThreadActivityId(oldActivityId);\n            }\n\n            Assert.AreEqual(0, entries.Count());\n        }\n\n        [TestMethod]\n        public void WhenEnablingSamplingAndTPLEvents()\n        {\n            var serviceConfigFile = \"Configurations\\\\Sampling\\\\WhenEnablingSamplingForAPRocessAndTPLEvents.xml\";\n            string fileName = \"WhenEnablingSamplingForAPRocessAndTPLEvents.log\";\n\n            IEnumerable<TestEventEntry> entries = null;\n            Guid activityId;\n            Guid oldActivityId;\n            TraceEventServiceConfiguration svcConfiguration;\n\n            InitializeTest(serviceConfigFile, fileName, out svcConfiguration, out activityId, out oldActivityId);\n            try\n            {\n                TestScenario.WithConfiguration(svcConfiguration, () =>\n                {\n                    var triggerLogger = TriggerEventSource.Logger;\n                    triggerLogger.TriggerEvent(\"triggermessage\");\n                    SamplingEventSource.Logger.BeforeEventToSample(\"mainmessage\");\n                    Task.Run(async () => { await LogEventsAsync(); });\n                    SamplingEventSource.Logger.AfterEventToSample(\"mainmessage\");\n\n                    waitObject.WaitOne();\n                    entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName, 50);\n                });\n            }\n            finally\n            {\n                EventSource.SetCurrentThreadActivityId(oldActivityId);\n            }\n\n            Assert.IsTrue(entries.Count() > 40 && entries.Count() < 50);\n        }\n\n        [TestMethod]\n        public void WhenEnablingSamplingAndTPLEventsAndMultipleSources()\n        {\n            var serviceConfigFile = \"Configurations\\\\Sampling\\\\WhenEnablingSamplingAndTPLEventsAndMultipleSources.xml\";\n            string fileName = \"WhenEnablingSamplingAndTPLEventsAndMultipleSources.log\";\n            File.Delete(\"errorsandWarnings.log\");\n\n            IEnumerable<TestEventEntry> entries = null;\n            Guid activityId;\n            Guid oldActivityId;\n            TraceEventServiceConfiguration svcConfiguration;\n\n            InitializeTest(serviceConfigFile, fileName, out svcConfiguration, out activityId, out oldActivityId);\n\n            try\n            {\n                TestScenario.WithConfiguration(svcConfiguration, () =>\n                {\n                    var triggerLogger = TriggerEventSource.Logger;\n                    triggerLogger.TriggerEvent(\"triggermessage\");\n                    SamplingEventSource.Logger.BeforeEventToSample(\"mainmessage\");\n                    SamplingEventSource1.Logger.EventToSampleFromOtherSource(\"mainmessage\");\n                    Task.Run(async () => await LogEventsAsync());\n                    SamplingEventSource.Logger.AfterEventToSample(\"mainmessage\");\n\n                    waitObject.WaitOne();\n                    entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName, 200);\n                });\n            }\n            finally\n            {\n                EventSource.SetCurrentThreadActivityId(oldActivityId);\n            }\n\n            // Should be 2 trigger events\n            Assert.AreEqual(2, entries.Count(entry => entry.Payload.ContainsKey(\"message\") && entry.Payload[\"message\"].ToString().ToLower().StartsWith(\"trigger\")));\n\n            // Should be 5 Sampling events\n            Assert.AreEqual(5, entries.Count(entry => entry.Payload.ContainsKey(\"message\")\n                && (entry.Payload[\"message\"].ToString().ToLower() == \"mainmessage\" || entry.Payload[\"message\"].ToString().ToLower().EndsWith(\"from process\"))));\n\n            // Should be TPL events\n            Guid guid = new Guid(\"2e5dba47-a3d2-4d16-8ee0-6671ffdcd7b5\");\n            Assert.IsTrue(entries.Count(entry => entry.ProviderId == guid) > 0);\n        }\n\n        [TestMethod]\n        public void WhenSamplingEnabledAndTriggerEventIsNotRaised()\n        {\n            var serviceConfigFile = \"Configurations\\\\Sampling\\\\WhenEnablingSamplingForAPRocessAndTPLEvents.xml\";\n            string fileName = \"WhenEnablingSamplingForAPRocessAndTPLEvents.log\";\n\n            IEnumerable<TestEventEntry> entries = null;\n            Guid activityId;\n            Guid oldActivityId;\n            TraceEventServiceConfiguration svcConfiguration;\n\n            InitializeTest(serviceConfigFile, fileName, out svcConfiguration, out activityId, out oldActivityId);\n            try\n            {\n                TestScenario.WithConfiguration(svcConfiguration, () =>\n                {\n                    SamplingEventSource.Logger.BeforeEventToSample(\"mainmessage\");\n                    Task.Run(() => { SamplingEventSource.Logger.EventInATask(\"test\"); waitObject.Set(); });\n                    SamplingEventSource.Logger.AfterEventToSample(\"mainmessage\");\n\n                    waitObject.WaitOne();\n                    entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName, 50);\n                });\n            }\n            finally\n            {\n                EventSource.SetCurrentThreadActivityId(oldActivityId);\n            }\n\n            Assert.AreEqual(0, entries.Count());\n        }\n\n        [TestMethod]\n        public void WhenServiceStartedBeforeProcessStarted()\n        {\n            var serviceConfigFile = \"Configurations\\\\Sampling\\\\WhenServiceStartedBeforeProcessStarted.xml\";\n            string fileName = \"WhenServiceStartedBeforeProcessStarted.log\";\n\n            IEnumerable<TestEventEntry> entries = null;\n            Guid activityId;\n            Guid oldActivityId;\n            TraceEventServiceConfiguration svcConfiguration;\n\n            InitializeTest(serviceConfigFile, fileName, out svcConfiguration, out activityId, out oldActivityId);\n\n            using (var process = new Process())\n            {\n                try\n                {\n                    TestScenario.WithConfiguration(svcConfiguration, () =>\n                    {\n                        process.StartInfo = new ProcessStartInfo() { UseShellExecute = false, RedirectStandardInput = true, FileName = \"ProcessToSample.exe\" };\n                        process.Start();\n\n                        process.StandardInput.Write(\"x\");\n                        process.WaitForExit(1000);\n\n                        entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName, 1000);\n                    });\n                }\n                catch (Exception exp)\n                {\n                    Assert.Fail(exp.Message);\n                }\n            }\n\n            Assert.AreEqual(6, entries.Count());\n        }\n\n        [TestMethod]\n        public void WhenServiceStartedAfterProcessStarted()\n        {\n            var serviceConfigFile = \"Configurations\\\\Sampling\\\\WhenServiceStartedAfterProcessStarted.xml\";\n            string fileName = \"WhenServiceStartedAfterProcessStarted.log\";\n\n            IEnumerable<TestEventEntry> entries = null;\n            Guid activityId;\n            Guid oldActivityId;\n            TraceEventServiceConfiguration svcConfiguration;\n\n            using (var process = new Process())\n            {\n                process.StartInfo = new ProcessStartInfo() { UseShellExecute = false, RedirectStandardInput = true, FileName = \"ProcessToSample.exe\" };\n                process.Start();\n\n                InitializeTest(serviceConfigFile, fileName, out svcConfiguration, out activityId, out oldActivityId);\n                try\n                {\n                    TestScenario.WithConfiguration(svcConfiguration, () =>\n                    {\n                        process.StandardInput.Write(\"x\");\n                        process.WaitForExit(1000);\n                        entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName, 1000);\n                    });\n                }\n                catch (Exception exp)\n                {\n                    Assert.Fail(exp.Message);\n                }\n            }\n\n            Assert.AreEqual(6, entries.Count());\n        }\n\n        [TestMethod]\n        public void WhenInvalidKeys()\n        {\n            var serviceConfigFile = \"Configurations\\\\Sampling\\\\WhenInvalidKeysInConfiguration.xml\";\n            string fileName = \"WhenInvalidKeysInConfiguration.log\";\n\n            IEnumerable<TestEventEntry> entries = null;\n            Guid activityId;\n            Guid oldActivityId;\n            TraceEventServiceConfiguration svcConfiguration;\n\n            InitializeTest(serviceConfigFile, fileName, out svcConfiguration, out activityId, out oldActivityId);\n            try\n            {\n                TestScenario.WithConfiguration(svcConfiguration, () =>\n                {\n                    TriggerEventSource.Logger.TriggerEvent(\"triggermessage1\");\n                    SamplingEventSource.Logger.EventToSample(\"mainmessage1\");\n\n                    WriteMessagesWithNewActivityId();\n\n                    entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName, 4);\n                });\n            }\n            finally\n            {\n                EventSource.SetCurrentThreadActivityId(oldActivityId);\n            }\n\n            Assert.AreEqual(4, entries.Count());\n        }\n\n        [TestMethod]\n        public void WhenInvalidKeyValue()\n        {\n            var serviceConfigFile = \"Configurations\\\\Sampling\\\\WhenInvalidKeyValueInConfiguration.xml\";\n            string fileName = \"WhenInvalidKeyValueInConfiguration.log\";\n            string errorFileName = \"Errors\" + fileName;\n            File.Delete(errorFileName);\n\n            IEnumerable<TestEventEntry> entries = null;\n            Guid activityId;\n            Guid oldActivityId;\n\n            TraceEventServiceConfiguration svcConfiguration;\n\n            InitializeTest(serviceConfigFile, fileName, out svcConfiguration, out activityId, out oldActivityId);\n\n            try\n            {\n                TestScenario.WithConfiguration(svcConfiguration, () =>\n                {\n                    // Create a new TriggerEventSource instead of the normal approach of using singleton \n                    // This is to force the EventSource constructor to fire which is where\n                    // the validation happens.\n                    new TriggerEventSource().TriggerEvent(\"triggermessage1\");\n                    SamplingEventSource.Logger.EventToSample(\"mainmessage1\");\n\n                    Task.Delay(TimeSpan.FromSeconds(10)).Wait();\n                });\n            }\n            finally\n            {\n                EventSource.SetCurrentThreadActivityId(oldActivityId);\n            }\n\n            entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(errorFileName, 1);\n\n            // Some events will be lost because of buffer overruns or schema synchronization delays in trace session\n            // is the message reported by SLAB even though the real error is misconfiguration\n            Assert.AreEqual(entries.First().EventId, 811);\n\n            entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName, 1);\n            Assert.AreEqual(0, entries.Count());\n        }\n\n        [TestMethod]\n        public void WhenSamplingIsEnabledAndDisabledAtRunTime()\n        {\n            var serviceConfigFile = \"Configurations\\\\Sampling\\\\WhenSamplingIsEnabledAndDisabledAtRunTime.xml\";\n            string fileName = \"WhenSamplingIsEnabledAndDisabledAtRunTime.log\";\n\n            IEnumerable<TestEventEntry> entries = null;\n            Guid activityId;\n            Guid oldActivityId;\n            TraceEventServiceConfiguration svcConfiguration;\n\n            InitializeTest(serviceConfigFile, fileName, out svcConfiguration, out activityId, out oldActivityId, true);\n            try\n            {\n                TestScenario.WithConfiguration(svcConfiguration, () =>\n                {\n                    TriggerEventSource.Logger.TriggerEvent(\"triggermessage1\");\n                    SamplingEventSource.Logger.EventToSample(\"mainmessage1\");\n\n                    WriteMessagesWithNewActivityId();\n\n                    entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName, 4);\n                    Assert.AreEqual(2, entries.Count());\n\n                    string configuration = File.ReadAllText(serviceConfigFile);\n                    configuration = configuration.Replace(\"true\", \"false\");\n                    File.WriteAllText(serviceConfigFile, configuration);\n\n                    Task.Delay(TimeSpan.FromSeconds(1)).Wait();\n\n                    WriteMessagesWithNewActivityId();\n                    WriteMessagesWithNewActivityId();\n\n                    entries = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName, 4);\n                    Assert.AreEqual(5, entries.Count());\n                });\n            }\n            finally\n            {\n                EventSource.SetCurrentThreadActivityId(oldActivityId);\n            }\n        }\n\n        [TestMethod]\n        public void WhenMultipleProcessesShareSameEventSource()\n        {\n            var serviceConfigFile = \"Configurations\\\\Sampling\\\\WhenMultipleProcessesShareSameEventSource.xml\";\n            string fileName1 = \"WhenMultipleProcessesShareSameEventSource1.log\";\n            string fileName2 = \"WhenMultipleProcessesShareSameEventSource2.log\";\n            File.Delete(fileName2);\n\n            IEnumerable<TestEventEntry> entries1 = null;\n            IEnumerable<TestEventEntry> entries2 = null;\n            Guid activityId;\n            Guid oldActivityId;\n            TraceEventServiceConfiguration svcConfiguration;\n\n            InitializeTest(serviceConfigFile, fileName1, out svcConfiguration, out activityId, out oldActivityId);\n\n            using (var process = new Process())\n            {\n                try\n                {\n                    TestScenario.WithConfiguration(svcConfiguration, () =>\n                    {\n                        process.StartInfo = new ProcessStartInfo() { UseShellExecute = false, RedirectStandardInput = true, FileName = \"ProcessToSample.exe\" };\n                        process.Start();\n\n                        TriggerEventSource.Logger.TriggerEvent(\"triggermessage1\");\n                        SamplingEventSource.Logger.EventToSample(\"mainmessage1\");\n\n                        process.StandardInput.Write(\"x\");\n                        process.WaitForExit(1000);\n                        entries1 = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName1, 1000);\n                        entries2 = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName2, 1000);\n                    });\n                }\n                catch (Exception exp)\n                {\n                    Assert.Fail(exp.Message);\n                }\n            }\n\n            Assert.AreEqual(2, entries1.Count());\n            Assert.AreEqual(1, entries2.Count());\n        }\n\n        [TestMethod]\n        public void WhenFilteringMultipleProcessesSameEventSource()\n        {\n            var serviceConfigFile = \"Configurations\\\\Sampling\\\\WhenFilteringMultipleProcessesSameEventSource.xml\";\n            string fileName1 = \"WhenFilteringMultipleProcessesSameEventSource.log\";\n            string fileName2 = \"WhenFilteringMultipleProcessesSameEventSource2.log\";\n            File.Delete(fileName2);\n\n            IEnumerable<TestEventEntry> entries1 = null;\n            IEnumerable<TestEventEntry> entries2 = null;\n            Guid activityId;\n            Guid oldActivityId;\n            TraceEventServiceConfiguration svcConfiguration;\n\n            InitializeTest(serviceConfigFile, fileName1, out svcConfiguration, out activityId, out oldActivityId);\n\n            using (var process = new Process())\n            {\n                try\n                {\n                    TestScenario.WithConfiguration(svcConfiguration, () =>\n                    {\n                        process.StartInfo = new ProcessStartInfo() { UseShellExecute = false, RedirectStandardInput = true, FileName = \"ProcessToSample.exe\" };\n                        process.Start();\n\n                        TriggerEventSource.Logger.TriggerEvent(\"triggermessage1\");\n                        SamplingEventSource.Logger.EventToSample(\"mainmessage1\");\n\n                        process.StandardInput.Write(\"x\");\n                        process.WaitForExit(1000);\n                        entries1 = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName1, 3);\n                        entries2 = FlatFileHelper.PollUntilJsonEventsAreWritten<TestEventEntry>(fileName2, 1);\n                    });\n                }\n                catch (Exception exp)\n                {\n                    Assert.Fail(exp.Message);\n                }\n            }\n\n            Assert.AreEqual(3, entries1.Count());\n            Assert.AreEqual(1, entries2.Count());\n        }\n\n        private async Task LogEventsAsync()\n        {\n            TriggerEventSource.Logger.TriggerEvent(\"trigger event from process triggered\");\n            SamplingEventSource.Logger.BeforeEventToSample(\"message 1 from process\");\n\n            await Task.Delay(10);\n\n            SamplingEventSource.Logger.AfterEventToSample(\"message 2 from process\");\n            waitObject.Set();\n        }\n\n        private void InitializeTest(string serviceConfigFile, string fileName, out TraceEventServiceConfiguration svcConfiguration, out Guid activityId, out Guid oldActivityId, bool shouldMonitorChanges = false)\n        {\n            File.Delete(fileName);\n\n            svcConfiguration = TraceEventServiceConfiguration.Load(serviceConfigFile, shouldMonitorChanges);\n\n            activityId = new Guid(\"368D6088-9F44-4735-B37F-3E76242583A1\");\n            oldActivityId = EventSource.CurrentThreadActivityId;\n            EventSource.SetCurrentThreadActivityId(activityId);\n        }\n\n        private void WriteMessagesWithNewActivityId()\n        {\n            EventSource.SetCurrentThreadActivityId(Guid.NewGuid());\n\n            TriggerEventSource.Logger.TriggerEvent(\"triggermessage2\");\n            SamplingEventSource.Logger.EventToSample(\"mainmessage2\");\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/SemanticLogging-svc.exe.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<configuration>\n  <startup>\n    <supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.5\" />\n  </startup>\n\n  <appSettings>\n    <add key=\"EtwConfigurationFileName\" value=\"slabsvcTest.xml\"/>\n  </appSettings>\n  \n  <runtime>\n    <gcServer enabled=\"true\" />\n    <gcConcurrent enabled=\"true\"/>\n    <!-- Default in v4.5 -->\n    <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">\n      <dependentAssembly>\n        <assemblyIdentity name=\"Microsoft.Data.OData\" publicKeyToken=\"31bf3856ad364e35\" culture=\"neutral\" />\n        <bindingRedirect oldVersion=\"0.0.0.0-5.2.0.0\" newVersion=\"5.2.0.0\" />\n      </dependentAssembly>\n    </assemblyBinding>\n  </runtime>\n\n</configuration>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/SemanticLogging.OutProc.Tests.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"12.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{0D748FC4-24AA-4D3A-81B9-296DF5921C14}</ProjectGuid>\n    <OutputType>Library</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests</RootNamespace>\n    <AssemblyName>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests</AssemblyName>\n    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>\n    <VisualStudioVersion Condition=\"'$(VisualStudioVersion)' == ''\">10.0</VisualStudioVersion>\n    <VSToolsPath Condition=\"'$(VSToolsPath)' == ''\">$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)</VSToolsPath>\n    <ReferencePath>$(ProgramFiles)\\Common Files\\microsoft shared\\VSTT\\$(VisualStudioVersion)\\UITestExtensionPackages</ReferencePath>\n    <IsCodedUITest>False</IsCodedUITest>\n    <TestProjectType>UnitTest</TestProjectType>\n    <SolutionDir Condition=\"$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'\">..\\</SolutionDir>\n    <RestorePackages>true</RestorePackages>\n    <SccProjectName>\n    </SccProjectName>\n    <SccLocalPath>\n    </SccLocalPath>\n    <SccAuxPath>\n    </SccAuxPath>\n    <SccProvider>\n    </SccProvider>\n    <TargetFrameworkProfile />\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"Microsoft.Data.Edm, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\Microsoft.Data.Edm.5.6.0\\lib\\net40\\Microsoft.Data.Edm.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Data.OData, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\Microsoft.Data.OData.5.6.0\\lib\\net40\\Microsoft.Data.OData.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Data.Services.Client, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\Microsoft.Data.Services.Client.5.6.0\\lib\\net40\\Microsoft.Data.Services.Client.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Diagnostics.Tracing.TraceEvent\">\n      <HintPath>..\\..\\..\\source\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\lib\\net40\\Microsoft.Diagnostics.Tracing.TraceEvent.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.WindowsAzure.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\Microsoft.WindowsAzure.ConfigurationManager.2.0.3\\lib\\net40\\Microsoft.WindowsAzure.Configuration.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.WindowsAzure.Storage, Version=3.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\..\\..\\source\\packages\\WindowsAzure.Storage.3.0.2.0\\lib\\net40\\Microsoft.WindowsAzure.Storage.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\Newtonsoft.Json.5.0.8\\lib\\net45\\Newtonsoft.Json.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Configuration\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Data.Services.Client\" />\n    <Reference Include=\"System.Management\" />\n    <Reference Include=\"System.ServiceProcess\" />\n    <Reference Include=\"System.Spatial, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\System.Spatial.5.6.0\\lib\\net40\\System.Spatial.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Transactions\" />\n    <Reference Include=\"System.Xml\" />\n    <Reference Include=\"System.Xml.Linq\" />\n  </ItemGroup>\n  <Choose>\n    <When Condition=\"('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'\">\n      <ItemGroup>\n        <Reference Include=\"Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\" />\n      </ItemGroup>\n    </When>\n    <Otherwise>\n      <ItemGroup>\n        <Reference Include=\"Microsoft.VisualStudio.QualityTools.UnitTestFramework\" />\n      </ItemGroup>\n    </Otherwise>\n  </Choose>\n  <ItemGroup>\n    <Compile Include=\"Configurations\\MyCustomSinkElement.cs\">\n      <DependentUpon>MyCustomSinkElement.xsd</DependentUpon>\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Compile>\n    <Compile Include=\"End2End\\End2EndFixtureBase.cs\" />\n    <Compile Include=\"End2End\\WindowsServiceIntegrationFixture.cs\" />\n    <Compile Include=\"Extensibility\\CustomSinkFixture.cs\" />\n    <Compile Include=\"Formatters\\JsonEventTextFormatterFixture.cs\" />\n    <Compile Include=\"Formatters\\XmlEventTextFormatterFixture.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n    <Compile Include=\"SamplingFixture.cs\" />\n    <Compile Include=\"ServiceConfiguration\\ReconfigFixture.cs\" />\n    <Compile Include=\"ServiceConfiguration\\RFFLSinkConfigFixture.cs\" />\n    <Compile Include=\"ServiceConfiguration\\FlatFileSinkConfigFixture.cs\" />\n    <Compile Include=\"ServiceConfiguration\\ConsoleSinkConfigFixture.cs\" />\n    <Compile Include=\"ServiceConfiguration\\DatabaseSinkConfigFixture.cs\" />\n    <Compile Include=\"ServiceConfiguration\\AzureSinkConfigFixture.cs\" />\n    <Compile Include=\"ServiceConfiguration\\ConfigIntegrationFixture.cs\" />\n    <Compile Include=\"ServiceConfiguration\\TraceEventServiceConfigFixture.cs\" />\n    <Compile Include=\"Sinks\\WindowsAzureTableSinkFixture.cs\" />\n    <Compile Include=\"Sinks\\DatabaseSinkFixture.cs\" />\n    <Compile Include=\"Sinks\\FlatFileSinkFixture.cs\" />\n    <Compile Include=\"Sinks\\InMemorySinkFixture.cs\" />\n    <Compile Include=\"TestObjects\\CustomFormatterWithWait.cs\" />\n    <Compile Include=\"TestObjects\\MockConsoleOutput.cs\" />\n    <Compile Include=\"TestObjects\\MockEventSource.cs\" />\n    <Compile Include=\"TestObjects\\MockEventSourceOutProc.cs\" />\n    <Compile Include=\"TestObjects\\MockEventSourceOutProc2.cs\" />\n    <Compile Include=\"TestObjects\\MockEventSourceOutProcEnum.cs\" />\n    <Compile Include=\"TestObjects\\MockEventSourceOutProcFiltering.cs\" />\n    <Compile Include=\"TestObjects\\MockEventSourceOutProcKeywords.cs\" />\n    <Compile Include=\"TestObjects\\MockEventSourceOutProcLevelFiltered.cs\" />\n    <Compile Include=\"TestObjects\\MockEventSourceOutProcSvc.cs\" />\n    <Compile Include=\"TestObjects\\MockFormatter.cs\" />\n    <Compile Include=\"TestObjects\\SamplingEventSource.cs\" />\n    <Compile Include=\"TestObjects\\SamplingEventSource1.cs\" />\n    <Compile Include=\"TestObjects\\TestAttributesEventSource.cs\" />\n    <Compile Include=\"TestObjects\\TestEventEntry.cs\" />\n    <Compile Include=\"TestObjects\\TestEventSource.cs\" />\n    <Compile Include=\"TestObjects\\TestEventSourceNoAttributes.cs\" />\n    <Compile Include=\"End2End\\IntegrationFixture.cs\" />\n    <Compile Include=\"TestObjects\\TriggerEventSource.cs\" />\n    <Compile Include=\"TestScenarios\\TestScenario.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Content Include=\"Configurations\\Sampling\\WhenEnablingSamplingAndTPLEventsAndMultipleSources.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Sampling\\WhenEnablingSamplingForAProcessAndProcessIsNotRunning.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Sampling\\WhenEnablingSamplingForAProcessAndProcessIsRunning.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Sampling\\WhenEnablingSamplingForAProcessAndTPLEvents.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Sampling\\WhenFilteringMultipleProcessesSameEventSource.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Sampling\\WhenInvalidKeysInConfiguration.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\Sampling\\WhenServiceStartedAfterProcessStarted.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\Sampling\\WhenServiceStartedBeforeProcessStarted.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\Sampling\\WhenInvalidKeyValueInConfiguration.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Sampling\\WhenSamplingIsEnabledAndDisabledAtRunTime.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Sampling\\WhenMultipleProcessesShareSameEventSource.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"slabsvcTest.xml\">\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <None Include=\"App.config\" />\n    <None Include=\"Configurations\\ExternalSchemas\\MyCustomSinkElement.xxsd\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </None>\n    <None Include=\"Configurations\\MyCustomSinkElement.xsd\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </None>\n    <None Include=\"packages.config\" />\n    <Content Include=\"Configurations\\RollingFlatFile\\RollingFlatFile.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WinService\\AzureTablesWinService.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WinService\\FlatFileWinService.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <None Include=\"SemanticLogging-svc.exe.config\">\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </None>\n  </ItemGroup>\n  <ItemGroup>\n    <Content Include=\"Configurations\\AzureTables\\AzureTables.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\AzureTables\\AzureTablesEmptyConnectionString.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\AzureTables\\AzureTablesEmptyInstanceName.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\AzureTables\\AzureTablesEmptyTableAddress.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\AzureTables\\AzureTablesMaxBufferSize.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\AzureTables\\AzureTablesMaxBufferSizeEmpty.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\AzureTables\\AzureTablesMaxBufferSizeValidation.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\AzureTables\\AzureTablesMissingConnectionString.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\AzureTables\\AzureTablesMissingInstanceName.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\AzureTables\\AzureTablesMissingTableAddress.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WinService\\SqlDB.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WinService\\VeryBasicConfig.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\BasicConfig.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\BasicConfigError.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\BasicConfigMissingAssembly.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\BasicConfigNoEventSourceIdentifier.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\BasicConfigOnylGuid.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\BasicConfigSourceNameAndId.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\BasicConfigWithNoGuid.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\BasicConfigWrongType.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\ConfigSessionNameEmpty.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Console\\Console.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Console\\ConsoleEmptyDateTimeFormat.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\Console\\ConsoleFormatterNoParam.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\Console\\ConsoleNoParams.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\CustomSink\\CustomSinkDiffOrder.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\CustomSink\\CustomSinkMissingParam.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\CustomSink\\CustomSqlDBNotAllParams.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\CustomSink\\CustomSqlSink.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\CustomSink\\FlatFileCustomFormatter.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\CustomSink\\FlatFileCustomFormatter2.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\DataCorrectness\\FlatFile.xml\">\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\EmptyKeyword.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\ExternalSchemaValidation.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\FlatFile\\FlatFile.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\FlatFile\\FlatFileCustomFormatter.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\FlatFile\\FlatFileEmptyFileName.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\FlatFile\\FlatFileEmptyName.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\FlatFile\\FlatFileFormatterOutProc.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\FlatFile\\FlatFileJsonFormatter.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\FlatFile\\FlatFileJsonFormatterMissingParams.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\FlatFile\\FlatFileNoFormatter.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\FlatFile\\FlatFileNoParams.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\FlatFile\\FlatFileXmlFormatter.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\FlatFile\\FlatFileXmlFormatterMissingParams.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\FlatFile\\FlatWrongFormatInFile.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\InnerSchemaValidation.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\InnerSchemaValidation2.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\KeywordFiltering\\KeywordFiltering.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\LevelFiltering\\LevelFiltering.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\LongSessionPrefix.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\LongSinkName.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\CustomSink\\MockFlatFileSink.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\CustomSink\\Multiple.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\NoEventSourceName.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Reconfiguration\\FlatFileListener.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Reconfiguration\\FlatFileListenerDiffSession.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Reconfiguration\\FlatFileListenerError.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Reconfiguration\\FlatFileListenerKeywordFiltered.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Reconfiguration\\FlatFileListenerLevelFiltered.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Reconfiguration\\FlatFileListenerNoFormatterEnd.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Reconfiguration\\FlatFileListenerNoFormatterStart.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Reconfiguration\\FlatFileListenerNoKeywordFiltered.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Reconfiguration\\FlatFileListenerTwoSources.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Reconfiguration\\FlatFileListenerTwoSourcesNoListener.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Reconfiguration\\FlatFileListenerTwoSourcesSameListener.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Reconfiguration\\FlatFileListenerXml.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Reconfiguration\\NoListener.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Reconfiguration\\Temp\\configFile.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\Reconfiguration\\TwoFlatFileListeners.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WinService\\RollingFlatFileWinService.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\RollingFlatFile\\RollingFlatFileEmptyFileName.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\RollingFlatFile\\RollingFlatFileEmptyMaxArchiveFiles.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\RollingFlatFile\\RollingFlatFileEmptyRollFileExistsBehavior.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\RollingFlatFile\\RollingFlatFileEmptyRollInterval.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\RollingFlatFile\\RollingFlatFileEmptyRollSizeKB.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\RollingFlatFile\\RollingFlatFileEmptyTimeStampPattern.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\RollingFlatFile\\RollingFlatFileMissingParams.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\RollingFlatFile\\RollingFlatFileNoFormatter.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\SessionNameLongInOneSink.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\SqlDatabase\\SqlBufferingCountEmpty.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\SqlDatabase\\SqlBufferingIntervalEmpty.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\SqlDatabase\\SqlDatabaseCustomTable.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\SqlDatabase\\SqlDatabaseHappyPath.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\SqlDatabase\\SqlDB.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\SqlDatabase\\SqlDBEmptyConnStr.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\SqlDatabase\\SqlDBEmptyInstance.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\SqlDatabase\\SqlDBEmptyName.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\SqlDatabase\\SqlDBMissingConnStr.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\SqlDatabase\\SqlDBMissingInstance.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\SqlDatabase\\SqlDBMissingName.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\SqlDatabase\\SqlDBTableEmpty.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\StringKeyword.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\TwoSinksSameName.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WithFormatter\\FlatFileJsonAndEnums.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WithFormatter\\FlatFileJsonFormatterDateTimeFormat.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WithFormatter\\FlatFileJsonFormatterIndentedOutProc.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n    <Content Include=\"Configurations\\WithFormatter\\FlatFileJsonFormatterOutProc.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WithFormatter\\FlatFileXmlFormatterAndEnums.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WithFormatter\\FlatFileXmlFormatterAndGuids.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WithFormatter\\FlatFileXmlFormatterDateTimeFormat.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WithFormatter\\FlatFileXmlFormatterIndentedOutProc.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WithFormatter\\FlatFileXmlFormatterInvalidDateTimeFormat.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WithFormatter\\FlatFileXmlFormatterOutProc.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WithFormatter\\FlatFileXmlWrongDateTime.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WithWrongFormatter.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WithWrongFormatterParameter.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Configurations\\WithWrongFormatterParameter2.xml\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\..\\..\\source\\Src\\SemanticLogging.Database\\SemanticLogging.Database.csproj\">\n      <Project>{ac34c8e7-2a5b-412c-aff7-cf7f52ee4569}</Project>\n      <Name>SemanticLogging.Database</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\..\\source\\Src\\SemanticLogging.Etw.WindowsService\\SemanticLogging.Etw.WindowsService.csproj\">\n      <Project>{0ebf89e7-d2b2-4968-bc17-0da066029c46}</Project>\n      <Name>SemanticLogging.Etw.WindowsService</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\..\\source\\Src\\SemanticLogging.Etw\\SemanticLogging.Etw.csproj\">\n      <Project>{8440aea2-cd55-42a0-8724-2ecce2b32374}</Project>\n      <Name>SemanticLogging.Etw</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\..\\source\\Src\\SemanticLogging.TextFile\\SemanticLogging.TextFile.csproj\">\n      <Project>{4b187511-187b-48b1-a593-18ba835b49c3}</Project>\n      <Name>SemanticLogging.TextFile</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\..\\source\\Src\\SemanticLogging.WindowsAzure\\SemanticLogging.WindowsAzure.csproj\">\n      <Project>{d7979e9b-7978-48fe-b345-3c767a20f9a1}</Project>\n      <Name>SemanticLogging.WindowsAzure</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\..\\source\\Src\\SemanticLogging\\SemanticLogging.csproj\">\n      <Project>{2cd4105b-0dd6-4c18-9b37-05d8e8f57303}</Project>\n      <Name>SemanticLogging</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\SemanticLogging.Tests.Shared\\SemanticLogging.Tests.Shared.csproj\">\n      <Project>{001e9c59-1326-48f1-9019-9e6ceeb1e458}</Project>\n      <Name>SemanticLogging.Tests.Shared</Name>\n    </ProjectReference>\n  </ItemGroup>\n  <Choose>\n    <When Condition=\"'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'\">\n      <ItemGroup>\n        <Reference Include=\"Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n        <Reference Include=\"Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n        <Reference Include=\"Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n        <Reference Include=\"Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n      </ItemGroup>\n    </When>\n  </Choose>\n  <Import Project=\"$(VSToolsPath)\\TeamTest\\Microsoft.TestTools.targets\" Condition=\"Exists('$(VSToolsPath)\\TeamTest\\Microsoft.TestTools.targets')\" />\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <Import Project=\"..\\..\\..\\source\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets\" Condition=\"Exists('..\\..\\..\\source\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('..\\..\\..\\source\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\..\\..\\source\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets'))\" />\n  </Target>\n  <Import Project=\"..\\..\\..\\source\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets\" Condition=\"Exists('..\\..\\..\\source\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('..\\..\\..\\source\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\..\\..\\source\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets'))\" />\n  </Target>\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/ServiceConfiguration/AzureSinkConfigFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.ServiceConfiguration\n{\n    [TestClass]\n    public class AzureSinkConfigFixture\n    {\n        [ClassInitialize]\n        public static void Setup(TestContext testContext)\n        {\n            AssemblyLoaderHelper.EnsureAllAssembliesAreLoadedForSinkTest();\n        }\n\n        [TestMethod]\n        public void WhenMissingConnectionString()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\AzureTables\\\\AzureTablesMissingConnectionString.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The required attribute 'connectionString' is missing.\");\n        }\n\n        [TestMethod]\n        public void WhenMissingInstanceName()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\AzureTables\\\\AzureTablesMissingInstanceName.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The required attribute 'instanceName' is missing.\");\n        }\n\n        [TestMethod]\n        public void WhenMissingTableAddress()\n        {\n            var serviceConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\AzureTables\\\\AzureTablesMissingTableAddress.xml\");\n\n            Assert.IsNotNull(serviceConfiguration);\n        }\n\n        [TestMethod]\n        public void WhenEmptyConnStr()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\AzureTables\\\\AzureTablesEmptyConnectionString.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The 'connectionString' attribute is invalid - The value '' is invalid according to its datatype \");\n        }\n\n        [TestMethod]\n        public void WhenEmptyInstanceName()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\AzureTables\\\\AzureTablesEmptyInstanceName.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The 'instanceName' attribute is invalid - The value '' is invalid according to its datatype\");\n        }\n\n        [TestMethod]\n        public void WhenmptyTableAddress()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\AzureTables\\\\AzureTablesEmptyTableAddress.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The 'tableAddress' attribute is invalid - The value '' is invalid according to its datatype\");\n        }\n\n        [TestMethod]\n        public void WhenMaxBufferSizeEmpty()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\AzureTables\\\\AzureTablesMaxBufferSizeEmpty.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The 'maxBufferSize' attribute is invalid - The value '' is invalid according to its datatype\");\n        }\n\n        [TestMethod]\n        public void WhenMaxBufferSizeLessThan500()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\AzureTables\\\\AzureTablesMaxBufferSizeValidation.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The size of 'maxBufferSize' should be greater or equal to '500'.\");\n            StringAssert.Contains(exc.ToString(), \"Parameter name: maxBufferSize\");\n        }\n\n        [TestMethod]\n        public void WhenConfigValidAndComplete()\n        {\n            var serviceConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\AzureTables\\\\AzureTablesMaxBufferSize.xml\");\n\n            Assert.IsNotNull(serviceConfiguration);\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/ServiceConfiguration/ConfigIntegrationFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Data;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.ServiceConfiguration\n{\n    [TestClass]\n    public class ConfigIntegrationFixture\n    {\n        [TestMethod]\n        public void WhenUsingTwoCollectorsForSameEventSource()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceOutProc.Logger;\n            EventTextFormatter formatter = new EventTextFormatter();\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProc\", null, EventLevel.LogAlways);\n\n            var subject = new EventEntrySubject();\n            subject.LogToSqlDatabase(\"testInstance\", validConnectionString, \"Traces\", TimeSpan.FromSeconds(1), 1);\n            SinkSettings sinkSettings = new SinkSettings(\"dbSink\", subject, new List<EventSourceSettings>() { { settings } });\n\n            var subject2 = new EventEntrySubject();\n            subject2.LogToSqlDatabase(\"testInstance\", validConnectionString, \"Traces\", TimeSpan.FromSeconds(1), 1);\n            SinkSettings sinkSettings2 = new SinkSettings(\"dbSink2\", subject2, new List<EventSourceSettings>() { { settings } });\n\n            System.Data.DataTable eventsDataTable = null;\n            List<SinkSettings> sinks = new List<SinkSettings>() { sinkSettings, sinkSettings2 };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            using (TraceEventService collector = new TraceEventService(svcConfiguration))\n            using (TraceEventService collector2 = new TraceEventService(svcConfiguration))\n            {\n                collector.Start();\n                collector2.Start();\n                try\n                {\n                    for (int n = 0; n < 10; n++)\n                    {\n                        logger.LogSomeMessage(\"some message\" + n.ToString());\n                    }\n\n                    eventsDataTable = DatabaseHelper.PollUntilEventsAreWritten(validConnectionString, 20);\n                }\n                finally\n                {\n                    collector.Stop();\n                    collector2.Stop();\n                }\n            }\n\n            Assert.AreEqual(20, eventsDataTable.Rows.Count);\n            StringAssert.Contains(eventsDataTable.Rows[0][\"payload\"].ToString(), \"some message\");\n        }\n\n        [TestMethod]\n        public void WhenUsingTwoCollectorsForSameEventSourceWithDifferentSinkTypes()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            string fileName = \"TwoCollectorsSameEventSourceDifferentSinkTypes.log\";\n            File.Delete(fileName);\n            string header = \"===========\";\n            var logger = MockEventSourceOutProc.Logger;\n            EventTextFormatter formatter = new EventTextFormatter(header);\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProc\", null, EventLevel.LogAlways);\n\n            var subject = new EventEntrySubject();\n            subject.LogToSqlDatabase(\"testInstance\", validConnectionString, \"Traces\", TimeSpan.FromSeconds(1), 1);\n            SinkSettings sinkSettings = new SinkSettings(\"dbSink\", subject, new List<EventSourceSettings>() { { settings } });\n\n            var subject2 = new EventEntrySubject();\n            subject2.LogToFlatFile(fileName, formatter);\n            SinkSettings sinkSettings2 = new SinkSettings(\"ffSink\", subject2, new List<EventSourceSettings>() { { settings } });\n\n            System.Data.DataTable eventsDataTable = null;\n            List<SinkSettings> sinks = new List<SinkSettings>() { sinkSettings, sinkSettings2 };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            IEnumerable<string> entries = null;\n            using (TraceEventService collector = new TraceEventService(svcConfiguration))\n            using (TraceEventService collector2 = new TraceEventService(svcConfiguration))\n            {\n                collector.Start();\n                collector2.Start();\n                try\n                {\n                    for (int n = 0; n < 10; n++)\n                    {\n                        logger.LogSomeMessage(\"some message\" + n.ToString());\n                    }\n\n                    eventsDataTable = DatabaseHelper.PollUntilEventsAreWritten(validConnectionString, 10);\n\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 10, header);\n                }\n                finally\n                {\n                    collector.Stop();\n                    collector2.Stop();\n                }\n            }\n\n            Assert.AreEqual(10, eventsDataTable.Rows.Count);\n            StringAssert.Contains(eventsDataTable.Rows[0][\"payload\"].ToString(), \"some message\");\n\n            Assert.AreEqual(10, entries.Count());\n            StringAssert.Contains(entries.First(), \"some message0\");\n            StringAssert.Contains(entries.Last(), \"some message9\");\n        }\n\n        [TestMethod]\n        public void WhenTwoEventSourcesAreUsedInOneCollector()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceOutProc.Logger;\n            var logger2 = MockEventSourceOutProc2.Logger;\n            EventTextFormatter formatter = new EventTextFormatter();\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProc\", null, EventLevel.LogAlways);\n            EventSourceSettings settings2 = new EventSourceSettings(\"MockEventSourceOutProc2\", null, EventLevel.LogAlways);\n\n            var subject = new EventEntrySubject();\n            subject.LogToSqlDatabase(\"testInstance\", validConnectionString, \"Traces\", TimeSpan.FromSeconds(1), 1);\n            SinkSettings sinkSettings = new SinkSettings(\"dbSink\", subject, new List<EventSourceSettings>() { settings, settings2 });\n            List<SinkSettings> sinks = new List<SinkSettings>() { sinkSettings };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    for (int n = 0; n < 200; n++)\n                    {\n                        logger.LogSomeMessage(\"some message\" + n.ToString());\n                    }\n\n                    var eventsDataTable = DatabaseHelper.PollUntilEventsAreWritten(validConnectionString, 200);\n                    Assert.AreEqual(200, eventsDataTable.Rows.Count);\n                    StringAssert.Contains(eventsDataTable.Rows[0][\"payload\"].ToString(), \"some message\");\n\n                    DatabaseHelper.CleanLoggingDB(validConnectionString);\n\n                    for (int n = 0; n < 200; n++)\n                    {\n                        logger2.LogSomeMessage(\"some message\" + n.ToString());\n                    }\n\n                    var eventsDataTable2 = DatabaseHelper.PollUntilEventsAreWritten(validConnectionString, 200);\n                    Assert.AreEqual(200, eventsDataTable2.Rows.Count);\n                    StringAssert.Contains(eventsDataTable2.Rows[0][\"payload\"].ToString(), \"some message\");\n                });\n        }\n\n        [TestMethod]\n        public void WhenEventsAreFiltered()\n        {\n            var logger = MockEventSourceOutProc.Logger;\n            EventTextFormatter formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var fileName = \"FlatFileAllFiltered.log\";\n            File.Delete(fileName);\n\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProc\", null, EventLevel.Critical);\n            var subject = new EventEntrySubject();\n            subject.LogToFlatFile(fileName, formatter);\n\n            SinkSettings sinkSettings = new SinkSettings(\"flatFileSink\", subject, new List<EventSourceSettings>() { { settings } });\n            List<SinkSettings> sinks = new List<SinkSettings>() { { sinkSettings } };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            IEnumerable<string> entries = null;\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    for (int n = 0; n < 200; n++)\n                    {\n                        logger.LogSomeMessage(\"some message\" + n.ToString());\n                    }\n\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 200, EventTextFormatter.DashSeparator);\n                });\n\n            Assert.AreEqual(0, entries.Count());\n        }\n\n        [TestMethod]\n        public void WhenInfoAndMoreVerboseLevelsAreFiltered()\n        {\n            var logger = MockEventSourceOutProc.Logger;\n            EventTextFormatter formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var fileName = \"FlatFileAllFiltered.log\";\n            File.Delete(fileName);\n\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProc\", null, EventLevel.Error);\n            var subject = new EventEntrySubject();\n            subject.LogToFlatFile(fileName, formatter);\n\n            SinkSettings sinkSettings = new SinkSettings(\"flatFileSink\", subject, new List<EventSourceSettings>() { { settings } });\n            List<SinkSettings> sinks = new List<SinkSettings>() { { sinkSettings } };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            IEnumerable<string> entries = null;\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    for (int n = 0; n < 200; n++)\n                    {\n                        logger.LogSomeMessage(\"some message \" + n.ToString());\n                        logger.Critical(\"some error \" + n.ToString());\n                    }\n\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 200, EventTextFormatter.DashSeparator);\n                });\n\n            Assert.AreEqual(200, entries.Count());\n            StringAssert.Contains(entries.First(), \"some error 0\");\n            StringAssert.Contains(entries.Last(), \"some error 199\");\n        }\n\n        [TestMethod]\n        public void WhenMoreVerboseEventsAreFilteredInConfig()\n        {\n            var fileName = \"levelFiltering.log\";\n            File.Delete(fileName);\n            var fileName2 = \"levelFiltering2.log\";\n            File.Delete(fileName2);\n            var fileName3 = \"levelFiltering3.log\";\n            File.Delete(fileName3);\n            var logger = MockEventSourceOutProcFiltering.Logger;\n\n            IEnumerable<string> entries = null;\n            IEnumerable<string> entries2 = null;\n            IEnumerable<string> entries3 = null;\n            TraceEventServiceConfiguration svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\LevelFiltering\\\\LevelFiltering.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.Informational(\"some informational message\");\n                    logger.Verbose(\"some verbose\");\n                    logger.Critical(\"some critical\");\n                    logger.Error(\"some error\");\n                    logger.Warning(\"some warning\");\n\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, \"======\");\n                    entries2 = FlatFileHelper.PollUntilTextEventsAreWritten(fileName2, 2, \"======\");\n                    entries3 = FlatFileHelper.PollUntilTextEventsAreWritten(fileName3, 3, \"======\");\n                });\n\n            StringAssert.Contains(entries.First().ToString(), \"some critical\");\n            StringAssert.Contains(entries2.First().ToString(), \"some critical\");\n            StringAssert.Contains(entries2.Last().ToString(), \"some error\");\n            Assert.AreEqual(1, entries3.Where(e => e.Contains(\"some error\")).Count());\n            Assert.AreEqual(1, entries3.Where(e => e.Contains(\"some critical\")).Count());\n            Assert.AreEqual(1, entries3.Where(e => e.Contains(\"some warning\")).Count());\n        }\n\n        [TestMethod]\n        public void WhenSomeKeywordsAreFiltered()\n        {\n            var fileName = \"keywordFiltering.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProcKeywords.Logger;\n\n            IEnumerable<string> entries = null;\n            TraceEventServiceConfiguration svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\KeywordFiltering\\\\keywordFiltering.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.InformationalPage(\"some informational message filtered by Page keyword\");\n                    logger.InformationalDatabase(\"some informational message filtered by Database keyword\");\n                    logger.InformationalDiagnostic(\"some informational message filtered by Diagnostic keyword\");\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 2, \"======\");\n                });\n\n            Assert.AreEqual(2, entries.Count());\n            StringAssert.Contains(entries.First().ToString(), \"some informational message filtered by Page keyword\");\n            StringAssert.Contains(entries.First().ToString(), \"Keywords : 1\");\n            StringAssert.Contains(entries.Last().ToString(), \"some informational message filtered by Database keyword\");\n            StringAssert.Contains(entries.Last().ToString(), \"Keywords : 2\");\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/ServiceConfiguration/ConsoleSinkConfigFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.ServiceConfiguration\n{\n    [TestClass]\n    public class ConsoleSinkConfigFixture\n    {\n        [TestMethod]\n        public void WhenConfigValidAndComplete()\n        {\n            var logger = MockEventSourceOutProc.Logger;\n            MockConsoleOutput mockConsole = new MockConsoleOutput();\n\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\Console\\\\Console.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    for (int n = 0; n < 10; n++)\n                    {\n                        logger.LogSomeMessage(\"some message to console \" + n.ToString() + \".\");\n                    }\n                });\n        }\n\n        [TestMethod]\n        public void WhenEmptyDateTime()\n        {\n            MockConsoleOutput mockConsole = new MockConsoleOutput();\n\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\Console\\\\ConsoleEmptyDateTimeFormat.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The 'dateTimeFormat' attribute is invalid - The value '' is invalid according to its datatype \");\n        }\n\n        [TestMethod]\n        public void WhenDefaultConfigWithDefaultFormatterParams()\n        {\n            var logger = MockEventSourceOutProc.Logger;\n            MockConsoleOutput mockConsole = new MockConsoleOutput();            \n\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\Console\\\\ConsoleFormatterNoParam.xml\");\n\n            Assert.IsNotNull(svcConfiguration);\n        }\n\n        [TestMethod]\n        public void WhenDefaultConfig()\n        {\n            var logger = MockEventSourceOutProc.Logger;\n            MockConsoleOutput mockConsole = new MockConsoleOutput();\n\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\Console\\\\ConsoleNoParams.xml\");\n\n            Assert.IsNotNull(svcConfiguration);\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/ServiceConfiguration/DatabaseSinkConfigFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System.Configuration;\nusing EtwConfig = Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.ServiceConfiguration\n{\n    [TestClass]\n    public class DatabaseSinkConfigFixture\n    {\n        [TestMethod]\n        public void WhenConfigIsValidAndComplete()\n        {\n            var validConnectionString = ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceOutProc.Logger;\n\n            System.Data.DataTable eventsDataTable = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\SqlDatabase\\\\SqlDatabaseHappyPath.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    for (int n = 0; n < 10; n++)\n                    {\n                        logger.LogSomeMessage(\"some message\" + n.ToString());\n                    }\n\n                    eventsDataTable = DatabaseHelper.PollUntilEventsAreWritten(validConnectionString, 10);\n                });\n\n            Assert.AreEqual(10, eventsDataTable.Rows.Count);\n        }        \n\n        [TestMethod]\n        public void WhenEmptyConnectionString()\n        {\n            var exc = ExceptionAssertHelper.Throws<EtwConfig.ConfigurationException>(() => EtwConfig.TraceEventServiceConfiguration.Load(\"Configurations\\\\SqlDatabase\\\\SqlDBEmptyConnStr.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The 'connectionString' attribute is invalid - The value '' is invalid according to its datatype \");\n        }\n\n        [TestMethod]\n        public void WhenMissingConnectionString()\n        {\n            var exc = ExceptionAssertHelper.Throws<EtwConfig.ConfigurationException>(() => EtwConfig.TraceEventServiceConfiguration.Load(\"Configurations\\\\SqlDatabase\\\\SqlDBMissingConnStr.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The required attribute 'connectionString' is missing.\");\n        }\n\n        [TestMethod]\n        public void WhenEmptyInstanceName()\n        {\n            var exc = ExceptionAssertHelper.Throws<EtwConfig.ConfigurationException>(() => EtwConfig.TraceEventServiceConfiguration.Load(\"Configurations\\\\SqlDatabase\\\\SqlDBEmptyInstance.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The 'instanceName' attribute is invalid - The value '' is invalid according to its datatype\");\n        }\n\n        [TestMethod]\n        public void WhenMissingInstanceName()\n        {\n            var exc = ExceptionAssertHelper.Throws<EtwConfig.ConfigurationException>(() => EtwConfig.TraceEventServiceConfiguration.Load(\"Configurations\\\\SqlDatabase\\\\SqlDBMissingInstance.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The required attribute 'instanceName' is missing.\");\n        }\n\n        [TestMethod]\n        public void WhenEmptyDatabaseName()\n        {\n            var exc = ExceptionAssertHelper.Throws<EtwConfig.ConfigurationException>(() => EtwConfig.TraceEventServiceConfiguration.Load(\"Configurations\\\\SqlDatabase\\\\SqlDBEmptyName.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The 'name' attribute is invalid - The value '' is invalid according to its datatype \");\n        }\n\n        [TestMethod]\n        public void WhenMissingDatabaseName()\n        {\n            var exc = ExceptionAssertHelper.Throws<EtwConfig.ConfigurationException>(() => EtwConfig.TraceEventServiceConfiguration.Load(\"Configurations\\\\SqlDatabase\\\\SqlDBMissingName.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The required attribute 'name' is missing.\");\n        }\n\n        [TestMethod]\n        public void WhenEmptyBufferingInterval()\n        {\n            var exc = ExceptionAssertHelper.Throws<EtwConfig.ConfigurationException>(() => EtwConfig.TraceEventServiceConfiguration.Load(\"Configurations\\\\SqlDatabase\\\\SqlBufferingIntervalEmpty.xml\"));\n            \n            StringAssert.Contains(exc.ToString(), \"The 'bufferingIntervalInSeconds' attribute is invalid - The value '' is invalid according to its datatype \");\n        }\n\n        [TestMethod]\n        public void WhenEmptyBufferingCount()\n        {\n            var exc = ExceptionAssertHelper.Throws<EtwConfig.ConfigurationException>(() => EtwConfig.TraceEventServiceConfiguration.Load(\"Configurations\\\\SqlDatabase\\\\SqlBufferingCountEmpty.xml\"));\n            \n            StringAssert.Contains(exc.ToString(), \"The 'bufferingCount' attribute is invalid - The value '' is invalid according to its datatype \");\n        }\n\n        [TestMethod]\n        public void WhenEmptyTableName()\n        {\n            var exc = ExceptionAssertHelper.Throws<EtwConfig.ConfigurationException>(() => EtwConfig.TraceEventServiceConfiguration.Load(\"Configurations\\\\SqlDatabase\\\\SqlDBTableEmpty.xml\"));\n            \n            StringAssert.Contains(exc.ToString(), \"The 'tableName' attribute is invalid - The value '' is invalid according to its datatype\");\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/ServiceConfiguration/FlatFileSinkConfigFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.ServiceConfiguration\n{\n    [TestClass]\n    public class FlatFileSinkConfigFixture\n    {\n        [TestMethod]\n        public void WhenConfigValidAndComplete()\n        {\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\FlatFile\\\\FlatFile.xml\");\n\n            Assert.IsNotNull(svcConfiguration);\n        }\n\n        [TestMethod]\n        public void WhenConfiguringCustomFormatter()\n        {\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\FlatFile\\\\FlatFileCustomFormatter.xml\");\n\n            Assert.IsNotNull(svcConfiguration);\n        }\n\n        [TestMethod]\n        public void WhenConfiguringJsonFormatter()\n        {\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\FlatFile\\\\FlatFileJsonFormatter.xml\");\n\n            Assert.IsNotNull(svcConfiguration);\n        }\n\n        [TestMethod]\n        public void WhenConfigurationJsonFormatterDefaultValuesForProperties()\n        {\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\FlatFile\\\\FlatFileJsonFormatterMissingParams.xml\");\n\n            Assert.IsNotNull(svcConfiguration);\n        }\n\n        [TestMethod]\n        public void WhenConfiguringXmlFormatter()\n        {\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\FlatFile\\\\FlatFileXmlFormatter.xml\");\n\n            Assert.IsNotNull(svcConfiguration);\n        }\n\n        [TestMethod]\n        public void WhenConfiguringXmlFormatterDefaultValuesForProperties()\n        {\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\FlatFile\\\\FlatFileXmlFormatterMissingParams.xml\");\n\n            Assert.IsNotNull(svcConfiguration);\n        }\n\n        [TestMethod]\n        public void WhenConfiguringWithNoProperties()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\FlatFile\\\\FlatFileNoParams.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The required attribute 'fileName' is missing.\");\n            StringAssert.Contains(exc.ToString(), \"The required attribute 'name' is missing.\");\n        }\n\n        [TestMethod]\n        public void WhenEmptyFileName()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\FlatFile\\\\FlatFileEmptyFileName.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The 'fileName' attribute is invalid - The value '' is invalid according to its datatype\");\n        }\n\n        [TestMethod]\n        public void WhenSinkWithName()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\FlatFile\\\\FlatFileEmptyName.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The 'name' attribute is invalid - The value '' is invalid according to its datatype\");\n        }\n\n        [TestMethod]\n        public void WhenFilePathIsInvalid()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\FlatFile\\\\FlatWrongFormatInFile.xml\"));\n\n            string fullExc = exc.ToString();\n            StringAssert.Contains(fullExc, \"The given path's format is not supported.\");\n        }\n\n        [TestMethod]\n        public void WhenNoFormatter()\n        {\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\FlatFile\\\\FlatFileNoFormatter.xml\");\n\n            Assert.IsNotNull(svcConfiguration);\n        }\n\n        [TestMethod]\n        public void WhenFormatterWithValuesForProperties()\n        {\n            string fileName = \"FlatFileFormatterOutProc.log\";\n            File.Delete(fileName);\n\n            IEnumerable<string> entries = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\FlatFile\\\\FlatFileFormatterOutProc.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    MockEventSourceOutProc.Logger.LogSomeMessage(\"some message\");\n                    MockEventSourceOutProc.Logger.LogSomeMessage(\"some message2\");\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 2, \"=======\");\n                });\n\n            Assert.AreEqual(2, entries.Count());\n            StringAssert.Contains(entries.First(), \"some message\");\n            StringAssert.Contains(entries.Last(), \"some message2\");\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/ServiceConfiguration/RFFLSinkConfigFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.ServiceConfiguration\n{\n    [TestClass]\n    public class RFFLSinkConfigFixture\n    {\n        [ClassInitialize]\n        public static void Setup(TestContext testContext)\n        {\n            AssemblyLoaderHelper.EnsureAllAssembliesAreLoadedForSinkTest();\n        }\n\n        [TestMethod]\n        public void WhenConfigIsValidAndComplete()\n        {\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\RollingFlatFile\\\\RollingFlatFile.xml\");\n\n            Assert.IsNotNull(svcConfiguration);\n        }\n\n        [TestMethod]\n        public void WhenNoFormatterSpecified()\n        {\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\RollingFlatFile\\\\RollingFlatFileNoFormatter.xml\");\n\n            Assert.IsNotNull(svcConfiguration);\n        }\n\n        [TestMethod]\n        public void WhenEmptyFileName()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\RollingFlatFile\\\\RollingFlatFileEmptyFileName.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The 'fileName' attribute is invalid - The value '' is invalid according to its datatype \");\n        }\n\n        [TestMethod]\n        public void WhenEmptyRollFileExistsBehavior()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\RollingFlatFile\\\\RollingFlatFileEmptyRollFileExistsBehavior.xml\"));\n\n            string expectedMessage = \"The 'rollFileExistsBehavior' attribute is invalid - The value '' is invalid according to its datatype\";\n            StringAssert.Contains(exc.ToString(), expectedMessage);\n        }\n\n        [TestMethod]\n        public void WhenEmptyRollInterval()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\RollingFlatFile\\\\RollingFlatFileEmptyRollInterval.xml\"));\n\n            string expectedMessage = \"The 'rollInterval' attribute is invalid - The value '' is invalid according to its datatype\";\n            StringAssert.Contains(exc.ToString(), expectedMessage);\n        }\n\n        [TestMethod]\n        public void WhenEmptyRollSizeKB()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\RollingFlatFile\\\\RollingFlatFileEmptyRollSizeKB.xml\"));\n\n            string expectedMessage = \"The 'rollSizeKB' attribute is invalid - The value '' is invalid according to its datatype\";\n            StringAssert.Contains(exc.ToString(), expectedMessage);\n        }\n\n        [TestMethod]\n        public void WhenEmptyTimeStampPattern()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\RollingFlatFile\\\\RollingFlatFileEmptyTimeStampPattern.xml\"));\n            \n            string expectedMessage = \"The 'timeStampPattern' attribute is invalid - The value '' is invalid according to its datatype\";\n            StringAssert.Contains(exc.ToString(), expectedMessage);\n        }\n\n        [TestMethod]\n        public void WhenEmptyMaxArchiveFiles()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\RollingFlatFile\\\\RollingFlatFileEmptyMaxArchiveFiles.xml\"));\n\n            string expectedMessage = \"The 'maxArchivedFiles' attribute is invalid - The value '' is invalid according to its datatype\";\n            StringAssert.Contains(exc.ToString(), expectedMessage);\n        }\n\n        [TestMethod]\n        public void WhenOnlyMandatoryProperties()\n        {\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\RollingFlatFile\\\\RollingFlatFileMissingParams.xml\");\n\n            Assert.IsNotNull(svcConfiguration);\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/ServiceConfiguration/ReconfigFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Diagnostics.Tracing;\nusing Microsoft.Diagnostics.Tracing.Session;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.ServiceConfiguration\n{\n    [TestClass]\n    public class ReconfigFixture\n    {\n        [ClassInitialize]\n        public static void Setup(TestContext testContext)\n        {\n            AssemblyLoaderHelper.EnsureAllAssembliesAreLoadedForSinkTest();\n        }\n\n        [TestInitialize]\n        public void TestInit()\n        {\n            foreach (var sessionName in TraceEventSession.GetActiveSessionNames())\n            {\n                if (sessionName.ToString().StartsWith(\"ServiceReconfig\"))\n                {\n                    new TraceEventSession(sessionName) { StopOnDispose = true }.Dispose();\n                }\n            }\n        }\n\n        [TestMethod]\n        public void WhenSinkIsAdded()\n        {\n            var fileName = \"flatFileReconfig.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n            var configFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + \"\\\\Configurations\\\\Reconfiguration\\\\temp\\\\configFile.xml\";\n            UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\NoListener.xml\", configFile);\n\n            IEnumerable<string> entries = null;\n            TraceEventServiceConfiguration svcConfiguration = TraceEventServiceConfiguration.Load(configFile, true);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig\", 1);\n                    UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListener.xml\", configFile);\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 1);\n\n                    MockEventSourceOutProc.Logger.LogSomeMessage(\"some message to new added flat file\");\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, \"======\");\n                });\n\n            File.Delete(configFile);\n\n            Assert.AreEqual(1, entries.Count());\n            StringAssert.Contains(entries.First(), \"some message to new added flat file\");\n        }\n\n        [TestMethod]\n        public void WhenSinkIsRemoved()\n        {\n            var fileName = \"flatFileReconfig.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n            var configFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + \"\\\\Configurations\\\\Reconfiguration\\\\temp\\\\configFile.xml\";\n            UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListener.xml\", configFile);\n\n            TraceEventServiceConfiguration svcConfiguration = TraceEventServiceConfiguration.Load(configFile, true);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 1);\n                    MockEventSourceOutProc.Logger.LogSomeMessage(\"some message to new added flat file\");\n                    var entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, \"======\");\n                    Assert.AreEqual(1, entries.Count());\n                    StringAssert.Contains(entries.First(), \"some message to new added flat file\");\n\n                    UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\NoListener.xml\", configFile);\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-dummyListener\", 1);\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 0);\n\n                    MockEventSourceOutProc.Logger.LogSomeMessage(\"this message should not be logged\");\n                    var entries2 = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, \"======\");\n                    Assert.AreEqual(1, entries2.Count());\n                });\n\n            File.Delete(configFile);\n        }\n\n        [TestMethod]\n        public void WhenEventLevelIsUpdated()\n        {\n            var fileName = \"flatFileReconfig.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n            var configFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + \"\\\\Configurations\\\\Reconfiguration\\\\temp\\\\configFile.xml\";\n            UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListener.xml\", configFile);\n\n            TraceEventServiceConfiguration svcConfiguration = TraceEventServiceConfiguration.Load(configFile, true);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 1);\n                    MockEventSourceOutProc.Logger.LogSomeMessage(\"some message to new added flat file\");\n                    var entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, \"======\");\n                    Assert.AreEqual(1, entries.Count());\n                    StringAssert.Contains(entries.First(), \"some message to new added flat file\");\n\n                    UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListenerLevelFiltered.xml\", configFile);\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 1);\n\n                    MockEventSourceOutProcLevelFiltered.Logger.LogSomeMessage(\"this message should not be logged\");\n                    var entries2 = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, \"======\");\n                    Assert.AreEqual(1, entries2.Count());\n\n                    MockEventSourceOutProcLevelFiltered.Logger.Critical(\"this critical message should pass the filter\");\n                    entries2 = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 2, \"======\");\n                    Assert.AreEqual(2, entries2.Count());\n                    StringAssert.Contains(entries2.First(), \"some message to new added flat file\");\n                    StringAssert.Contains(entries2.Last(), \"this critical message should pass the filter\");\n                });\n\n            File.Delete(configFile);\n        }\n\n        [TestMethod]\n        public void WhenKeywordIsUpdated()\n        {\n            var fileName = \"flatFileReconfig.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProcKeywords.Logger;\n            var configFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + \"\\\\Configurations\\\\Reconfiguration\\\\temp\\\\configFile.xml\";\n            UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListenerNoKeywordFiltered.xml\", configFile);\n\n            TraceEventServiceConfiguration svcConfiguration = TraceEventServiceConfiguration.Load(configFile, true);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 1);\n\n                    MockEventSourceOutProcKeywords.Logger.InformationalPage(\"No keyword filtering\");\n                    var entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, \"======\");\n                    Assert.AreEqual(1, entries.Count());\n                    StringAssert.Contains(entries.First(), \"No keyword filtering\");\n\n                    UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListenerKeywordFiltered.xml\", configFile);\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 1);\n\n                    MockEventSourceOutProcKeywords.Logger.InformationalPage(\"InformationalPage ok\");\n                    MockEventSourceOutProcKeywords.Logger.InformationalDatabase(\"InformationalDatabase ok\");\n                    MockEventSourceOutProcKeywords.Logger.InformationalDiagnostic(\"Diagnostic not ok\");\n                    var entries2 = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 3, \"======\");\n                    Assert.AreEqual(3, entries2.Count());\n                    StringAssert.Contains(entries2.First(), \"No keyword filtering\");\n                    StringAssert.Contains(entries2.ElementAt(1).ToString(), \"InformationalPage ok\");\n                    StringAssert.Contains(entries2.Last(), \"InformationalDatabase ok\");\n                });\n\n            File.Delete(configFile);\n        }\n\n        [TestMethod]\n        public void WhenSinkAddedWithErrorDoesNotRecycle()\n        {\n            var fileName = \"flatfileListenerOk.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n            var configFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + \"\\\\Configurations\\\\Reconfiguration\\\\temp\\\\configFile.xml\";\n            UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\NoListener.xml\", configFile);\n\n            TraceEventServiceConfiguration svcConfiguration = TraceEventServiceConfiguration.Load(configFile, true);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    using (var collectErrorsListener = new InMemoryEventListener())\n                    {\n                        collectErrorsListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.LogAlways, Keywords.All);\n                        try\n                        {\n                            TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig\", 1);\n                            UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListenerError.xml\", configFile);\n                            TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 0);\n                            TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-2flatFileListener\", 1);\n\n                            MockEventSourceOutProc.Logger.LogSomeMessage(\"Some informational from a new listener.\");\n                            var entries2 = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, \"======\");\n                            Assert.AreEqual(1, entries2.Count());\n                            StringAssert.Contains(entries2.First(), \"Some informational from a new listener.\");\n\n                            collectErrorsListener.WaitEvents.Wait(TimeSpan.FromSeconds(3));\n                            StringAssert.Contains(collectErrorsListener.ToString(), \"One or more errors occurred when loading the TraceEventService configuration file.\");\n                            StringAssert.Contains(collectErrorsListener.ToString(), \"The given path's format is not supported.\");\n                            StringAssert.Contains(collectErrorsListener.ToString(), \"The configuration was partially successfully loaded. Check logs for further error details.\");\n                        }\n                        finally\n                        {\n                            File.Delete(configFile);\n                            collectErrorsListener.DisableEvents(SemanticLoggingEventSource.Log);\n                        }\n                    }\n                });\n        }\n\n        [TestMethod]\n        public void WhenTwoSourcesSinkAddedThenRemoved()\n        {\n            var fileName = \"flatFileReconfig.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n            var configFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + \"\\\\Configurations\\\\Reconfiguration\\\\temp\\\\configFile.xml\";\n            UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListenerTwoSources.xml\", configFile);\n\n            TraceEventServiceConfiguration svcConfiguration = TraceEventServiceConfiguration.Load(configFile, true);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 1);\n\n                    MockEventSourceOutProc.Logger.LogSomeMessage(\"some message to new added flat file\");\n                    var entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, \"======\");\n                    Assert.AreEqual(1, entries.Count());\n                    StringAssert.Contains(entries.First(), \"some message to new added flat file\");\n\n                    UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListenerTwoSourcesSameListener.xml\", configFile);\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 1);\n\n                    MockEventSourceOutProc.Logger.LogSomeMessage(\"some message to new added flat file2\");\n                    MockEventSourceOutProc2.Logger.LogSomeMessage(\"some message to new added flat file3\");\n                    var entries2 = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 3, \"======\");\n                    Assert.AreEqual(3, entries2.Count());\n                    StringAssert.Contains(entries2.First(), \"some message to new added flat file\");\n                    StringAssert.Contains(entries2.ElementAt(1), \"some message to new added flat file2\");\n                    StringAssert.Contains(entries2.Last(), \"some message to new added flat file3\");\n\n                    UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListenerTwoSources.xml\", configFile);\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 1);\n\n                    MockEventSourceOutProc.Logger.LogSomeMessage(\"last message to new added flat file\");\n                    var entries3 = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 4, \"======\");\n                    Assert.AreEqual(4, entries3.Count());\n                    StringAssert.Contains(entries3.Last(), \"last message to new added flat file\");\n\n                    UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListenerTwoSourcesNoListener.xml\", configFile);\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 0);\n                });\n\n            File.Delete(configFile);\n        }\n\n        [TestMethod]\n        public void WhenConfigUpdatedTwice()\n        {\n            var fileName = \"flatFileReconfig.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n            var configFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + \"\\\\Configurations\\\\Reconfiguration\\\\temp\\\\configFile.xml\";\n            UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\NoListener.xml\", configFile);\n\n            TraceEventServiceConfiguration svcConfiguration = TraceEventServiceConfiguration.Load(configFile, true);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 0);\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-dummyListener\", 1);\n\n                    TraceEventServiceConfiguration newConfig = TraceEventServiceConfiguration.Load(\"Configurations\\\\Reconfiguration\\\\NoListener.xml\");\n                    UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\NoListener.xml\", configFile);\n\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 0);\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-dummyListener\", 1);\n                });\n\n            File.Delete(configFile);\n        }\n\n        [TestMethod]\n        public void WhenConnfigUpdatedTwiceWithTwoListeners()\n        {\n            var fileName = \"flatFileReconfig.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n            var configFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + \"\\\\Configurations\\\\Reconfiguration\\\\temp\\\\configFile.xml\";\n            UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListener.xml\", configFile);\n\n            TraceEventServiceConfiguration svcConfiguration = TraceEventServiceConfiguration.Load(configFile, true);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 1);\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-dummyListener\", 1);\n\n                    UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListener.xml\", configFile);\n\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 1);\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-dummyListener\", 1);\n                });\n\n            File.Delete(configFile);\n        }\n\n        [TestMethod]\n        public void WhenConfigChangesSessionRecycles()\n        {\n            var fileName = \"flatFileReconfig.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n            var configFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + \"\\\\Configurations\\\\Reconfiguration\\\\temp\\\\configFile.xml\";\n            UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListener.xml\", configFile);\n\n            TraceEventServiceConfiguration svcConfiguration = TraceEventServiceConfiguration.Load(configFile, true);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 1);\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-dummyListener\", 1);\n\n                    UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListenerDiffSession.xml\", configFile);\n                });\n\n            File.Delete(configFile);\n        }\n\n        [TestMethod]\n        public void WhenSourceAddedSessionRecycles()\n        {\n            var fileName = \"flatFileReconfig.log\";\n            File.Delete(fileName);\n            var logger = MockEventSourceOutProc.Logger;\n            var configFile = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + \"\\\\Configurations\\\\Reconfiguration\\\\temp\\\\configFile.xml\";\n            UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListener.xml\", configFile);\n\n            TraceEventServiceConfiguration svcConfiguration = TraceEventServiceConfiguration.Load(configFile, true);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-flatFileListener\", 1);\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-dummyListener\", 1);\n\n                    MockEventSourceOutProc.Logger.LogSomeMessage(\"some message to new added flat file\");\n                    var entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, \"======\");\n                    Assert.AreEqual(1, entries.Count());\n                    StringAssert.Contains(entries.First(), \"some message to new added flat file\");\n\n                    UpdateServiceConfigurationFile(\"Configurations\\\\Reconfiguration\\\\FlatFileListenerTwoSourcesSameListener.xml\", configFile);\n                    TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfig-dummyListener2\", 1);\n\n                    MockEventSourceOutProc2.Logger.LogSomeMessage(\"another message to new added flat file\");\n                    var entries2 = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 2, \"======\");\n                    Assert.AreEqual(2, entries2.Count());\n                    StringAssert.Contains(entries2.First(), \"some message to new added flat file\");\n                });\n\n            File.Delete(configFile);\n        }\n\n        [TestMethod]\n        public void WhenSourceManifestIsUpdated()\n        {\n            var fileName = \"twoflatFileListeners.log\";\n            File.Delete(fileName);\n            var fileName2 = \"twoflatFileListeners2.log\";\n            File.Delete(fileName2);\n\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\Reconfiguration\\\\TwoFlatFileListeners.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    var newDomain = AppDomain.CreateDomain(\"TestintDynamicManifest\", AppDomain.CurrentDomain.Evidence, AppDomain.CurrentDomain.SetupInformation);\n                    try\n                    {\n                        var instance = (IsolatedExecutingClass)newDomain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, typeof(IsolatedExecutingClass).FullName);\n                        instance.TestWithSource1();\n                    }\n                    finally\n                    {\n                        AppDomain.Unload(newDomain);\n                    }\n\n                    newDomain = AppDomain.CreateDomain(\"TestintDynamicManifest\", AppDomain.CurrentDomain.Evidence, AppDomain.CurrentDomain.SetupInformation);\n                    try\n                    {\n                        var instance = (IsolatedExecutingClass)newDomain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, typeof(IsolatedExecutingClass).FullName);\n                        instance.TestWithSource2();\n                    }\n                    finally\n                    {\n                        AppDomain.Unload(newDomain);\n                    }\n\n                    var entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 2, \"======\");\n                    Assert.AreEqual(2, entries.Count());\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName2, 2, \"======\");\n                    Assert.AreEqual(2, entries.Count());\n                });\n        }\n\n        private static void UpdateServiceConfigurationFile(string path, string tempFile)\n        {\n            File.WriteAllText(tempFile, File.ReadAllText(path));\n\n            // Arbitrary time to wait until the config changes are applied\n            Task.Delay(TimeSpan.FromSeconds(2)).Wait();\n        }\n\n        [EventSource(Name = \"MyNewCompanyEventSource\")]\n        private sealed class MyNewCompanyEventSource : EventSource\n        {\n            public static class Tasks\n            {\n                public const EventTask Opcode = (EventTask)1;\n            }\n\n            [Event(1, Message = \"Event1 ID={0}\", Opcode = EventOpcode.Start, Task = Tasks.Opcode)]\n            public void Event1(int id)\n            {\n                if (this.IsEnabled())\n                {\n                    this.WriteEvent(1, id);\n                }\n            }\n\n            public static readonly MyNewCompanyEventSource Logger = new MyNewCompanyEventSource();\n        }\n\n        [EventSource(Name = \"MyNewCompanyEventSource\")]\n        private sealed class MyNewCompanyEventSource2 : EventSource\n        {\n            public static class Tasks\n            {\n                public const EventTask Opcode = (EventTask)1;\n            }\n\n            [Event(1, Message = \"Event1 ID={0}\", Opcode = EventOpcode.Start, Task = Tasks.Opcode)]\n            public void Event1(int id)\n            {\n                if (this.IsEnabled())\n                {\n                    this.WriteEvent(1, id);\n                }\n            }\n\n            [Event(2, Message = \"Event2 ID={0}\", Opcode = EventOpcode.Start, Task = Tasks.Opcode)]\n            public void Event2(int id)\n            {\n                if (this.IsEnabled())\n                {\n                    this.WriteEvent(2, id);\n                }\n            }\n\n            public static readonly MyNewCompanyEventSource2 Logger = new MyNewCompanyEventSource2();\n        }\n\n        [Serializable]\n        internal class IsolatedExecutingClass : MarshalByRefObject\n        {\n            public void TestWithSource1()\n            {\n                var logger = MyNewCompanyEventSource.Logger;\n                logger.Event1(1);\n            }\n\n            public void TestWithSource2()\n            {\n                var logger = MyNewCompanyEventSource2.Logger;\n                logger.Event2(2);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/ServiceConfiguration/TraceEventServiceConfigFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\nusing System.Xml.Schema;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.ServiceConfiguration\n{\n    [TestClass]\n    public class TraceEventServiceConfigFixture\n    {\n        [TestMethod]\n        public void WhenSessionNameIsTooLong()\n        {\n            // session name should not be more than 200 chars\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\LongSessionPrefix.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The 'sessionNamePrefix' attribute is invalid - The value\");\n            StringAssert.Contains(exc.ToString(), \"The actual length is greater than the MaxLength value.\");\n        }\n\n        [TestMethod]\n        public void WhenSinkNameIsTooLong()\n        {\n            // sink name should not be moe than 200 chars\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\LongSinkName.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The 'name' attribute is invalid - The value\");\n            StringAssert.Contains(exc.ToString(), \"The actual length is greater than the MaxLength value.\");\n        }\n\n        [TestMethod]\n        public void WhenSomeSessionNamesAreInvalid()\n        {\n            File.Delete(\"sessionLength.log\");\n            File.Delete(\"sessionLength2.log\");\n\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\SessionNameLongInOneSink.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    Assert.IsTrue(TraceSessionHelper.WaitAndAssertCountOfSessions(\"ServiceReconfigService\", 3));\n                    Assert.IsTrue(File.Exists(\"sessionLength.log\"));\n                    Assert.IsTrue(File.Exists(\"sessionLength2.log\"));\n                });\n        }\n\n        [TestMethod]\n        public void WhenCustomSinkAssemblyNotFound()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\BasicConfigMissingAssembly.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"One or more errors occurred when loading the TraceEventService configuration file.\");\n            StringAssert.Contains(exc.ToString(), \"Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests' or one of its dependencies. The system cannot find the file specified.\");\n        }\n\n        [TestMethod]\n        public void WhenCustomSinkTypeIsMissing()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\BasicConfigWrongType.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"One or more errors occurred when loading the TraceEventService configuration file.\");\n            StringAssert.Contains(exc.ToString(), \"Could not load type 'Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects.Foo' from assembly 'Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests'.\");\n        }\n\n        [TestMethod]\n        public void WhenFormatterTypeNotFound()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\WithWrongFormatterParameter2.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"One or more errors occurred when loading the TraceEventService configuration file.\");\n            StringAssert.Contains(exc.ToString(), \"Could not load type 'Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters' from assembly 'Microsoft.Practices.EnterpriseLibrary.SemanticLogging'.\");\n        }    \n\n        [TestMethod]\n        public void WhenWrongTypeForFormatter()\n        {\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\WithWrongFormatterParameter.xml\", createSinks: false);\n\n            Assert.IsNotNull(svcConfiguration);\n        }\n\n        [TestMethod]\n        public void WhenUsingWrongFormatter()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\WithWrongFormatter.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"One or more errors occurred when loading the TraceEventService configuration file.\");\n            StringAssert.Contains(exc.ToString(), \"Could not load type 'Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.CustomFormatterWithWait' from assembly 'Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests'.\");\n        }\n\n        [TestMethod]\n        public void WhenListenerMissing()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\BasicConfigError.xml\"));\n\n            StringAssert.Contains(exc.Message, \"One or more errors occurred when loading the TraceEventService configuration file.\");\n            StringAssert.Contains(exc.ToString(), \"Could not load type 'Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects.Foo' from assembly 'Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests'.\");\n        }\n\n        [TestMethod]\n        public void WhenOnlyGuidForEventSource()\n        {\n            var svcConfig = TraceEventServiceConfiguration.Load(\"Configurations\\\\BasicConfigOnylGuid.xml\");\n\n            Assert.AreEqual(1, svcConfig.SinkSettings[0].EventSources.Count());\n            Assert.AreEqual(new Guid(\"659518be-d338-564b-2759-c63c10ef82e2\"), svcConfig.SinkSettings[0].EventSources.First().EventSourceId);\n        }\n\n        [TestMethod]\n        public void WhenBothNameAndIDSpecified()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\BasicConfigSourceNameAndId.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"There is an ambiguity when both name and id are specified. Specify only one value.\");\n        }\n\n        [TestMethod]\n        public void WhenNoEventSourceProperties()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\BasicConfigNoEventSourceIdentifier.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The EventSource 'name' and 'id' values are missing. Please provide either name or id.\");\n        }\n\n        [TestMethod]\n        public void WhenDefaultValues()\n        {\n            var logger = MockEventSourceOutProc.Logger;\n\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\BasicConfig.xml\");\n\n            Assert.AreEqual(1, svcConfiguration.SinkSettings[0].EventSources.Count());\n            Assert.AreEqual(new Guid(\"f150d8fb-960c-5e38-a69d-49bae6f97289\"), svcConfiguration.SinkSettings[0].EventSources.First().EventSourceId);\n            Assert.AreEqual(\"TestEventSource\", svcConfiguration.SinkSettings[0].EventSources.First().Name);\n            Assert.AreEqual(\"consoleSink\", svcConfiguration.SinkSettings[0].Name);\n            Assert.AreEqual(1, svcConfiguration.SinkSettings[0].EventSources.Count());\n            Assert.AreEqual(1, svcConfiguration.SinkSettings.Count);\n            Assert.AreEqual(\"Microsoft-SemanticLogging-Etw\", svcConfiguration.Settings.SessionNamePrefix);\n        }\n\n        [TestMethod]\n        public void WhenOnlyEventSourceName()\n        {\n            var logger = MockEventSourceOutProc.Logger;\n\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\BasicConfigWithNoGuid.xml\");\n\n            Assert.AreEqual(1, svcConfiguration.SinkSettings[0].EventSources.Count());\n            Assert.AreEqual(MockEventSource.Logger.Guid, svcConfiguration.SinkSettings[0].EventSources.First().EventSourceId);\n            Assert.AreEqual(\"TestEventSource\", svcConfiguration.SinkSettings[0].EventSources.First().Name);\n            Assert.AreEqual(\"consoleSink\", svcConfiguration.SinkSettings[0].Name);\n            Assert.AreEqual(1, svcConfiguration.SinkSettings[0].EventSources.Count());\n            Assert.AreEqual(1, svcConfiguration.SinkSettings.Count);\n            Assert.AreEqual(\"Microsoft-SemanticLogging-Etw\", svcConfiguration.Settings.SessionNamePrefix);\n        }\n\n        [TestMethod]\n        public void WhenKeywordsISEmpty()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\EmptyKeyword.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"One or more errors occurred when loading the TraceEventService configuration file.\");\n            StringAssert.Contains(exc.ToString(), \"The 'matchAnyKeyword' attribute is invalid - The value '' is invalid according to its datatype\");\n        }\n\n        [TestMethod]\n        public void WhenKeywordISInvalid()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\StringKeyword.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"One or more errors occurred when loading the TraceEventService configuration file.\");\n            StringAssert.Contains(exc.ToString(), \"The 'matchAnyKeyword' attribute is invalid - The value 'Database' is invalid according to its datatype 'http://www.w3.org/2001/XMLSchema:long' - The string 'Database' is not a valid Int64 value.\");\n        }\n\n        [TestMethod]\n        public void WhenSessionPrefixIsEmpty()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\ConfigSessionNameEmpty.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The 'sessionNamePrefix' attribute is invalid - The value '' is invalid according to its datatype \");\n        }\n\n        [TestMethod]\n        public void WhenSourceNameIsEmpty()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\NoEventSourceName.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The EventSource 'name' and 'id' values are missing. Please provide either name or id.\");\n        }\n\n        [TestMethod]\n        public void WhenDuplicateSinkNames()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\TwoSinksSameName.xml\"));\n\n            string expectedMessage = \"There is a duplicate key sequence 'listener1'\";\n            StringAssert.Contains(exc.ToString(), expectedMessage);\n        }\n\n        [TestMethod]\n        public void WhenCustomSinkSchemHasInvalidProperty()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\InnerSchemaValidation.xml\"));\n\n            string expectedMessage = \"The 'foo' attribute is not declared.\";\n            StringAssert.Contains(exc.Message, \"One or more errors occurred when loading the TraceEventService configuration file.\");\n            var ex = exc.InnerExceptions.FirstOrDefault(e => e.Message.Contains(expectedMessage));\n            Assert.IsNotNull(ex);\n            Assert.IsInstanceOfType(ex, typeof(XmlSchemaValidationException));\n        }\n\n        [TestMethod]\n        public void WhenCustomSinkSchemaHasInvalidPropertyValue()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\ExternalSchemaValidation.xml\"));\n\n            StringAssert.Contains(exc.ToString(), \"The 'attr' attribute is invalid - The value 'foo' is invalid according to its datatype\");\n        }\n\n        [TestMethod]\n        public void WhenCustomSinkSchemaHasMissingAttribute()\n        {\n            var exc = ExceptionAssertHelper.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Configurations\\\\InnerSchemaValidation2.xml\"));\n\n            string expectedMessage = \"The required attribute 'name' is missing.\";\n            StringAssert.Contains(exc.ToString(), expectedMessage);\n        }\n\n        [TestMethod]\n        public void WhenSinkNameIsDuplicated1()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceOutProc.Logger;\n\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProc\", null, EventLevel.LogAlways);\n            var subject = new EventEntrySubject();\n            subject.LogToSqlDatabase(\"testInstance\", validConnectionString, \"Traces\", TimeSpan.FromSeconds(10), 200);\n            SinkSettings sinkSettings = new SinkSettings(\"dbSink\", subject, new List<EventSourceSettings>() { { settings } });\n            var subject2 = new EventEntrySubject();\n            subject2.LogToSqlDatabase(\"testInstance\", validConnectionString, \"Traces\", TimeSpan.FromSeconds(10), 200);\n            SinkSettings sinkSettings2 = new SinkSettings(\"dbSink\", subject2, new List<EventSourceSettings>() { { settings } });\n            List<SinkSettings> sinks = new List<SinkSettings>() { sinkSettings, sinkSettings2 };\n            var exc = ExceptionAssertHelper.\n                Throws<Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration.ConfigurationException>(\n                            () => new TraceEventServiceConfiguration(sinks));\n\n            StringAssert.Contains(exc.ToString(), \"Duplicate sinks\");\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Sinks/DatabaseSinkFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.Sinks\n{\n    [TestClass]\n    public class DatabaseSinkFixture\n    {\n        [ClassInitialize]\n        public static void Setup(TestContext testContext)\n        {\n            AssemblyLoaderHelper.EnsureAllAssembliesAreLoadedForSinkTest();\n        }\n\n        [TestMethod]\n        public void WhenUsingSinkProgrammatically()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceOutProc.Logger;\n            EventTextFormatter formatter = new EventTextFormatter();\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProc\", null, EventLevel.LogAlways);\n            var subject = new EventEntrySubject();\n            subject.LogToSqlDatabase(\"testInstance\", validConnectionString, \"Traces\", TimeSpan.FromSeconds(1), 1);\n\n            System.Data.DataTable eventsDataTable = null;\n            SinkSettings sinkSettings = new SinkSettings(\"sqlDBsink\", subject, new List<EventSourceSettings>() { { settings } });\n            List<SinkSettings> sinks = new List<SinkSettings>() { { sinkSettings } };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    for (int n = 0; n < 10; n++)\n                    {\n                        logger.LogSomeMessage(\"some message\" + n.ToString());\n                    }\n\n                    eventsDataTable = DatabaseHelper.PollUntilEventsAreWritten(validConnectionString, 10);\n                });\n\n            Assert.AreEqual(10, eventsDataTable.Rows.Count);\n            StringAssert.Contains(eventsDataTable.Rows[0][\"payload\"].ToString(), \"some message\");\n        }\n\n        [TestMethod]\n        public void WhenEnumsInPayload()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceOutProcEnum.Logger;\n            EventTextFormatter formatter = new EventTextFormatter();\n\n            System.Data.DataTable eventsDataTable = null;\n            var subject = new EventEntrySubject();\n            subject.LogToSqlDatabase(\"testInstance\", validConnectionString, \"Traces\", bufferingCount: 1);\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProcEnum\", null, EventLevel.LogAlways);\n            SinkSettings sinkSettings = new SinkSettings(\"sqlDBsink\", subject, new List<EventSourceSettings>() { { settings } });\n            List<SinkSettings> sinks = new List<SinkSettings>() { { sinkSettings } };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.SendEnumsEvent16(MockEventSourceOutProcEnum.MyColor.Blue, MockEventSourceOutProcEnum.MyFlags.Flag3);\n\n                    eventsDataTable = DatabaseHelper.PollUntilEventsAreWritten(validConnectionString, 1);\n                });\n\n            Assert.AreEqual(1, eventsDataTable.Rows.Count);\n            StringAssert.Contains(eventsDataTable.Rows[0][\"payload\"].ToString(), @\"\"\"a\"\": 1\");\n            StringAssert.Contains(eventsDataTable.Rows[0][\"payload\"].ToString(), @\"\"\"b\"\": 4\");\n        }\n\n        [TestMethod]\n        public void WhenUsingSinkThroughConfig()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceOutProc.Logger;\n\n            System.Data.DataTable eventsDataTable = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\SqlDatabase\\\\SqlDB.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    for (int n = 0; n < 10; n++)\n                    {\n                        logger.LogSomeMessage(\"some message\" + n.ToString());\n                    }\n\n                    eventsDataTable = DatabaseHelper.PollUntilEventsAreWritten(validConnectionString, 10);\n                });\n\n            Assert.AreEqual(10, eventsDataTable.Rows.Count);\n            StringAssert.Contains(eventsDataTable.Rows[0][\"payload\"].ToString(), \"some message\");\n        }\n\n        [TestMethod]\n        public void WhenProcessId()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceOutProcEnum.Logger;\n            EventTextFormatter formatter = new EventTextFormatter();\n\n            System.Data.DataTable eventsDataTable = null;\n            var subject = new EventEntrySubject();\n            subject.LogToSqlDatabase(\"testInstance\", validConnectionString, \"Traces\", bufferingCount: 1);\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProcEnum\", null, EventLevel.LogAlways);\n            SinkSettings sinkSettings = new SinkSettings(\"sqlDBsink\", subject, new List<EventSourceSettings>() { { settings } });\n            List<SinkSettings> sinks = new List<SinkSettings>() { { sinkSettings } };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.SaveExpenseStarted(Guid.NewGuid());\n\n                    eventsDataTable = DatabaseHelper.PollUntilEventsAreWritten(validConnectionString, 1);\n                });\n\n            Assert.AreEqual(1, eventsDataTable.Rows.Count);\n            Assert.AreEqual(System.Diagnostics.Process.GetCurrentProcess().Id, Convert.ToInt32(eventsDataTable.Rows[0][\"ProcessId\"]));\n        }\n\n        [TestMethod]\n        public void WhenThreadId()\n        {\n            var validConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n            DatabaseHelper.CleanLoggingDB(validConnectionString);\n            var logger = MockEventSourceOutProcEnum.Logger;\n            EventTextFormatter formatter = new EventTextFormatter();\n\n            System.Data.DataTable eventsDataTable = null;\n            var subject = new EventEntrySubject();\n            subject.LogToSqlDatabase(\"testInstance\", validConnectionString, \"Traces\", bufferingCount: 1);\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProcEnum\", null, EventLevel.LogAlways);\n            SinkSettings sinkSettings = new SinkSettings(\"sqlDBsink\", subject, new List<EventSourceSettings>() { { settings } });\n            List<SinkSettings> sinks = new List<SinkSettings>() { { sinkSettings } };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.SaveExpenseStarted(Guid.NewGuid());\n\n                    eventsDataTable = DatabaseHelper.PollUntilEventsAreWritten(validConnectionString, 1);\n                });\n\n            Assert.AreEqual(1, eventsDataTable.Rows.Count);\n            Assert.AreEqual(ThreadHelper.GetCurrentUnManagedThreadId(), Convert.ToInt32(eventsDataTable.Rows[0][\"ThreadId\"]));\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Sinks/FlatFileSinkFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.Sinks\n{\n    [TestClass]\n    public class FlatFileSinkFixture\n    {\n        [TestMethod]\n        public void WhenUsingFlatFileSinkProgrammatic()\n        {\n            var logger = MockEventSourceOutProc.Logger;\n            EventTextFormatter formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var fileName = \"newflatfileSerial.log\";\n            File.Delete(fileName);\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProc\", null, EventLevel.LogAlways);\n            var subject = new EventEntrySubject();\n            subject.LogToFlatFile(fileName, formatter);\n\n            SinkSettings sinkSettings = new SinkSettings(\"flatFileSink\", subject, new List<EventSourceSettings>() { { settings } });\n            List<SinkSettings> sinks = new List<SinkSettings>() { { sinkSettings } };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            IEnumerable<string> entries = null;\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    for (int n = 0; n < 200; n++)\n                    {\n                        logger.LogSomeMessage(\"some message\" + n.ToString());\n                    }\n\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 200, EventTextFormatter.DashSeparator);\n                });\n\n            Assert.AreEqual(200, entries.Count());\n            StringAssert.Contains(entries.First(), \"some message0\");\n            StringAssert.Contains(entries.Last(), \"some message199\");\n        }\n\n        [TestMethod]\n        public void WhenUsingRollingSinkProgrammatic()\n        {\n            var logger = MockEventSourceOutProc.Logger;\n            EventTextFormatter formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            var fileName = \"newRollingFlatfileSerial.log\";\n            File.Delete(fileName);\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProc\", null, EventLevel.LogAlways);\n            var subject = new EventEntrySubject();\n            subject.LogToRollingFlatFile(fileName, 100, \"d\", RollFileExistsBehavior.Overwrite, RollInterval.Day, formatter);\n\n            SinkSettings sinkSettings = new SinkSettings(\"rollingFlatFileSink\", subject, new List<EventSourceSettings>() { { settings } });\n            List<SinkSettings> sinks = new List<SinkSettings>() { { sinkSettings } };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            IEnumerable<string> entries = null;\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    for (int n = 0; n < 200; n++)\n                    {\n                        logger.LogSomeMessage(\"some message\" + n.ToString());\n                    }\n\n                    entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 200, EventTextFormatter.DashSeparator);\n                });\n\n            Assert.AreEqual(200, entries.Count());\n            StringAssert.Contains(entries.First(), \"some message0\");\n            StringAssert.Contains(entries.Last(), \"some message199\");\n        }\n\n        [TestMethod]\n        public void WhenNoArgEventIsLogged()\n        {\n            var serviceConfigFile = \"Configurations\\\\DataCorrectness\\\\FlatFile.xml\";\n            string fileName = @\".\\Logs\\OutProcFlatFileData.log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs\");\n\n            IEnumerable<string> entries = null;\n            TestScenario.WithTempUpdatesInConfiguration(\n                serviceConfigFile,\n                xmlContent => xmlContent.Replace(\"replaceEventSource\", \"TestEventSourceNoAttributes\"),\n                    () =>\n                    {\n                        var logger = TestEventSourceNoAttributes.Logger;\n                        logger.NoArgEvent1();\n                        entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, EventTextFormatter.DashSeparator);\n                    });\n\n            Assert.AreEqual(1, entries.Count());\n            StringAssert.Contains(entries.First(), \"EventId : 1\");\n            StringAssert.Contains(entries.First(), \"Payload : \");\n        }\n\n        [TestMethod]\n        public void WhenIntArgPayload()\n        {\n            var serviceConfigFile = \"Configurations\\\\DataCorrectness\\\\FlatFile.xml\";\n            string fileName = @\".\\Logs\\OutProcFlatFileData.log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs\");\n\n            IEnumerable<string> entries = null;\n            TestScenario.WithTempUpdatesInConfiguration(\n                serviceConfigFile,\n                xmlContent => xmlContent.Replace(\"replaceEventSource\", \"TestEventSourceNoAttributes\"),\n                    () =>\n                    {\n                        var logger = TestEventSourceNoAttributes.Logger;\n                        logger.IntArgEvent2(10);\n\n                        entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, EventTextFormatter.DashSeparator);\n                    });\n\n            Assert.AreEqual(1, entries.Count());\n            StringAssert.Contains(entries.First(), \"EventId : 2\");\n            StringAssert.Contains(entries.First(), \"Payload : [arg : 10]\");\n        }\n\n        [TestMethod]\n        public void WhenLongArgPayload()\n        {\n            var serviceConfigFile = \"Configurations\\\\DataCorrectness\\\\FlatFile.xml\";\n            string fileName = @\".\\Logs\\OutProcFlatFileData.log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs\");\n\n            IEnumerable<string> entries = null;\n            TestScenario.WithTempUpdatesInConfiguration(\n                serviceConfigFile,\n                xmlContent => xmlContent.Replace(\"replaceEventSource\", \"TestEventSourceNoAttributes\"),\n                    () =>\n                    {\n                        var logger = TestEventSourceNoAttributes.Logger;\n                        logger.LongArgEvent3((long)10);\n\n                        entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, EventTextFormatter.DashSeparator);\n                    });\n\n            Assert.AreEqual(1, entries.Count());\n            StringAssert.Contains(entries.First(), \"EventId : 3\");\n            StringAssert.Contains(entries.First(), \"Payload : [arg : 10]\");\n        }\n\n        [TestMethod]\n        public void WhenObjectArgPayload()\n        {\n            var serviceConfigFile = \"Configurations\\\\DataCorrectness\\\\FlatFile.xml\";\n            string fileName = @\".\\Logs\\OutProcFlatFileData.log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs\");\n\n            IEnumerable<string> entries = null;\n            TestScenario.WithTempUpdatesInConfiguration(\n                serviceConfigFile,\n                xmlContent => xmlContent.Replace(\"replaceEventSource\", \"TestEventSourceNoAttributes\"),\n                    () =>\n                    {\n                        var logger = TestEventSourceNoAttributes.Logger;\n                        logger.ObjectArrayEvent4(10, \"stringarg1\", 20, \"stringarg3\", 30);\n\n                        entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, EventTextFormatter.DashSeparator);\n                    });\n\n            Assert.AreEqual(1, entries.Count());\n            StringAssert.Contains(entries.First(), \"EventId : 4\");\n            StringAssert.Contains(entries.First(), \"Payload : [arg0 : 10] [arg1 : stringarg1] [arg2 : 20] [arg3 : stringarg3] [arg4 : 30]\");\n        }\n\n        [TestMethod]\n        public void WhenTwoArgPayload()\n        {\n            var serviceConfigFile = \"Configurations\\\\DataCorrectness\\\\FlatFile.xml\";\n            string fileName = @\".\\Logs\\OutProcFlatFileData.log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs\");\n\n            IEnumerable<string> entries = null;\n            TestScenario.WithTempUpdatesInConfiguration(\n                serviceConfigFile,\n                xmlContent => xmlContent.Replace(\"replaceEventSource\", \"TestEventSourceNoAttributes\"),\n                    () =>\n                    {\n                        var logger = TestEventSourceNoAttributes.Logger;\n                        logger.TwoIntArgEvent6(10, 30);\n\n                        entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, EventTextFormatter.DashSeparator);\n                    });\n\n            Assert.AreEqual(1, entries.Count());\n            StringAssert.Contains(entries.First(), \"EventId : 6\");\n            StringAssert.Contains(entries.First(), \"Payload : [arg1 : 10] [arg2 : 30]\");\n        }\n\n        [TestMethod]\n        public void When3ArgStringPayload()\n        {\n            var serviceConfigFile = \"Configurations\\\\DataCorrectness\\\\FlatFile.xml\";\n            string fileName = @\".\\Logs\\OutProcFlatFileData.log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs\");\n\n            IEnumerable<string> entries = null;\n            TestScenario.WithTempUpdatesInConfiguration(\n                serviceConfigFile,\n                xmlContent => xmlContent.Replace(\"replaceEventSource\", \"TestEventSourceNoAttributes\"),\n                    () =>\n                    {\n                        var logger = TestEventSourceNoAttributes.Logger;\n                        logger.ThreeStringArgEvent14(\"message1\", \"message2\", \"message3\");\n\n                        entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, EventTextFormatter.DashSeparator);\n                    });\n\n            Assert.AreEqual(1, entries.Count());\n            StringAssert.Contains(entries.First(), \"EventId : 14\");\n            StringAssert.Contains(entries.First(), \"Payload : [arg1 : message1] [arg2 : message2] [arg3 : message3]\");\n        }\n\n        [TestMethod]\n        public void WhenStringAndLongArgPayload()\n        {\n            var serviceConfigFile = \"Configurations\\\\DataCorrectness\\\\FlatFile.xml\";\n            string fileName = @\".\\Logs\\OutProcFlatFileData.log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs\");\n\n            IEnumerable<string> entries = null;\n            TestScenario.WithTempUpdatesInConfiguration(\n                serviceConfigFile,\n                xmlContent => xmlContent.Replace(\"replaceEventSource\", \"TestEventSourceNoAttributes\"),\n                    () =>\n                    {\n                        var logger = TestEventSourceNoAttributes.Logger;\n                        logger.StringAndLongArgEvent9(\"message1\", 20);\n\n                        entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, EventTextFormatter.DashSeparator);\n                    });\n\n            Assert.AreEqual(1, entries.Count());\n            StringAssert.Contains(entries.First(), \"EventId : 9\");\n            StringAssert.Contains(entries.First(), \"Payload : [arg1 : message1] [arg2 : 20]\");\n        }\n\n        [TestMethod]\n        public void WhenEnumAndFlagPayload()\n        {\n            var serviceConfigFile = \"Configurations\\\\DataCorrectness\\\\FlatFile.xml\";\n            string fileName = @\".\\Logs\\OutProcFlatFileData.log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs\");\n\n            IEnumerable<string> entries = null;\n            TestScenario.WithTempUpdatesInConfiguration(\n                serviceConfigFile,\n                xmlContent => xmlContent.Replace(\"replaceEventSource\", \"TestEventSourceNoAttributes\"),\n                    () =>\n                    {\n                        var logger = TestEventSourceNoAttributes.Logger;\n                        logger.SendEnumsEvent15(MyColor.Green, MyFlags.Flag1 | MyFlags.Flag3);\n\n                        entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, EventTextFormatter.DashSeparator);\n                    });\n\n            Assert.AreEqual(1, entries.Count());\n            StringAssert.Contains(entries.First(), \"EventId : 15\");\n            StringAssert.Contains(entries.First(), \"Payload : [color : 2] [flags : 5]\");\n        }\n\n        [TestMethod]\n        public void WhenEventAttributeHasNoTask()\n        {\n            var serviceConfigFile = \"Configurations\\\\DataCorrectness\\\\FlatFile.xml\";\n            string fileName = @\".\\Logs\\OutProcFlatFileData.log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs\");\n\n            IEnumerable<string> entries = null;\n            TestScenario.WithTempUpdatesInConfiguration(\n                serviceConfigFile,\n                xmlContent => xmlContent.Replace(@\"name=\"\"replaceEventSource\"\"\", @\"id=\"\"B4F8149D-6DD2-4EE2-A46A-45584A942D1C\"\"\"),\n                    () =>\n                    {\n                        var logger = TestAttributesEventSource.Logger;\n                        logger.NoTaskSpecfied2(1, 3, 5);\n\n                        entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, EventTextFormatter.DashSeparator);\n                    });\n\n            Assert.AreEqual(1, entries.Count());\n            StringAssert.Contains(entries.First(), \"EventId : 105\");\n        }\n\n        [TestMethod]\n        public void WhenProcessId()\n        {\n            var serviceConfigFile = \"Configurations\\\\DataCorrectness\\\\FlatFile.xml\";\n            string fileName = @\".\\Logs\\OutProcFlatFileData.log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs\");\n\n            IEnumerable<string> entries = null;\n            TestScenario.WithTempUpdatesInConfiguration(\n                serviceConfigFile,\n                xmlContent => xmlContent.Replace(\"replaceEventSource\", \"TestEventSourceNoAttributes\"),\n                    () =>\n                    {\n                        var logger = TestEventSourceNoAttributes.Logger;\n                        logger.NoArgEvent1();\n                        entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, EventTextFormatter.DashSeparator);\n                    });\n\n            Assert.AreEqual(1, entries.Count());\n            StringAssert.Contains(entries.First(), \"ProcessId : \" + System.Diagnostics.Process.GetCurrentProcess().Id);\n        }\n\n        [TestMethod]\n        public void WhenThreadId()\n        {\n            var serviceConfigFile = \"Configurations\\\\DataCorrectness\\\\FlatFile.xml\";\n            string fileName = @\".\\Logs\\OutProcFlatFileData.log\";\n            FlatFileHelper.DeleteDirectory(@\".\\Logs\");\n\n            IEnumerable<string> entries = null;\n            TestScenario.WithTempUpdatesInConfiguration(\n                serviceConfigFile,\n                xmlContent => xmlContent.Replace(\"replaceEventSource\", \"TestEventSourceNoAttributes\"),\n                    () =>\n                    {\n                        var logger = TestEventSourceNoAttributes.Logger;\n                        logger.NoArgEvent1();\n                        entries = FlatFileHelper.PollUntilTextEventsAreWritten(fileName, 1, EventTextFormatter.DashSeparator);\n                    });\n\n            Assert.AreEqual(1, entries.Count());\n            StringAssert.Contains(entries.First(), \"ThreadId : \" + ThreadHelper.GetCurrentUnManagedThreadId());\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Sinks/InMemorySinkFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.Sinks\n{\n    [TestClass]\n    public class InMemorySinkFixture\n    {\n        [TestMethod]\n        public void WhenConcurrentEventsRaised()\n        {\n            var logger = MockEventSourceOutProc.Logger;\n            EventTextFormatter formatter = new EventTextFormatter();\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProc\", null, EventLevel.LogAlways);\n            InMemorySink sink = new InMemorySink(formatter);\n\n            SinkSettings sinkSettings = new SinkSettings(\"memorySink\", sink, new List<EventSourceSettings>() { { settings } });\n            List<SinkSettings> sinks = new List<SinkSettings>() { { sinkSettings } };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    sink.WaitSignalCondition = () => sink.EventWrittenCount == 100;\n                    for (int n = 0; n < 100; n++)\n                    {\n                        logger.LogSomeMessage(\"some message\" + n.ToString());\n                    }\n\n                    sink.WaitOnAsyncEvents.WaitOne(TimeSpan.FromSeconds(10));\n                });\n\n            StringAssert.Contains(sink.ToString(), \"some message99\");\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/Sinks/WindowsAzureTableSinkFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestScenarios;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.Sinks\n{\n    [TestClass]\n    public class WindowsAzureTableSinkFixture\n    {\n        private string tableName;\n\n        [ClassInitialize]\n        public static void Setup(TestContext testContext)\n        {\n            AssemblyLoaderHelper.EnsureAllAssembliesAreLoadedForSinkTest();\n        }\n\n        [TestInitialize]\n        public void Initialize()\n        {\n            this.tableName = string.Empty;\n        }\n\n        [TestCleanup]\n        public void Teardown()\n        {\n            if (!string.IsNullOrWhiteSpace(this.tableName))\n            {\n                AzureTableHelper.DeleteTable(System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"], this.tableName);\n            }\n        }\n\n        [TestMethod]\n        public void WhenConnectionTakesTooLong()\n        {\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            var subject = new EventEntrySubject();\n            subject.LogToWindowsAzureTable(\"AzureInstance\", connectionString);\n\n            Assert.IsTrue(Task.Run(() => subject.OnCompleted()).Wait(TimeSpan.FromSeconds(2)));\n        }\n\n        [TestMethod]\n        public void WhenConfiguringProgrammatically()\n        {\n            this.tableName = \"testoutofprocazuretables\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = MockEventSourceOutProc.Logger;\n            EventTextFormatter formatter = new EventTextFormatter();\n\n            IEnumerable<WindowsAzureTableEventEntry> events = null;\n            EventSourceSettings settings = new EventSourceSettings(\"MockEventSourceOutProc\", null, EventLevel.LogAlways);\n            var subject = new EventEntrySubject();\n            subject.LogToWindowsAzureTable(\"AzureInstance\", connectionString, tableName, TimeSpan.FromSeconds(1));\n            SinkSettings sinkSettings = new SinkSettings(\"azureSink\", subject, new List<EventSourceSettings>() { { settings } });\n            List<SinkSettings> sinks = new List<SinkSettings>() { { sinkSettings } };\n            TraceEventServiceConfiguration svcConfiguration = new TraceEventServiceConfiguration(sinks);\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.Critical(\"Critical message\");\n                    }\n\n                    events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 10);\n                });\n\n            Assert.AreEqual<int>(10, events.Count());\n            Assert.AreEqual<int>(2, events.First().EventId);\n        }\n\n        [TestMethod]\n        public void WhenUsingExternalConfig()\n        {\n            this.tableName = \"outProcazuretablesusingconfig\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = MockEventSourceOutProc.Logger;\n\n            IEnumerable<WindowsAzureTableEventEntry> events = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\AzureTables\\\\AzureTables.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    for (int i = 0; i < 10; i++)\n                    {\n                        logger.Critical(\"Critical message\");\n                    }\n\n                    events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 10);\n                });\n\n            Assert.AreEqual<int>(10, events.Count());\n            Assert.AreEqual<int>(2, events.First().EventId);\n        }\n\n        [TestMethod]\n        public void WhenProcessId()\n        {\n            this.tableName = \"outProcazuretablesusingconfig\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = MockEventSourceOutProc.Logger;\n\n            IEnumerable<WindowsAzureTableEventEntry> events = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\AzureTables\\\\AzureTables.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.Critical(\"Critical message\");\n\n                    events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 1);\n                });\n\n            Assert.AreEqual<int>(1, events.Count());\n            Assert.AreEqual<int>(System.Diagnostics.Process.GetCurrentProcess().Id, events.First().ProcessId);\n        }\n\n        [TestMethod]\n        public void WhenThreadId()\n        {\n            this.tableName = \"outProcazuretablesusingconfig\";\n            var connectionString = System.Configuration.ConfigurationManager.AppSettings[\"StorageConnectionString\"];\n            AzureTableHelper.DeleteTable(connectionString, this.tableName);\n            var logger = MockEventSourceOutProc.Logger;\n\n            IEnumerable<WindowsAzureTableEventEntry> events = null;\n            var svcConfiguration = TraceEventServiceConfiguration.Load(\"Configurations\\\\AzureTables\\\\AzureTables.xml\");\n            TestScenario.WithConfiguration(\n                svcConfiguration,\n                () =>\n                {\n                    logger.Critical(\"Critical message\");\n\n                    events = AzureTableHelper.PollForEvents(connectionString, this.tableName, 1);\n                });\n\n            Assert.AreEqual<int>(1, events.Count());\n            Assert.AreEqual<int>(ThreadHelper.GetCurrentUnManagedThreadId(), events.First().ThreadId);\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/CustomFormatterWithWait.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    public class CustomFormatterWithWait : IEventTextFormatter, IDisposable\n    {\n        /// <summary>\n        /// The dash separator\n        /// </summary>\n        public const string DashSeparator = \"----------------------------------------\";\n        private ManualResetEventSlim waitEvents;\n        private const string TextSerializationError = \"Cannot serialize the payload: {0}\";\n        private bool disposed;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventTextFormatter\" /> class.\n        /// </summary>\n        public CustomFormatterWithWait()\n            : this(null, null)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventTextFormatter\" /> class.\n        /// </summary>\n        /// <param name=\"header\">The header.</param>\n        public CustomFormatterWithWait(string header)\n            : this(header, null)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventTextFormatter\" /> class.\n        /// </summary>\n        /// <param name=\"header\">The header.</param>\n        /// <param name=\"footer\">The footer.</param>\n        public CustomFormatterWithWait(string header, string footer)\n        {\n            waitEvents = new ManualResetEventSlim();\n\n            this.Header = header;\n            this.Footer = footer;\n            this.Detailed = EventLevel.Informational;\n        }\n\n        /// <summary>\n        /// Gets or sets the header\n        /// </summary>\n        public string Header { get; set; }\n\n        /// <summary>\n        /// Gets or sets the footer\n        /// </summary>\n        public string Footer { get; set; }\n\n        /// <summary>\n        /// Gets or sets the lowest <see cref=\"EventLevel\" /> value where the formatted output provides all the event entry information.\n        /// Otherwise a summarized content of the event entry will be written.\n        /// </summary>\n        public EventLevel Detailed { get; set; }\n\n        /// <summary>\n        /// Gets or sets the date time format used for timestamp value.\n        /// </summary>\n        /// <value>\n        /// The date time format.\n        /// </value>\n        public string DateTimeFormat { get; set; }\n\n        public ManualResetEventSlim WaitEvents\n        {\n            get { return this.waitEvents; }\n        }\n\n        /// <summary>\n        /// Writes the event.\n        /// </summary>\n        /// <param name=\"eventData\">The <see cref=\"EventWrittenEventArgs\" /> instance containing the event data.</param>\n        /// <param name=\"writer\">The writer.</param>\n        public void WriteEvent(EventEntry eventEntry, TextWriter writer)\n        {\n            // Write header\n            if (!string.IsNullOrWhiteSpace(this.Header))\n            {\n                writer.WriteLine(this.Header); \n            }\n\n            if (eventEntry.Payload.First().ToString() == \"error\")\n            {\n                writer.WriteLine(\"This is an entry containing and error and should not be logged\");\n                throw new InvalidOperationException(\"error\");\n            }\n\n            if (eventEntry.Schema.Level >= this.Detailed)\n            {\n                // Write properties\n                writer.WriteLine(\"Mock SourceId : {0}\", eventEntry.ProviderId);\n                writer.WriteLine(\"Mock EventId : {0}\", eventEntry.EventId);\n                writer.WriteLine(\"Keywords : {0}\", eventEntry.Schema.Keywords);\n                writer.WriteLine(\"Level : {0}\", eventEntry.Schema.Level);\n                writer.WriteLine(\"Message : {0}\", eventEntry.FormattedMessage);\n                writer.WriteLine(\"Opcode : {0}\", eventEntry.Schema.Opcode);\n                writer.WriteLine(\"Task : {0} {1}\", eventEntry.Schema.Task, eventEntry.Schema.EventName);\n                writer.WriteLine(\"Version : {0}\", eventEntry.Schema.Version);\n                writer.WriteLine(\"Payload :{0}\", FormatPayload(eventEntry));\n                writer.WriteLine(\"Timestamp : {0}\", eventEntry.GetFormattedTimestamp(this.DateTimeFormat));\n            }\n            else\n            {\n                writer.WriteLine(\"EventId : {0}, Level : {1}, Message : {2}, Payload :{3}, Timestamp : {4}\",\n                    eventEntry.EventId,\n                    eventEntry.Schema.Level,\n                    eventEntry.FormattedMessage,\n                    FormatPayload(eventEntry),\n                    eventEntry.GetFormattedTimestamp(this.DateTimeFormat));\n            }\n\n            // Write footer\n            if (!string.IsNullOrWhiteSpace(this.Footer))\n            {\n                writer.WriteLine(this.Footer); \n            }\n\n            writer.WriteLine();\n\n            if (this.waitEvents != null)\n            {\n                waitEvents.Reset(); \n            }\n        }\n\n        public void Dispose()\n        {\n            this.Dispose(true);\n            GC.SuppressFinalize(this);\n        }\n\n        protected virtual void Dispose(bool disposing)\n        {\n            if (!this.disposed)\n            {\n                if (disposing)\n                {\n                    if (this.waitEvents != null)\n                    {\n                        this.waitEvents.Dispose();\n                    }\n                }\n\n                this.waitEvents = null;\n                this.disposed = true;\n            }\n        }\n\n        private static string FormatPayload(EventEntry entry)\n        {\n            var eventSchema = entry.Schema;\n            var sb = new StringBuilder();\n            for (int i = 0; i < entry.Payload.Count; i++)\n            {\n                try\n                {\n                    sb.AppendFormat(\" [{0} : {1}]\", eventSchema.Payload[i], entry.Payload[i]);\n                }\n                catch (Exception e)\n                {\n                    SemanticLoggingEventSource.Log.EventEntryTextWriterFailed(e.ToString());\n                    sb.AppendFormat(\" [{0} : {1}]\", \"Exception\", string.Format(CultureInfo.CurrentCulture, TextSerializationError, e.Message));\n                }\n            }\n\n            return sb.ToString();\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/MockConsoleOutput.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.IO;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    public class MockConsoleOutput : IDisposable\n    {\n        private TextWriter writer;\n        private TextWriter originalOutput;\n        private bool disposed;\n\n        public MockConsoleOutput()\n        {\n            writer = new StringWriter();\n            originalOutput = Console.Out;\n            Console.SetOut(writer);\n        }\n\n        public string Ouput\n        {\n            get { return writer.ToString(); }\n        }\n\n        public void Dispose()\n        {\n            this.Dispose(true);\n            GC.SuppressFinalize(this);\n        }\n\n        protected virtual void Dispose(bool disposing)\n        {\n            if (!this.disposed)\n            {\n                Console.SetOut(originalOutput);\n\n                if (disposing)\n                {\n                    if (this.writer != null)\n                    {\n                        this.writer.Dispose();\n                    }\n                }\n\n                this.writer = null;\n                this.disposed = true;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/MockEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    [EventSource(Name = \"TestEventSource\")]\n    public sealed class MockEventSource : EventSource\n    {\n        public const int ErrorWithKeywordDiagnosticEventId = 1020;\n        public const int CriticalWithKeywordPageEventId = 1021;\n        public const int InfoWithKeywordDiagnosticEventId = 1022;\n        public const int VerboseWithKeywordPageEventId = 1023;\n        public const int CriticalWithTaskNameEventId = 1500;\n\n        public static readonly MockEventSource Logger = new MockEventSource();\n\n        public class Keywords\n        {\n            public const EventKeywords Page = (EventKeywords)1;\n            public const EventKeywords Diagnostic = (EventKeywords)4;\n        }\n\n        public class Tasks\n        {\n            public const EventTask Page = (EventTask)1;\n            public const EventTask DBQuery = (EventTask)2;\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/MockEventSourceOutProc.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    [EventSource(Name = \"MockEventSourceOutProc\")]\n    public sealed class MockEventSourceOutProc : EventSource\n    {\n        public static readonly MockEventSourceOutProc Logger = new MockEventSourceOutProc();\n\n        [Event(2, Level = EventLevel.Critical)]\n        public void Critical(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(2, message); \n            }\n        }\n\n        [Event(8, Level = EventLevel.Informational)]\n        public void LogSomeMessage(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(8, message); \n            }\n        }\n    }\n}"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/MockEventSourceOutProc2.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    [EventSource(Name = \"MockEventSourceOutProc2\")]\n    public sealed class MockEventSourceOutProc2 : EventSource\n    {\n        public static readonly MockEventSourceOutProc2 Logger = new MockEventSourceOutProc2();\n\n        [Event(8, Level = EventLevel.Informational)]\n        public void LogSomeMessage(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(8, message); \n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/MockEventSourceOutProcEnum.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    public sealed class MockEventSourceOutProcEnum : EventSource\n    {\n        public static readonly MockEventSourceOutProcEnum Logger = new MockEventSourceOutProcEnum();\n\n        public static class Tasks\n        {\n            public const EventTask Opcode = (EventTask)1;\n        }\n\n        [Event(2)]\n        public void SendEnumsEvent15(MyColor a, MyFlags b)\n        {\n            this.WriteEvent(2, (int)a, (int)b);\n        }\n\n        [Event(3, Task = Tasks.Opcode, Opcode = EventOpcode.Resume)]\n        public void SendEnumsEvent16(MyColor a, MyFlags b)\n        {\n            this.WriteEvent(3, a, b);\n        }\n\n        [Event(4)]\n        public void SaveExpenseStarted(Guid expenseId)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(4, expenseId);\n            }\n        }\n\n        public enum MyColor { Red, Blue, Green }\n\n        public enum MyFlags { Flag1 = 1, Flag2 = 2, Flag3 = 4 }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/MockEventSourceOutProcFiltering.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    [EventSource(Name = \"MockEventSourceOutProcFiltering\")]\n    public sealed class MockEventSourceOutProcFiltering : EventSource\n    {\n        public static readonly MockEventSourceOutProcFiltering Logger = new MockEventSourceOutProcFiltering();\n\n        [Event(1, Level = EventLevel.Informational)]\n        public void Informational(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(1, message); \n            }\n        }\n\n        [Event(2, Level = EventLevel.Verbose)]\n        public void Verbose(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(2, message); \n            }\n        }\n\n        [Event(3, Level = EventLevel.Critical)]\n        public void Critical(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(3, message); \n            }\n        }\n\n        [Event(4, Level = EventLevel.Error)]\n        public void Error(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(4, message); \n            }\n        }\n\n        [Event(5, Level = EventLevel.Warning)]\n        public void Warning(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(5, message); \n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/MockEventSourceOutProcKeywords.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    [EventSource(Name = \"MockEventSourceOutProcKeywords\")]\n    public sealed class MockEventSourceOutProcKeywords : EventSource\n    {\n        public static readonly MockEventSourceOutProcKeywords Logger = new MockEventSourceOutProcKeywords();\n\n        [Event(1, Level = EventLevel.Informational, Keywords = Keywords.Page)]\n        public void InformationalPage(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(1, message); \n            }\n        }\n\n        [Event(2, Level = EventLevel.Informational, Keywords = Keywords.Database)]\n        public void InformationalDatabase(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(2, message); \n            }\n        }\n\n        [Event(3, Level = EventLevel.Informational, Keywords = Keywords.Diagnostic)]\n        public void InformationalDiagnostic(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(3, message); \n            }\n        }\n\n        public class Keywords\n        {\n            public const EventKeywords Page = (EventKeywords)1;\n            public const EventKeywords Database = (EventKeywords)2;\n            public const EventKeywords Diagnostic = (EventKeywords)4;\n            public const EventKeywords Perf = (EventKeywords)8;\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/MockEventSourceOutProcLevelFiltered.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    [EventSource(Name = \"MockEventSourceOutProcLevelFiltered\")]\n    public sealed class MockEventSourceOutProcLevelFiltered : EventSource\n    {\n        public static readonly MockEventSourceOutProcLevelFiltered Logger = new MockEventSourceOutProcLevelFiltered();\n\n        [Event(2, Level = EventLevel.Critical)]\n        public void Critical(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(2, message); \n            }\n        }\n\n        [Event(8, Level = EventLevel.Informational)]\n        public void LogSomeMessage(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(8, message); \n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/MockEventSourceOutProcSvc.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    [EventSource(Name = \"MockEventSourceOutProcSvc\")]\n    public class MockEventSourceOutProcSvc : EventSource\n    {\n        public static readonly MockEventSourceOutProcSvc Logger = new MockEventSourceOutProcSvc();\n\n        [Event(2, Level = EventLevel.Critical)]\n        public void Critical(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(2, message);\n            }\n        }\n\n        [Event(8, Level = EventLevel.Informational)]\n        public void LogSomeMessage(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(8, message);\n            }\n        }\n    }\n}"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/MockFormatter.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.IO;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    public class MockFormatter : IEventTextFormatter\n    {\n        private bool throwOnWrite;\n\n        public MockFormatter()\n            : this(false)\n        {\n        }\n\n        public MockFormatter(bool throwOnWrite)\n        {\n            this.throwOnWrite = throwOnWrite;\n        }\n\n        public List<Tuple<EventEntry, TextWriter>> WriteEventCalls = new List<Tuple<EventEntry, TextWriter>>();\n\n        public string Header { get; set; }\n\n        public string Footer { get; set; }\n\n        public void WriteEvent(EventEntry eventEntry, TextWriter writer)\n        {\n            if (throwOnWrite)\n            {\n                throw new InvalidOperationException(); \n            }\n\n            this.WriteEventCalls.Add(Tuple.Create(eventEntry, writer));\n            if (eventEntry.Payload.Count > 0)\n            {\n                writer.Write(eventEntry.Payload[0]); \n            }\n        }\n\n        public EventLevel Detailed { get; set; }\n\n        public string DateTimeFormat { get; set; }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/SamplingEventSource.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    [EventSource(Name = \"SamplingEventSource\")]\n    public class SamplingEventSource : EventSource\n    {\n        public static SamplingEventSource Logger = new SamplingEventSource();\n\n        [Event(1, Level = EventLevel.Informational)]\n        public void EventToSample(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(1, message);\n            }\n        }\n\n        [Event(2, Level = EventLevel.Informational)]\n        public void BeforeEventToSample(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(2, message);\n            }\n        }\n\n        [Event(3, Level = EventLevel.Informational)]\n        public void AfterEventToSample(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(3, message);\n            }\n        }\n\n        [Event(4, Level = EventLevel.Informational)]\n        public void EventInATask(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(4, message);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/SamplingEventSource1.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    [EventSource(Name = \"SamplingEventSource1\")]\n    public class SamplingEventSource1 : EventSource\n    {\n        public static SamplingEventSource1 Logger = new SamplingEventSource1();\n\n        [Event(1, Level = EventLevel.Informational)]\n        public void EventToSampleFromOtherSource(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(1, message);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/TestAttributesEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    [EventSource(Name = \"TestProvideraaa\", Guid = \"B4F8149D-6DD2-4EE2-A46A-45584A942D1C\")]\n    public sealed class TestAttributesEventSource : EventSource\n    {\n        public static readonly TestAttributesEventSource Logger = new TestAttributesEventSource();\n\n        [Event(105)]\n        public void NoTaskSpecfied2(int arg1, int arg2, int arg3)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(105, arg1, arg3, arg3);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/TestEventEntry.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    public class TestEventEntry\n    {\n        public int EventId { get; set; }\n\n        public Guid ProviderId { get; set; }\n\n        public string ProviderName { get; set; }\n\n        public string Message { get; set; }\n\n        public EventKeywords EventKeywords { get; set; }\n\n        public EventLevel Level { get; set; }\n\n        public EventOpcode Opcode { get; set; }\n\n        public EventTask Task { get; set; }\n\n        public byte Version { get; set; }\n\n        public Dictionary<string, object> Payload { get; set; }\n\n        public DateTimeOffset Timestamp { get; set; }\n\n        public int ProcessId { get; set; }\n\n        public int ThreadId { get; set; }\n    }\n\n    public class TestEventEntryCustomTimeStamp\n    {\n        public int EventId { get; set; }\n\n        public Guid ProviderId { get; set; }\n\n        public string ProviderName { get; set; }\n\n        public string Message { get; set; }\n\n        public EventKeywords EventKeywords { get; set; }\n\n        public EventLevel Level { get; set; }\n\n        public EventOpcode Opcode { get; set; }\n\n        public EventTask Task { get; set; }\n\n        public byte Version { get; set; }\n\n        public Dictionary<string, object> Payload { get; set; }\n\n        public string Timestamp { get; set; }\n\n        public int ProcessId { get; set; }\n\n        public int ThreadId { get; set; }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/TestEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    public sealed class TestEventSource : EventSource\n    {\n        public const int InformationalEventId = 4;\n        public const int AuditSuccessEventId = 20;\n        public const int ErrorEventId = 5;\n        public const int CriticalEventId = 6;\n        public const int LogAlwaysEventId = 7;\n        public const int VerboseEventId = 100;\n        public const int NonDefaultOpcodeNonDefaultVersionEventId = 103;\n        public const int EventWithoutPayloadNorMessageId = 200;\n        public const int EventWithPayloadId = 201;\n        public const int EventWithMessageId = 202;\n        public const int EventWithPayloadAndMessageId = 203;\n        public const int EventIdForAllParameters = 150;\n        public const int EventWithMultiplePayloadsId = 205;\n        public const int ErrorWithKeywordDiagnosticEventId = 1020;\n        public const int CriticalWithKeywordPageEventId = 1021;\n        public const int CriticalWithTaskNameEventId = 1500;\n\n        public static readonly TestEventSource Logger = new TestEventSource();\n\n        public class Keywords\n        {\n            public const EventKeywords Page = (EventKeywords)1;\n            public const EventKeywords DataBase = (EventKeywords)2;\n            public const EventKeywords Diagnostic = (EventKeywords)4;\n            public const EventKeywords Perf = (EventKeywords)8;\n        }\n\n        public class Tasks\n        {\n            public const EventTask Page = (EventTask)1;\n            public const EventTask DBQuery = (EventTask)2;\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/TestEventSourceNoAttributes.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    public sealed class TestEventSourceNoAttributes : EventSource\n    {\n        public static readonly TestEventSourceNoAttributes Logger = new TestEventSourceNoAttributes();\n\n        public void NoArgEvent1()\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(1);\n            }\n        }\n\n        public void IntArgEvent2(int arg)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(2, arg);\n            }\n        }\n\n        public void LongArgEvent3(long arg)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(3, arg);\n            }\n        }\n\n        [Event(4, Message = \"Check if it is logged\")]\n        public void ObjectArrayEvent4(int arg0, string arg1, int arg2, string arg3, int arg4)\n        {\n            if (this.IsEnabled())\n            {\n                object[] args = new object[5];\n                args[0] = arg0;\n                args[1] = (object)arg1;\n                args[2] = arg2;\n                args[3] = arg3;\n                args[4] = arg4;\n                this.WriteEvent(4, args);\n            }\n        }\n\n        public void StringArgEvent5(string arg)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(5, arg);\n            }\n        }\n\n        public void TwoIntArgEvent6(int arg1, int arg2)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(6, arg1, arg2);\n            }\n        }\n\n        public void TwoLongArgEvent7(long arg1, long arg2)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(7, arg1, arg2);\n            }\n        }\n\n        public void StringAndIntArgEvent8(string arg1, int arg2)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(8, arg1, arg2);\n            }\n        }\n\n        public void StringAndLongArgEvent9(string arg1, long arg2)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(9, arg1, arg2);\n            }\n        }\n\n        public void StringAndStringArgEvent10(string arg1, string arg2)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(10, arg1, arg2);\n            }\n        }\n\n        public void ThreeIntArgEvent11(int arg1, int arg2, int arg3)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(11, arg1, arg2, arg3);\n            }\n        }\n\n        public void ThreeLongArgEvent12(long arg1, long arg2, long arg3)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(12, arg1, arg2, arg3);\n            }\n        }\n\n        public void StringAndTwoIntArgEvent13(string arg1, int arg2, int arg3)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(13, arg1, arg2, arg3);\n            }\n        }\n\n        public void ThreeStringArgEvent14(string arg1, string arg2, string arg3)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(14, arg1, arg2, arg3);\n            }\n        }\n\n        public void SendEnumsEvent15(MyColor color, MyFlags flags)\n        {\n            this.WriteEvent(15, (int)color, (int)flags);\n        }\n    }\n\n    public enum MyColor\n    {\n        Red,\n        Blue,\n        Green,\n    }\n\n    [Flags]\n    public enum MyFlags\n    {\n        Flag1 = 1,\n        Flag2 = 2,\n        Flag3 = 4,\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestObjects/TriggerEventSource.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects\n{\n    public sealed class TriggerEventSource : EventSource\n    {\n        public static TriggerEventSource Logger = new TriggerEventSource();\n\n        [Event(1, Level = EventLevel.Informational)]\n        public void TriggerEvent(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(1, message);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/TestScenarios/TestScenario.cs",
    "content": "﻿using Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestScenarios\n{\n    internal static class TestScenario\n    {\n        public static void WithConfiguration(TraceEventServiceConfiguration svcConfiguration, Action scenario)\n        {\n            using (TraceEventService collector = new TraceEventService(svcConfiguration))\n            {\n                collector.Start();\n                try\n                {\n                    scenario();\n                }\n                finally\n                {\n                    collector.Stop();\n                }\n            }\n        }\n\n        public static void WithTempUpdatesInConfiguration(string serviceConfigFile, Func<string, string> updateConfiguration, Action scenario)\n        {\n            FlatFileHelper.DeleteDirectory(@\".\\Logs\");\n            string xmlContent = File.ReadAllText(serviceConfigFile);\n            var xmlContentRepl = updateConfiguration(xmlContent);\n            try\n            {\n                File.WriteAllText(serviceConfigFile, xmlContentRepl);\n                var svcConfiguration = TraceEventServiceConfiguration.Load(serviceConfigFile);\n                TestScenario.WithConfiguration(\n                    svcConfiguration,\n                    () =>\n                    {\n                        scenario();\n                    });\n            }\n            finally\n            {\n                File.WriteAllText(serviceConfigFile, xmlContent);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"Microsoft.Data.Edm\" version=\"5.6.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Data.OData\" version=\"5.6.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Data.Services.Client\" version=\"5.6.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Diagnostics.Tracing.TraceEvent\" version=\"1.0.15\" targetFramework=\"net451\" />\n  <package id=\"Microsoft.WindowsAzure.ConfigurationManager\" version=\"2.0.3\" targetFramework=\"net45\" />\n  <package id=\"Newtonsoft.Json\" version=\"5.0.8\" targetFramework=\"net45\" />\n  <package id=\"System.Spatial\" version=\"5.6.0\" targetFramework=\"net45\" />\n  <package id=\"WindowsAzure.Storage\" version=\"3.0.2.0\" targetFramework=\"net45\" />\n  <package id=\"StyleCop.MSBuild\" version=\"4.7.49.0\" targetFramework=\"net45\" developmentDependency=\"true\" />\n</packages>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.OutProc.Tests/slabsvcTest.xml",
    "content": "﻿<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <flatFileSink  fileName=\"FlatFileOutProcSvc.log\" name=\"FlatFileEventListener\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProcSvc\"/>\n      </sources>\n      <customEventTextFormatter type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests.TestObjects.CustomFormatterWithWait, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests\">\n        <parameters>\n          <parameter name=\"header\" type=\"System.String\" value=\"----------\">\n          </parameter>\n        </parameters>\n      </customEventTextFormatter>\n    </flatFileSink>\n    <windowsAzureTableSink name=\"AzureTablesEventListener\" tableAddress=\"azuretablese2eusingwindowsservice\" instanceName=\"mytestinstance\" bufferingIntervalInSeconds=\"1\" sortKeysAscending=\"0\" connectionString=\"UseDevelopmentStorage=true\"  bufferingFlushAllTimeoutInSeconds=\"1\">\n      <sources>\n        <eventSource name=\"MockEventSourceOutProcSvc\"  />\n      </sources>\n    </windowsAzureTableSink>\n  </sinks>\n</configuration>\n\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Information about an assembly is controlled through the following \n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(\"SemanticLogging.Tests.Shared\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"\")]\n[assembly: AssemblyProduct(\"SemanticLogging.Tests.Shared\")]\n[assembly: AssemblyCopyright(\"Copyright ©  2014\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// Setting ComVisible to false makes the types in this assembly not visible \n// to COM components.  If you need to access a type in this assembly from \n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n// The following GUID is for the ID of the typelib if this project is exposed to COM\n[assembly: Guid(\"086372b9-c39b-46c2-96e9-dce9dc556c98\")]\n\n// Version information for an assembly consists of the following four values:\n//\n//      Major Version\n//      Minor Version \n//      Build Number\n//      Revision\n//\n// You can specify all the values or you can default the Build and Revision Numbers \n// by using the '*' as shown below:\n// [assembly: AssemblyVersion(\"1.0.*\")]\n[assembly: AssemblyVersion(\"1.0.0.0\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/SemanticLogging.Tests.Shared.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"12.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{001E9C59-1326-48F1-9019-9E6CEEB1E458}</ProjectGuid>\n    <OutputType>Library</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared</RootNamespace>\n    <AssemblyName>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared</AssemblyName>\n    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>\n    <VisualStudioVersion Condition=\"'$(VisualStudioVersion)' == ''\">10.0</VisualStudioVersion>\n    <VSToolsPath Condition=\"'$(VSToolsPath)' == ''\">$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)</VSToolsPath>\n    <ReferencePath>$(ProgramFiles)\\Common Files\\microsoft shared\\VSTT\\$(VisualStudioVersion)\\UITestExtensionPackages</ReferencePath>\n    <IsCodedUITest>False</IsCodedUITest>\n    <TestProjectType>UnitTest</TestProjectType>\n    <SolutionDir Condition=\"$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'\">..\\</SolutionDir>\n    <RestorePackages>true</RestorePackages>\n    <TargetFrameworkProfile />\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"Microsoft.Data.Edm, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\Microsoft.Data.Edm.5.6.0\\lib\\net40\\Microsoft.Data.Edm.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Data.OData, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\Microsoft.Data.OData.5.6.0\\lib\\net40\\Microsoft.Data.OData.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Data.Services.Client, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\Microsoft.Data.Services.Client.5.6.0\\lib\\net40\\Microsoft.Data.Services.Client.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Diagnostics.Tracing.TraceEvent\">\n      <HintPath>..\\..\\..\\source\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\lib\\net40\\Microsoft.Diagnostics.Tracing.TraceEvent.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.WindowsAzure.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\Microsoft.WindowsAzure.ConfigurationManager.2.0.3\\lib\\net40\\Microsoft.WindowsAzure.Configuration.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.WindowsAzure.Storage, Version=3.0.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\..\\..\\source\\packages\\WindowsAzure.Storage.3.0.2.0\\lib\\net40\\Microsoft.WindowsAzure.Storage.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\Newtonsoft.Json.5.0.8\\lib\\net45\\Newtonsoft.Json.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Data.Services.Client\" />\n    <Reference Include=\"System.Net.Http\" />\n    <Reference Include=\"System.Spatial, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\..\\source\\packages\\System.Spatial.5.6.0\\lib\\net40\\System.Spatial.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Transactions\" />\n    <Reference Include=\"System.Xml\" />\n    <Reference Include=\"System.Xml.Linq\" />\n  </ItemGroup>\n  <Choose>\n    <When Condition=\"('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'\">\n      <ItemGroup>\n        <Reference Include=\"Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\" />\n      </ItemGroup>\n    </When>\n    <Otherwise>\n      <ItemGroup>\n        <Reference Include=\"Microsoft.VisualStudio.QualityTools.UnitTestFramework\" />\n      </ItemGroup>\n    </Otherwise>\n  </Choose>\n  <ItemGroup>\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n    <Compile Include=\"TestObjects\\CustomSqlSink.cs\" />\n    <Compile Include=\"TestObjects\\InMemoryEventListener.cs\" />\n    <Compile Include=\"TestObjects\\InMemorySink.cs\" />\n    <Compile Include=\"TestObjects\\IObservableEventEntryExtensions.cs\" />\n    <Compile Include=\"TestObjects\\MockFlatFileSink.cs\" />\n    <Compile Include=\"TestObjects\\MockFlatFileSink2.cs\" />\n    <Compile Include=\"TestSupport\\AssemblyLoaderHelper.cs\" />\n    <Compile Include=\"TestSupport\\AzureTableHelper.cs\" />\n    <Compile Include=\"TestSupport\\DatabaseHelper.cs\" />\n    <Compile Include=\"TestSupport\\ElasticsearchHelper.cs\" />\n    <Compile Include=\"TestSupport\\EventRecordExtensions.cs\" />\n    <Compile Include=\"TestSupport\\EventTextFormatterExtensions.cs\" />\n    <Compile Include=\"TestSupport\\ExceptionAssertHelper.cs\" />\n    <Compile Include=\"TestSupport\\FlatFileHelper.cs\" />\n    <Compile Include=\"TestSupport\\LogFileReader.cs\" />\n    <Compile Include=\"TestSupport\\ThreadHelper.cs\" />\n    <Compile Include=\"TestSupport\\TraceSessionHelper.cs\" />\n    <Compile Include=\"TestSupport\\WindowsAzureTableEventEntry.cs\" />\n    <Compile Include=\"TestSupport\\XmlFormattedEntry.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"packages.config\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\..\\..\\source\\Src\\SemanticLogging.Database\\SemanticLogging.Database.csproj\">\n      <Project>{ac34c8e7-2a5b-412c-aff7-cf7f52ee4569}</Project>\n      <Name>SemanticLogging.Database</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\..\\source\\Src\\SemanticLogging.Etw\\SemanticLogging.Etw.csproj\">\n      <Project>{8440aea2-cd55-42a0-8724-2ecce2b32374}</Project>\n      <Name>SemanticLogging.Etw</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\..\\source\\Src\\SemanticLogging\\SemanticLogging.csproj\">\n      <Project>{2cd4105b-0dd6-4c18-9b37-05d8e8f57303}</Project>\n      <Name>SemanticLogging</Name>\n    </ProjectReference>\n  </ItemGroup>\n  <Choose>\n    <When Condition=\"'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'\">\n      <ItemGroup>\n        <Reference Include=\"Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n        <Reference Include=\"Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n        <Reference Include=\"Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n        <Reference Include=\"Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n      </ItemGroup>\n    </When>\n  </Choose>\n  <Import Project=\"$(VSToolsPath)\\TeamTest\\Microsoft.TestTools.targets\" Condition=\"Exists('$(VSToolsPath)\\TeamTest\\Microsoft.TestTools.targets')\" />\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <Import Project=\"..\\..\\..\\source\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets\" Condition=\"Exists('..\\..\\..\\source\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('..\\..\\..\\source\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\..\\..\\source\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets'))\" />\n  </Target>\n  <Import Project=\"..\\..\\..\\source\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets\" Condition=\"Exists('..\\..\\..\\source\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('..\\..\\..\\source\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\..\\..\\source\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets'))\" />\n  </Target>\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestObjects/CustomSqlSink.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Data;\nusing System.Data.Common;\nusing System.Data.SqlClient;\nusing System.Globalization;\nusing System.Runtime.InteropServices;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Transactions;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\n//using Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.Database;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects\n{\n    public class MyCustomSinkSqlElement : ISinkElement\n    {\n        private readonly XName sinkName = XName.Get(\"CustomSqlSink\", \"urn:sqlTest\");\n\n        public bool CanCreateSink(XElement element)\n        {\n            return element.Name == this.sinkName;\n        }\n\n        public IObserver<EventEntry> CreateSink(XElement element)\n        {\n            string bufferingIntervalInSecondsAttr = (string)element.Attribute(\"bufferingIntervalInSeconds\");\n            TimeSpan? bufferingInterval = string.IsNullOrWhiteSpace(bufferingIntervalInSecondsAttr) ? (TimeSpan?)null : TimeSpan.FromSeconds(int.Parse(bufferingIntervalInSecondsAttr));\n\n            int bufferingCount = (int?)element.Attribute(\"bufferingCount\") ?? default(int);\n\n            var subject = new EventEntrySubject();\n\n            subject.LogToCustomSqlDatabase(\n                (string)element.Attribute(\"instanceName\"),\n                (string)element.Attribute(\"connectionString\"),\n                (string)element.Attribute(\"tableName\"),\n                bufferingInterval,\n                bufferingCount);\n\n            return subject;\n        }\n    }\n\n    /// <summary>\n    /// Sink that asynchronously writes entries to SQL Server database.\n    /// </summary>\n    [ComVisible(false)]\n    public class CustomSqlSink : IObserver<EventEntry>, IDisposable\n    {\n        /// <summary>\n        /// Default table name used to write traces.\n        /// </summary>\n        public const string DefaultTableName = \"Traces\";\n\n        private readonly string instanceName;\n        private readonly string connectionString;\n        private readonly string tableName;\n        private readonly BufferedEventPublisher<EventEntry> bufferedPublisher;\n        private readonly EventSourceSchemaCache schemaCache = EventSourceSchemaCache.Instance;\n        private readonly DbProviderFactory dbProviderFactory;\n        private CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"SqlDatabaseSink\" /> class with the specified instance name, connection string and table name.\n        /// </summary>\n        /// <param name=\"instanceName\">The name of the instance originating the entries.</param>\n        /// <param name=\"connectionString\">The connection string.</param>\n        /// <param name=\"tableName\">The name of the table.</param>\n        /// <param name=\"bufferingInterval\">The buffering interval between each batch publishing.</param>\n        /// <param name=\"bufferingCount\">The number of entries that will trigger a batch publishing.</param>\n        public CustomSqlSink(string instanceName, string connectionString, string tableName = \"Traces\", TimeSpan? bufferingInterval = null, int bufferingCount = Buffering.DefaultBufferingCount)\n        {\n            Guard.ArgumentNotNullOrEmpty(instanceName, \"instanceName\");\n            ValidateSqlConnectionString(connectionString, \"connectionString\");\n\n            string sinkId = string.Format(CultureInfo.InvariantCulture, \"DatabaseSink ({0})\", instanceName);\n            this.dbProviderFactory = SqlClientFactory.Instance;\n            this.bufferedPublisher = BufferedEventPublisher<EventEntry>.CreateAndStart(sinkId, this.PublishEventsAsync, bufferingInterval ?? Buffering.DefaultBufferingInterval, bufferingCount, 30000, this.cancellationTokenSource.Token);\n            this.instanceName = instanceName;\n            this.connectionString = connectionString;\n            this.tableName = tableName ?? \"Traces\";\n        }\n\n        /// <summary>\n        /// Finalizes an instance of the <see cref=\"SqlDatabaseSink\"/> class.\n        /// </summary>\n        ~CustomSqlSink()\n        {\n            this.Dispose(false);\n        }\n\n        /// <summary>\n        /// Flushes the buffer content to <see cref=\"PublishEventsAsync\"/>.\n        /// </summary>\n        /// <returns>The Task that flushes the buffer.</returns>\n        public Task FlushAsync()\n        {\n            return this.bufferedPublisher.FlushAsync();\n        }\n\n        /// <summary>\n        /// Releases all resources used by the current instance of the <see cref=\"SqlDatabaseSink\"/> class.\n        /// </summary>\n        public void Dispose()\n        {\n            this.Dispose(true);\n            GC.SuppressFinalize(this);\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has finished sending push-based notifications.\n        /// </summary>\n        public void OnCompleted()\n        {\n            this.FlushAsync().Wait();\n            this.Dispose();\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has experienced an error condition.\n        /// </summary>\n        /// <param name=\"error\">An object that provides additional information about the error.</param>\n        public void OnError(Exception error)\n        {\n            this.FlushAsync().Wait();\n            this.Dispose();\n        }\n\n        /// <summary>\n        /// Provides the sink with new data to write.\n        /// </summary>\n        /// <param name=\"value\">The current entry to write to the database.</param>\n        public void OnNext(EventEntry value)\n        {\n            if (value != null)\n            {\n                this.bufferedPublisher.TryPost(value);\n            }\n        }\n\n        protected virtual void Dispose(bool disposing)\n        {\n            if (!this.disposed)\n            {\n                if (disposing)\n                {\n                    if (this.bufferedPublisher != null)\n                    {\n                        this.bufferedPublisher.Dispose();\n                    }\n\n                    if (this.cancellationTokenSource != null)\n                    {\n                        this.cancellationTokenSource.Dispose();\n                    }\n                }\n\n                this.cancellationTokenSource = null;\n                this.disposed = true;\n            }\n        }\n\n        //private static void Retrying(object sender, Transient.RetryingEventArgs e)\n        //{\n        //    SemanticLoggingEventSource.Log.DatabaseSinkOpenDatabaseFailed(e.LastException.ToString());\n        //}\n\n        private static void ValidateSqlConnectionString(string connectionStringValue, string argumentName)\n        {\n            Guard.ArgumentNotNullOrEmpty(connectionStringValue, argumentName);\n\n            try\n            {\n                var builder = new SqlConnectionStringBuilder();\n                builder.ConnectionString = connectionStringValue;\n            }\n            catch (ArgumentException e)\n            {\n                throw new ArgumentException(\"Invalid Connection string\", argumentName, e);\n            }\n        }\n\n        private static DataTable GetDataTable(string instanceName, IEnumerable<EventEntry> collection)\n        {\n            var table = new DataTable();\n            table.Columns.Add(\"InstanceName\", typeof(string));\n            table.Columns.Add(\"ProviderId\", typeof(Guid));\n            table.Columns.Add(\"ProviderName\", typeof(string));\n            table.Columns.Add(\"EventId\", typeof(int));\n            table.Columns.Add(\"EventKeywords\", typeof(long));\n            table.Columns.Add(\"Level\", typeof(string));\n            table.Columns.Add(\"Opcode\", typeof(int));\n            table.Columns.Add(\"Task\", typeof(int));\n            table.Columns.Add(\"Timestamp\", typeof(DateTime));\n            table.Columns.Add(\"Version\", typeof(int));\n            table.Columns.Add(\"FormattedMessage\", typeof(string));\n            table.Columns.Add(\"Payload\", typeof(string));\n\n            foreach (var entry in collection)\n            {\n                var values = new object[]\n                {\n                    instanceName,\n                    entry.Schema.ProviderId,\n                    entry.Schema.ProviderName,\n                    (int)entry.EventId,\n                    (long)entry.Schema.Keywords,\n                    (int)entry.Schema.Level,\n                    (int)entry.Schema.Opcode,\n                    (int)entry.Schema.Task,\n                    entry.Timestamp.UtcDateTime,\n                    (int)entry.Schema.Version,\n                    (object)entry.FormattedMessage ?? DBNull.Value,\n                    (object)EventEntryUtil.JsonSerializePayload(entry) ?? DBNull.Value\n                };\n\n                table.Rows.Add(values);\n            }\n\n            return table;\n        }\n\n        private async Task<int> PublishEventsAsync(IList<EventEntry> collection)\n        {\n            var token = this.cancellationTokenSource.Token;\n            var table = GetDataTable(this.instanceName, collection);\n\n            // Prevent the connection from getting enlisted in an ambient transaction\n            using (var connection = this.dbProviderFactory.CreateConnection())\n            {\n                connection.ConnectionString = this.connectionString;\n\n                try\n                {\n                    Task openTask;\n                    using (new TransactionScope(TransactionScopeOption.Suppress))\n                    {\n                        // Opt-out of using ambient transactions while opening the connection.\n                        // Disposing the transaction scope needs to happen in the same thread where it was created,\n                        // and that is why the await is done after the using finishes.\n                        openTask = connection.OpenAsync(token);\n                    }\n\n                    await openTask.ConfigureAwait(false);\n                }\n                catch (OperationCanceledException)\n                {\n                    return 0;\n                }\n                catch (Exception)\n                {\n                    //SemanticLoggingEventSource.Log.DatabaseSinkOpenFailed(dbe.ToString());\n                    return 0;\n                }\n\n                try\n                {\n                    if (token.IsCancellationRequested)\n                    {\n                        return 0;\n                    }\n\n                    using (var adapter = this.dbProviderFactory.CreateDataAdapter())\n                    {\n                        adapter.InsertCommand = this.CreateCommand(connection);\n                        adapter.UpdateBatchSize = 2;  //TODO: review\n                        adapter.Update(table);\n                    }\n                }\n                catch (OperationCanceledException)\n                {\n                    return 0;\n                }\n                finally\n                {\n                    connection.Close();\n                }\n            }\n\n            return collection.Count;\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Security\", \"CA2100:Review SQL queries for security vulnerabilities\", Justification = \"Reviewed\")]\n        private DbCommand CreateCommand(DbConnection connection)\n        {\n            var cmd = this.dbProviderFactory.CreateCommand();\n            cmd.Connection = connection;\n            cmd.CommandText = string.Format(CultureInfo.InvariantCulture, InsertSql, this.tableName);\n            cmd.UpdatedRowSource = UpdateRowSource.None;\n\n            cmd.Parameters.Add(this.CreateParameter(\"@InstanceName\", DbType.String, \"InstanceName\"));\n            cmd.Parameters.Add(this.CreateParameter(\"@ProviderId\", DbType.Guid, \"ProviderId\"));\n            cmd.Parameters.Add(this.CreateParameter(\"@ProviderName\", DbType.String, \"ProviderName\"));\n            cmd.Parameters.Add(this.CreateParameter(\"@EventId\", DbType.Int32, \"EventId\"));\n            cmd.Parameters.Add(this.CreateParameter(\"@EventKeywords\", DbType.Int64, \"EventKeywords\"));\n            cmd.Parameters.Add(this.CreateParameter(\"@Level\", DbType.Int32, \"Level\"));\n            cmd.Parameters.Add(this.CreateParameter(\"@Opcode\", DbType.Int32, \"Opcode\"));\n            cmd.Parameters.Add(this.CreateParameter(\"@Task\", DbType.Int32, \"Task\"));\n            cmd.Parameters.Add(this.CreateParameter(\"@Timestamp\", DbType.DateTime, \"Timestamp\"));\n            cmd.Parameters.Add(this.CreateParameter(\"@Version\", DbType.Int32, \"Version\"));\n            cmd.Parameters.Add(this.CreateParameter(\"@FormattedMessage\", DbType.String, \"FormattedMessage\"));\n            cmd.Parameters.Add(this.CreateParameter(\"@Payload\", DbType.String, \"Payload\"));\n\n            return cmd;\n        }\n\n        private const string InsertSql = @\"INSERT INTO {0} ([InstanceName], [ProviderId], [ProviderName], [EventId], [EventKeywords], [Level], [Opcode], [Task], [Timestamp], [Version], [FormattedMessage], [Payload]) VALUES (@InstanceName, @ProviderId, @ProviderName, @EventId, @EventKeywords, @Level, @Opcode, @Task, @Timestamp, @Version, @FormattedMessage, @Payload)\";\n        private bool disposed;\n\n        private DbParameter CreateParameter(string parameterName, DbType dbType, string sourceColumn)\n        {\n            var param = this.dbProviderFactory.CreateParameter();\n            param.ParameterName = parameterName;\n            param.DbType = dbType;\n            param.SourceColumn = sourceColumn;\n\n            return param;\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestObjects/IObservableEventEntryExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing System;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects\n{\n    public static class IObservableEventEntryExtensions\n    {\n        /// <summary>\n        /// Subscribes to the listener using a <see cref=\"SqlDatabaseSink\" />.\n        /// </summary>\n        /// <param name=\"eventStream\">The event stream. Typically this is an instance of <see cref=\"ObservableEventListener\" />.</param>\n        /// <param name=\"instanceName\">The name of the instance originating the entries.</param>\n        /// <param name=\"connectionString\">The connection string.</param>\n        /// <param name=\"tableName\">The name of the table.</param>\n        /// <param name=\"bufferingInterval\">The buffering interval between each batch publishing.</param>\n        /// <param name=\"bufferingCount\">The number of entries that will trigger a batch publishing.</param>\n        /// <returns>The sink instance.</returns>\n        public static SinkSubscription<CustomSqlSink> LogToCustomSqlDatabase(this IObservable<EventEntry> eventStream, string instanceName, string connectionString, string tableName = \"Traces\", TimeSpan? bufferingInterval = null, int bufferingCount = Buffering.DefaultBufferingCount)\n        {\n            var sink = new CustomSqlSink(instanceName, connectionString, tableName, bufferingInterval ?? Buffering.DefaultBufferingInterval, bufferingCount);\n\n            var subscription = eventStream.Subscribe(sink);\n\n            return new SinkSubscription<CustomSqlSink>(subscription, sink);\n        }\n\n        public static SinkSubscription<MockFlatFileSink> LogToMockFlatFile(this IObservable<EventEntry> eventStream, string fileName, string header)\n        {\n            var sink = new MockFlatFileSink(fileName, header);\n\n            var subscription = eventStream.Subscribe(sink);\n\n            return new SinkSubscription<MockFlatFileSink>(subscription, sink);\n        }\n\n        public static IDisposable SubscribeWithConversion(this IObservable<EventEntry> source, IObserver<EventEntry> sink)\n        {\n            return source.CreateSubscription(sink, PassEventEntry);\n        }\n\n        public static EventEntry PassEventEntry(this EventEntry entry)\n        {\n            return entry;\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestObjects/InMemoryEventListener.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Threading;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects\n{\n    public class InMemoryEventListener : EventListener, IDisposable\n    {\n        public MemoryStream Stream;\n        private readonly EventSourceSchemaCache schemaCache = EventSourceSchemaCache.Instance;\n        private readonly object lockObject = new object();\n        private StreamWriter writer;\n        private ManualResetEventSlim waitEvents;\n        private long writenBytes;\n        private bool disposed;\n\n        public InMemoryEventListener()\n            : this(new EventTextFormatter())\n        {\n            this.waitEvents = new ManualResetEventSlim(); \n        }\n\n        public InMemoryEventListener(IEventTextFormatter formatter)\n        {\n            this.Formatter = formatter;\n            this.Stream = new MemoryStream();\n            this.writer = new StreamWriter(this.Stream);\n        }\n\n        public ManualResetEventSlim WaitEvents\n        {\n            get { return this.waitEvents; }\n        }\n\n        public IEventTextFormatter Formatter { get; set; }\n\n        public override string ToString()\n        {\n            if (false == this.Stream.CanRead)\n            {\n                return string.Empty; \n            }\n\n            this.Stream.Position = 0;\n            var reader = new StreamReader(this.Stream);\n            return reader.ReadToEnd();\n        }\n\n        public override sealed void Dispose()\n        {\n            this.Dispose(true);\n            GC.SuppressFinalize(this);\n        }\n\n        protected virtual void Dispose(bool disposing)\n        {\n            if (!this.disposed)\n            {\n                if (disposing)\n                {\n                    if (this.waitEvents != null)\n                    {\n                        this.waitEvents.Dispose();\n                    }\n\n                    if (this.writer != null)\n                    {\n                        this.writer.Dispose();\n                    }\n\n                    if (this.Stream != null)\n                    {\n                        this.Stream.Dispose();\n                    }\n                }\n\n                this.waitEvents = null;\n                this.writer = null;\n                this.Stream = null;\n\n                this.disposed = true;\n            }\n        }\n\n        protected override void OnEventWritten(EventWrittenEventArgs eventData)\n        {\n            var entry = EventEntry.Create(eventData, this.schemaCache.GetSchema(eventData.EventId, eventData.EventSource));\n\n            lock (this.lockObject)\n            {\n                this.Formatter.WriteEvent(entry, this.writer);\n                this.writer.Flush();\n                this.writenBytes = this.Stream.Length;\n\n                if (this.waitEvents != null)\n                {\n                    this.waitEvents.Reset(); \n                }\n            }\n        }\n\n        ~InMemoryEventListener()\n        {\n            this.Dispose(false);\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestObjects/InMemorySink.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Threading;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects\n{\n    public class InMemorySink : EventListener, IObserver<EventEntry>, IDisposable\n    {\n        private readonly EventSourceSchemaCache schemaCache = EventSourceSchemaCache.Instance;\n        private readonly object lockObject = new object();\n        private MemoryStream memory;\n        private StreamWriter writer;\n        private long writenBytes;\n        private ManualResetEventSlim waitOnAsync;\n        private bool disposed;\n\n        public InMemorySink()\n            : this(null)\n        {\n        }\n\n        public InMemorySink(IEventTextFormatter formatter = null)\n        {\n            this.Formatter = formatter ?? new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            this.memory = new MemoryStream();\n            this.writer = new StreamWriter(this.memory) { AutoFlush = false };\n            this.waitOnAsync = new ManualResetEventSlim();\n        }\n\n        public IEventTextFormatter Formatter { get; set; }\n\n        public int EventWrittenCount { get; private set; }\n\n        public Func<bool> WaitSignalCondition { get; set; }\n\n        public override string ToString()\n        {\n            this.memory.Position = 0;\n            return new StreamReader(this.memory).ReadToEnd();\n        }\n\n        public WaitHandle WaitOnAsyncEvents { get { return this.waitOnAsync.WaitHandle; } }\n\n        public override sealed void Dispose()\n        {\n            this.Dispose(true);\n            GC.SuppressFinalize(this);\n        }\n\n        protected virtual void Dispose(bool disposing)\n        {\n            if (!this.disposed)\n            {\n                if (disposing)\n                {\n                    if (this.memory != null)\n                    {\n                        this.memory.Dispose();\n                    }\n\n                    if (this.writer != null)\n                    {\n                        this.writer.Dispose();\n                    }\n\n                    if (this.waitOnAsync != null)\n                    {\n                        this.waitOnAsync.Dispose();\n                    }\n                }\n\n                this.memory = null;\n                this.writer = null;\n                this.waitOnAsync = null;\n\n                this.disposed = true;\n            }\n        }\n\n        protected override void OnEventWritten(EventWrittenEventArgs eventData)\n        {\n            var entry = EventEntry.Create(eventData, this.schemaCache.GetSchema(eventData.EventId, eventData.EventSource));\n\n            this.OnNext(entry);\n        }\n\n        public void OnCompleted()\n        {\n        }\n\n        public void OnError(Exception error)\n        {\n        }\n\n        public void OnNext(EventEntry value)\n        {\n            lock (this.lockObject)\n            {\n                try\n                {\n                    this.writer.Write(this.Formatter.WriteEvent(value));\n                    this.EventWrittenCount++;\n                    // check that no data was already flushed\n                    Assert.AreEqual(this.writenBytes, this.memory.Length);\n                    this.writer.Flush();\n                    this.writenBytes = this.memory.Length;\n                }\n                finally\n                {\n                    // mark any async event as done       \n                    if (this.WaitSignalCondition == null || this.WaitSignalCondition())\n                    {\n                        this.waitOnAsync.Set();\n                    }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestObjects/MockFlatFileSink.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing System;\nusing System.Collections.Concurrent;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects\n{\n    public class MockFlatFileSink : IObserver<EventEntry>, IDisposable\n    {\n        private readonly object lockObject = new object();\n        private readonly object flushLockObject = new object();\n        private readonly EventSourceSchemaCache schemaCache = EventSourceSchemaCache.Instance;\n        private StreamWriter writer;\n        private bool disposed;\n        private volatile TaskCompletionSource<bool> flushSource = new TaskCompletionSource<bool>();\n\n        public MockFlatFileSink(string fileName, string header)\n            : this(fileName, header, null)\n        {\n        }\n\n        public MockFlatFileSink(string fileName, string header, IEventTextFormatter formatter = null)\n        {\n            FileUtil.ValidFile(fileName);\n\n            this.Formatter = formatter ?? new EventTextFormatter(header: header, verbosityThreshold: EventLevel.LogAlways);\n\n            var file = FileUtil.ProcessFileNameForLogging(fileName);\n\n            this.writer = new StreamWriter(file.Open(FileMode.Append, FileAccess.Write, FileShare.Read));\n\n            this.flushSource.SetResult(true);\n        }\n\n        /// <summary>\n        /// Flushes the buffer content to the file.\n        /// </summary>\n        /// <returns>The Task that gets completed when the buffer is flushed.</returns>\n        public Task FlushAsync()\n        {\n            lock (this.flushLockObject)\n            {\n                return this.flushSource.Task;\n            }\n        }\n\n        /// <summary>\n        /// Finalizes an instance of the <see cref=\"FlatFileSink\"/> class.\n        /// </summary>\n        ~MockFlatFileSink()\n        {\n            this.Dispose(false);\n        }\n\n        public IEventTextFormatter Formatter { get; set; }\n        public int EventWrittenCount { get; private set; }\n        public Func<bool> WaitSignalCondition { get; set; }\n\n        public void Dispose()\n        {\n            this.Dispose(true);\n            GC.SuppressFinalize(this);\n        }\n\n        protected virtual void Dispose(bool disposing)\n        {\n            if (!this.disposed)\n            {\n                if (disposing)\n                {\n                    if (this.writer != null)\n                    {\n                        this.writer.Dispose();\n                    }\n                }\n\n                this.writer = null;\n                this.disposed = true;\n            }\n        }\n\n        private void OnSingleEventWritten(EventEntry entry)\n        {\n            try\n            {\n                lock (this.lockObject)\n                {\n                    try\n                    {\n                        string strEntry = Formatter.WriteEvent(entry);\n\n                        this.writer.Write(strEntry);\n                        this.writer.Flush();\n                    }\n                    catch (Exception)\n                    {\n                    }\n                }\n            }\n            catch (Exception e)\n            {\n                SemanticLoggingEventSource.Log.FlatFileSinkWriteFailed(e.ToString());\n            }\n        }\n\n        public void OnCompleted()\n        {\n            this.FlushAsync().Wait();\n            this.Dispose();\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has experienced an error condition.\n        /// </summary>\n        /// <param name=\"error\">An object that provides additional information about the error.</param>\n        public void OnError(Exception error)\n        {\n            this.FlushAsync().Wait();\n            this.Dispose();\n        }\n\n        /// <summary>\n        /// Provides the sink with new data to write.\n        /// </summary>\n        /// <param name=\"value\">The current entry to write to the file.</param>\n        public void OnNext(EventEntry value)\n        {\n            this.OnSingleEventWritten(value);\n        }\n    }\n}"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestObjects/MockFlatFileSink2.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing System;\nusing System.Collections.Concurrent;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestObjects\n{\n    public class MockFlatFileSink2 : IObserver<EventEntry>, IDisposable\n    {\n        private readonly object lockObject = new object();\n        private readonly object flushLockObject = new object();\n        private readonly EventSourceSchemaCache schemaCache = EventSourceSchemaCache.Instance;\n        private StreamWriter writer;\n        private bool disposed;\n        private volatile TaskCompletionSource<bool> flushSource = new TaskCompletionSource<bool>();\n\n        public MockFlatFileSink2(string fileName, int headerCount)\n            : this(fileName, new string('=', headerCount), null)\n        {\n        }\n\n        public MockFlatFileSink2(string fileName, string header)\n            : this(fileName, header, null)\n        {\n        }\n\n        public MockFlatFileSink2(string fileName, string header, IEventTextFormatter formatter = null)\n        {\n            FileUtil.ValidFile(fileName);\n\n            this.Formatter = formatter ?? new EventTextFormatter(header: header, verbosityThreshold: EventLevel.LogAlways);\n\n            var file = FileUtil.ProcessFileNameForLogging(fileName);\n\n            this.writer = new StreamWriter(file.Open(FileMode.Append, FileAccess.Write, FileShare.Read));\n\n            this.flushSource.SetResult(true);\n        }\n\n        /// <summary>\n        /// Flushes the buffer content to the file.\n        /// </summary>\n        /// <returns>The Task that gets completed when the buffer is flushed.</returns>\n        public Task FlushAsync()\n        {\n            lock (this.flushLockObject)\n            {\n                return this.flushSource.Task;\n            }\n        }\n\n        /// <summary>\n        /// Finalizes an instance of the <see cref=\"FlatFileSink\"/> class.\n        /// </summary>\n        ~MockFlatFileSink2()\n        {\n            this.Dispose(false);\n        }\n\n        public IEventTextFormatter Formatter { get; set; }\n        public int EventWrittenCount { get; private set; }\n        public Func<bool> WaitSignalCondition { get; set; }\n\n        public void Dispose()\n        {\n            this.Dispose(true);\n            GC.SuppressFinalize(this);\n        }\n\n        protected virtual void Dispose(bool disposing)\n            {\n                if (!this.disposed)\n                {\n                if (disposing)\n                    {\n                    if (this.writer != null)\n                        {\n                            this.writer.Dispose();\n                        }\n                    }\n\n                this.writer = null;\n                this.disposed = true;\n            }\n        }\n\n        private void OnSingleEventWritten(EventEntry entry)\n        {\n            try\n            {\n                lock (this.lockObject)\n                {\n                    try\n                    {\n                        string strEntry = Formatter.WriteEvent(entry);\n\n                        this.writer.Write(strEntry);\n                        this.writer.Flush();\n                    }\n                    catch (Exception)\n                    {\n                    }\n                }\n            }\n            catch (Exception e)\n            {\n                SemanticLoggingEventSource.Log.FlatFileSinkWriteFailed(e.ToString());\n            }\n        }\n\n        public void OnCompleted()\n        {\n            this.FlushAsync().Wait();\n            this.Dispose();\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has experienced an error condition.\n        /// </summary>\n        /// <param name=\"error\">An object that provides additional information about the error.</param>\n        public void OnError(Exception error)\n        {\n            this.FlushAsync().Wait();\n            this.Dispose();\n        }\n\n        /// <summary>\n        /// Provides the sink with new data to write.\n        /// </summary>\n        /// <param name=\"value\">The current entry to write to the file.</param>\n        public void OnNext(EventEntry value)\n        {\n            this.OnSingleEventWritten(value);\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestSupport/AssemblyLoaderHelper.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.IO;\nusing System.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport\n{\n    public static class AssemblyLoaderHelper\n    {\n        public static void EnsureAllAssembliesAreLoadedForSinkTest()\n        {\n            EnsureAssemblyIsLoaded(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.WindowsAzure\", \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.WindowsAzure.dll\");\n            EnsureAssemblyIsLoaded(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Database\", \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Database.dll\");\n            EnsureAssemblyIsLoaded(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.TextFile\", \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.TextFile.dll\");\n        }\n\n        private static void EnsureAssemblyIsLoaded(string assemblyName, string assemblyFileName)\n        {\n            var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();\n            if (!loadedAssemblies.Any(a => a.FullName.StartsWith(assemblyName)))\n            {\n                var assemblyBytes = File.ReadAllBytes(assemblyFileName);\n                AppDomain.CurrentDomain.Load(assemblyBytes);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestSupport/AzureTableHelper.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.WindowsAzure.Storage;\nusing Microsoft.WindowsAzure.Storage.Table;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport\n{\n    public static class AzureTableHelper\n    {\n        public static void DeleteTable(string connectionString, string tableName)\n        {\n            var table = GetTable(connectionString, tableName);\n            table.DeleteIfExists();\n        }\n\n        public static IEnumerable<WindowsAzureTableEventEntry> PollForEvents(string connectionString, string tableName, int eventsToRecieve)\n        {\n            return PollForEvents(connectionString, tableName, eventsToRecieve, TimeSpan.FromSeconds(10));\n        }\n\n        public static IEnumerable<WindowsAzureTableEventEntry> PollForEvents(string connectionString, string tableName, int eventsToRecieve, TimeSpan waitFor)\n        {\n            IEnumerable<WindowsAzureTableEventEntry> entries = new WindowsAzureTableEventEntry[0];\n            var timeoutToWaitUntilEventIsReceived = DateTime.UtcNow.Add(waitFor);\n            var table = GetTable(connectionString, tableName);\n            var query = new TableQuery<WindowsAzureTableEventEntry>();\n            while (DateTime.UtcNow < timeoutToWaitUntilEventIsReceived)\n            {\n                try\n                {\n                    entries = table.ExecuteQuery<WindowsAzureTableEventEntry>(query);\n                    if (entries.Count() >= eventsToRecieve)\n                    {\n                        break;\n                    }\n                }\n                catch\n                { }\n\n                Task.Delay(200).Wait();\n            }\n\n            return entries;\n        }\n\n        //public static IEnumerable<WindowsAzureTableEventEntry> GetEvents(string connectionString, string tableName)\n        //{\n        //    var table = GetTable(connectionString, tableName);\n        //    var query = new TableQuery<WindowsAzureTableEventEntry>();\n        //    return table.ExecuteQuery<WindowsAzureTableEventEntry>(query).ToList();\n        //}\n\n        public static int GetEventsCount(string connectionString, string tableName)\n        {\n            var table = GetTable(connectionString, tableName);\n            if (!table.Exists())\n            {\n                return 0;\n            }\n\n            var query = new TableQuery<WindowsAzureTableEventEntry>();\n            return table.ExecuteQuery<WindowsAzureTableEventEntry>(query.Select(new List<string>() { \"PartitionKey\", \"RowKey\", \"EventId\" })).Count();\n        }\n\n        private static CloudTable GetTable(string connectionString, string tableName)\n        {\n            var account = CloudStorageAccount.Parse(connectionString);\n            var client = account.CreateCloudTableClient();\n\n            return client.GetTableReference(tableName);\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestSupport/DatabaseHelper.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Data;\nusing System.Data.SqlClient;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport\n{\n    public static class DatabaseHelper\n    {\n        public static void CleanLoggingDB(string databaseConnectionString)\n        {\n            using (var connection = new SqlConnection(databaseConnectionString))\n            {\n                connection.Open();\n                SqlCommand command = new SqlCommand(\"DELETE TRACES\", connection);\n                command.ExecuteNonQuery();\n            }\n        }\n\n        public static DataTable GetLoggedTable(string databaseConnectionString)\n        {\n            return GetLoggedTable(databaseConnectionString, 1);\n        }\n\n        public static DataTable GetLoggedTable(string databaseConnectionString, int recordCount)\n        {\n            using (var connection = new SqlConnection(databaseConnectionString))\n            {\n                DataSet dataset = new DataSet();\n                DataTable datatable = new DataTable();\n                connection.Open();\n                SqlDataAdapter adapter = new SqlDataAdapter(\"SELECT * FROM TRACES\", connection);\n\n                for (int n = 0; n < 20; n++)\n                {\n                    dataset = new DataSet();\n                    adapter.Fill(dataset);\n                    datatable = dataset.Tables[0];\n                    if (datatable.Rows.Count >= recordCount)\n                    {\n                        break; \n                    }\n\n                    Task.Delay(800).Wait();\n                }\n\n                return datatable;\n            }\n        }\n\n        public static DataTable PollUntilEventsAreWritten(string databaseConnectionString, int eventsCount)\n        {\n            var timeoutToWaitUntilEventIsReceived = DateTime.UtcNow.AddSeconds(20);\n            var datatable = new DataTable();\n            while (DateTime.UtcNow < timeoutToWaitUntilEventIsReceived)\n            {\n                try\n                {\n                    using (var connection = new SqlConnection(databaseConnectionString))\n                    {\n                        var dataset = new DataSet();\n                        connection.Open();\n                        var adapter = new SqlDataAdapter(\"SELECT * FROM TRACES\", connection);\n                        dataset = new DataSet();\n                        adapter.Fill(dataset);\n                        datatable = dataset.Tables[0];\n                        if (datatable.Rows.Count >= eventsCount)\n                        {\n                            break;\n                        }\n                    }\n                }\n                catch \n                { }\n\n                Task.Delay(200).Wait();\n            }\n\n            return datatable;\n        }\n\n        public static void DropLoggingTable(string databaseConnectionString)\n        {\n            using (var connection = new SqlConnection(databaseConnectionString))\n            {\n                connection.Open();\n                SqlCommand command = new SqlCommand(\"DROP TABLE [dbo].[Traces]\", connection);\n                command.ExecuteNonQuery();\n            }\n        }\n\n        public static void CreateLoggingTable(string databaseConnectionString)\n        {\n            using (var connection = new SqlConnection(databaseConnectionString))\n            {\n                connection.Open();\n                SqlCommand command = new SqlCommand(@\"CREATE TABLE [dbo].[Traces](\n\t[id] [bigint] IDENTITY(1,1) NOT NULL,\n\t[InstanceName] [nvarchar](1000) NOT NULL,\n\t[ProviderId] [uniqueidentifier] NOT NULL,\n\t[ProviderName] [nvarchar](500) NOT NULL,\n\t[EventId] [int] NOT NULL,\n\t[EventKeywords] [bigint] NOT NULL,\n\t[Level] [int] NOT NULL,\n\t[Opcode] [int] NOT NULL,\n\t[Task] [int] NOT NULL,\n\t[Timestamp] [datetimeoffset](7) NOT NULL,\n\t[Version] [int] NOT NULL,\n\t[FormattedMessage] [nvarchar](4000) NULL,\n\t[Payload] [nvarchar](4000) NULL,\n\t[ActivityId] [uniqueidentifier],\n\t[RelatedActivityId] [uniqueidentifier],\n CONSTRAINT [PK_Traces] PRIMARY KEY CLUSTERED \n(\n\t[id] ASC\n)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF)\n)\", connection);\n                command.ExecuteNonQuery();\n            }\n        }\n\n        public static int GetRowCount(string databaseConnectionString)\n        {\n            using (var connection = new SqlConnection(databaseConnectionString))\n            {\n                connection.Open();\n                SqlCommand command = new SqlCommand(\"SELECT count(*) FROM TRACES\", connection);\n                return (int)command.ExecuteScalar();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestSupport/ElasticSearchHelper.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Newtonsoft.Json;\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Net.Http;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport\n{\n    public static class ElasticsearchHelper\n    {\n        public static void DeleteIndex(string uri, string indexName = null)\n        {\n            indexName = indexName ?? \"*\";\n\n            var client = new HttpClient { BaseAddress = new Uri(uri) };\n\n            client.DeleteAsync(indexName).Wait();\n        }\n\n        public static QueryResult GetEvents(string uri, string indexName, string typeName, string match = null)\n        {\n            if (String.IsNullOrEmpty(indexName) || String.IsNullOrEmpty(typeName))\n            {\n                throw new ArgumentException(\" index name and type name need to be supplied\");\n            }\n\n            string query = \"/\" + indexName + \"/\" + typeName + \"/\" + \"_search\";\n            if (!String.IsNullOrEmpty(match))\n            {\n                query += match;\n            }\n\n            try\n            {\n                var client = new HttpClient { BaseAddress = new Uri(uri) };\n                var response = client.GetStringAsync(query).Result;\n                var result = JsonConvert.DeserializeObject<QueryResult>(response);\n                return result;\n            }\n            catch\n            { }\n\n            return new QueryResult\n            {\n                Hits = new QueryResultItemCollection(),\n                Shards = new Dictionary<string, object>()\n            };\n        }\n\n        public static QueryResult PollUntilEvents(string uri, string indexName, string typeName, int eventsToReceive, string match = null, TimeSpan? maxPollTime = null)\n        {\n            if (!maxPollTime.HasValue)\n            {\n                maxPollTime = TimeSpan.FromSeconds(10);\n            }\n\n            QueryResult results = null;\n            DateTime pollUntil = DateTime.Now.Add(maxPollTime.Value);\n            while (DateTime.Now < pollUntil)\n            {\n                results = GetEvents(uri, indexName, typeName, match);\n                if (results.Hits.Total == eventsToReceive)\n                {\n                    return results;\n                }\n\n                Task.Delay(TimeSpan.FromMilliseconds(500)).Wait();\n            }\n\n            throw new TimeoutException(\n                string.Format(CultureInfo.InvariantCulture, \"The expected count of {0} events were not received on {1} seconds. Total events received: {2}.\",\n                eventsToReceive, \n                maxPollTime.Value.ToString(@\"ss\\.fff\"),\n                results.Hits.Total));\n        }\n    }\n\n    public class QueryResult\n    {\n        public int Took;\n\n        [JsonProperty(PropertyName = \"timed_out\")]\n        public bool TimedOut;\n\n        [JsonProperty(PropertyName = \"_shards\")]\n        public Dictionary<string, object> Shards { get; set; }\n\n        public QueryResultItemCollection Hits { get; set; }\n    }\n\n    public class QueryResultItemCollection\n    {\n        [JsonProperty(PropertyName = \"total\")]\n        public int Total { get; set; }\n\n        public QueryResultItem[] Hits { get; set; }\n    }\n\n    public class QueryResultItem\n    {\n        [JsonProperty(PropertyName = \"_index\")]\n        public string Index { get; set; }\n\n        [JsonProperty(PropertyName = \"_type\")]\n        public string Type { get; set; }\n\n        [JsonProperty(PropertyName = \"_id\")]\n        public string Id { get; set; }\n\n        [JsonProperty(PropertyName = \"_source\")]\n        public Dictionary<string, object> Source { get; set; }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestSupport/EventRecordExtensions.cs",
    "content": "﻿//// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\n//using Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\n//using Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.Database;\n//using Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n//using Microsoft.SqlServer.Server;\n//using System;\n//using System.Data;\n//using System.Linq;\n\n//namespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport\n//{\n//    public static class EventRecordExtensions\n//    {\n//        internal static readonly SqlMetaData[] SqlMetaData;\n//        internal static readonly string[] Fields;\n\n//        static EventRecordExtensions()\n//        {\n//            SqlMetaData = new SqlMetaData[]\n//            {\n//                new SqlMetaData(\"InstanceName\", SqlDbType.NVarChar, 1000),\n//                new SqlMetaData(\"ProviderId\", SqlDbType.UniqueIdentifier),\n//                new SqlMetaData(\"ProviderName\", SqlDbType.NVarChar, 500),\n//                new SqlMetaData(\"EventId\", SqlDbType.Int),\n//                new SqlMetaData(\"EventKeywords\", SqlDbType.BigInt),\n//                new SqlMetaData(\"Level\", SqlDbType.Int),\n//                new SqlMetaData(\"Opcode\", SqlDbType.Int),\n//                new SqlMetaData(\"Task\", SqlDbType.Int),\n//                new SqlMetaData(\"Timestamp\", SqlDbType.DateTimeOffset),\n//                new SqlMetaData(\"Version\", SqlDbType.Int),\n//                new SqlMetaData(\"FormattedMessage\", SqlDbType.NVarChar, 4000),\n//                new SqlMetaData(\"Payload\", SqlDbType.NVarChar, 4000)\n//            };\n\n//            Fields = SqlMetaData.Select(x => x.Name).ToArray();\n//        }\n\n//        /// <summary>\n//        /// Subscribes an <see cref=\"IObserver{EventRecord}\"/> sink by doing a straight projection of a sequence of <see cref=\"EventEntry\"/>\n//        /// and converting it to a <see cref=\"EventRecord\"/> entity.\n//        /// </summary>\n//        /// <param name=\"source\">The original stream of events.</param>\n//        /// <param name=\"sink\">The underlying sink.</param>\n//        /// <returns>A subscription token to unsubscribe to the event stream.</returns>\n//        /// <remarks>When using Reactive Extensions (Rx), this is equivalent to doing a Select statement on the <paramref name=\"source\"/> to convert it to <see cref=\"IObservable{String}\"/> and then\n//        /// calling Subscribe on it.\n//        /// </remarks>\n//        public static IDisposable SubscribeWithConversion(this IObservable<EventEntry> source, IObserver<EventRecord> sink)\n//        {\n//            return source.CreateSubscription(sink, TryConvertToEventRecord);\n//        }\n\n//        /// <summary>\n//        /// Converts an <see cref=\"EventEntry\"/> to a <see cref=\"EventRecord\"/>.\n//        /// </summary>\n//        /// <param name=\"entry\">The entry to convert.</param>\n//        /// <returns>A converted entry, or <see langword=\"null\"/> if the payload is invalid.</returns>\n//        public static EventRecord TryConvertToEventRecord(this EventEntry entry)\n//        {\n//            var entity = new EventRecord()\n//            {\n//                ProviderId = entry.ProviderId,\n//                ProviderName = entry.Schema.ProviderName,\n//                EventId = entry.EventId,\n//                EventKeywords = (long)entry.Schema.Keywords,\n//                Level = (int)entry.Schema.Level,\n//                Opcode = (int)entry.Schema.Opcode,\n//                Task = (int)entry.Schema.Task,\n//                Timestamp = entry.Timestamp,\n//                Version = entry.Schema.Version,\n//                FormattedMessage = entry.FormattedMessage,\n//                Payload = EventEntryUtil.JsonSerializePayload(entry)\n//            };\n\n//            return entity;\n//        }\n\n//        public static SqlDataRecord ToSqlDataRecord(this EventRecord record)\n//        {\n//            var sqlDataRecord = new SqlDataRecord(SqlMetaData);\n\n//            sqlDataRecord.SetValue(0, record.InstanceName ?? string.Empty);\n//            sqlDataRecord.SetValue(1, record.ProviderId);\n//            sqlDataRecord.SetValue(2, record.ProviderName ?? string.Empty);\n//            sqlDataRecord.SetValue(3, record.EventId);\n//            sqlDataRecord.SetValue(4, record.EventKeywords);\n//            sqlDataRecord.SetValue(5, record.Level);\n//            sqlDataRecord.SetValue(6, record.Opcode);\n//            sqlDataRecord.SetValue(7, record.Task);\n//            sqlDataRecord.SetValue(8, record.Timestamp);\n//            sqlDataRecord.SetValue(9, record.Version);\n//            sqlDataRecord.SetValue(10, (object)record.FormattedMessage ?? DBNull.Value);\n//            sqlDataRecord.SetValue(11, (object)record.Payload ?? DBNull.Value);\n\n//            return sqlDataRecord;\n//        }\n//    }\n//}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestSupport/EventTextFormatterExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing System.Globalization;\nusing System.IO;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport\n{\n    public static class EventTextFormatterExtensions\n    {\n        /// <summary>\n        /// Formats the event as a string.\n        /// </summary>\n        /// <param name=\"entry\">The entry to format.</param>\n        /// <param name=\"formatter\">The formatter to use.</param>\n        /// <returns>A formatted entry.</returns>\n        public static string WriteEvent(this IEventTextFormatter formatter, EventEntry entry)\n        {\n            Guard.ArgumentNotNull(formatter, \"formatter\");\n\n            using (var writer = new StringWriter(CultureInfo.CurrentCulture))\n            {\n                formatter.WriteEvent(entry, writer);\n                return writer.ToString();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestSupport/ExceptionAssertHelper.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport\n{\n    public static class ExceptionAssertHelper\n    {\n        public static T Throws<T>(Action action) where T : Exception\n        {\n            try\n            {\n                action();\n            }\n            catch (T ex)\n            {\n                return ex;\n            }\n\n            Assert.Fail(\"Exception of type {0} should be thrown.\", typeof(T));\n            return null;\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestSupport/FlatFileHelper.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Newtonsoft.Json;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Xml.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport\n{\n    public class FlatFileHelper\n    {\n        public static IEnumerable<T> PollUntilJsonEventsAreWritten<T>(string fileName, int eventsToRecieve)\n        {\n            return PollUntilEventsAreWritten(\n                fileName,\n                eventsToRecieve,\n                (fileContents) => JsonConvert.DeserializeObject<T[]>(\"[\" + fileContents + \"]\"));\n        }\n\n        public static IEnumerable<XElement> PollUntilXmlEventsAreWritten(string fileName, int eventsToRecieve)\n        {\n            return PollUntilEventsAreWritten(\n                fileName,\n                eventsToRecieve,\n                (fileContents) => XDocument.Parse(\"<Events>\" + fileContents + \"</Events>\").Root.Elements());\n        }\n\n        public static IEnumerable<string> PollUntilTextEventsAreWritten(string fileName, int eventsToRecieve, string header)\n        {\n            return PollUntilEventsAreWritten(\n                fileName,\n                eventsToRecieve,\n                (fileContents) => Regex.Split(ReadFileWithoutLock(fileName), header).Where(c => !string.IsNullOrWhiteSpace(c)));\n        }\n\n        public static void DeleteDirectory(string name)\n        {\n            if (Directory.Exists(name))\n            {\n                Directory.Delete(name, true);\n            }\n        }\n\n        public static string GetAllText(string fileName)\n        {\n            for (int n = 0; n < 10; n++)\n            {\n                if (File.Exists(fileName))\n                {\n                    Task.Delay(100).Wait();\n                    return ReadFileWithoutLock(fileName);\n                }\n\n                Task.Delay(500).Wait();\n            }\n\n            return string.Empty;\n        }\n\n        public static IEnumerable<string> GetFileNames(string filePattern)\n        {\n            return Directory.EnumerateFiles(\".\", filePattern, SearchOption.TopDirectoryOnly);\n        }\n\n        public static string ReadFromFiles(string fileNamePattern)\n        {\n            string logMessages = null;\n            IEnumerable<string> files = GetFileNames(fileNamePattern);\n            foreach (var file in files)\n            {\n                logMessages += ReadFileWithoutLock(file);\n            }\n\n            return logMessages;\n        }\n\n        public static void PollUntilFilesAreCreated(string path, string fileNamePattern, int filesCount)\n        {\n            var timeoutToWaitUntilEventIsReceived = DateTime.UtcNow.AddSeconds(10);\n            while (DateTime.UtcNow < timeoutToWaitUntilEventIsReceived)\n            {\n                try\n                {\n                    if (Directory.Exists(path))\n                    {\n                        if (GetFileNames(fileNamePattern).Count() == filesCount)\n                        {\n                            break;\n                        }\n                    }\n                }\n                catch\n                { }\n\n                Task.Delay(200).Wait();\n            }\n        }\n\n        public static void DeleteCreatedLogFiles(string fileNameWithoutExtension)\n        {\n            try\n            {\n                foreach (string createdFileName in Directory.GetFiles(\".\", fileNameWithoutExtension + \"*\"))\n                {\n                    File.Delete(createdFileName);\n                }\n            }\n            catch\n            { }\n        }\n\n        private static IEnumerable<T> PollUntilEventsAreWritten<T>(string fileName, int eventsToRecieve, Func<string, IEnumerable<T>> deserializeString)\n        {\n            IEnumerable<T> entries = new T[0];\n            var timeoutToWaitUntilEventIsReceived = DateTime.UtcNow.AddSeconds(10);\n            while (DateTime.UtcNow < timeoutToWaitUntilEventIsReceived)\n            {\n                if (File.Exists(fileName))\n                {\n                    try\n                    {\n                        var fileContents = ReadFileWithoutLock(fileName);\n                        entries = deserializeString(fileContents);\n                        if (entries.Count() == eventsToRecieve)\n                        {\n                            break;\n                        }\n                    }\n                    catch\n                    { }\n                }\n\n                Task.Delay(200).Wait();\n            }\n\n            return entries;\n        }\n\n        private static string ReadFileWithoutLock(string fileName)\n        {\n            using (var reader = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))\n            {\n                return reader.ReadToEnd();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestSupport/LogFileReader.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport\n{\n    public static class LogFileReader\n    {\n        public static List<Dictionary<string, string>> GetEntries(string fileName)\n        {\n            List<Dictionary<string, string>> fileContents = new List<Dictionary<string, string>>();\n            using (var reader = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read)))\n            {\n                int index = 0;\n                while (!reader.EndOfStream)\n                {\n                    string line = reader.ReadLine();\n                    if (String.IsNullOrEmpty(line.Trim()))\n                    {\n                        continue; \n                    }\n                    string[] keyValue = null;\n                    if (!line.Contains(\"Payload :\"))\n                    {\n                        keyValue = line.Split(':');\n                    }\n                    else\n                    {\n                        keyValue = new string[2];\n                        keyValue[0] = \"Payload\";\n                        keyValue[1] = line.Substring(9, line.Length - 9).Trim();\n                    }\n\n                    keyValue[0] = keyValue[0].Trim();\n                    keyValue[1] = keyValue[1].Trim();\n                    if (keyValue[0] == \"ProviderId\")\n                    {\n                        fileContents.Add(new Dictionary<string, string>());\n                        index++;\n                    }\n\n                    fileContents[index - 1][keyValue[0]] = keyValue[1];\n                }\n            }\n\n            return fileContents;\n        }\n\n        public static string ReadFileWithoutLock(string fileName)\n        {\n            using (var reader = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))\n            {\n                return reader.ReadToEnd();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestSupport/ThreadHelper.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport\n{\n    public static class ThreadHelper\n    {\n        [System.Runtime.InteropServices.DllImport(\"kernel32.dll\")]\n        private static extern uint GetCurrentThreadId();\n\n        public static int GetCurrentUnManagedThreadId()\n        {\n            return (int)GetCurrentThreadId();\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestSupport/TraceSessionHelper.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Diagnostics.Tracing;\nusing Microsoft.Diagnostics.Tracing.Session;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport\n{\n    public class TraceSessionHelper\n    {\n        public static bool WaitAndAssertCountOfSessions(string sessionNamePrefix, int countOfSessions)\n        {\n            var allSessionsHaveStarted = PollUntil(sessionNames => sessionNames.Count(name => name.StartsWith(sessionNamePrefix)) == countOfSessions);\n            if (allSessionsHaveStarted)\n            {\n                return true;\n            }\n\n            throw new TimeoutException(countOfSessions + \" sessions with the prefix '\" + sessionNamePrefix + \"' have not started within time. These are the active sessions: \" + string.Join(\", \", TraceEventSession.GetActiveSessionNames()));\n        }\n\n        private static bool PollUntil(Func<IEnumerable<string>, bool> pollUntilCondition)\n        {\n            var timeoutToWaitUntilEventIsReceived = DateTime.UtcNow.AddSeconds(10);\n            while (DateTime.UtcNow < timeoutToWaitUntilEventIsReceived)\n            {\n                var activeSessionNames = TraceEventSession.GetActiveSessionNames();\n                if (pollUntilCondition(activeSessionNames))\n                {\n                    return true;\n                }\n\n                Task.Delay(200).Wait();\n            }\n\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestSupport/WindowsAzureTableEventEntry.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.WindowsAzure.Storage.Table;\nusing System;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport\n{\n    public class WindowsAzureTableEventEntry : TableEntity\n    {\n        private const string RowKeyFormat = \"{0}_{1}_{2:X5}\";\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"WindowsAzureTableEventEntry\"/> class.\n        /// </summary>\n        public WindowsAzureTableEventEntry()\n        {\n        }\n\n        /// <summary>\n        /// Gets or sets the event identifier.\n        /// </summary>\n        public int EventId { get; set; }\n\n        /// <summary>\n        /// Gets or sets the event date.\n        /// </summary>\n        public DateTime EventDate { get; set; }\n\n        /// <summary>\n        /// Gets or sets the keywords for the event.\n        /// </summary>\n        public long Keywords { get; set; }\n\n        /// <summary>\n        /// Gets or sets the unique identifier for the event source.\n        /// </summary>\n        public Guid EventSourceGuid { get; set; }\n\n        /// <summary>\n        /// Gets or sets the friendly name of the class that is derived from the event source.\n        /// </summary>\n        public string EventSourceName { get; set; }\n\n        /// <summary>\n        /// Gets or sets the instance name where the entries are generated from.\n        /// </summary>\n        public string InstanceName { get; set; }\n\n        /// <summary>\n        /// Gets or sets the level of the event.\n        /// </summary>\n        public string Level { get; set; }\n\n        /// <summary>\n        /// Gets or sets the message for the event.\n        /// </summary>\n        public string Message { get; set; }\n\n        /// <summary>\n        /// Gets or sets the operation code for the event.\n        /// </summary>\n        public int Opcode { get; set; }\n\n        /// <summary>\n        /// Gets or sets the task for the event.\n        /// </summary>\n        public int Task { get; set; }\n\n        /// <summary>\n        /// Gets or sets the version of the event.\n        /// </summary>\n        public int Version { get; set; }\n\n        /// <summary>\n        /// Gets or sets the payload for the event.\n        /// </summary>\n        public string Payload { get; set; }\n\n        /// <summary>\n        /// Gets or sets the process ID of the event.\n        /// </summary>\n        public int ProcessId { get; set; }\n\n        /// <summary>\n        /// Gets or sets the thread ID of the event.\n        /// </summary>\n        public int ThreadId { get; set; }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/TestSupport/XmlFormattedEntry.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Linq;\nusing System.Xml.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared.TestSupport\n{\n    public class XmlFormattedEntry\n    {\n        private const string EventNS = \"{http://schemas.microsoft.com/win/2004/08/events/event}\";\n\n        public static XElement Provider { get; set; }\n        public static XElement EventId { get; set; }\n        public static XElement Version { get; set; }\n        public static XElement Level { get; set; }\n        public static XElement Task { get; set; }\n        public static XElement Opcode { get; set; }\n        public static XElement Keywords { get; set; }\n        public static XElement TimeCreated { get; set; }\n        public static XElement Payload { get; set; }\n        public static XElement Message { get; set; }\n        public static XElement Correlation { get; set; }\n        public static XAttribute ProcessId { get; set; }\n        public static XAttribute ThreadId { get; set; }\n\n        public static void Fill(XElement entry)\n        {\n            Provider = entry.Descendants(EventNS + \"Provider\").Single();\n            EventId = entry.Descendants(EventNS + \"EventID\").Single();\n            Version = entry.Descendants(EventNS + \"Version\").Single();\n            Level = entry.Descendants(EventNS + \"Level\").Single();\n            Task = entry.Descendants(EventNS + \"Task\").Single();\n            Opcode = entry.Descendants(EventNS + \"Opcode\").Single();\n            Keywords = entry.Descendants(EventNS + \"Keywords\").Single();\n            TimeCreated = entry.Descendants(EventNS + \"TimeCreated\").Single();\n            Payload = entry.Descendants(EventNS + \"EventData\").Single();\n            Message = entry.Descendants(EventNS + \"RenderingInfo\").Single();\n            Correlation = entry.Descendants(EventNS + \"Correlation\").SingleOrDefault();\n            ProcessId = entry.Descendants(EventNS + \"Execution\").SingleOrDefault().Attribute(XName.Get(\"ProcessID\"));\n            ThreadId = entry.Descendants(EventNS + \"Execution\").SingleOrDefault().Attribute(XName.Get(\"ThreadID\"));\n        }\n    }\n}\n"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.Shared/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"Microsoft.Data.Edm\" version=\"5.6.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Data.OData\" version=\"5.6.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Data.Services.Client\" version=\"5.6.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Diagnostics.Tracing.TraceEvent\" version=\"1.0.15\" targetFramework=\"net451\" />\n  <package id=\"Microsoft.WindowsAzure.ConfigurationManager\" version=\"2.0.3\" targetFramework=\"net45\" />\n  <package id=\"Newtonsoft.Json\" version=\"5.0.8\" targetFramework=\"net45\" />\n  <package id=\"System.Spatial\" version=\"5.6.0\" targetFramework=\"net45\" />\n  <package id=\"WindowsAzure.Storage\" version=\"3.0.2.0\" targetFramework=\"net45\" />\n  <package id=\"StyleCop.MSBuild\" version=\"4.7.49.0\" targetFramework=\"net45\" developmentDependency=\"true\" />\n</packages>"
  },
  {
    "path": "BVT/SLAB.Tests/SemanticLogging.Tests.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2012\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging.InProc.Tests\", \"SemanticLogging.InProc.Tests\\SemanticLogging.InProc.Tests.csproj\", \"{FFAF719C-D4E7-4AFF-A896-3CA5605B2C88}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging.OutProc.Tests\", \"SemanticLogging.OutProc.Tests\\SemanticLogging.OutProc.Tests.csproj\", \"{0D748FC4-24AA-4D3A-81B9-296DF5921C14}\"\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"sut\", \"sut\", \"{AE0E5E88-D144-4D87-82E9-C06B2D1EA507}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging\", \"..\\..\\source\\Src\\SemanticLogging\\SemanticLogging.csproj\", \"{2CD4105B-0DD6-4C18-9B37-05D8E8F57303}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging.Etw\", \"..\\..\\source\\Src\\SemanticLogging.Etw\\SemanticLogging.Etw.csproj\", \"{8440AEA2-CD55-42A0-8724-2ECCE2B32374}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging.Database\", \"..\\..\\source\\Src\\SemanticLogging.Database\\SemanticLogging.Database.csproj\", \"{AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging.WindowsAzure\", \"..\\..\\source\\Src\\SemanticLogging.WindowsAzure\\SemanticLogging.WindowsAzure.csproj\", \"{D7979E9B-7978-48FE-B345-3C767A20F9A1}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging.Etw.WindowsService\", \"..\\..\\source\\Src\\SemanticLogging.Etw.WindowsService\\SemanticLogging.Etw.WindowsService.csproj\", \"{0EBF89E7-D2B2-4968-BC17-0DA066029C46}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging.Tests.Shared\", \"SemanticLogging.Tests.Shared\\SemanticLogging.Tests.Shared.csproj\", \"{001E9C59-1326-48F1-9019-9E6CEEB1E458}\"\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Solution Items\", \"Solution Items\", \"{7FEF73F8-E020-4F0D-B3E9-969AA584307B}\"\n\tProjectSection(SolutionItems) = preProject\n\t\tSettings.StyleCop = Settings.StyleCop\n\tEndProjectSection\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"SemanticLogging.OutProc.ProcessSampling\", \"SemanticLogging.OutProc.ProcessSampling\", \"{FBCD225E-F144-4F20-B32D-201B9CADB5BB}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ProcessToSample\", \"ProcessToSample\\ProcessToSample.csproj\", \"{F7FC3535-8EAF-4305-A7F8-C774FE717F54}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging.TextFile\", \"..\\..\\source\\Src\\SemanticLogging.TextFile\\SemanticLogging.TextFile.csproj\", \"{4B187511-187B-48B1-A593-18BA835B49C3}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{FFAF719C-D4E7-4AFF-A896-3CA5605B2C88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{FFAF719C-D4E7-4AFF-A896-3CA5605B2C88}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{FFAF719C-D4E7-4AFF-A896-3CA5605B2C88}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{FFAF719C-D4E7-4AFF-A896-3CA5605B2C88}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{0D748FC4-24AA-4D3A-81B9-296DF5921C14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{0D748FC4-24AA-4D3A-81B9-296DF5921C14}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{0D748FC4-24AA-4D3A-81B9-296DF5921C14}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{0D748FC4-24AA-4D3A-81B9-296DF5921C14}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{2CD4105B-0DD6-4C18-9B37-05D8E8F57303}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{2CD4105B-0DD6-4C18-9B37-05D8E8F57303}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{2CD4105B-0DD6-4C18-9B37-05D8E8F57303}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{2CD4105B-0DD6-4C18-9B37-05D8E8F57303}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{8440AEA2-CD55-42A0-8724-2ECCE2B32374}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{8440AEA2-CD55-42A0-8724-2ECCE2B32374}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{8440AEA2-CD55-42A0-8724-2ECCE2B32374}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{8440AEA2-CD55-42A0-8724-2ECCE2B32374}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{D7979E9B-7978-48FE-B345-3C767A20F9A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{D7979E9B-7978-48FE-B345-3C767A20F9A1}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{D7979E9B-7978-48FE-B345-3C767A20F9A1}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{D7979E9B-7978-48FE-B345-3C767A20F9A1}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{0EBF89E7-D2B2-4968-BC17-0DA066029C46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{0EBF89E7-D2B2-4968-BC17-0DA066029C46}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{0EBF89E7-D2B2-4968-BC17-0DA066029C46}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{0EBF89E7-D2B2-4968-BC17-0DA066029C46}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{001E9C59-1326-48F1-9019-9E6CEEB1E458}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{001E9C59-1326-48F1-9019-9E6CEEB1E458}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{001E9C59-1326-48F1-9019-9E6CEEB1E458}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{001E9C59-1326-48F1-9019-9E6CEEB1E458}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{F7FC3535-8EAF-4305-A7F8-C774FE717F54}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{F7FC3535-8EAF-4305-A7F8-C774FE717F54}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{F7FC3535-8EAF-4305-A7F8-C774FE717F54}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{F7FC3535-8EAF-4305-A7F8-C774FE717F54}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{4B187511-187B-48B1-A593-18BA835B49C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{4B187511-187B-48B1-A593-18BA835B49C3}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{4B187511-187B-48B1-A593-18BA835B49C3}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{4B187511-187B-48B1-A593-18BA835B49C3}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(NestedProjects) = preSolution\n\t\t{2CD4105B-0DD6-4C18-9B37-05D8E8F57303} = {AE0E5E88-D144-4D87-82E9-C06B2D1EA507}\n\t\t{8440AEA2-CD55-42A0-8724-2ECCE2B32374} = {AE0E5E88-D144-4D87-82E9-C06B2D1EA507}\n\t\t{AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569} = {AE0E5E88-D144-4D87-82E9-C06B2D1EA507}\n\t\t{D7979E9B-7978-48FE-B345-3C767A20F9A1} = {AE0E5E88-D144-4D87-82E9-C06B2D1EA507}\n\t\t{0EBF89E7-D2B2-4968-BC17-0DA066029C46} = {AE0E5E88-D144-4D87-82E9-C06B2D1EA507}\n\t\t{4B187511-187B-48B1-A593-18BA835B49C3} = {AE0E5E88-D144-4D87-82E9-C06B2D1EA507}\n\t\t{F7FC3535-8EAF-4305-A7F8-C774FE717F54} = {FBCD225E-F144-4F20-B32D-201B9CADB5BB}\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tEnterpriseLibraryConfigurationToolBinariesPathV6 = ..\\..\\Source\\packages\\EnterpriseLibrary.TransientFaultHandling.6.0.1304.0\\lib\\portable-net45+win+wp8;..\\..\\Source\\Blocks\\SemanticLogging\\packages\\EnterpriseLibrary.TransientFaultHandling.Data.6.0.1304.1\\lib\\NET45\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "BVT/SLAB.Tests/Settings.StyleCop",
    "content": "<StyleCopSettings Version=\"105\">\n  <GlobalSettings>\n    <StringProperty Name=\"MergeSettingsFiles\">NoMerge</StringProperty>\n    <BooleanProperty Name=\"ViolationsAsErrors\">True</BooleanProperty>\n  </GlobalSettings>\n  <Parsers>\n    <Parser ParserId=\"StyleCop.CSharp.CsParser\">\n      <ParserSettings>\n        <BooleanProperty Name=\"AnalyzeDesignerFiles\">False</BooleanProperty>\n      </ParserSettings>\n    </Parser>\n  </Parsers>\n  <Analyzers>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.NamingRules\">\n      <Rules>\n        <Rule Name=\"FieldNamesMustNotBeginWithUnderscore\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings>\n        <CollectionProperty Name=\"Hungarian\">\n          <Value>as</Value>\n          <Value>db</Value>\n          <Value>dc</Value>\n          <Value>do</Value>\n          <Value>ef</Value>\n          <Value>id</Value>\n          <Value>if</Value>\n          <Value>in</Value>\n          <Value>is</Value>\n          <Value>my</Value>\n          <Value>no</Value>\n          <Value>on</Value>\n          <Value>sl</Value>\n          <Value>to</Value>\n          <Value>ui</Value>\n          <Value>vs</Value>\n        </CollectionProperty>\n      </AnalyzerSettings>\n    </Analyzer>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.DocumentationRules\">\n      <Rules>\n        <Rule Name=\"FileMustHaveHeader\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"FileHeaderMustContainFileName\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"FileHeaderFileNameDocumentationMustMatchFileName\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"FileHeaderMustHaveValidCompanyText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ConstructorSummaryDocumentationMustBeginWithStandardText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"DestructorSummaryDocumentationMustBeginWithStandardText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"DocumentationHeadersMustNotContainBlankLines\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementsMustBeDocumented\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"PartialElementsMustBeDocumented\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"EnumerationItemsMustBeDocumented\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"DocumentationMustContainValidXml\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementDocumentationMustHaveSummary\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"PartialElementDocumentationMustHaveSummary\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementDocumentationMustHaveSummaryText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"PartialElementDocumentationMustHaveSummaryText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementDocumentationMustNotHaveDefaultSummary\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementParametersMustBeDocumented\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementParameterDocumentationMustMatchElementParameters\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementParameterDocumentationMustDeclareParameterName\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementParameterDocumentationMustHaveText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementReturnValueMustBeDocumented\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementReturnValueDocumentationMustHaveText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"VoidReturnValueMustNotBeDocumented\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"GenericTypeParametersMustBeDocumented\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"GenericTypeParametersMustBeDocumentedPartialClass\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"GenericTypeParameterDocumentationMustMatchTypeParameters\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"GenericTypeParameterDocumentationMustDeclareParameterName\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"GenericTypeParameterDocumentationMustHaveText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"PropertySummaryDocumentationMustMatchAccessors\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"PropertySummaryDocumentationMustOmitSetAccessorWithRestrictedAccess\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementDocumentationMustNotBeCopiedAndPasted\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"SingleLineCommentsMustNotUseDocumentationStyleSlashes\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"DocumentationTextMustNotBeEmpty\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"DocumentationTextMustContainWhitespace\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"DocumentationMustMeetCharacterPercentage\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"IncludedDocumentationXPathDoesNotExist\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"IncludeNodeDoesNotContainValidFileAndPath\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"InheritDocMustBeUsedWithInheritingClass\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"FileHeaderMustShowCopyright\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"FileHeaderMustHaveCopyrightText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"FileHeaderFileNameDocumentationMustMatchTypeName\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings>\n        <BooleanProperty Name=\"IgnorePrivates\">True</BooleanProperty>\n        <BooleanProperty Name=\"IgnoreInternals\">True</BooleanProperty>\n      </AnalyzerSettings>\n    </Analyzer>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.ReadabilityRules\">\n      <Rules>\n        <Rule Name=\"ParameterMustNotSpanMultipleLines\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"PrefixLocalCallsWithThis\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ParameterMustFollowComma\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"SplitParametersMustStartOnLineAfterDeclaration\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ParametersMustBeOnSameLineOrSeparateLines\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"UseBuiltInTypeAlias\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings />\n    </Analyzer>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.LayoutRules\">\n      <Rules>\n        <Rule Name=\"AllAccessorsMustBeMultiLineOrSingleLine\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"SingleLineCommentsMustNotBeFollowedByBlankLine\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ClosingCurlyBracketMustBeFollowedByBlankLine\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"SingleLineCommentMustBePrecededByBlankLine\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementsMustBeSeparatedByBlankLine\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"StatementMustNotBeOnSingleLine\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementMustNotBeOnSingleLine\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings />\n    </Analyzer>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.MaintainabilityRules\">\n      <Rules>\n        <Rule Name=\"FieldsMustBePrivate\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"DebugAssertMustProvideMessageText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"StatementMustNotUseUnnecessaryParenthesis\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"FileMayOnlyContainASingleClass\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings />\n    </Analyzer>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.OrderingRules\">\n      <Rules>\n        <Rule Name=\"UsingDirectivesMustBePlacedWithinNamespace\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementsMustAppearInTheCorrectOrder\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementsMustBeOrderedByAccess\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ConstantsMustAppearBeforeFields\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"StaticElementsMustAppearBeforeInstanceElements\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"SystemUsingDirectivesMustBePlacedBeforeOtherUsingDirectives\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings />\n    </Analyzer>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.SpacingRules\">\n      <Rules>\n        <Rule Name=\"SingleLineCommentsMustBeginWithSingleSpace\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"MemberAccessSymbolsMustBeSpacedCorrectly\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings />\n    </Analyzer>\n  </Analyzers>\n</StyleCopSettings>"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing\nIf you haven't already read through them, we recommend the starting with the [Azure contribution guidelines][azure-oss].\n\nWe will _consider_ any contributions that align with the stated goals of the project.\n\n## Legal\nYou will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright.\n\nPlease submit a [Contributor License Agreement (CLA)](https://cla.azure.com/) before submitting a pull request. This process is automated and should be painless.\n\n## Housekeeping\nYour pull request should:\n\n* Include a description of what your change intends to do.\n* Be based on a reasonably recent commit in the `master` branch.\n* Include tests covering your changes _as appropriate_.\n\n## Be nice\nWe might be slower than you'd like. We might also ask you to make changes to the pull request. We ask for your patience.  :smiley:\n\n[azure-oss]: http://azure.github.io/guidelines.html#contributing\n"
  },
  {
    "path": "LICENSE.txt",
    "content": "========================================================================================\nMicrosoft patterns & practices (http://microsoft.com/practices)\nSEMANTIC LOGGING APPLICATION BLOCK\n========================================================================================\n\nCopyright (c) Microsoft.  All rights reserved.\nMicrosoft would like to thank its contributors, a list\nof whom are at http://aka.ms/entlib-contributors\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you\nmay not use this file except in compliance with the License. You may\nobtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing permissions\nand limitations under the License."
  },
  {
    "path": "README.md",
    "content": ":warning: This project is no longer under development. A possible alternative, depending on use case, is [Microsoft.Diagnostic.EventFlow](https://github.com/Azure/diagnostics-eventflow). :warning:\n\n## What is Semantic Logging?\n\nSemantic Logging (formerly know at the Semantic Logging Application Block or SLAB) is designed by the\n[patterns & practices](http://aka.ms/mspnp) team to help .NET developers move from the unstructured\nlogging approach towards the strongly-typed (semantic) logging approach, making it easier to consume\nlogging information, especially when there is a large volume of log data to be analyzed. When used\nout-of-process, Semantic Logging uses [_Event Tracing for Windows (ETW)_][ETW], a fast, lightweight, strongly\ntyped, extensible logging system that is built into the Windows operating system.\n\nSemantic Logging enables you to use the [`EventSource`][EventSource] class and semantic log messages in your\napplications without moving away from the log formats you are familiar with (such as database, text\nfile, Azure table storage). Also, you do not need to commit to how you consume events when developing\nbusiness logic; you have a unified application-specific API for logging and then you can decide later\nwhether you want those events to go to ETW or alternative destinations.\n\n## How do I use Semantic Logging?\n\nOfficial releases are available via [NuGet](http://www.nuget.org/packages/EnterpriseLibrary.SemanticLogging/).\nYou can also head to [msdn.com](https://msdn.microsoft.com/en-us/library/dn774980.aspx) for additional\ninformation, documentation, videos, and hands-on labs.\n\n## Building\n\nTo build the solution, run msbuild.exe from the project’s `build` folder. You'll need to use the\nVisual Studio Developer Command Prompt. Some of the unit tests require a SQL database.\n\n## How do I contribute?\n\nPlease see [CONTRIBUTING.md](/CONTRIBUTING.md) for more details.\n\n## Release notes\n\nRelease notes each [release are available](https://github.com/mspnp/semantic-logging/releases).\n\n[ETW]: https://msdn.microsoft.com/en-us/library/windows/desktop/bb968803(v=vs.85).aspx\n[EventSource]: https://msdn.microsoft.com/en-us/library/system.diagnostics.tracing.eventsource%28v=vs.110%29.aspx\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n\n\n"
  },
  {
    "path": "build/build.proj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" DefaultTargets=\"Build\" ToolsVersion=\"4.0\" >\n\n  <Import Project=\"build.targets\"/>\n\n</Project>"
  },
  {
    "path": "build/build.targets",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- This file builds the Enterprise Library Application Blocks  -->\n<!-- and runs the unit tests.                                    -->\n<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"\n    DefaultTargets=\"Build\"\n    ToolsVersion=\"4.0\" >\n\n  <PropertyGroup>\n    <Configuration>Release</Configuration>\n    <Platform>Any CPU</Platform>\n\n    <AssemblyOriginatorKeyFile></AssemblyOriginatorKeyFile>\n    <SignAssembly>false</SignAssembly>\n    <DelaySign>false</DelaySign>\n\n    <RunCodeAnalysis>true</RunCodeAnalysis>\n    \n    <RepoRoot>$(MSBuildThisFileDirectory)..\\</RepoRoot>\n    <SourceRoot Condition=\" '$(SourceRoot)' == '' \">$(RepoRoot)Source\\</SourceRoot>\n    <OutputRoot Condition=\" '$(OutputRoot)' == '' \">$(RepoRoot)bin\\$(Configuration)\\</OutputRoot>\n  </PropertyGroup>\n\n  <!-- DevEnvDir: Provide a sensible default and add a trailing slash if necessary -->\n  <PropertyGroup>\n    <DevEnvDir Condition=\"('$(DevEnvDir)' != '') And (!HasTrailingSlash('$(DevEnvDir)'))\">$(DevEnvDir)\\</DevEnvDir>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <Solutions Include=\"$(SourceRoot)**\\*.sln\"/>\n  </ItemGroup>\n\n  <Target Name=\"Rebuild\" DependsOnTargets=\"Clean;Build\"/>\n  \n  <Target Name=\"Build\" DependsOnTargets=\"Compile;RunTests;BuildNugetPackages\" />\n\n  <Target Name=\"Clean\" DependsOnTargets=\"CleanProjects;CleanNugetPackages\"/>\n\n  <Target Name=\"CleanProjects\">\n    <MSBuild Projects=\"@(Solutions)\" Properties=\"Configuration=$(Configuration);Platform=$(Platform);AssemblyOriginatorKeyFile=$(AssemblyOriginatorKeyFile);SignAssembly=$(SignAssembly);DelaySign=$(DelaySign);\" Targets=\"Clean\"/>\n  </Target>\n\n  <Target Name=\"Compile\" DependsOnTargets=\"RestoreNugetPackages\">\n    <PropertyGroup>\n      <BuildProperties>$(BuildProperties);Configuration=$(Configuration);Platform=$(Platform)</BuildProperties>\n      <BuildProperties>$(BuildProperties);AssemblyOriginatorKeyFile=$(AssemblyOriginatorKeyFile);SignAssembly=$(SignAssembly);DelaySign=$(DelaySign);</BuildProperties>\n      <BuildProperties>$(BuildProperties);RunCodeAnalysis=$(RunCodeAnalysis)</BuildProperties>\n    </PropertyGroup>\n    <MSBuild Projects=\"@(Solutions)\" Properties=\"$(BuildProperties)\"/>\n  </Target>\n\n  <Target Name=\"RunTests\" DependsOnTargets=\"Compile\">\n    <PropertyGroup>\n      <TestProperties>Configuration=$(Configuration)</TestProperties>\n      <TestProperties Condition=\" '$(RunTests)' != '' \">$(TestProperties);RunTests=$(RunTests)</TestProperties>\n      <TestProperties Condition=\" '$(DevEnvDir)' != '' \">$(TestProperties);DevEnvDir=$(DevEnvDir)</TestProperties>\n      <TestProperties Condition=\" '$(TestAssembliesToExclude)' != '' \">$(TestProperties);TestAssembliesToExclude=$(TestAssembliesToExclude)</TestProperties>\n      <TestProperties Condition=\" '$(MinimumCoverageRequired)' != '' \">$(TestProperties);MinimumCoverageRequired=$(MinimumCoverageRequired)</TestProperties>\n      <TestProperties Condition=\" '$(GetCoverageInformation)' != '' \">$(TestProperties);GetCoverageInformation=$(GetCoverageInformation)</TestProperties>\n      <TestProperties Condition=\" '$(GetMstestCoverage)' != '' \">$(TestProperties);GetMstestCoverage=$(GetMstestCoverage)</TestProperties>\n    </PropertyGroup>\n\n    <MSBuild Projects=\"test.targets\" Targets=\"RunTests\" Properties=\"$(TestProperties)\"/>\n  </Target>\n  \n  <Import Project=\"nuget.targets\"/>\n</Project>"
  },
  {
    "path": "build/nuget.targets",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- This file builds the Enterprise Library Application Blocks  -->\n<!-- and runs the unit tests.                                    -->\n<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"\n    ToolsVersion=\"4.0\" >\n\n  <PropertyGroup>\n    <NuGetExeDirectory>$(MSBuildThisFileDirectory)bin\\</NuGetExeDirectory>\n    <NuGetExePath>$(NuGetExeDirectory)nuget.exe</NuGetExePath>\n    <BuildNugetPackages>true</BuildNugetPackages>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <NuSpecFiles Include=\"$(SourceRoot)**\\*.nuspec\" Exclude=\"$(SourceRoot)packages\\**\\*.nuspec\"/>\n  </ItemGroup>\n\n  <Target Name=\"RestoreNugetPackages\" DependsOnTargets=\"_DownloadNuGet\">\n    <Exec Command=\"&quot;$(NuGetExePath)&quot; restore &quot;%(Solutions.FullPath)&quot; -NonInteractive\"/>\n    <Exec Command=\"&quot;$(NuGetExePath)&quot; restore packages.config -PackagesDirectory packages -NonInteractive\"/>\n  </Target>\n\n  <Target Name=\"BuildNugetPackages\" DependsOnTargets=\"_DownloadNuget;_GetPackageVersions;_BuildPackageVersionTokens\"\n          Condition=\" '$(BuildNugetPackages)' == 'true' \"\n          Inputs=\"@(NuSpecFiles)\" Outputs=\"%(NuSpecFiles.Identity)-runalways\">\n\n    <PropertyGroup>\n      <SourceRootFullPath>$([System.IO.Path]::GetFullPath('$(SourceRoot)'))</SourceRootFullPath>\n      <PackageBasePath>$(SourceRootFullPath.TrimEnd('\\'))</PackageBasePath>\n      <PackageOutputDir Condition=\" '$(PackageOutputDir)' == '' \">$([System.IO.Path]::GetFullPath('$(RepoRoot)bin\\$(Configuration)\\Nuget'))</PackageOutputDir>\n    </PropertyGroup>\n\n    <PropertyGroup>\n      <_NuGetPackTarget>$([System.IO.Path]::GetDirectoryName(\"%(NuSpecFiles.FullPath)\"))\\%(NuSpecFiles.Filename).csproj</_NuGetPackTarget>\n      <_NuGetPackTarget Condition=\" !Exists('$(_NuGetPackTarget)') \">%(NuSpecFiles.FullPath)</_NuGetPackTarget>\n    </PropertyGroup>\n\n    <MakeDir Directories=\"$(PackageOutputDir)\" Condition=\"!Exists($(PackageOutputDir))\"/>\n\n    <Exec Command=\"&quot;$(NuGetExePath)&quot; pack &quot;$(_NuGetPackTarget)&quot; -Properties Configuration=$(Configuration);@(_VersionTokens) -NonInteractive -OutputDirectory &quot;$(PackageOutputDir)&quot; -Symbols -BasePath &quot;$(PackageBasePath)&quot;\"\n          IgnoreStandardErrorWarningFormat=\"true\"/>\n\n  </Target>\n\n  <Target Name=\"CleanNugetPackages\">\n\n    <PropertyGroup>\n      <PackageOutputDir Condition=\" '$(PackageOutputDir)' == '' \">$([System.IO.Path]::GetFullPath('$(RepoRoot)bin\\$(Configuration)\\Nuget'))</PackageOutputDir>\n    </PropertyGroup>\n    \n    <ItemGroup>\n      <Packages Include=\"$(PackageOutputDir)\\*.nupkg\"/>\n    </ItemGroup>\n\n    <Message Text=\"@(Packages)\"/>\n    <Delete Files=\"@(Packages)\"/>\n            \n  </Target>\n\n  <Target Name=\"_GetPackageVersions\">\n\n    <ItemGroup>\n      <OutputBinaries Include=\"$(OutputRoot)*.dll;$(OutputRoot)*.exe\"/>\n    </ItemGroup>\n\n    <GetAssemblyVersion VersionProviderPaths=\"@(OutputBinaries)\">\n      <Output TaskParameter=\"Versions\" ItemName=\"AssemblyVersions\"/>\n    </GetAssemblyVersion>\n\n    <Message Importance=\"high\" Text=\"Versions found: @(AssemblyVersions)\"/>\n\n  </Target>\n\n  <Target Name=\"_BuildPackageVersionTokens\" Inputs=\"@(AssemblyVersions)\" Outputs=\"%(Identity)\">\n    <!-- Using target batching to be able to do transformations on the metadata values -->\n    <PropertyGroup>\n      <AssemblyToken>%(AssemblyVersions.Identity)</AssemblyToken>\n      <AssemblyToken>$(AssemblyToken.Replace(\".\", \"_\"))</AssemblyToken>\n      <AssemblyToken>$(AssemblyToken.Replace(\"-\", \"_\"))</AssemblyToken>\n    </PropertyGroup>\n\n    <ItemGroup>\n      <_VersionTokens Include=\"$(VersionTokens)$(AssemblyToken)_Version=%(AssemblyVersions.InformationalVersion)\"/>\n    </ItemGroup>\n  </Target>\n\n  <Target Name=\"_DownloadNuGet\" Condition=\"!Exists('$(NuGetExePath)')\">\n    <MakeDir Directories=\"$(NuGetExeDirectory)\" Condition=\"!Exists('$(NuGetExeDirectory)')\"/>\n    <DownloadNuGet OutputFilename=\"$(NuGetExePath)\" />\n  </Target>\n\n  <UsingTask TaskName=\"DownloadNuGet\" TaskFactory=\"CodeTaskFactory\" AssemblyFile=\"$(MSBuildToolsPath)\\Microsoft.Build.Tasks.v4.0.dll\">\n    <ParameterGroup>\n      <OutputFilename ParameterType=\"System.String\" Required=\"true\" />\n    </ParameterGroup>\n    <Task>\n      <Reference Include=\"System.Core\" />\n      <Using Namespace=\"System\" />\n      <Using Namespace=\"System.IO\" />\n      <Using Namespace=\"System.Net\" />\n      <Using Namespace=\"Microsoft.Build.Framework\" />\n      <Using Namespace=\"Microsoft.Build.Utilities\" />\n      <Code Type=\"Fragment\" Language=\"cs\">\n        <![CDATA[\n                try\n                {\n                    OutputFilename = Path.GetFullPath(OutputFilename);\n\n                    Log.LogMessage(\"Downloading latest version of NuGet.exe to \" + OutputFilename);\n                    WebClient webClient = new WebClient();\n                    webClient.DownloadFile(\"https://www.nuget.org/nuget.exe\", OutputFilename);\n\n                    return true;\n                }\n                catch (Exception ex) {\n                    Log.LogErrorFromException(ex);\n                    return false;\n                }\n            ]]>\n      </Code>\n    </Task>\n  </UsingTask>\n\n  <UsingTask TaskName=\"GetAssemblyVersion\" TaskFactory=\"CodeTaskFactory\" AssemblyFile=\"$(MSBuildToolsPath)\\Microsoft.Build.Tasks.v4.0.dll\">\n    <ParameterGroup>\n      <VersionProviderPaths ParameterType=\"Microsoft.Build.Framework.ITaskItem[]\" Required=\"true\" />\n      <Versions ParameterType=\"Microsoft.Build.Framework.ITaskItem[]\" Output=\"true\" />\n    </ParameterGroup>\n    <Task>\n      <Using Namespace=\"System\" />\n      <Using Namespace=\"System.Reflection\" />\n      <Using Namespace=\"Microsoft.Build.Framework\" />\n      <Using Namespace=\"Microsoft.Build.Utilities\" />\n      <Code Type=\"Fragment\" Language=\"cs\">\n        <![CDATA[\n                var versions = new List<ITaskItem>();\n                try\n                {\n                    foreach(var versionProviderPath in VersionProviderPaths)\n                    {\n                        var assembly = Assembly.LoadFrom(versionProviderPath.GetMetadata(\"Fullpath\"));\n                        var assemblyName = assembly.GetName();\n                        var version = assemblyName.Version;\n                        var fileVersionAttribute = assembly.GetCustomAttribute<AssemblyFileVersionAttribute>();\n                        var informationalVersionAttribute = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>();\n\n                        var item = new TaskItem(assemblyName.Name);\n                        item.SetMetadata(\"AssemblyVersion\", version.ToString());\n                        item.SetMetadata(\"FileVersion\", fileVersionAttribute != null ? fileVersionAttribute.Version : string.Empty);\n                        item.SetMetadata(\"InformationalVersion\", informationalVersionAttribute != null ? informationalVersionAttribute.InformationalVersion : string.Empty);\n\n                        versions.Add(item);\n                    }\n\n                    Versions = versions.ToArray();\n                    return true;\n                }\n                catch (Exception ex) {\n                    Log.LogErrorFromException(ex);\n                    return false;\n                }\n            ]]>\n      </Code>\n    </Task>\n  </UsingTask>\n\n</Project>"
  },
  {
    "path": "build/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"OpenCover\" version=\"4.5.1923\" />\n  <package id=\"ReportGenerator\" version=\"1.9.0.0\" />\n</packages>"
  },
  {
    "path": "build/test.targets",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- This file builds the Enterprise Library Application Blocks  -->\n<!-- and runs the unit tests.                                    -->\n<Project xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"\n    DefaultTargets=\"RunTests\"\n    ToolsVersion=\"4.0\" >\n\n  <PropertyGroup>\n    <RepoRoot>$(MSBuildThisFileDirectory)..\\</RepoRoot>\n    <SourceRoot>$(RepoRoot)Source\\</SourceRoot>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n\n    <RunTests Condition=\" '$(RunTests)' == '' \">true</RunTests>\n    <GetCoverageInformation>true</GetCoverageInformation>\n    <GetMstestCoverage>true</GetMstestCoverage>\n\n    <MinimumCoverageRequired Condition=\" '$(MinimumCoverageRequired)' == '' \">60</MinimumCoverageRequired>\n  </PropertyGroup>\n\n  <!-- DevEnvDir: Provide a sensible default and add a trailing slash if necessary -->\n  <PropertyGroup>\n    <DevEnvDir Condition=\"('$(DevEnvDir)' != '') And (!HasTrailingSlash('$(DevEnvDir)'))\">$(DevEnvDir)\\</DevEnvDir>\n    <TestRunner>$(DevEnvDir)CommonExtensions\\Microsoft\\TestWindow\\vstest.console.exe</TestRunner>\n  </PropertyGroup>\n\n  <Target Name=\"RunTests\" Condition=\" '$(RunTests)' == 'true' \"\n          DependsOnTargets=\"_CollectTestAssemblies;_RunTests\">\n  </Target>\n\n  <Target Name=\"_RunTests\" Condition=\" '@(TestAssemblies)' != '' \"\n          DependsOnTargets=\"_RunTestsWithoutCoverage;_RunTestsWithMstestCoverage;_RunTestsWithOpenCoverCoverage;_CheckCoverage\">\n  </Target>\n\n  <Target Name=\"_CollectTestAssemblies\">\n    <ItemGroup>\n      <TestAssemblies Include=\"$(SourceRoot)**\\bin\\$(Configuration)\\*.Tests.*dll\"/>\n      <TestAssemblies Remove=\"$(SourceRoot)**\\bin\\$(Configuration)\\$(TestAssembliesToExclude)\" Condition=\" '$(TestAssembliesToExclude)' != '' \"/>\n    </ItemGroup>\n  </Target>\n\n  <Target Name=\"_CheckTestRunner\">\n    <Error Condition=\" '$(DevEnvDir)' == '' \"\n           Text=\"Ensure the 'DevEnvDir' variable is set to your Visual Studio install location in order to run the tests. Either set it manually or run this script from a Visual Studio command prompt.\"/>\n    <Error Condition=\" !Exists($(TestRunner)) \"\n           Text=\"Test runner not found at the expected location $(TestRunner). Ensure the test runner is available in your Visual Studio install location.\"/>\n  </Target>\n\n  <Target Name=\"_RunTestsWithoutCoverage\" DependsOnTargets=\"_CheckTestRunner;_CollectTestAssemblies\" Condition=\" ('$(RunTests)' == 'true') And ('$(GetCoverageInformation)' == 'false')\">\n    <Exec Command=\"&quot;$(TestRunner)&quot; @(TestAssemblies->'&quot;%(Identity)&quot;', ' ') /logger:trx\"\n          WorkingDirectory=\"$(SourceRoot)\"\n          IgnoreStandardErrorWarningFormat=\"true\"/>\n  </Target>\n\n  <Target Name=\"_RunTestsWithMstestCoverage\" DependsOnTargets=\"_CheckTestRunner;_CollectTestAssemblies\" Condition=\" ('$(RunTests)' == 'true') And ('$(GetCoverageInformation)' == 'true') And ('$(GetMstestCoverage)' == 'true')\">\n    <Exec Command=\"&quot;$(TestRunner)&quot; @(TestAssemblies->'&quot;%(Identity)&quot;', ' ') /logger:trx /Enablecodecoverage /InIsolation\"\n          WorkingDirectory=\"$(SourceRoot)\"\n          IgnoreStandardErrorWarningFormat=\"true\"\n          ConsoleToMSBuild=\"true\">\n      <Output TaskParameter=\"ExitCode\" PropertyName=\"ExitCode\" />\n      <Output TaskParameter=\"ConsoleOutput\" ItemName=\"OutputOfExec\" />\n    </Exec>\n\n    <ParseTestOutput CommandOutput=\"@(OutputOfExec)\">\n      <Output TaskParameter=\"TrxFile\" PropertyName=\"TrxFile\"/>\n      <Output TaskParameter=\"CoverageFile\" PropertyName=\"CoverageFile\"/>\n    </ParseTestOutput>\n\n    <Message Text=\"Coverage: $(CoverageFile)\"/>\n    <Message Text=\"Trx: $(TrxFile)\"/>\n\n    <GetCoverageInformation CoverageFile=\"$(CoverageFile)\" DevEnvDir=\"$(DevEnvDir)\">\n      <Output TaskParameter=\"CoverageData\" ItemName=\"CoverageData\"/>\n    </GetCoverageInformation>\n\n    <Message Text=\"CoverageData: @(CoverageData) %(CoverageData.BlocksCovered) %(CoverageData.BlocksNotCovered) %(CoverageData.Coverage)\"/>\n  </Target>\n\n  <Target Name=\"_RunTestsWithOpenCoverCoverage\" DependsOnTargets=\"_CheckTestRunner;_CollectTestAssemblies\" Condition=\" ('$(RunTests)' == 'true') And ('$(GetCoverageInformation)' == 'true') And ('$(GetMstestCoverage)' == 'false')\">\n\n    <PropertyGroup>\n      <CoverageOutputDir Condition=\" '$(PackageOutputDir)' == '' \">$([System.IO.Path]::GetFullPath('$(RepoRoot)bin\\$(Configuration)\\coverage'))\\</CoverageOutputDir>\n    </PropertyGroup>\n\n    <PropertyGroup>\n      <OpenCoverCommand>&quot;%(OpenCoverConsole.Fullpath)&quot;</OpenCoverCommand>\n      <OpenCoverCommand>$(OpenCoverCommand) -register:user -mergebyhash -returntargetcode</OpenCoverCommand>\n      <OpenCoverCommand>$(OpenCoverCommand) -filter:&quot;+[Microsoft.Practices.*]* -[Microsoft.Practices.*Tests]* -[Microsoft.Practices.*TestSupport]*&quot;</OpenCoverCommand>\n      <OpenCoverCommand>$(OpenCoverCommand) -output:&quot;$(CoverageOutputDir)OpenCoverResults.xml&quot;</OpenCoverCommand>\n      <OpenCoverCommand>$(OpenCoverCommand) -target:&quot;$(TestRunner)&quot;</OpenCoverCommand>\n      <OpenCoverCommand>$(OpenCoverCommand) -targetargs:&quot;@(TestAssemblies->'\\&quot;%(Identity)\\&quot;', ' ') /logger:trx&quot;</OpenCoverCommand>\n    </PropertyGroup>\n\n    <Delete Files=\"$(CoverageOutputDir)**\\*.*\"/>\n    <MakeDir Directories=\"$(CoverageOutputDir)\" Condition=\"!Exists($(CoverageOutputDir))\"/>\n\n    <!-- Cannot use the built-in msbuild task. Its output of \"error messages\" causes the task to fail, and the output parsing cannot be prevented. -->\n    <Exec Command=\"$(OpenCoverCommand)\" IgnoreStandardErrorWarningFormat=\"true\"/>\n\n    <Message Text=\"Generating code coverage report...\" Importance=\"High\" />\n    <ReportGenerator ReportFiles=\"$(CoverageOutputDir)OpenCoverResults.xml\"\n                     TargetDirectory=\"$(CoverageOutputDir)\"\n                     ReportTypes=\"Html;XmlSummary\" />\n\n    <GetOpenCoverCoverageInformation CoverageFile=\"$(CoverageOutputDir)Summary.xml\">\n      <Output TaskParameter=\"CoverageData\" ItemName=\"CoverageData\"/>\n    </GetOpenCoverCoverageInformation>\n\n    <Message Text=\"Coverage data: @(CoverageData) %(CoverageData.Covered) %(CoverageData.Coverable) %(CoverageData.Coverage)\"/>\n  </Target>\n\n  <Target Name=\"_CheckCoverage\" Condition=\" '@(CoverageData)' != '' \">\n\n    <ItemGroup>\n      <FilteredCoverageData Include=\"@(CoverageData)\" Condition=\" '%(CoverageData.Coverage)' &lt; '$(MinimumCoverageRequired)' \"/>\n    </ItemGroup>\n\n    <Warning Condition=\" '@(FilteredCoverageData)' != '' \"\n            Text=\"Required coverage of $(MinimumCoverageRequired) not reached for%0A@(FilteredCoverageData->'%(Identity): %(Coverage)', '%0A')\"/>\n  </Target>\n\n  <ItemGroup>\n    <OpenCoverMsBuild Include=\"packages\\**\\OpenCover.MSBuild.dll\" />\n    <OpenCoverConsole Include=\"packages\\**\\OpenCover.Console.exe\" />\n    <ReportGeneratorMsBuild Include=\"packages\\**\\ReportGenerator.exe\" />\n  </ItemGroup>\n  <UsingTask TaskName=\"OpenCover.MSBuild.OpenCover\" AssemblyFile=\"@(OpenCoverMsBuild)\" />\n  <UsingTask TaskName=\"Palmmedia.ReportGenerator.MSBuild.ReportGenerator\" AssemblyFile=\"@(ReportGeneratorMsBuild)\" />\n\n  <UsingTask TaskName=\"ParseTestOutput\" TaskFactory=\"CodeTaskFactory\" AssemblyFile=\"$(MSBuildToolsPath)\\Microsoft.Build.Tasks.v4.0.dll\">\n    <ParameterGroup>\n      <CommandOutput ParameterType=\"Microsoft.Build.Framework.ITaskItem[]\" Required=\"true\" />\n      <TrxFile ParameterType=\"System.String\" Output=\"true\"/>\n      <CoverageFile ParameterType=\"System.String\" Output=\"true\"/>\n    </ParameterGroup>\n    <Task>\n      <Reference Include=\"System.Core\" />\n      <Using Namespace=\"System\" />\n      <Using Namespace=\"System.Text.RegularExpressions\" />\n      <Using Namespace=\"Microsoft.Build.Framework\" />\n      <Using Namespace=\"Microsoft.Build.Utilities\" />\n      <Code Type=\"Fragment\" Language=\"cs\">\n        <![CDATA[\n            var trxRegex = new Regex(@\"^Results File: (?<trx>[a-zA-Z]:\\\\.*\\.trx)$\");\n            var coverageRegex = new Regex(@\"^(?<coverage>[a-zA-Z]:\\\\.*\\.coverage)$\");\n            \n            this.TrxFile = \"\";\n            this.CoverageFile = \"\";\n\n            try \n            {\n              foreach (var item in this.CommandOutput)\n              {\n                //Log.LogMessage(item.ItemSpec);\n              \n                var trxMatch = trxRegex.Match(item.ItemSpec);\n                var coverageMatch = coverageRegex.Match(item.ItemSpec);\n                \n                if (trxMatch.Success)\n                {\n                  this.TrxFile = trxMatch.Groups[\"trx\"].Value;\n                }\n               \n                if (coverageMatch.Success)\n                {\n                  this.CoverageFile = coverageMatch.Groups[\"coverage\"].Value;\n                }\n              }\n            }\n            catch (Exception ex) \n            {\n              Log.LogErrorFromException(ex);\n              return false;\n            }\n            ]]>\n      </Code>\n    </Task>\n  </UsingTask>\n\n  <UsingTask TaskName=\"GetCoverageInformation\" TaskFactory=\"CodeTaskFactory\" AssemblyFile=\"$(MSBuildToolsPath)\\Microsoft.Build.Tasks.v4.0.dll\">\n    <ParameterGroup>\n      <CoverageFile ParameterType=\"System.String\" Required=\"true\"/>\n      <DevEnvDir ParameterType=\"System.String\" Required=\"true\"/>\n      <CoverageData ParameterType=\"Microsoft.Build.Framework.ITaskItem[]\" Output=\"true\" />\n    </ParameterGroup>\n    <Task>\n      <Reference Include=\"System.Core\" />\n      <Reference Include=\"System.Data\" />\n      <Reference Include=\"System.Xml\" />\n      <Reference Include=\"System.Data.DataSetExtensions\" />\n      <Reference Include=\"Microsoft.CSharp\"/>\n\n      <Using Namespace=\"System\" />\n      <Using Namespace=\"System.Collections.Generic\" />\n      <Using Namespace=\"System.Reflection\"/>\n      <Using Namespace=\"Microsoft.Build.Framework\" />\n      <Using Namespace=\"Microsoft.Build.Utilities\" />\n\n      <Code Type=\"Fragment\" Language=\"cs\">\n        <![CDATA[\n\n            try \n            {\n              var coverageData = new List<ITaskItem>();\n\n              var coverageAssembly = Assembly.LoadFrom(System.IO.Path.Combine(DevEnvDir, @\"PrivateAssemblies\\Microsoft.VisualStudio.Coverage.Analysis.dll\"));\n              var coverageInfoType = coverageAssembly.GetType(\"Microsoft.VisualStudio.Coverage.Analysis.CoverageInfo\");\n\n              using (dynamic info = coverageInfoType.InvokeMember(\"CreateFromFile\", BindingFlags.Static | BindingFlags.Public | BindingFlags.InvokeMethod, null, null, new object[] { CoverageFile }))\n              {\n                  var dataSet = info.BuildDataSet();\n\n                  foreach (var module in dataSet.Module)\n                  {\n                      if (module.ModuleName.IndexOf(\"test\", StringComparison.Ordinal) == -1)\n                      {\n                          var item = new TaskItem(module.ModuleName);\n                          item.SetMetadata(\"BlocksCovered\", module.BlocksCovered.ToString());\n                          item.SetMetadata(\"BlocksNotCovered\", module.BlocksNotCovered.ToString());\n                          item.SetMetadata(\"Coverage\", (100f * module.BlocksCovered / (float)(module.BlocksCovered + module.BlocksNotCovered)).ToString());\n\n                          coverageData.Add(item);\n                      }\n                  }\n              }\n\n              CoverageData = coverageData.ToArray();\n            }\n            catch (Exception ex) \n            {\n              Log.LogErrorFromException(ex);\n              return false;\n            }\n            ]]>\n      </Code>\n    </Task>\n  </UsingTask>\n\n  <UsingTask TaskName=\"GetOpenCoverCoverageInformation\" TaskFactory=\"CodeTaskFactory\" AssemblyFile=\"$(MSBuildToolsPath)\\Microsoft.Build.Tasks.v4.0.dll\">\n    <ParameterGroup>\n      <CoverageFile ParameterType=\"System.String\" Required=\"true\"/>\n      <CoverageData ParameterType=\"Microsoft.Build.Framework.ITaskItem[]\" Output=\"true\" />\n    </ParameterGroup>\n    <Task>\n      <Reference Include=\"System.Core\" />\n      <Reference Include=\"System.Xml\" />\n      <Reference Include=\"System.Xml.Linq\" />\n\n      <Using Namespace=\"System.Xml.Linq\" />\n      <Using Namespace=\"System.Collections.Generic\" />\n      <Using Namespace=\"Microsoft.Build.Framework\" />\n      <Using Namespace=\"Microsoft.Build.Utilities\" />\n\n      <Code Type=\"Fragment\" Language=\"cs\">\n        <![CDATA[\n\n            try \n            {\n              var coverageData = new List<ITaskItem>();\n\n              var summaryFile = XDocument.Load(this.CoverageFile);\n\n              foreach (var assembly in summaryFile.Descendants(\"Assembly\"))\n              {\n                var item = new TaskItem(assembly.Attribute(\"name\").Value);\n                item.SetMetadata(\"Covered\", assembly.Attribute(\"coveredlines\").Value);\n                item.SetMetadata(\"Coverable\", assembly.Attribute(\"coverablelines\").Value);\n                item.SetMetadata(\"Coverage\", assembly.Attribute(\"coverage\").Value);\n\n                coverageData.Add(item);\n              }\n\n              CoverageData = coverageData.ToArray();\n            }\n            catch (Exception ex) \n            {\n              Log.LogErrorFromException(ex);\n              return false;\n            }\n            ]]>\n      </Code>\n    </Task>\n  </UsingTask>\n\n  <Import Project=\"nuget.targets\"/>\n</Project>"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/ServiceConfiguration.Cloud.cscfg",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ServiceConfiguration serviceName=\"SlabReconfiguration\" xmlns=\"http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration\" osFamily=\"3\" osVersion=\"*\" schemaVersion=\"2012-10.1.8\">\n  <Role name=\"SlabReconfigurationWebRole\">\n    <Instances count=\"1\" />\n    <ConfigurationSettings>\n      <Setting name=\"Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString\" value=\"UseDevelopmentStorage=true\" />\n      <Setting name=\"azureLoggingConnectionString\" value=\"UseDevelopmentStorage=true\" />\n      <Setting name=\"azureLoggingVerbosity\" value=\"Warning\" />\n    </ConfigurationSettings>\n  </Role>\n</ServiceConfiguration>"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/ServiceConfiguration.Local.cscfg",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ServiceConfiguration serviceName=\"SlabReconfiguration\" xmlns=\"http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration\" osFamily=\"3\" osVersion=\"*\" schemaVersion=\"2012-10.1.8\">\n  <Role name=\"SlabReconfigurationWebRole\">\n    <Instances count=\"1\" />\n    <ConfigurationSettings>\n      <Setting name=\"Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString\" value=\"UseDevelopmentStorage=true\" />\n      <Setting name=\"azureLoggingConnectionString\" value=\"UseDevelopmentStorage=true\" />\n      <Setting name=\"azureLoggingVerbosity\" value=\"Warning\" />\n    </ConfigurationSettings>\n  </Role>\n</ServiceConfiguration>"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/ServiceDefinition.csdef",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<ServiceDefinition name=\"SlabReconfiguration\" xmlns=\"http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition\" schemaVersion=\"2012-10.1.8\">\n  <WebRole name=\"SlabReconfigurationWebRole\" vmsize=\"Small\">\n    <Sites>\n      <Site name=\"Web\">\n        <Bindings>\n          <Binding name=\"Endpoint1\" endpointName=\"Endpoint1\" />\n        </Bindings>\n      </Site>\n    </Sites>\n    <Endpoints>\n      <InputEndpoint name=\"Endpoint1\" protocol=\"http\" port=\"80\" />\n    </Endpoints>\n    <Imports>\n      <Import moduleName=\"Diagnostics\" />\n    </Imports>\n    <ConfigurationSettings>\n      <Setting name=\"azureLoggingConnectionString\" />\n      <Setting name=\"azureLoggingVerbosity\" />\n    </ConfigurationSettings>\n  </WebRole>\n</ServiceDefinition>"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfiguration.ccproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProductVersion>1.8</ProductVersion>\n    <ProjectGuid>929e88dd-e793-4800-9d60-4e7df8fd464e</ProjectGuid>\n    <OutputType>Library</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>SlabReconfiguration</RootNamespace>\n    <AssemblyName>SlabReconfiguration</AssemblyName>\n    <StartDevelopmentStorage>True</StartDevelopmentStorage>\n    <Name>SlabReconfiguration</Name>\n    <SccProjectName>SAK</SccProjectName>\n    <SccProvider>SAK</SccProvider>\n    <SccAuxPath>SAK</SccAuxPath>\n    <SccLocalPath>SAK</SccLocalPath>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <!-- Items for the project -->\n  <ItemGroup>\n    <ServiceDefinition Include=\"ServiceDefinition.csdef\" />\n    <ServiceConfiguration Include=\"ServiceConfiguration.Local.cscfg\" />\n    <ServiceConfiguration Include=\"ServiceConfiguration.Cloud.cscfg\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"SlabReconfigurationWebRole\\SlabReconfigurationWebRole.csproj\">\n      <Name>SlabReconfigurationWebRole</Name>\n      <Project>{33f16a52-a92b-4138-ac8b-1d34993c69f0}</Project>\n      <Private>True</Private>\n      <RoleType>Web</RoleType>\n      <RoleName>SlabReconfigurationWebRole</RoleName>\n      <UpdateDiagnosticsConnectionStringOnPublish>True</UpdateDiagnosticsConnectionStringOnPublish>\n    </ProjectReference>\n  </ItemGroup>\n  <!-- Import the target files for this project template -->\n  <PropertyGroup>\n    <VisualStudioVersion Condition=\" '$(VisualStudioVersion)' == '' \">10.0</VisualStudioVersion>\n    <CloudExtensionsDir Condition=\" '$(CloudExtensionsDir)' == '' \">$(MSBuildExtensionsPath)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\Windows Azure Tools\\1.8\\</CloudExtensionsDir>\n  </PropertyGroup>\n  <Import Project=\"$(CloudExtensionsDir)Microsoft.WindowsAzure.targets\" />\n</Project>"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfiguration.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2012\nProject(\"{CC5FD16D-436D-48AD-A40C-5A424C6E3E79}\") = \"SlabReconfiguration\", \"SlabReconfiguration.ccproj\", \"{929E88DD-E793-4800-9D60-4E7DF8FD464E}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SlabReconfigurationWebRole\", \"SlabReconfigurationWebRole\\SlabReconfigurationWebRole.csproj\", \"{33F16A52-A92B-4138-AC8B-1D34993C69F0}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{929E88DD-E793-4800-9D60-4E7DF8FD464E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{929E88DD-E793-4800-9D60-4E7DF8FD464E}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{929E88DD-E793-4800-9D60-4E7DF8FD464E}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{929E88DD-E793-4800-9D60-4E7DF8FD464E}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{33F16A52-A92B-4138-AC8B-1D34993C69F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{33F16A52-A92B-4138-AC8B-1D34993C69F0}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{33F16A52-A92B-4138-AC8B-1D34993C69F0}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{33F16A52-A92B-4138-AC8B-1D34993C69F0}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tEnterpriseLibraryConfigurationToolBinariesPathV6 = packages\\EnterpriseLibrary.TransientFaultHandling.6.0.1304.0\\lib\\portable-net45+win+wp8;packages\\EnterpriseLibrary.TransientFaultHandling.WindowsAzure.Storage.6.0.1304.0\\lib\\NET45\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/App_Start/BundleConfig.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Web;\nusing System.Web.Optimization;\n\nnamespace SlabReconfigurationWebRole\n{\n    public class BundleConfig\n    {\n        // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725\n        public static void RegisterBundles(BundleCollection bundles)\n        {\n            bundles.Add(new ScriptBundle(\"~/bundles/jquery\").Include(\n                        \"~/Scripts/jquery-{version}.js\"));\n\n            bundles.Add(new ScriptBundle(\"~/bundles/jqueryui\").Include(\n                        \"~/Scripts/jquery-ui-{version}.js\"));\n\n            bundles.Add(new ScriptBundle(\"~/bundles/jqueryval\").Include(\n                        \"~/Scripts/jquery.unobtrusive*\",\n                        \"~/Scripts/jquery.validate*\"));\n\n            // Use the development version of Modernizr to develop with and learn from. Then, when you're\n            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.\n            bundles.Add(new ScriptBundle(\"~/bundles/modernizr\").Include(\n                        \"~/Scripts/modernizr-*\"));\n\n            bundles.Add(new StyleBundle(\"~/Content/css\").Include(\"~/Content/site.css\"));\n\n            bundles.Add(new StyleBundle(\"~/Content/themes/base/css\").Include(\n                        \"~/Content/themes/base/jquery.ui.core.css\",\n                        \"~/Content/themes/base/jquery.ui.resizable.css\",\n                        \"~/Content/themes/base/jquery.ui.selectable.css\",\n                        \"~/Content/themes/base/jquery.ui.accordion.css\",\n                        \"~/Content/themes/base/jquery.ui.autocomplete.css\",\n                        \"~/Content/themes/base/jquery.ui.button.css\",\n                        \"~/Content/themes/base/jquery.ui.dialog.css\",\n                        \"~/Content/themes/base/jquery.ui.slider.css\",\n                        \"~/Content/themes/base/jquery.ui.tabs.css\",\n                        \"~/Content/themes/base/jquery.ui.datepicker.css\",\n                        \"~/Content/themes/base/jquery.ui.progressbar.css\",\n                        \"~/Content/themes/base/jquery.ui.theme.css\"));\n        }\n    }\n}"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/App_Start/FilterConfig.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Web;\nusing System.Web.Mvc;\n\nnamespace SlabReconfigurationWebRole\n{\n    public class FilterConfig\n    {\n        public static void RegisterGlobalFilters(GlobalFilterCollection filters)\n        {\n            filters.Add(new HandleErrorAttribute());\n        }\n    }\n}"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/App_Start/RouteConfig.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web;\nusing System.Web.Mvc;\nusing System.Web.Routing;\n\nnamespace SlabReconfigurationWebRole\n{\n    public class RouteConfig\n    {\n        public static void RegisterRoutes(RouteCollection routes)\n        {\n            routes.IgnoreRoute(\"{resource}.axd/{*pathInfo}\");\n\n            routes.MapRoute(\n                name: \"Default\",\n                url: \"{controller}/{action}/{id}\",\n                defaults: new { controller = \"Home\", action = \"Index\", id = UrlParameter.Optional }\n            );\n        }\n    }\n}"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/App_Start/WebApiConfig.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web.Http;\n\nnamespace SlabReconfigurationWebRole\n{\n    public static class WebApiConfig\n    {\n        public static void Register(HttpConfiguration config)\n        {\n            config.Routes.MapHttpRoute(\n                name: \"DefaultApi\",\n                routeTemplate: \"api/{controller}/{id}\",\n                defaults: new { id = RouteParameter.Optional }\n            );\n        }\n    }\n}\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/Site.css",
    "content": "﻿body {\n    font-size: .85em;\n    font-family: \"Segoe UI\", Verdana, Helvetica, Sans-Serif;\n    color: #232323;\n    background-color: #fff;\n}\n\nheader, footer, nav, section {\n    display: block;\n}\n\n\n/* Styles for basic forms\n-----------------------------------------------------------*/\nfieldset {\n    border: 1px solid #ddd;\n    padding: 0 1.4em 1.4em 1.4em;\n    margin: 0 0 1.5em 0;\n}\n\nlegend {\n    font-size: 1.2em;\n    font-weight: bold;\n}\n\ntextarea {\n    min-height: 75px;\n}\n\n.editor-label {\n    margin: 1em 0 0 0;\n}\n\n.editor-field {\n    margin: 0.5em 0 0 0;\n}\n\n\n/* Styles for validation helpers\n-----------------------------------------------------------*/\n.field-validation-error {\n    color: #f00;\n}\n\n.field-validation-valid {\n    display: none;\n}\n\n.input-validation-error {\n    border: 1px solid #f00;\n    background-color: #fee;\n}\n\n.validation-summary-errors {\n    font-weight: bold;\n    color: #f00;\n}\n\n.validation-summary-valid {\n    display: none;\n}\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/themes/base/jquery-ui.css",
    "content": "/*! jQuery UI - v1.8.24 - 2012-09-28\n* https://github.com/jquery/jquery-ui\n* Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.tabs.css, jquery.ui.theme.css\n* Copyright (c) 2012 AUTHORS.txt; Licensed MIT */\n\n/* Layout helpers\n----------------------------------*/\n.ui-helper-hidden { display: none; }\n.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }\n.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }\n.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: \"\"; display: table; }\n.ui-helper-clearfix:after { clear: both; }\n.ui-helper-clearfix { zoom: 1; }\n.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }\n\n\n/* Interaction Cues\n----------------------------------*/\n.ui-state-disabled { cursor: default !important; }\n\n\n/* Icons\n----------------------------------*/\n\n/* states and images */\n.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }\n\n\n/* Misc visuals\n----------------------------------*/\n\n/* Overlays */\n.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }\n\n/* IE/Win - Fix animation bug - #4615 */\n.ui-accordion { width: 100%; }\n.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }\n.ui-accordion .ui-accordion-li-fix { display: inline; }\n.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }\n.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }\n.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }\n.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }\n.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }\n.ui-accordion .ui-accordion-content-active { display: block; }\n\n.ui-autocomplete { position: absolute; cursor: default; }\t\n\n/* workarounds */\n* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */\n\n/*\n * jQuery UI Menu 1.8.24\n *\n * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Menu#theming\n */\n.ui-menu {\n\tlist-style:none;\n\tpadding: 2px;\n\tmargin: 0;\n\tdisplay:block;\n\tfloat: left;\n}\n.ui-menu .ui-menu {\n\tmargin-top: -3px;\n}\n.ui-menu .ui-menu-item {\n\tmargin:0;\n\tpadding: 0;\n\tzoom: 1;\n\tfloat: left;\n\tclear: left;\n\twidth: 100%;\n}\n.ui-menu .ui-menu-item a {\n\ttext-decoration:none;\n\tdisplay:block;\n\tpadding:.2em .4em;\n\tline-height:1.5;\n\tzoom:1;\n}\n.ui-menu .ui-menu-item a.ui-state-hover,\n.ui-menu .ui-menu-item a.ui-state-active {\n\tfont-weight: normal;\n\tmargin: -1px;\n}\n\n.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */\n.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */\nbutton.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */\n.ui-button-icons-only { width: 3.4em; } \nbutton.ui-button-icons-only { width: 3.7em; } \n\n/*button text element */\n.ui-button .ui-button-text { display: block; line-height: 1.4;  }\n.ui-button-text-only .ui-button-text { padding: .4em 1em; }\n.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }\n.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }\n.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }\n.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }\n/* no icon support for input elements, provide padding by default */\ninput.ui-button { padding: .4em 1em; }\n\n/*button icon element(s) */\n.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }\n.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }\n.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }\n.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }\n.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }\n\n/*button sets*/\n.ui-buttonset { margin-right: 7px; }\n.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }\n\n/* workarounds */\nbutton.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */\n\n.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }\n.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }\n.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }\n.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }\n.ui-datepicker .ui-datepicker-prev { left:2px; }\n.ui-datepicker .ui-datepicker-next { right:2px; }\n.ui-datepicker .ui-datepicker-prev-hover { left:1px; }\n.ui-datepicker .ui-datepicker-next-hover { right:1px; }\n.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px;  }\n.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }\n.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }\n.ui-datepicker select.ui-datepicker-month-year {width: 100%;}\n.ui-datepicker select.ui-datepicker-month, \n.ui-datepicker select.ui-datepicker-year { width: 49%;}\n.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }\n.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0;  }\n.ui-datepicker td { border: 0; padding: 1px; }\n.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }\n.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }\n.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }\n.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }\n\n/* with multiple calendars */\n.ui-datepicker.ui-datepicker-multi { width:auto; }\n.ui-datepicker-multi .ui-datepicker-group { float:left; }\n.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }\n.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }\n.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }\n.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }\n.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }\n.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }\n.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }\n.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }\n\n/* RTL support */\n.ui-datepicker-rtl { direction: rtl; }\n.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }\n.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }\n.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }\n.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }\n.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }\n.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }\n.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }\n.ui-datepicker-rtl .ui-datepicker-group { float:right; }\n.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }\n.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }\n\n/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */\n.ui-datepicker-cover {\n    position: absolute; /*must have*/\n    z-index: -1; /*must have*/\n    filter: mask(); /*must have*/\n    top: -4px; /*must have*/\n    left: -4px; /*must have*/\n    width: 200px; /*must have*/\n    height: 200px; /*must have*/\n}\n.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }\n.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative;  }\n.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } \n.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }\n.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }\n.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }\n.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }\n.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }\n.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }\n.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }\n.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }\n.ui-draggable .ui-dialog-titlebar { cursor: move; }\n\n.ui-progressbar { height:2em; text-align: left; overflow: hidden; }\n.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }\n.ui-resizable { position: relative;}\n.ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }\n.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }\n.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }\n.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }\n.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }\n.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }\n.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }\n.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }\n.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }\n.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}\n.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }\n\n.ui-slider { position: relative; text-align: left; }\n.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }\n.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }\n\n.ui-slider-horizontal { height: .8em; }\n.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }\n.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }\n.ui-slider-horizontal .ui-slider-range-min { left: 0; }\n.ui-slider-horizontal .ui-slider-range-max { right: 0; }\n\n.ui-slider-vertical { width: .8em; height: 100px; }\n.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }\n.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }\n.ui-slider-vertical .ui-slider-range-min { bottom: 0; }\n.ui-slider-vertical .ui-slider-range-max { top: 0; }\n.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as \"fixed\") */\n.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }\n.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }\n.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }\n.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }\n.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }\n.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */\n.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }\n.ui-tabs .ui-tabs-hide { display: none !important; }\n\n/* Component containers\n----------------------------------*/\n.ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; }\n.ui-widget .ui-widget { font-size: 1em; }\n.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; }\n.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; }\n.ui-widget-content a { color: #222222/*{fcContent}*/; }\n.ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; }\n.ui-widget-header a { color: #222222/*{fcHeader}*/; }\n\n/* Interaction states\n----------------------------------*/\n.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }\n.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; }\n.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(images/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; }\n.ui-state-hover a, .ui-state-hover a:hover { color: #212121/*{fcHover}*/; text-decoration: none; }\n.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; }\n.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; text-decoration: none; }\n.ui-widget :active { outline: none; }\n\n/* Interaction Cues\n----------------------------------*/\n.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight  {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }\n.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636/*{fcHighlight}*/; }\n.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }\n.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a/*{fcError}*/; }\n.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a/*{fcError}*/; }\n.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }\n.ui-priority-secondary, .ui-widget-content .ui-priority-secondary,  .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }\n.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }\n\n/* Icons\n----------------------------------*/\n\n/* states and images */\n.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }\n.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }\n.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; }\n.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; }\n.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; }\n.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; }\n.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; }\n.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; }\n\n/* positioning */\n.ui-icon-carat-1-n { background-position: 0 0; }\n.ui-icon-carat-1-ne { background-position: -16px 0; }\n.ui-icon-carat-1-e { background-position: -32px 0; }\n.ui-icon-carat-1-se { background-position: -48px 0; }\n.ui-icon-carat-1-s { background-position: -64px 0; }\n.ui-icon-carat-1-sw { background-position: -80px 0; }\n.ui-icon-carat-1-w { background-position: -96px 0; }\n.ui-icon-carat-1-nw { background-position: -112px 0; }\n.ui-icon-carat-2-n-s { background-position: -128px 0; }\n.ui-icon-carat-2-e-w { background-position: -144px 0; }\n.ui-icon-triangle-1-n { background-position: 0 -16px; }\n.ui-icon-triangle-1-ne { background-position: -16px -16px; }\n.ui-icon-triangle-1-e { background-position: -32px -16px; }\n.ui-icon-triangle-1-se { background-position: -48px -16px; }\n.ui-icon-triangle-1-s { background-position: -64px -16px; }\n.ui-icon-triangle-1-sw { background-position: -80px -16px; }\n.ui-icon-triangle-1-w { background-position: -96px -16px; }\n.ui-icon-triangle-1-nw { background-position: -112px -16px; }\n.ui-icon-triangle-2-n-s { background-position: -128px -16px; }\n.ui-icon-triangle-2-e-w { background-position: -144px -16px; }\n.ui-icon-arrow-1-n { background-position: 0 -32px; }\n.ui-icon-arrow-1-ne { background-position: -16px -32px; }\n.ui-icon-arrow-1-e { background-position: -32px -32px; }\n.ui-icon-arrow-1-se { background-position: -48px -32px; }\n.ui-icon-arrow-1-s { background-position: -64px -32px; }\n.ui-icon-arrow-1-sw { background-position: -80px -32px; }\n.ui-icon-arrow-1-w { background-position: -96px -32px; }\n.ui-icon-arrow-1-nw { background-position: -112px -32px; }\n.ui-icon-arrow-2-n-s { background-position: -128px -32px; }\n.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }\n.ui-icon-arrow-2-e-w { background-position: -160px -32px; }\n.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }\n.ui-icon-arrowstop-1-n { background-position: -192px -32px; }\n.ui-icon-arrowstop-1-e { background-position: -208px -32px; }\n.ui-icon-arrowstop-1-s { background-position: -224px -32px; }\n.ui-icon-arrowstop-1-w { background-position: -240px -32px; }\n.ui-icon-arrowthick-1-n { background-position: 0 -48px; }\n.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }\n.ui-icon-arrowthick-1-e { background-position: -32px -48px; }\n.ui-icon-arrowthick-1-se { background-position: -48px -48px; }\n.ui-icon-arrowthick-1-s { background-position: -64px -48px; }\n.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }\n.ui-icon-arrowthick-1-w { background-position: -96px -48px; }\n.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }\n.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }\n.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }\n.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }\n.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }\n.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }\n.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }\n.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }\n.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }\n.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }\n.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }\n.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }\n.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }\n.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }\n.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }\n.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }\n.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }\n.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }\n.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }\n.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }\n.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }\n.ui-icon-arrow-4 { background-position: 0 -80px; }\n.ui-icon-arrow-4-diag { background-position: -16px -80px; }\n.ui-icon-extlink { background-position: -32px -80px; }\n.ui-icon-newwin { background-position: -48px -80px; }\n.ui-icon-refresh { background-position: -64px -80px; }\n.ui-icon-shuffle { background-position: -80px -80px; }\n.ui-icon-transfer-e-w { background-position: -96px -80px; }\n.ui-icon-transferthick-e-w { background-position: -112px -80px; }\n.ui-icon-folder-collapsed { background-position: 0 -96px; }\n.ui-icon-folder-open { background-position: -16px -96px; }\n.ui-icon-document { background-position: -32px -96px; }\n.ui-icon-document-b { background-position: -48px -96px; }\n.ui-icon-note { background-position: -64px -96px; }\n.ui-icon-mail-closed { background-position: -80px -96px; }\n.ui-icon-mail-open { background-position: -96px -96px; }\n.ui-icon-suitcase { background-position: -112px -96px; }\n.ui-icon-comment { background-position: -128px -96px; }\n.ui-icon-person { background-position: -144px -96px; }\n.ui-icon-print { background-position: -160px -96px; }\n.ui-icon-trash { background-position: -176px -96px; }\n.ui-icon-locked { background-position: -192px -96px; }\n.ui-icon-unlocked { background-position: -208px -96px; }\n.ui-icon-bookmark { background-position: -224px -96px; }\n.ui-icon-tag { background-position: -240px -96px; }\n.ui-icon-home { background-position: 0 -112px; }\n.ui-icon-flag { background-position: -16px -112px; }\n.ui-icon-calendar { background-position: -32px -112px; }\n.ui-icon-cart { background-position: -48px -112px; }\n.ui-icon-pencil { background-position: -64px -112px; }\n.ui-icon-clock { background-position: -80px -112px; }\n.ui-icon-disk { background-position: -96px -112px; }\n.ui-icon-calculator { background-position: -112px -112px; }\n.ui-icon-zoomin { background-position: -128px -112px; }\n.ui-icon-zoomout { background-position: -144px -112px; }\n.ui-icon-search { background-position: -160px -112px; }\n.ui-icon-wrench { background-position: -176px -112px; }\n.ui-icon-gear { background-position: -192px -112px; }\n.ui-icon-heart { background-position: -208px -112px; }\n.ui-icon-star { background-position: -224px -112px; }\n.ui-icon-link { background-position: -240px -112px; }\n.ui-icon-cancel { background-position: 0 -128px; }\n.ui-icon-plus { background-position: -16px -128px; }\n.ui-icon-plusthick { background-position: -32px -128px; }\n.ui-icon-minus { background-position: -48px -128px; }\n.ui-icon-minusthick { background-position: -64px -128px; }\n.ui-icon-close { background-position: -80px -128px; }\n.ui-icon-closethick { background-position: -96px -128px; }\n.ui-icon-key { background-position: -112px -128px; }\n.ui-icon-lightbulb { background-position: -128px -128px; }\n.ui-icon-scissors { background-position: -144px -128px; }\n.ui-icon-clipboard { background-position: -160px -128px; }\n.ui-icon-copy { background-position: -176px -128px; }\n.ui-icon-contact { background-position: -192px -128px; }\n.ui-icon-image { background-position: -208px -128px; }\n.ui-icon-video { background-position: -224px -128px; }\n.ui-icon-script { background-position: -240px -128px; }\n.ui-icon-alert { background-position: 0 -144px; }\n.ui-icon-info { background-position: -16px -144px; }\n.ui-icon-notice { background-position: -32px -144px; }\n.ui-icon-help { background-position: -48px -144px; }\n.ui-icon-check { background-position: -64px -144px; }\n.ui-icon-bullet { background-position: -80px -144px; }\n.ui-icon-radio-off { background-position: -96px -144px; }\n.ui-icon-radio-on { background-position: -112px -144px; }\n.ui-icon-pin-w { background-position: -128px -144px; }\n.ui-icon-pin-s { background-position: -144px -144px; }\n.ui-icon-play { background-position: 0 -160px; }\n.ui-icon-pause { background-position: -16px -160px; }\n.ui-icon-seek-next { background-position: -32px -160px; }\n.ui-icon-seek-prev { background-position: -48px -160px; }\n.ui-icon-seek-end { background-position: -64px -160px; }\n.ui-icon-seek-start { background-position: -80px -160px; }\n/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */\n.ui-icon-seek-first { background-position: -80px -160px; }\n.ui-icon-stop { background-position: -96px -160px; }\n.ui-icon-eject { background-position: -112px -160px; }\n.ui-icon-volume-off { background-position: -128px -160px; }\n.ui-icon-volume-on { background-position: -144px -160px; }\n.ui-icon-power { background-position: 0 -176px; }\n.ui-icon-signal-diag { background-position: -16px -176px; }\n.ui-icon-signal { background-position: -32px -176px; }\n.ui-icon-battery-0 { background-position: -48px -176px; }\n.ui-icon-battery-1 { background-position: -64px -176px; }\n.ui-icon-battery-2 { background-position: -80px -176px; }\n.ui-icon-battery-3 { background-position: -96px -176px; }\n.ui-icon-circle-plus { background-position: 0 -192px; }\n.ui-icon-circle-minus { background-position: -16px -192px; }\n.ui-icon-circle-close { background-position: -32px -192px; }\n.ui-icon-circle-triangle-e { background-position: -48px -192px; }\n.ui-icon-circle-triangle-s { background-position: -64px -192px; }\n.ui-icon-circle-triangle-w { background-position: -80px -192px; }\n.ui-icon-circle-triangle-n { background-position: -96px -192px; }\n.ui-icon-circle-arrow-e { background-position: -112px -192px; }\n.ui-icon-circle-arrow-s { background-position: -128px -192px; }\n.ui-icon-circle-arrow-w { background-position: -144px -192px; }\n.ui-icon-circle-arrow-n { background-position: -160px -192px; }\n.ui-icon-circle-zoomin { background-position: -176px -192px; }\n.ui-icon-circle-zoomout { background-position: -192px -192px; }\n.ui-icon-circle-check { background-position: -208px -192px; }\n.ui-icon-circlesmall-plus { background-position: 0 -208px; }\n.ui-icon-circlesmall-minus { background-position: -16px -208px; }\n.ui-icon-circlesmall-close { background-position: -32px -208px; }\n.ui-icon-squaresmall-plus { background-position: -48px -208px; }\n.ui-icon-squaresmall-minus { background-position: -64px -208px; }\n.ui-icon-squaresmall-close { background-position: -80px -208px; }\n.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }\n.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }\n.ui-icon-grip-solid-vertical { background-position: -32px -224px; }\n.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }\n.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }\n.ui-icon-grip-diagonal-se { background-position: -80px -224px; }\n\n\n/* Misc visuals\n----------------------------------*/\n\n/* Corner radius */\n.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -khtml-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; }\n.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; -khtml-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; }\n.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; }\n.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }\n\n/* Overlays */\n.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }\n.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -khtml-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; }"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/themes/base/jquery.ui.accordion.css",
    "content": "/*!\n * jQuery UI Accordion 1.8.24\n *\n * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Accordion#theming\n */\n/* IE/Win - Fix animation bug - #4615 */\n.ui-accordion { width: 100%; }\n.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; }\n.ui-accordion .ui-accordion-li-fix { display: inline; }\n.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; }\n.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; }\n.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; }\n.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }\n.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; }\n.ui-accordion .ui-accordion-content-active { display: block; }\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/themes/base/jquery.ui.all.css",
    "content": "/*!\n * jQuery UI CSS Framework 1.8.24\n *\n * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Theming\n */\n@import \"jquery.ui.base.css\";\n@import \"jquery.ui.theme.css\";\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/themes/base/jquery.ui.autocomplete.css",
    "content": "/*!\n * jQuery UI Autocomplete 1.8.24\n *\n * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Autocomplete#theming\n */\n.ui-autocomplete { position: absolute; cursor: default; }\t\n\n/* workarounds */\n* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */\n\n/*\n * jQuery UI Menu 1.8.24\n *\n * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Menu#theming\n */\n.ui-menu {\n\tlist-style:none;\n\tpadding: 2px;\n\tmargin: 0;\n\tdisplay:block;\n\tfloat: left;\n}\n.ui-menu .ui-menu {\n\tmargin-top: -3px;\n}\n.ui-menu .ui-menu-item {\n\tmargin:0;\n\tpadding: 0;\n\tzoom: 1;\n\tfloat: left;\n\tclear: left;\n\twidth: 100%;\n}\n.ui-menu .ui-menu-item a {\n\ttext-decoration:none;\n\tdisplay:block;\n\tpadding:.2em .4em;\n\tline-height:1.5;\n\tzoom:1;\n}\n.ui-menu .ui-menu-item a.ui-state-hover,\n.ui-menu .ui-menu-item a.ui-state-active {\n\tfont-weight: normal;\n\tmargin: -1px;\n}\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/themes/base/jquery.ui.base.css",
    "content": "/*!\n * jQuery UI CSS Framework 1.8.24\n *\n * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Theming\n */\n@import url(\"jquery.ui.core.css\");\n\n@import url(\"jquery.ui.accordion.css\");\n@import url(\"jquery.ui.autocomplete.css\");\n@import url(\"jquery.ui.button.css\");\n@import url(\"jquery.ui.datepicker.css\");\n@import url(\"jquery.ui.dialog.css\");\n@import url(\"jquery.ui.progressbar.css\");\n@import url(\"jquery.ui.resizable.css\");\n@import url(\"jquery.ui.selectable.css\");\n@import url(\"jquery.ui.slider.css\");\n@import url(\"jquery.ui.tabs.css\");\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/themes/base/jquery.ui.button.css",
    "content": "/*!\n * jQuery UI Button 1.8.24\n *\n * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Button#theming\n */\n.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */\n.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */\nbutton.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */\n.ui-button-icons-only { width: 3.4em; } \nbutton.ui-button-icons-only { width: 3.7em; } \n\n/*button text element */\n.ui-button .ui-button-text { display: block; line-height: 1.4;  }\n.ui-button-text-only .ui-button-text { padding: .4em 1em; }\n.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }\n.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }\n.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }\n.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }\n/* no icon support for input elements, provide padding by default */\ninput.ui-button { padding: .4em 1em; }\n\n/*button icon element(s) */\n.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }\n.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }\n.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }\n.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }\n.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }\n\n/*button sets*/\n.ui-buttonset { margin-right: 7px; }\n.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }\n\n/* workarounds */\nbutton.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/themes/base/jquery.ui.core.css",
    "content": "/*!\n * jQuery UI CSS Framework 1.8.24\n *\n * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Theming/API\n */\n\n/* Layout helpers\n----------------------------------*/\n.ui-helper-hidden { display: none; }\n.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }\n.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }\n.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: \"\"; display: table; }\n.ui-helper-clearfix:after { clear: both; }\n.ui-helper-clearfix { zoom: 1; }\n.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }\n\n\n/* Interaction Cues\n----------------------------------*/\n.ui-state-disabled { cursor: default !important; }\n\n\n/* Icons\n----------------------------------*/\n\n/* states and images */\n.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }\n\n\n/* Misc visuals\n----------------------------------*/\n\n/* Overlays */\n.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/themes/base/jquery.ui.datepicker.css",
    "content": "/*!\n * jQuery UI Datepicker 1.8.24\n *\n * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Datepicker#theming\n */\n.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }\n.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }\n.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }\n.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }\n.ui-datepicker .ui-datepicker-prev { left:2px; }\n.ui-datepicker .ui-datepicker-next { right:2px; }\n.ui-datepicker .ui-datepicker-prev-hover { left:1px; }\n.ui-datepicker .ui-datepicker-next-hover { right:1px; }\n.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px;  }\n.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }\n.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }\n.ui-datepicker select.ui-datepicker-month-year {width: 100%;}\n.ui-datepicker select.ui-datepicker-month, \n.ui-datepicker select.ui-datepicker-year { width: 49%;}\n.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }\n.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0;  }\n.ui-datepicker td { border: 0; padding: 1px; }\n.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }\n.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }\n.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }\n.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }\n\n/* with multiple calendars */\n.ui-datepicker.ui-datepicker-multi { width:auto; }\n.ui-datepicker-multi .ui-datepicker-group { float:left; }\n.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }\n.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }\n.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }\n.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }\n.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }\n.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }\n.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }\n.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }\n\n/* RTL support */\n.ui-datepicker-rtl { direction: rtl; }\n.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }\n.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }\n.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }\n.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }\n.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }\n.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }\n.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }\n.ui-datepicker-rtl .ui-datepicker-group { float:right; }\n.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }\n.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }\n\n/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */\n.ui-datepicker-cover {\n    position: absolute; /*must have*/\n    z-index: -1; /*must have*/\n    filter: mask(); /*must have*/\n    top: -4px; /*must have*/\n    left: -4px; /*must have*/\n    width: 200px; /*must have*/\n    height: 200px; /*must have*/\n}"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/themes/base/jquery.ui.dialog.css",
    "content": "/*!\n * jQuery UI Dialog 1.8.24\n *\n * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Dialog#theming\n */\n.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; }\n.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative;  }\n.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } \n.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }\n.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }\n.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }\n.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }\n.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }\n.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }\n.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }\n.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }\n.ui-draggable .ui-dialog-titlebar { cursor: move; }\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/themes/base/jquery.ui.progressbar.css",
    "content": "/*!\n * jQuery UI Progressbar 1.8.24\n *\n * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Progressbar#theming\n */\n.ui-progressbar { height:2em; text-align: left; overflow: hidden; }\n.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/themes/base/jquery.ui.resizable.css",
    "content": "/*!\n * jQuery UI Resizable 1.8.24\n *\n * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Resizable#theming\n */\n.ui-resizable { position: relative;}\n.ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }\n.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }\n.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }\n.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }\n.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }\n.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }\n.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }\n.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }\n.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }\n.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/themes/base/jquery.ui.selectable.css",
    "content": "/*!\n * jQuery UI Selectable 1.8.24\n *\n * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Selectable#theming\n */\n.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/themes/base/jquery.ui.slider.css",
    "content": "/*!\n * jQuery UI Slider 1.8.24\n *\n * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Slider#theming\n */\n.ui-slider { position: relative; text-align: left; }\n.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }\n.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }\n\n.ui-slider-horizontal { height: .8em; }\n.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }\n.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }\n.ui-slider-horizontal .ui-slider-range-min { left: 0; }\n.ui-slider-horizontal .ui-slider-range-max { right: 0; }\n\n.ui-slider-vertical { width: .8em; height: 100px; }\n.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }\n.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }\n.ui-slider-vertical .ui-slider-range-min { bottom: 0; }\n.ui-slider-vertical .ui-slider-range-max { top: 0; }"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/themes/base/jquery.ui.tabs.css",
    "content": "/*!\n * jQuery UI Tabs 1.8.24\n *\n * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Tabs#theming\n */\n.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as \"fixed\") */\n.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }\n.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; }\n.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }\n.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; }\n.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; }\n.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */\n.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }\n.ui-tabs .ui-tabs-hide { display: none !important; }\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Content/themes/base/jquery.ui.theme.css",
    "content": "/*!\n * jQuery UI CSS Framework 1.8.24\n *\n * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Theming/API\n *\n * To view and modify this theme, visit http://jqueryui.com/themeroller/\n */\n\n\n/* Component containers\n----------------------------------*/\n.ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; }\n.ui-widget .ui-widget { font-size: 1em; }\n.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; }\n.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; }\n.ui-widget-content a { color: #222222/*{fcContent}*/; }\n.ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; }\n.ui-widget-header a { color: #222222/*{fcHeader}*/; }\n\n/* Interaction states\n----------------------------------*/\n.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; }\n.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; }\n.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(images/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; }\n.ui-state-hover a, .ui-state-hover a:hover { color: #212121/*{fcHover}*/; text-decoration: none; }\n.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; }\n.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; text-decoration: none; }\n.ui-widget :active { outline: none; }\n\n/* Interaction Cues\n----------------------------------*/\n.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight  {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; }\n.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636/*{fcHighlight}*/; }\n.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; }\n.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a/*{fcError}*/; }\n.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a/*{fcError}*/; }\n.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }\n.ui-priority-secondary, .ui-widget-content .ui-priority-secondary,  .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }\n.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }\n\n/* Icons\n----------------------------------*/\n\n/* states and images */\n.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }\n.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; }\n.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; }\n.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; }\n.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; }\n.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; }\n.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; }\n.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; }\n\n/* positioning */\n.ui-icon-carat-1-n { background-position: 0 0; }\n.ui-icon-carat-1-ne { background-position: -16px 0; }\n.ui-icon-carat-1-e { background-position: -32px 0; }\n.ui-icon-carat-1-se { background-position: -48px 0; }\n.ui-icon-carat-1-s { background-position: -64px 0; }\n.ui-icon-carat-1-sw { background-position: -80px 0; }\n.ui-icon-carat-1-w { background-position: -96px 0; }\n.ui-icon-carat-1-nw { background-position: -112px 0; }\n.ui-icon-carat-2-n-s { background-position: -128px 0; }\n.ui-icon-carat-2-e-w { background-position: -144px 0; }\n.ui-icon-triangle-1-n { background-position: 0 -16px; }\n.ui-icon-triangle-1-ne { background-position: -16px -16px; }\n.ui-icon-triangle-1-e { background-position: -32px -16px; }\n.ui-icon-triangle-1-se { background-position: -48px -16px; }\n.ui-icon-triangle-1-s { background-position: -64px -16px; }\n.ui-icon-triangle-1-sw { background-position: -80px -16px; }\n.ui-icon-triangle-1-w { background-position: -96px -16px; }\n.ui-icon-triangle-1-nw { background-position: -112px -16px; }\n.ui-icon-triangle-2-n-s { background-position: -128px -16px; }\n.ui-icon-triangle-2-e-w { background-position: -144px -16px; }\n.ui-icon-arrow-1-n { background-position: 0 -32px; }\n.ui-icon-arrow-1-ne { background-position: -16px -32px; }\n.ui-icon-arrow-1-e { background-position: -32px -32px; }\n.ui-icon-arrow-1-se { background-position: -48px -32px; }\n.ui-icon-arrow-1-s { background-position: -64px -32px; }\n.ui-icon-arrow-1-sw { background-position: -80px -32px; }\n.ui-icon-arrow-1-w { background-position: -96px -32px; }\n.ui-icon-arrow-1-nw { background-position: -112px -32px; }\n.ui-icon-arrow-2-n-s { background-position: -128px -32px; }\n.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }\n.ui-icon-arrow-2-e-w { background-position: -160px -32px; }\n.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }\n.ui-icon-arrowstop-1-n { background-position: -192px -32px; }\n.ui-icon-arrowstop-1-e { background-position: -208px -32px; }\n.ui-icon-arrowstop-1-s { background-position: -224px -32px; }\n.ui-icon-arrowstop-1-w { background-position: -240px -32px; }\n.ui-icon-arrowthick-1-n { background-position: 0 -48px; }\n.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }\n.ui-icon-arrowthick-1-e { background-position: -32px -48px; }\n.ui-icon-arrowthick-1-se { background-position: -48px -48px; }\n.ui-icon-arrowthick-1-s { background-position: -64px -48px; }\n.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }\n.ui-icon-arrowthick-1-w { background-position: -96px -48px; }\n.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }\n.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }\n.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }\n.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }\n.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }\n.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }\n.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }\n.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }\n.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }\n.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }\n.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }\n.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }\n.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }\n.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }\n.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }\n.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }\n.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }\n.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }\n.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }\n.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }\n.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }\n.ui-icon-arrow-4 { background-position: 0 -80px; }\n.ui-icon-arrow-4-diag { background-position: -16px -80px; }\n.ui-icon-extlink { background-position: -32px -80px; }\n.ui-icon-newwin { background-position: -48px -80px; }\n.ui-icon-refresh { background-position: -64px -80px; }\n.ui-icon-shuffle { background-position: -80px -80px; }\n.ui-icon-transfer-e-w { background-position: -96px -80px; }\n.ui-icon-transferthick-e-w { background-position: -112px -80px; }\n.ui-icon-folder-collapsed { background-position: 0 -96px; }\n.ui-icon-folder-open { background-position: -16px -96px; }\n.ui-icon-document { background-position: -32px -96px; }\n.ui-icon-document-b { background-position: -48px -96px; }\n.ui-icon-note { background-position: -64px -96px; }\n.ui-icon-mail-closed { background-position: -80px -96px; }\n.ui-icon-mail-open { background-position: -96px -96px; }\n.ui-icon-suitcase { background-position: -112px -96px; }\n.ui-icon-comment { background-position: -128px -96px; }\n.ui-icon-person { background-position: -144px -96px; }\n.ui-icon-print { background-position: -160px -96px; }\n.ui-icon-trash { background-position: -176px -96px; }\n.ui-icon-locked { background-position: -192px -96px; }\n.ui-icon-unlocked { background-position: -208px -96px; }\n.ui-icon-bookmark { background-position: -224px -96px; }\n.ui-icon-tag { background-position: -240px -96px; }\n.ui-icon-home { background-position: 0 -112px; }\n.ui-icon-flag { background-position: -16px -112px; }\n.ui-icon-calendar { background-position: -32px -112px; }\n.ui-icon-cart { background-position: -48px -112px; }\n.ui-icon-pencil { background-position: -64px -112px; }\n.ui-icon-clock { background-position: -80px -112px; }\n.ui-icon-disk { background-position: -96px -112px; }\n.ui-icon-calculator { background-position: -112px -112px; }\n.ui-icon-zoomin { background-position: -128px -112px; }\n.ui-icon-zoomout { background-position: -144px -112px; }\n.ui-icon-search { background-position: -160px -112px; }\n.ui-icon-wrench { background-position: -176px -112px; }\n.ui-icon-gear { background-position: -192px -112px; }\n.ui-icon-heart { background-position: -208px -112px; }\n.ui-icon-star { background-position: -224px -112px; }\n.ui-icon-link { background-position: -240px -112px; }\n.ui-icon-cancel { background-position: 0 -128px; }\n.ui-icon-plus { background-position: -16px -128px; }\n.ui-icon-plusthick { background-position: -32px -128px; }\n.ui-icon-minus { background-position: -48px -128px; }\n.ui-icon-minusthick { background-position: -64px -128px; }\n.ui-icon-close { background-position: -80px -128px; }\n.ui-icon-closethick { background-position: -96px -128px; }\n.ui-icon-key { background-position: -112px -128px; }\n.ui-icon-lightbulb { background-position: -128px -128px; }\n.ui-icon-scissors { background-position: -144px -128px; }\n.ui-icon-clipboard { background-position: -160px -128px; }\n.ui-icon-copy { background-position: -176px -128px; }\n.ui-icon-contact { background-position: -192px -128px; }\n.ui-icon-image { background-position: -208px -128px; }\n.ui-icon-video { background-position: -224px -128px; }\n.ui-icon-script { background-position: -240px -128px; }\n.ui-icon-alert { background-position: 0 -144px; }\n.ui-icon-info { background-position: -16px -144px; }\n.ui-icon-notice { background-position: -32px -144px; }\n.ui-icon-help { background-position: -48px -144px; }\n.ui-icon-check { background-position: -64px -144px; }\n.ui-icon-bullet { background-position: -80px -144px; }\n.ui-icon-radio-off { background-position: -96px -144px; }\n.ui-icon-radio-on { background-position: -112px -144px; }\n.ui-icon-pin-w { background-position: -128px -144px; }\n.ui-icon-pin-s { background-position: -144px -144px; }\n.ui-icon-play { background-position: 0 -160px; }\n.ui-icon-pause { background-position: -16px -160px; }\n.ui-icon-seek-next { background-position: -32px -160px; }\n.ui-icon-seek-prev { background-position: -48px -160px; }\n.ui-icon-seek-end { background-position: -64px -160px; }\n.ui-icon-seek-start { background-position: -80px -160px; }\n/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */\n.ui-icon-seek-first { background-position: -80px -160px; }\n.ui-icon-stop { background-position: -96px -160px; }\n.ui-icon-eject { background-position: -112px -160px; }\n.ui-icon-volume-off { background-position: -128px -160px; }\n.ui-icon-volume-on { background-position: -144px -160px; }\n.ui-icon-power { background-position: 0 -176px; }\n.ui-icon-signal-diag { background-position: -16px -176px; }\n.ui-icon-signal { background-position: -32px -176px; }\n.ui-icon-battery-0 { background-position: -48px -176px; }\n.ui-icon-battery-1 { background-position: -64px -176px; }\n.ui-icon-battery-2 { background-position: -80px -176px; }\n.ui-icon-battery-3 { background-position: -96px -176px; }\n.ui-icon-circle-plus { background-position: 0 -192px; }\n.ui-icon-circle-minus { background-position: -16px -192px; }\n.ui-icon-circle-close { background-position: -32px -192px; }\n.ui-icon-circle-triangle-e { background-position: -48px -192px; }\n.ui-icon-circle-triangle-s { background-position: -64px -192px; }\n.ui-icon-circle-triangle-w { background-position: -80px -192px; }\n.ui-icon-circle-triangle-n { background-position: -96px -192px; }\n.ui-icon-circle-arrow-e { background-position: -112px -192px; }\n.ui-icon-circle-arrow-s { background-position: -128px -192px; }\n.ui-icon-circle-arrow-w { background-position: -144px -192px; }\n.ui-icon-circle-arrow-n { background-position: -160px -192px; }\n.ui-icon-circle-zoomin { background-position: -176px -192px; }\n.ui-icon-circle-zoomout { background-position: -192px -192px; }\n.ui-icon-circle-check { background-position: -208px -192px; }\n.ui-icon-circlesmall-plus { background-position: 0 -208px; }\n.ui-icon-circlesmall-minus { background-position: -16px -208px; }\n.ui-icon-circlesmall-close { background-position: -32px -208px; }\n.ui-icon-squaresmall-plus { background-position: -48px -208px; }\n.ui-icon-squaresmall-minus { background-position: -64px -208px; }\n.ui-icon-squaresmall-close { background-position: -80px -208px; }\n.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }\n.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }\n.ui-icon-grip-solid-vertical { background-position: -32px -224px; }\n.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }\n.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }\n.ui-icon-grip-diagonal-se { background-position: -80px -224px; }\n\n\n/* Misc visuals\n----------------------------------*/\n\n/* Corner radius */\n.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -khtml-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; }\n.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; -khtml-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; }\n.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; }\n.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; }\n\n/* Overlays */\n.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; }\n.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -khtml-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; }"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Controllers/HomeController.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Web.Mvc;\nusing SlabReconfigurationWebRole.Models;\n\nnamespace SlabReconfigurationWebRole.Controllers\n{\n    public class HomeController : Controller\n    {\n        [HttpGet]\n        public ActionResult Index()\n        {\n            return View();\n        }\n\n        [HttpGet]\n        public ActionResult Success()\n        {\n            return View();\n        }\n\n        [HttpPost]\n        public ActionResult SendMessage(MessageModel messageModel)\n        {\n            if (!this.ModelState.IsValid)\n            {\n                return View(\"Index\");\n            }\n\n            try\n            {\n                MvcApplication.MessageSender.SendMessage(messageModel.Recipient, messageModel.Message);\n            }\n            catch (InvalidOperationException e)\n            {\n                return View(\"Error\", (object)e.Message);\n            }\n\n            return RedirectToAction(\"Success\");\n        }\n\n    }\n}\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/EntLib.licenseheader",
    "content": "﻿extensions: designer.cs generated.cs\nextensions: .cs .cpp .h\n// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\n\nextensions: .aspx .ascx"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Events/QuickStartEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Web;\n\nnamespace SlabReconfigurationWebRole.Events\n{\n    [EventSource(Name = \"QuickStartEventSource\")]\n    public sealed class QuickStartEventSource : EventSource\n    {\n        private static readonly Lazy<QuickStartEventSource> log = new Lazy<QuickStartEventSource>(() => new QuickStartEventSource());\n\n        public static QuickStartEventSource Log\n        {\n            get { return log.Value; }\n        }\n\n        [Event(1, Level = EventLevel.Verbose)]\n        internal void SendingMessage(string recipient, string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(1, recipient, message);\n            }\n        }\n\n        [Event(2, Level = EventLevel.Informational)]\n        internal void MessageSent(string recipient)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(2, recipient);\n            }\n        }\n\n        [NonEvent]\n        internal void MessageSendingFailed(string recipient, Exception exception)\n        {\n            if (this.IsEnabled())\n            {\n                this.MessageSendingFailed(recipient, exception.ToString());\n            }\n        }\n\n        [Event(3, Level = EventLevel.Error)]\n        private void MessageSendingFailed(string recipient, string exceptionInformation)\n        {\n            this.WriteEvent(3, recipient, exceptionInformation);\n        }\n    }\n}"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Global.asax",
    "content": "﻿<%@ Application Codebehind=\"Global.asax.cs\" Inherits=\"SlabReconfigurationWebRole.MvcApplication\" Language=\"C#\" %>\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Global.asax.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Web.Http;\nusing System.Web.Mvc;\nusing System.Web.Optimization;\nusing System.Web.Routing;\nusing SlabReconfigurationWebRole.Messaging;\n\nnamespace SlabReconfigurationWebRole\n{\n    // Note: For instructions on enabling IIS6 or IIS7 classic mode, \n    // visit http://go.microsoft.com/?LinkId=9394801\n\n    public partial class MvcApplication : System.Web.HttpApplication\n    {\n        protected void Application_Start()\n        {\n            AreaRegistration.RegisterAllAreas();\n\n            WebApiConfig.Register(GlobalConfiguration.Configuration);\n            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);\n            RouteConfig.RegisterRoutes(RouteTable.Routes);\n            BundleConfig.RegisterBundles(BundleTable.Bundles);\n\n            this.InitializeDiagnostics();\n        }\n\n        private static readonly Lazy<IMessageSender> messageSender = new Lazy<IMessageSender>(() => new FakeMessageSender());\n\n        public static IMessageSender MessageSender\n        {\n            get { return messageSender.Value; }\n        }\n\n        partial void InitializeDiagnostics();\n    }\n}"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Global.asax.slab.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging;\nusing Microsoft.WindowsAzure.ServiceRuntime;\n\nnamespace SlabReconfigurationWebRole\n{\n    partial class MvcApplication\n    {\n        internal const string AzureLoggingConfigurationSettingName = \"azureLoggingConnectionString\";\n        internal const string AzureLoggingVerbositySettingName = \"azureLoggingVerbosity\";\n\n        private ObservableEventListener listener;\n\n        public MvcApplication()\n        {\n        }\n\n        partial void InitializeDiagnostics()\n        {\n            var connectionString = RoleEnvironment.GetConfigurationSettingValue(AzureLoggingConfigurationSettingName);\n\n            this.listener = new ObservableEventListener();\n            this.listener.LogToWindowsAzureTable(RoleEnvironment.CurrentRoleInstance.Id, connectionString, bufferingInterval: TimeSpan.FromSeconds(30));\n\n            this.SetupListener();\n            RoleEnvironment.Changed += RoleEnvironment_Changed;\n        }\n\n        void RoleEnvironment_Changed(object sender, RoleEnvironmentChangedEventArgs e)\n        {\n            // Using WAD for tracing how the verbosity is updated\n            Trace.TraceInformation(\"Updating instance\");\n\n            foreach (var settingChange in e.Changes.OfType<RoleEnvironmentConfigurationSettingChange>())\n            {\n                if (string.Equals(settingChange.ConfigurationSettingName, AzureLoggingVerbositySettingName, StringComparison.Ordinal))\n                {\n                    Trace.TraceInformation(\"Setting up listener after change\");\n\n                    this.SetupListener();\n                }\n            }\n        }\n\n        private void SetupListener()\n        {\n            EventLevel level;\n            if (Enum.TryParse<EventLevel>(RoleEnvironment.GetConfigurationSettingValue(AzureLoggingVerbositySettingName), out level))\n            {\n                Trace.TraceInformation(\"Updating verbosity to {0}\", level);\n\n                this.listener.EnableEvents(SlabReconfigurationWebRole.Events.QuickStartEventSource.Log, level);\n            }\n            else\n            {\n                Trace.TraceWarning(\"Invalid verbosity configuration\");\n            }\n        }\n\n        public override void Dispose()\n        {\n            base.Dispose();\n            if (this.listener != null)\n            {\n                this.listener.Dispose();\n            }\n        }\n    }\n}"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Messaging/FakeMessageSender.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing SlabReconfigurationWebRole.Events;\n\nnamespace SlabReconfigurationWebRole.Messaging\n{\n    public class FakeMessageSender : IMessageSender\n    {\n        private Random randomFailure;\n\n        public FakeMessageSender()\n        {\n            this.randomFailure = new Random();\n        }\n\n        public void SendMessage(string recipient, string message)\n        {\n            QuickStartEventSource.Log.SendingMessage(recipient, message);\n\n            try\n            {\n                if (this.randomFailure.Next(10) == 0)\n                {\n                    throw new InvalidOperationException(\"Random error sending message\");\n                }\n\n                QuickStartEventSource.Log.MessageSent(recipient);\n            }\n            catch (InvalidOperationException e)\n            {\n                QuickStartEventSource.Log.MessageSendingFailed(recipient, e);\n                throw;\n            }\n        }\n    }\n}"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Messaging/IMessageSender.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nnamespace SlabReconfigurationWebRole.Messaging\n{\n    public interface IMessageSender\n    {\n        void SendMessage(string recipient, string message);\n    }\n}"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Models/MessageModel.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.ComponentModel.DataAnnotations;\n\nnamespace SlabReconfigurationWebRole.Models\n{\n    public class MessageModel\n    {\n        [Required]\n        [MaxLength(20)]\n        public string Recipient { get; set; }\n\n        [Required]\n        [MaxLength(200)]\n        public string Message { get; set; }\n    }\n}"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Properties/AssemblyInfo.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Information about an assembly is controlled through the following \n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(\"SlabReconfigurationWebRole\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"\")]\n[assembly: AssemblyProduct(\"SlabReconfigurationWebRole\")]\n[assembly: AssemblyCopyright(\"Copyright ©  2013\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// Setting ComVisible to false makes the types in this assembly not visible \n// to COM components.  If you need to access a type in this assembly from \n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n// The following GUID is for the ID of the typelib if this project is exposed to COM\n[assembly: Guid(\"53699e7f-bd7a-4e87-9c37-572daf69b72a\")]\n\n// Version information for an assembly consists of the following four values:\n//\n//      Major Version\n//      Minor Version \n//      Build Number\n//      Revision\n//\n// You can specify all the values or you can default the Revision and Build Numbers \n// by using the '*' as shown below:\n[assembly: AssemblyVersion(\"1.0.0.0\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Scripts/jquery-1.8.2.intellisense.js",
    "content": "intellisense.annotate(jQuery, {\n  'ajax': function() {\n    /// <signature>\n    ///   <summary>Perform an asynchronous HTTP (Ajax) request.</summary>\n    ///   <param name=\"url\" type=\"String\">A string containing the URL to which the request is sent.</param>\n    ///   <param name=\"settings\" type=\"Object\">A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup(). See jQuery.ajax( settings ) below for a complete list of all settings.</param>\n    ///   <returns type=\"jqXHR\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Perform an asynchronous HTTP (Ajax) request.</summary>\n    ///   <param name=\"settings\" type=\"Object\">A set of key/value pairs that configure the Ajax request. All settings are optional. A default can be set for any option with $.ajaxSetup().</param>\n    ///   <returns type=\"jqXHR\" />\n    /// </signature>\n  },\n  'ajaxPrefilter': function() {\n    /// <signature>\n    ///   <summary>Handle custom Ajax options or modify existing options before each request is sent and before they are processed by $.ajax().</summary>\n    ///   <param name=\"dataTypes\" type=\"String\">An optional string containing one or more space-separated dataTypes</param>\n    ///   <param name=\"handler(options, originalOptions, jqXHR)\" type=\"Function\">A handler to set default values for future Ajax requests.</param>\n    /// </signature>\n  },\n  'ajaxSetup': function() {\n    /// <signature>\n    ///   <summary>Set default values for future Ajax requests.</summary>\n    ///   <param name=\"options\" type=\"Object\">A set of key/value pairs that configure the default Ajax request. All options are optional.</param>\n    /// </signature>\n  },\n  'boxModel': function() {\n    /// <summary>Deprecated in jQuery 1.3 (see jQuery.support). States if the current page, in the user's browser, is being rendered using the W3C CSS Box Model.</summary>\n    /// <returns type=\"Boolean\" />\n  },\n  'browser': function() {\n    /// <summary>Contains flags for the useragent, read from navigator.userAgent. We recommend against using this property; please try to use feature detection instead (see jQuery.support). jQuery.browser may be moved to a plugin in a future release of jQuery.</summary>\n    /// <returns type=\"Map\" />\n  },\n  'browser.version': function() {\n    /// <summary>The version number of the rendering engine for the user's browser.</summary>\n    /// <returns type=\"String\" />\n  },\n  'Callbacks': function() {\n    /// <signature>\n    ///   <summary>A multi-purpose callbacks list object that provides a powerful way to manage callback lists.</summary>\n    ///   <param name=\"flags\" type=\"String\">An optional list of space-separated flags that change how the callback list behaves.</param>\n    /// </signature>\n  },\n  'contains': function() {\n    /// <signature>\n    ///   <summary>Check to see if a DOM element is within another DOM element.</summary>\n    ///   <param name=\"container\" type=\"Element\">The DOM element that may contain the other element.</param>\n    ///   <param name=\"contained\" type=\"Element\">The DOM element that may be contained by the other element.</param>\n    ///   <returns type=\"Boolean\" />\n    /// </signature>\n  },\n  'cssHooks': function() {\n    /// <summary>Hook directly into jQuery to override how particular CSS properties are retrieved or set, normalize CSS property naming, or create custom properties.</summary>\n    /// <returns type=\"Object\" />\n  },\n  'data': function() {\n    /// <signature>\n    ///   <summary>Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element.</summary>\n    ///   <param name=\"element\" type=\"Element\">The DOM element to query for the data.</param>\n    ///   <param name=\"key\" type=\"String\">Name of the data stored.</param>\n    ///   <returns type=\"Object\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Returns value at named data store for the element, as set by jQuery.data(element, name, value), or the full data store for the element.</summary>\n    ///   <param name=\"element\" type=\"Element\">The DOM element to query for the data.</param>\n    ///   <returns type=\"Object\" />\n    /// </signature>\n  },\n  'dequeue': function() {\n    /// <signature>\n    ///   <summary>Execute the next function on the queue for the matched element.</summary>\n    ///   <param name=\"element\" type=\"Element\">A DOM element from which to remove and execute a queued function.</param>\n    ///   <param name=\"queueName\" type=\"String\">A string containing the name of the queue. Defaults to fx, the standard effects queue.</param>\n    /// </signature>\n  },\n  'each': function() {\n    /// <signature>\n    ///   <summary>A generic iterator function, which can be used to seamlessly iterate over both objects and arrays. Arrays and array-like objects with a length property (such as a function's arguments object) are iterated by numeric index, from 0 to length-1. Other objects are iterated via their named properties.</summary>\n    ///   <param name=\"collection\" type=\"Object\">The object or array to iterate over.</param>\n    ///   <param name=\"callback(indexInArray, valueOfElement)\" type=\"Function\">The function that will be executed on every object.</param>\n    ///   <returns type=\"Object\" />\n    /// </signature>\n  },\n  'error': function() {\n    /// <signature>\n    ///   <summary>Takes a string and throws an exception containing it.</summary>\n    ///   <param name=\"message\" type=\"String\">The message to send out.</param>\n    /// </signature>\n  },\n  'extend': function() {\n    /// <signature>\n    ///   <summary>Merge the contents of two or more objects together into the first object.</summary>\n    ///   <param name=\"target\" type=\"Object\">An object that will receive the new properties if additional objects are passed in or that will extend the jQuery namespace if it is the sole argument.</param>\n    ///   <param name=\"object1\" type=\"Object\">An object containing additional properties to merge in.</param>\n    ///   <param name=\"objectN\" type=\"Object\">Additional objects containing properties to merge in.</param>\n    ///   <returns type=\"Object\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Merge the contents of two or more objects together into the first object.</summary>\n    ///   <param name=\"deep\" type=\"Boolean\">If true, the merge becomes recursive (aka. deep copy).</param>\n    ///   <param name=\"target\" type=\"Object\">The object to extend. It will receive the new properties.</param>\n    ///   <param name=\"object1\" type=\"Object\">An object containing additional properties to merge in.</param>\n    ///   <param name=\"objectN\" type=\"Object\">Additional objects containing properties to merge in.</param>\n    ///   <returns type=\"Object\" />\n    /// </signature>\n  },\n  'get': function() {\n    /// <signature>\n    ///   <summary>Load data from the server using a HTTP GET request.</summary>\n    ///   <param name=\"url\" type=\"String\">A string containing the URL to which the request is sent.</param>\n    ///   <param name=\"data\" type=\"String\">A map or string that is sent to the server with the request.</param>\n    ///   <param name=\"success(data, textStatus, jqXHR)\" type=\"Function\">A callback function that is executed if the request succeeds.</param>\n    ///   <param name=\"dataType\" type=\"String\">The type of data expected from the server. Default: Intelligent Guess (xml, json, script, or html).</param>\n    ///   <returns type=\"jqXHR\" />\n    /// </signature>\n  },\n  'getJSON': function() {\n    /// <signature>\n    ///   <summary>Load JSON-encoded data from the server using a GET HTTP request.</summary>\n    ///   <param name=\"url\" type=\"String\">A string containing the URL to which the request is sent.</param>\n    ///   <param name=\"data\" type=\"Object\">A map or string that is sent to the server with the request.</param>\n    ///   <param name=\"success(data, textStatus, jqXHR)\" type=\"Function\">A callback function that is executed if the request succeeds.</param>\n    ///   <returns type=\"jqXHR\" />\n    /// </signature>\n  },\n  'getScript': function() {\n    /// <signature>\n    ///   <summary>Load a JavaScript file from the server using a GET HTTP request, then execute it.</summary>\n    ///   <param name=\"url\" type=\"String\">A string containing the URL to which the request is sent.</param>\n    ///   <param name=\"success(script, textStatus, jqXHR)\" type=\"Function\">A callback function that is executed if the request succeeds.</param>\n    ///   <returns type=\"jqXHR\" />\n    /// </signature>\n  },\n  'globalEval': function() {\n    /// <signature>\n    ///   <summary>Execute some JavaScript code globally.</summary>\n    ///   <param name=\"code\" type=\"String\">The JavaScript code to execute.</param>\n    /// </signature>\n  },\n  'grep': function() {\n    /// <signature>\n    ///   <summary>Finds the elements of an array which satisfy a filter function. The original array is not affected.</summary>\n    ///   <param name=\"array\" type=\"Array\">The array to search through.</param>\n    ///   <param name=\"function(elementOfArray, indexInArray)\" type=\"Function\">The function to process each item against.  The first argument to the function is the item, and the second argument is the index.  The function should return a Boolean value.  this will be the global window object.</param>\n    ///   <param name=\"invert\" type=\"Boolean\">If \"invert\" is false, or not provided, then the function returns an array consisting of all elements for which \"callback\" returns true.  If \"invert\" is true, then the function returns an array consisting of all elements for which \"callback\" returns false.</param>\n    ///   <returns type=\"Array\" />\n    /// </signature>\n  },\n  'hasData': function() {\n    /// <signature>\n    ///   <summary>Determine whether an element has any jQuery data associated with it.</summary>\n    ///   <param name=\"element\" type=\"Element\">A DOM element to be checked for data.</param>\n    ///   <returns type=\"Boolean\" />\n    /// </signature>\n  },\n  'holdReady': function() {\n    /// <signature>\n    ///   <summary>Holds or releases the execution of jQuery's ready event.</summary>\n    ///   <param name=\"hold\" type=\"Boolean\">Indicates whether the ready hold is being requested or released</param>\n    /// </signature>\n  },\n  'inArray': function() {\n    /// <signature>\n    ///   <summary>Search for a specified value within an array and return its index (or -1 if not found).</summary>\n    ///   <param name=\"value\" type=\"Object\">The value to search for.</param>\n    ///   <param name=\"array\" type=\"Array\">An array through which to search.</param>\n    ///   <param name=\"fromIndex\" type=\"Number\">The index of the array at which to begin the search. The default is 0, which will search the whole array.</param>\n    ///   <returns type=\"Number\" />\n    /// </signature>\n  },\n  'isArray': function() {\n    /// <signature>\n    ///   <summary>Determine whether the argument is an array.</summary>\n    ///   <param name=\"obj\" type=\"Object\">Object to test whether or not it is an array.</param>\n    ///   <returns type=\"boolean\" />\n    /// </signature>\n  },\n  'isEmptyObject': function() {\n    /// <signature>\n    ///   <summary>Check to see if an object is empty (contains no properties).</summary>\n    ///   <param name=\"object\" type=\"Object\">The object that will be checked to see if it's empty.</param>\n    ///   <returns type=\"Boolean\" />\n    /// </signature>\n  },\n  'isFunction': function() {\n    /// <signature>\n    ///   <summary>Determine if the argument passed is a Javascript function object.</summary>\n    ///   <param name=\"obj\" type=\"Object\">Object to test whether or not it is a function.</param>\n    ///   <returns type=\"boolean\" />\n    /// </signature>\n  },\n  'isNumeric': function() {\n    /// <signature>\n    ///   <summary>Determines whether its argument is a number.</summary>\n    ///   <param name=\"value\" type=\"Object\">The value to be tested.</param>\n    ///   <returns type=\"Boolean\" />\n    /// </signature>\n  },\n  'isPlainObject': function() {\n    /// <signature>\n    ///   <summary>Check to see if an object is a plain object (created using \"{}\" or \"new Object\").</summary>\n    ///   <param name=\"object\" type=\"Object\">The object that will be checked to see if it's a plain object.</param>\n    ///   <returns type=\"Boolean\" />\n    /// </signature>\n  },\n  'isWindow': function() {\n    /// <signature>\n    ///   <summary>Determine whether the argument is a window.</summary>\n    ///   <param name=\"obj\" type=\"Object\">Object to test whether or not it is a window.</param>\n    ///   <returns type=\"boolean\" />\n    /// </signature>\n  },\n  'isXMLDoc': function() {\n    /// <signature>\n    ///   <summary>Check to see if a DOM node is within an XML document (or is an XML document).</summary>\n    ///   <param name=\"node\" type=\"Element\">The DOM node that will be checked to see if it's in an XML document.</param>\n    ///   <returns type=\"Boolean\" />\n    /// </signature>\n  },\n  'makeArray': function() {\n    /// <signature>\n    ///   <summary>Convert an array-like object into a true JavaScript array.</summary>\n    ///   <param name=\"obj\" type=\"Object\">Any object to turn into a native Array.</param>\n    ///   <returns type=\"Array\" />\n    /// </signature>\n  },\n  'map': function() {\n    /// <signature>\n    ///   <summary>Translate all items in an array or object to new array of items.</summary>\n    ///   <param name=\"array\" type=\"Array\">The Array to translate.</param>\n    ///   <param name=\"callback(elementOfArray, indexInArray)\" type=\"Function\">The function to process each item against.  The first argument to the function is the array item, the second argument is the index in array The function can return any value. Within the function, this refers to the global (window) object.</param>\n    ///   <returns type=\"Array\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Translate all items in an array or object to new array of items.</summary>\n    ///   <param name=\"arrayOrObject\" type=\"Object\">The Array or Object to translate.</param>\n    ///   <param name=\"callback( value, indexOrKey )\" type=\"Function\">The function to process each item against.  The first argument to the function is the value; the second argument is the index or key of the array or object property. The function can return any value to add to the array. A returned array will be flattened into the resulting array. Within the function, this refers to the global (window) object.</param>\n    ///   <returns type=\"Array\" />\n    /// </signature>\n  },\n  'merge': function() {\n    /// <signature>\n    ///   <summary>Merge the contents of two arrays together into the first array.</summary>\n    ///   <param name=\"first\" type=\"Array\">The first array to merge, the elements of second added.</param>\n    ///   <param name=\"second\" type=\"Array\">The second array to merge into the first, unaltered.</param>\n    ///   <returns type=\"Array\" />\n    /// </signature>\n  },\n  'noConflict': function() {\n    /// <signature>\n    ///   <summary>Relinquish jQuery's control of the $ variable.</summary>\n    ///   <param name=\"removeAll\" type=\"Boolean\">A Boolean indicating whether to remove all jQuery variables from the global scope (including jQuery itself).</param>\n    ///   <returns type=\"Object\" />\n    /// </signature>\n  },\n  'noop': function() {\n    /// <summary>An empty function.</summary>\n    /// <returns type=\"Function\" />\n  },\n  'now': function() {\n    /// <summary>Return a number representing the current time.</summary>\n    /// <returns type=\"Number\" />\n  },\n  'param': function() {\n    /// <signature>\n    ///   <summary>Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request.</summary>\n    ///   <param name=\"obj\" type=\"Object\">An array or object to serialize.</param>\n    ///   <returns type=\"String\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Create a serialized representation of an array or object, suitable for use in a URL query string or Ajax request.</summary>\n    ///   <param name=\"obj\" type=\"Object\">An array or object to serialize.</param>\n    ///   <param name=\"traditional\" type=\"Boolean\">A Boolean indicating whether to perform a traditional \"shallow\" serialization.</param>\n    ///   <returns type=\"String\" />\n    /// </signature>\n  },\n  'parseJSON': function() {\n    /// <signature>\n    ///   <summary>Takes a well-formed JSON string and returns the resulting JavaScript object.</summary>\n    ///   <param name=\"json\" type=\"String\">The JSON string to parse.</param>\n    ///   <returns type=\"Object\" />\n    /// </signature>\n  },\n  'parseXML': function() {\n    /// <signature>\n    ///   <summary>Parses a string into an XML document.</summary>\n    ///   <param name=\"data\" type=\"String\">a well-formed XML string to be parsed</param>\n    ///   <returns type=\"XMLDocument\" />\n    /// </signature>\n  },\n  'post': function() {\n    /// <signature>\n    ///   <summary>Load data from the server using a HTTP POST request.</summary>\n    ///   <param name=\"url\" type=\"String\">A string containing the URL to which the request is sent.</param>\n    ///   <param name=\"data\" type=\"String\">A map or string that is sent to the server with the request.</param>\n    ///   <param name=\"success(data, textStatus, jqXHR)\" type=\"Function\">A callback function that is executed if the request succeeds.</param>\n    ///   <param name=\"dataType\" type=\"String\">The type of data expected from the server. Default: Intelligent Guess (xml, json, script, text, html).</param>\n    ///   <returns type=\"jqXHR\" />\n    /// </signature>\n  },\n  'proxy': function() {\n    /// <signature>\n    ///   <summary>Takes a function and returns a new one that will always have a particular context.</summary>\n    ///   <param name=\"function\" type=\"Function\">The function whose context will be changed.</param>\n    ///   <param name=\"context\" type=\"Object\">The object to which the context (this) of the function should be set.</param>\n    ///   <returns type=\"Function\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Takes a function and returns a new one that will always have a particular context.</summary>\n    ///   <param name=\"context\" type=\"Object\">The object to which the context of the function should be set.</param>\n    ///   <param name=\"name\" type=\"String\">The name of the function whose context will be changed (should be a property of the context object).</param>\n    ///   <returns type=\"Function\" />\n    /// </signature>\n  },\n  'queue': function() {\n    /// <signature>\n    ///   <summary>Manipulate the queue of functions to be executed on the matched element.</summary>\n    ///   <param name=\"element\" type=\"Element\">A DOM element where the array of queued functions is attached.</param>\n    ///   <param name=\"queueName\" type=\"String\">A string containing the name of the queue. Defaults to fx, the standard effects queue.</param>\n    ///   <param name=\"newQueue\" type=\"Array\">An array of functions to replace the current queue contents.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Manipulate the queue of functions to be executed on the matched element.</summary>\n    ///   <param name=\"element\" type=\"Element\">A DOM element on which to add a queued function.</param>\n    ///   <param name=\"queueName\" type=\"String\">A string containing the name of the queue. Defaults to fx, the standard effects queue.</param>\n    ///   <param name=\"callback()\" type=\"Function\">The new function to add to the queue.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'removeData': function() {\n    /// <signature>\n    ///   <summary>Remove a previously-stored piece of data.</summary>\n    ///   <param name=\"element\" type=\"Element\">A DOM element from which to remove data.</param>\n    ///   <param name=\"name\" type=\"String\">A string naming the piece of data to remove.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'sub': function() {\n    /// <summary>Creates a new copy of jQuery whose properties and methods can be modified without affecting the original jQuery object.</summary>\n    /// <returns type=\"jQuery\" />\n  },\n  'support': function() {\n    /// <summary>A collection of properties that represent the presence of different browser features or bugs. Primarily intended for jQuery's internal use; specific properties may be removed when they are no longer needed internally to improve page startup performance.</summary>\n    /// <returns type=\"Object\" />\n  },\n  'trim': function() {\n    /// <signature>\n    ///   <summary>Remove the whitespace from the beginning and end of a string.</summary>\n    ///   <param name=\"str\" type=\"String\">The string to trim.</param>\n    ///   <returns type=\"String\" />\n    /// </signature>\n  },\n  'type': function() {\n    /// <signature>\n    ///   <summary>Determine the internal JavaScript [[Class]] of an object.</summary>\n    ///   <param name=\"obj\" type=\"Object\">Object to get the internal JavaScript [[Class]] of.</param>\n    ///   <returns type=\"String\" />\n    /// </signature>\n  },\n  'unique': function() {\n    /// <signature>\n    ///   <summary>Sorts an array of DOM elements, in place, with the duplicates removed. Note that this only works on arrays of DOM elements, not strings or numbers.</summary>\n    ///   <param name=\"array\" type=\"Array\">The Array of DOM elements.</param>\n    ///   <returns type=\"Array\" />\n    /// </signature>\n  },\n  'when': function() {\n    /// <signature>\n    ///   <summary>Provides a way to execute callback functions based on one or more objects, usually Deferred objects that represent asynchronous events.</summary>\n    ///   <param name=\"deferreds\" type=\"Deferred\">One or more Deferred objects, or plain JavaScript objects.</param>\n    ///   <returns type=\"Promise\" />\n    /// </signature>\n  },\n});\n\nvar _1228819969 = jQuery.Callbacks;\njQuery.Callbacks = function(flags) {\nvar _object = _1228819969(flags);\nintellisense.annotate(_object, {\n  'add': function() {\n    /// <signature>\n    ///   <summary>Add a callback or a collection of callbacks to a callback list.</summary>\n    ///   <param name=\"callbacks\" type=\"Function\">A function, or array of functions, that are to be added to the callback list.</param>\n    /// </signature>\n  },\n  'disable': function() {\n    /// <summary>Disable a callback list from doing anything more.</summary>\n  },\n  'empty': function() {\n    /// <summary>Remove all of the callbacks from a list.</summary>\n  },\n  'fire': function() {\n    /// <signature>\n    ///   <summary>Call all of the callbacks with the given arguments</summary>\n    ///   <param name=\"arguments\" type=\"\">The argument or list of arguments to pass back to the callback list.</param>\n    /// </signature>\n  },\n  'fired': function() {\n    /// <summary>Determine if the callbacks have already been called at least once.</summary>\n    /// <returns type=\"Boolean\" />\n  },\n  'fireWith': function() {\n    /// <signature>\n    ///   <summary>Call all callbacks in a list with the given context and arguments.</summary>\n    ///   <param name=\"context\" type=\"\">A reference to the context in which the callbacks in the list should be fired.</param>\n    ///   <param name=\"args\" type=\"\">An argument, or array of arguments, to pass to the callbacks in the list.</param>\n    /// </signature>\n  },\n  'has': function() {\n    /// <signature>\n    ///   <summary>Determine whether a supplied callback is in a list</summary>\n    ///   <param name=\"callback\" type=\"Function\">The callback to search for.</param>\n    ///   <returns type=\"Boolean\" />\n    /// </signature>\n  },\n  'lock': function() {\n    /// <summary>Lock a callback list in its current state.</summary>\n  },\n  'locked': function() {\n    /// <summary>Determine if the callbacks list has been locked.</summary>\n    /// <returns type=\"Boolean\" />\n  },\n  'remove': function() {\n    /// <signature>\n    ///   <summary>Remove a callback or a collection of callbacks from a callback list.</summary>\n    ///   <param name=\"callbacks\" type=\"Function\">A function, or array of functions, that are to be removed from the callback list.</param>\n    /// </signature>\n  },\n});\n\nreturn _object;\n};\nintellisense.redirectDefinition(jQuery.Callbacks, _1228819969);\n\nvar _731531622 = jQuery.Deferred;\njQuery.Deferred = function(func) {\nvar _object = _731531622(func);\nintellisense.annotate(_object, {\n  'always': function() {\n    /// <signature>\n    ///   <summary>Add handlers to be called when the Deferred object is either resolved or rejected.</summary>\n    ///   <param name=\"alwaysCallbacks\" type=\"Function\">A function, or array of functions, that is called when the Deferred is resolved or rejected.</param>\n    ///   <param name=\"alwaysCallbacks\" type=\"Function\">Optional additional functions, or arrays of functions, that are called when the Deferred is resolved or rejected.</param>\n    ///   <returns type=\"Deferred\" />\n    /// </signature>\n  },\n  'done': function() {\n    /// <signature>\n    ///   <summary>Add handlers to be called when the Deferred object is resolved.</summary>\n    ///   <param name=\"doneCallbacks\" type=\"Function\">A function, or array of functions, that are called when the Deferred is resolved.</param>\n    ///   <param name=\"doneCallbacks\" type=\"Function\">Optional additional functions, or arrays of functions, that are called when the Deferred is resolved.</param>\n    ///   <returns type=\"Deferred\" />\n    /// </signature>\n  },\n  'fail': function() {\n    /// <signature>\n    ///   <summary>Add handlers to be called when the Deferred object is rejected.</summary>\n    ///   <param name=\"failCallbacks\" type=\"Function\">A function, or array of functions, that are called when the Deferred is rejected.</param>\n    ///   <param name=\"failCallbacks\" type=\"Function\">Optional additional functions, or arrays of functions, that are called when the Deferred is rejected.</param>\n    ///   <returns type=\"Deferred\" />\n    /// </signature>\n  },\n  'isRejected': function() {\n    /// <summary>Determine whether a Deferred object has been rejected.</summary>\n    /// <returns type=\"Boolean\" />\n  },\n  'isResolved': function() {\n    /// <summary>Determine whether a Deferred object has been resolved.</summary>\n    /// <returns type=\"Boolean\" />\n  },\n  'notify': function() {\n    /// <signature>\n    ///   <summary>Call the progressCallbacks on a Deferred object with the given args.</summary>\n    ///   <param name=\"args\" type=\"Object\">Optional arguments that are passed to the progressCallbacks.</param>\n    ///   <returns type=\"Deferred\" />\n    /// </signature>\n  },\n  'notifyWith': function() {\n    /// <signature>\n    ///   <summary>Call the progressCallbacks on a Deferred object with the given context and args.</summary>\n    ///   <param name=\"context\" type=\"Object\">Context passed to the progressCallbacks as the this object.</param>\n    ///   <param name=\"args\" type=\"Object\">Optional arguments that are passed to the progressCallbacks.</param>\n    ///   <returns type=\"Deferred\" />\n    /// </signature>\n  },\n  'pipe': function() {\n    /// <signature>\n    ///   <summary>Utility method to filter and/or chain Deferreds.</summary>\n    ///   <param name=\"doneFilter\" type=\"Function\">An optional function that is called when the Deferred is resolved.</param>\n    ///   <param name=\"failFilter\" type=\"Function\">An optional function that is called when the Deferred is rejected.</param>\n    ///   <returns type=\"Promise\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Utility method to filter and/or chain Deferreds.</summary>\n    ///   <param name=\"doneFilter\" type=\"Function\">An optional function that is called when the Deferred is resolved.</param>\n    ///   <param name=\"failFilter\" type=\"Function\">An optional function that is called when the Deferred is rejected.</param>\n    ///   <param name=\"progressFilter\" type=\"Function\">An optional function that is called when progress notifications are sent to the Deferred.</param>\n    ///   <returns type=\"Promise\" />\n    /// </signature>\n  },\n  'progress': function() {\n    /// <signature>\n    ///   <summary>Add handlers to be called when the Deferred object generates progress notifications.</summary>\n    ///   <param name=\"progressCallbacks\" type=\"Function\">A function, or array of functions, that is called when the Deferred generates progress notifications.</param>\n    ///   <returns type=\"Deferred\" />\n    /// </signature>\n  },\n  'promise': function() {\n    /// <signature>\n    ///   <summary>Return a Deferred's Promise object.</summary>\n    ///   <param name=\"target\" type=\"Object\">Object onto which the promise methods have to be attached</param>\n    ///   <returns type=\"Promise\" />\n    /// </signature>\n  },\n  'reject': function() {\n    /// <signature>\n    ///   <summary>Reject a Deferred object and call any failCallbacks with the given args.</summary>\n    ///   <param name=\"args\" type=\"Object\">Optional arguments that are passed to the failCallbacks.</param>\n    ///   <returns type=\"Deferred\" />\n    /// </signature>\n  },\n  'rejectWith': function() {\n    /// <signature>\n    ///   <summary>Reject a Deferred object and call any failCallbacks with the given context and args.</summary>\n    ///   <param name=\"context\" type=\"Object\">Context passed to the failCallbacks as the this object.</param>\n    ///   <param name=\"args\" type=\"Array\">An optional array of arguments that are passed to the failCallbacks.</param>\n    ///   <returns type=\"Deferred\" />\n    /// </signature>\n  },\n  'resolve': function() {\n    /// <signature>\n    ///   <summary>Resolve a Deferred object and call any doneCallbacks with the given args.</summary>\n    ///   <param name=\"args\" type=\"Object\">Optional arguments that are passed to the doneCallbacks.</param>\n    ///   <returns type=\"Deferred\" />\n    /// </signature>\n  },\n  'resolveWith': function() {\n    /// <signature>\n    ///   <summary>Resolve a Deferred object and call any doneCallbacks with the given context and args.</summary>\n    ///   <param name=\"context\" type=\"Object\">Context passed to the doneCallbacks as the this object.</param>\n    ///   <param name=\"args\" type=\"Array\">An optional array of arguments that are passed to the doneCallbacks.</param>\n    ///   <returns type=\"Deferred\" />\n    /// </signature>\n  },\n  'state': function() {\n    /// <summary>Determine the current state of a Deferred object.</summary>\n    /// <returns type=\"String\" />\n  },\n  'then': function() {\n    /// <signature>\n    ///   <summary>Add handlers to be called when the Deferred object is resolved or rejected.</summary>\n    ///   <param name=\"doneCallbacks\" type=\"Function\">A function, or array of functions, called when the Deferred is resolved.</param>\n    ///   <param name=\"failCallbacks\" type=\"Function\">A function, or array of functions, called when the Deferred is rejected.</param>\n    ///   <returns type=\"Deferred\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Add handlers to be called when the Deferred object is resolved or rejected.</summary>\n    ///   <param name=\"doneCallbacks\" type=\"Function\">A function, or array of functions, called when the Deferred is resolved.</param>\n    ///   <param name=\"failCallbacks\" type=\"Function\">A function, or array of functions, called when the Deferred is rejected.</param>\n    ///   <param name=\"progressCallbacks\" type=\"Function\">A function, or array of functions, called when the Deferred notifies progress.</param>\n    ///   <returns type=\"Deferred\" />\n    /// </signature>\n  },\n});\n\nreturn _object;\n};\nintellisense.redirectDefinition(jQuery.Callbacks, _731531622);\n\nintellisense.annotate(jQuery.Event.prototype, {\n  'currentTarget': function() {\n    /// <summary>The current DOM element within the event bubbling phase.</summary>\n    /// <returns type=\"Element\" />\n  },\n  'data': function() {\n    /// <summary>An optional data map passed to an event method when the current executing handler is bound.</summary>\n  },\n  'delegateTarget': function() {\n    /// <summary>The element where the currently-called jQuery event handler was attached.</summary>\n    /// <returns type=\"Element\" />\n  },\n  'isDefaultPrevented': function() {\n    /// <summary>Returns whether event.preventDefault() was ever called on this event object.</summary>\n    /// <returns type=\"Boolean\" />\n  },\n  'isImmediatePropagationStopped': function() {\n    /// <summary>Returns whether event.stopImmediatePropagation() was ever called on this event object.</summary>\n    /// <returns type=\"Boolean\" />\n  },\n  'isPropagationStopped': function() {\n    /// <summary>Returns whether event.stopPropagation() was ever called on this event object.</summary>\n    /// <returns type=\"Boolean\" />\n  },\n  'namespace': function() {\n    /// <summary>The namespace specified when the event was triggered.</summary>\n    /// <returns type=\"String\" />\n  },\n  'pageX': function() {\n    /// <summary>The mouse position relative to the left edge of the document.</summary>\n    /// <returns type=\"Number\" />\n  },\n  'pageY': function() {\n    /// <summary>The mouse position relative to the top edge of the document.</summary>\n    /// <returns type=\"Number\" />\n  },\n  'preventDefault': function() {\n    /// <summary>If this method is called, the default action of the event will not be triggered.</summary>\n  },\n  'relatedTarget': function() {\n    /// <summary>The other DOM element involved in the event, if any.</summary>\n    /// <returns type=\"Element\" />\n  },\n  'result': function() {\n    /// <summary>The last value returned by an event handler that was triggered by this event, unless the value was undefined.</summary>\n    /// <returns type=\"Object\" />\n  },\n  'stopImmediatePropagation': function() {\n    /// <summary>Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree.</summary>\n  },\n  'stopPropagation': function() {\n    /// <summary>Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.</summary>\n  },\n  'target': function() {\n    /// <summary>The DOM element that initiated the event.</summary>\n    /// <returns type=\"Element\" />\n  },\n  'timeStamp': function() {\n    /// <summary>The difference in milliseconds between the time the browser created the event and January 1, 1970.</summary>\n    /// <returns type=\"Number\" />\n  },\n  'type': function() {\n    /// <summary>Describes the nature of the event.</summary>\n    /// <returns type=\"String\" />\n  },\n  'which': function() {\n    /// <summary>For key or mouse events, this property indicates the specific key or button that was pressed.</summary>\n    /// <returns type=\"Number\" />\n  },\n});\n\nintellisense.annotate(jQuery.fn, {\n  'add': function() {\n    /// <signature>\n    ///   <summary>Add elements to the set of matched elements.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string representing a selector expression to find additional elements to add to the set of matched elements.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Add elements to the set of matched elements.</summary>\n    ///   <param name=\"elements\" type=\"Array\">One or more elements to add to the set of matched elements.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Add elements to the set of matched elements.</summary>\n    ///   <param name=\"html\" type=\"String\">An HTML fragment to add to the set of matched elements.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Add elements to the set of matched elements.</summary>\n    ///   <param name=\"jQuery object\" type=\"jQuery object \">An existing jQuery object to add to the set of matched elements.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Add elements to the set of matched elements.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string representing a selector expression to find additional elements to add to the set of matched elements.</param>\n    ///   <param name=\"context\" type=\"Element\">The point in the document at which the selector should begin matching; similar to the context argument of the $(selector, context) method.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'addClass': function() {\n    /// <signature>\n    ///   <summary>Adds the specified class(es) to each of the set of matched elements.</summary>\n    ///   <param name=\"className\" type=\"String\">One or more class names to be added to the class attribute of each matched element.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Adds the specified class(es) to each of the set of matched elements.</summary>\n    ///   <param name=\"function(index, currentClass)\" type=\"Function\">A function returning one or more space-separated class names to be added to the existing class name(s). Receives the index position of the element in the set and the existing class name(s) as arguments. Within the function, this refers to the current element in the set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'after': function() {\n    /// <signature>\n    ///   <summary>Insert content, specified by the parameter, after each element in the set of matched elements.</summary>\n    ///   <param name=\"content\" type=\"jQuery\">HTML string, DOM element, or jQuery object to insert after each element in the set of matched elements.</param>\n    ///   <param name=\"content\" type=\"jQuery\">One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Insert content, specified by the parameter, after each element in the set of matched elements.</summary>\n    ///   <param name=\"function(index)\" type=\"Function\">A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'ajaxComplete': function() {\n    /// <signature>\n    ///   <summary>Register a handler to be called when Ajax requests complete. This is an Ajax Event.</summary>\n    ///   <param name=\"handler(event, XMLHttpRequest, ajaxOptions)\" type=\"Function\">The function to be invoked.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'ajaxError': function() {\n    /// <signature>\n    ///   <summary>Register a handler to be called when Ajax requests complete with an error. This is an Ajax Event.</summary>\n    ///   <param name=\"handler(event, jqXHR, ajaxSettings, thrownError)\" type=\"Function\">The function to be invoked.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'ajaxSend': function() {\n    /// <signature>\n    ///   <summary>Attach a function to be executed before an Ajax request is sent. This is an Ajax Event.</summary>\n    ///   <param name=\"handler(event, jqXHR, ajaxOptions)\" type=\"Function\">The function to be invoked.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'ajaxStart': function() {\n    /// <signature>\n    ///   <summary>Register a handler to be called when the first Ajax request begins. This is an Ajax Event.</summary>\n    ///   <param name=\"handler()\" type=\"Function\">The function to be invoked.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'ajaxStop': function() {\n    /// <signature>\n    ///   <summary>Register a handler to be called when all Ajax requests have completed. This is an Ajax Event.</summary>\n    ///   <param name=\"handler()\" type=\"Function\">The function to be invoked.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'ajaxSuccess': function() {\n    /// <signature>\n    ///   <summary>Attach a function to be executed whenever an Ajax request completes successfully. This is an Ajax Event.</summary>\n    ///   <param name=\"handler(event, XMLHttpRequest, ajaxOptions)\" type=\"Function\">The function to be invoked.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'all': function() {\n    /// <summary>Selects all elements.</summary>\n  },\n  'andSelf': function() {\n    /// <summary>Add the previous set of elements on the stack to the current set.</summary>\n    /// <returns type=\"jQuery\" />\n  },\n  'animate': function() {\n    /// <signature>\n    ///   <summary>Perform a custom animation of a set of CSS properties.</summary>\n    ///   <param name=\"properties\" type=\"Object\">A map of CSS properties that the animation will move toward.</param>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"easing\" type=\"String\">A string indicating which easing function to use for the transition.</param>\n    ///   <param name=\"complete\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Perform a custom animation of a set of CSS properties.</summary>\n    ///   <param name=\"properties\" type=\"Object\">A map of CSS properties that the animation will move toward.</param>\n    ///   <param name=\"options\" type=\"Object\">A map of additional options to pass to the method. Supported keys:         duration: A string or number determining how long the animation will run.easing: A string indicating which easing function to use for the transition.complete: A function to call once the animation is complete.step: A function to be called after each step of the animation.queue: A Boolean indicating whether to place the animation in the effects queue. If false, the animation will begin immediately. As of jQuery 1.7, the queue option can also accept a string, in which case the animation is added to the queue represented by that string.specialEasing: A map of one or more of the CSS properties defined by the properties argument and their corresponding easing functions (added 1.4).</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'animated': function() {\n    /// <summary>Select all elements that are in the progress of an animation at the time the selector is run.</summary>\n  },\n  'append': function() {\n    /// <signature>\n    ///   <summary>Insert content, specified by the parameter, to the end of each element in the set of matched elements.</summary>\n    ///   <param name=\"content\" type=\"jQuery\">DOM element, HTML string, or jQuery object to insert at the end of each element in the set of matched elements.</param>\n    ///   <param name=\"content\" type=\"jQuery\">One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Insert content, specified by the parameter, to the end of each element in the set of matched elements.</summary>\n    ///   <param name=\"function(index, html)\" type=\"Function\">A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'appendTo': function() {\n    /// <signature>\n    ///   <summary>Insert every element in the set of matched elements to the end of the target.</summary>\n    ///   <param name=\"target\" type=\"jQuery\">A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted at the end of the element(s) specified by this parameter.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'attr': function() {\n    /// <signature>\n    ///   <summary>Set one or more attributes for the set of matched elements.</summary>\n    ///   <param name=\"attributeName\" type=\"String\">The name of the attribute to set.</param>\n    ///   <param name=\"value\" type=\"Number\">A value to set for the attribute.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Set one or more attributes for the set of matched elements.</summary>\n    ///   <param name=\"map\" type=\"Object\">A map of attribute-value pairs to set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Set one or more attributes for the set of matched elements.</summary>\n    ///   <param name=\"attributeName\" type=\"String\">The name of the attribute to set.</param>\n    ///   <param name=\"function(index, attr)\" type=\"Function\">A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old attribute value as arguments.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'attributeContains': function() {\n    /// <signature>\n    ///   <summary>Selects elements that have the specified attribute with a value containing the a given substring.</summary>\n    ///   <param name=\"attribute\" type=\"String\">An attribute name.</param>\n    ///   <param name=\"value\" type=\"String\">An attribute value. Can be either an unquoted single word or a quoted string.</param>\n    /// </signature>\n  },\n  'attributeContainsPrefix': function() {\n    /// <signature>\n    ///   <summary>Selects elements that have the specified attribute with a value either equal to a given string or starting with that string followed by a hyphen (-).</summary>\n    ///   <param name=\"attribute\" type=\"String\">An attribute name.</param>\n    ///   <param name=\"value\" type=\"String\">An attribute value. Can be either an unquoted single word or a quoted string.</param>\n    /// </signature>\n  },\n  'attributeContainsWord': function() {\n    /// <signature>\n    ///   <summary>Selects elements that have the specified attribute with a value containing a given word, delimited by spaces.</summary>\n    ///   <param name=\"attribute\" type=\"String\">An attribute name.</param>\n    ///   <param name=\"value\" type=\"String\">An attribute value. Can be either an unquoted single word or a quoted string.</param>\n    /// </signature>\n  },\n  'attributeEndsWith': function() {\n    /// <signature>\n    ///   <summary>Selects elements that have the specified attribute with a value ending exactly with a given string. The comparison is case sensitive.</summary>\n    ///   <param name=\"attribute\" type=\"String\">An attribute name.</param>\n    ///   <param name=\"value\" type=\"String\">An attribute value. Can be either an unquoted single word or a quoted string.</param>\n    /// </signature>\n  },\n  'attributeEquals': function() {\n    /// <signature>\n    ///   <summary>Selects elements that have the specified attribute with a value exactly equal to a certain value.</summary>\n    ///   <param name=\"attribute\" type=\"String\">An attribute name.</param>\n    ///   <param name=\"value\" type=\"String\">An attribute value. Can be either an unquoted single word or a quoted string.</param>\n    /// </signature>\n  },\n  'attributeHas': function() {\n    /// <signature>\n    ///   <summary>Selects elements that have the specified attribute, with any value.</summary>\n    ///   <param name=\"attribute\" type=\"String\">An attribute name.</param>\n    /// </signature>\n  },\n  'attributeMultiple': function() {\n    /// <signature>\n    ///   <summary>Matches elements that match all of the specified attribute filters.</summary>\n    ///   <param name=\"attributeFilter1\" type=\"String\">An attribute filter.</param>\n    ///   <param name=\"attributeFilter2\" type=\"String\">Another attribute filter, reducing the selection even more</param>\n    ///   <param name=\"attributeFilterN\" type=\"String\">As many more attribute filters as necessary</param>\n    /// </signature>\n  },\n  'attributeNotEqual': function() {\n    /// <signature>\n    ///   <summary>Select elements that either don't have the specified attribute, or do have the specified attribute but not with a certain value.</summary>\n    ///   <param name=\"attribute\" type=\"String\">An attribute name.</param>\n    ///   <param name=\"value\" type=\"String\">An attribute value. Can be either an unquoted single word or a quoted string.</param>\n    /// </signature>\n  },\n  'attributeStartsWith': function() {\n    /// <signature>\n    ///   <summary>Selects elements that have the specified attribute with a value beginning exactly with a given string.</summary>\n    ///   <param name=\"attribute\" type=\"String\">An attribute name.</param>\n    ///   <param name=\"value\" type=\"String\">An attribute value. Can be either an unquoted single word or a quoted string.</param>\n    /// </signature>\n  },\n  'before': function() {\n    /// <signature>\n    ///   <summary>Insert content, specified by the parameter, before each element in the set of matched elements.</summary>\n    ///   <param name=\"content\" type=\"jQuery\">HTML string, DOM element, or jQuery object to insert before each element in the set of matched elements.</param>\n    ///   <param name=\"content\" type=\"jQuery\">One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert before each element in the set of matched elements.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Insert content, specified by the parameter, before each element in the set of matched elements.</summary>\n    ///   <param name=\"function\" type=\"Function\">A function that returns an HTML string, DOM element(s), or jQuery object to insert before each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'bind': function() {\n    /// <signature>\n    ///   <summary>Attach a handler to an event for the elements.</summary>\n    ///   <param name=\"eventType\" type=\"String\">A string containing one or more DOM event types, such as \"click\" or \"submit,\" or custom event names.</param>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Attach a handler to an event for the elements.</summary>\n    ///   <param name=\"eventType\" type=\"String\">A string containing one or more DOM event types, such as \"click\" or \"submit,\" or custom event names.</param>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"preventBubble\" type=\"Boolean\">Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Attach a handler to an event for the elements.</summary>\n    ///   <param name=\"events\" type=\"Object\">A map of one or more DOM event types and functions to execute for them.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'blur': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"blur\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"blur\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'button': function() {\n    /// <summary>Selects all button elements and elements of type button.</summary>\n  },\n  'change': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"change\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"change\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'checkbox': function() {\n    /// <summary>Selects all elements of type checkbox.</summary>\n  },\n  'checked': function() {\n    /// <summary>Matches all elements that are checked.</summary>\n  },\n  'child': function() {\n    /// <signature>\n    ///   <summary>Selects all direct child elements specified by \"child\" of elements specified by \"parent\".</summary>\n    ///   <param name=\"parent\" type=\"String\">Any valid selector.</param>\n    ///   <param name=\"child\" type=\"String\">A selector to filter the child elements.</param>\n    /// </signature>\n  },\n  'children': function() {\n    /// <signature>\n    ///   <summary>Get the children of each element in the set of matched elements, optionally filtered by a selector.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'class': function() {\n    /// <signature>\n    ///   <summary>Selects all elements with the given class.</summary>\n    ///   <param name=\"class\" type=\"String\">A class to search for. An element can have multiple classes; only one of them must match.</param>\n    /// </signature>\n  },\n  'clearQueue': function() {\n    /// <signature>\n    ///   <summary>Remove from the queue all items that have not yet been run.</summary>\n    ///   <param name=\"queueName\" type=\"String\">A string containing the name of the queue. Defaults to fx, the standard effects queue.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'click': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"click\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"click\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'clone': function() {\n    /// <signature>\n    ///   <summary>Create a deep copy of the set of matched elements.</summary>\n    ///   <param name=\"withDataAndEvents\" type=\"Boolean\">A Boolean indicating whether event handlers should be copied along with the elements. As of jQuery 1.4, element data will be copied as well.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Create a deep copy of the set of matched elements.</summary>\n    ///   <param name=\"withDataAndEvents\" type=\"Boolean\">A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false. *In jQuery 1.5.0 the default value was incorrectly true; it was changed back to false in 1.5.1 and up.</param>\n    ///   <param name=\"deepWithDataAndEvents\" type=\"Boolean\">A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false).</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'closest': function() {\n    /// <signature>\n    ///   <summary>Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <param name=\"context\" type=\"Element\">A DOM element within which a matching element may be found. If no context is passed in then the context of the jQuery set will be used instead.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree.</summary>\n    ///   <param name=\"jQuery object\" type=\"jQuery\">A jQuery object to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Get the first element that matches the selector, beginning at the current element and progressing up through the DOM tree.</summary>\n    ///   <param name=\"element\" type=\"Element\">An element to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'contains': function() {\n    /// <signature>\n    ///   <summary>Select all elements that contain the specified text.</summary>\n    ///   <param name=\"text\" type=\"String\">A string of text to look for. It's case sensitive.</param>\n    /// </signature>\n  },\n  'contents': function() {\n    /// <summary>Get the children of each element in the set of matched elements, including text and comment nodes.</summary>\n    /// <returns type=\"jQuery\" />\n  },\n  'context': function() {\n    /// <summary>The DOM node context originally passed to jQuery(); if none was passed then context will likely be the document.</summary>\n    /// <returns type=\"Element\" />\n  },\n  'css': function() {\n    /// <signature>\n    ///   <summary>Set one or more CSS properties for the  set of matched elements.</summary>\n    ///   <param name=\"propertyName\" type=\"String\">A CSS property name.</param>\n    ///   <param name=\"value\" type=\"Number\">A value to set for the property.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Set one or more CSS properties for the  set of matched elements.</summary>\n    ///   <param name=\"propertyName\" type=\"String\">A CSS property name.</param>\n    ///   <param name=\"function(index, value)\" type=\"Function\">A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Set one or more CSS properties for the  set of matched elements.</summary>\n    ///   <param name=\"map\" type=\"Object\">A map of property-value pairs to set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'data': function() {\n    /// <signature>\n    ///   <summary>Store arbitrary data associated with the matched elements.</summary>\n    ///   <param name=\"key\" type=\"String\">A string naming the piece of data to set.</param>\n    ///   <param name=\"value\" type=\"Object\">The new data value; it can be any Javascript type including Array or Object.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Store arbitrary data associated with the matched elements.</summary>\n    ///   <param name=\"obj\" type=\"Object\">An object of key-value pairs of data to update.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'dblclick': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"dblclick\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"dblclick\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'delay': function() {\n    /// <signature>\n    ///   <summary>Set a timer to delay execution of subsequent items in the queue.</summary>\n    ///   <param name=\"duration\" type=\"Number\">An integer indicating the number of milliseconds to delay execution of the next item in the queue.</param>\n    ///   <param name=\"queueName\" type=\"String\">A string containing the name of the queue. Defaults to fx, the standard effects queue.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'delegate': function() {\n    /// <signature>\n    ///   <summary>Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.</summary>\n    ///   <param name=\"selector\" type=\"String\">A selector to filter the elements that trigger the event.</param>\n    ///   <param name=\"eventType\" type=\"String\">A string containing one or more space-separated JavaScript event types, such as \"click\" or \"keydown,\" or custom event names.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute at the time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.</summary>\n    ///   <param name=\"selector\" type=\"String\">A selector to filter the elements that trigger the event.</param>\n    ///   <param name=\"eventType\" type=\"String\">A string containing one or more space-separated JavaScript event types, such as \"click\" or \"keydown,\" or custom event names.</param>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute at the time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Attach a handler to one or more events for all elements that match the selector, now or in the future, based on a specific set of root elements.</summary>\n    ///   <param name=\"selector\" type=\"String\">A selector to filter the elements that trigger the event.</param>\n    ///   <param name=\"events\" type=\"Object\">A map of one or more event types and functions to execute for them.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'dequeue': function() {\n    /// <signature>\n    ///   <summary>Execute the next function on the queue for the matched elements.</summary>\n    ///   <param name=\"queueName\" type=\"String\">A string containing the name of the queue. Defaults to fx, the standard effects queue.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'descendant': function() {\n    /// <signature>\n    ///   <summary>Selects all elements that are descendants of a given ancestor.</summary>\n    ///   <param name=\"ancestor\" type=\"String\">Any valid selector.</param>\n    ///   <param name=\"descendant\" type=\"String\">A selector to filter the descendant elements.</param>\n    /// </signature>\n  },\n  'detach': function() {\n    /// <signature>\n    ///   <summary>Remove the set of matched elements from the DOM.</summary>\n    ///   <param name=\"selector\" type=\"String\">A selector expression that filters the set of matched elements to be removed.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'die': function() {\n    /// <signature>\n    ///   <summary>Remove an event handler previously attached using .live() from the elements.</summary>\n    ///   <param name=\"eventType\" type=\"String\">A string containing a JavaScript event type, such as click or keydown.</param>\n    ///   <param name=\"handler\" type=\"String\">The function that is no longer to be executed.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Remove an event handler previously attached using .live() from the elements.</summary>\n    ///   <param name=\"eventTypes\" type=\"Object\">A map of one or more event types, such as click or keydown and their corresponding functions that are no longer to be executed.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'disabled': function() {\n    /// <summary>Selects all elements that are disabled.</summary>\n  },\n  'each': function() {\n    /// <signature>\n    ///   <summary>Iterate over a jQuery object, executing a function for each matched element.</summary>\n    ///   <param name=\"function(index, Element)\" type=\"Function\">A function to execute for each matched element.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'element': function() {\n    /// <signature>\n    ///   <summary>Selects all elements with the given tag name.</summary>\n    ///   <param name=\"element\" type=\"String\">An element to search for. Refers to the tagName of DOM nodes.</param>\n    /// </signature>\n  },\n  'empty': function() {\n    /// <summary>Select all elements that have no children (including text nodes).</summary>\n  },\n  'enabled': function() {\n    /// <summary>Selects all elements that are enabled.</summary>\n  },\n  'end': function() {\n    /// <summary>End the most recent filtering operation in the current chain and return the set of matched elements to its previous state.</summary>\n    /// <returns type=\"jQuery\" />\n  },\n  'eq': function() {\n    /// <signature>\n    ///   <summary>Reduce the set of matched elements to the one at the specified index.</summary>\n    ///   <param name=\"index\" type=\"Number\">An integer indicating the 0-based position of the element.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Reduce the set of matched elements to the one at the specified index.</summary>\n    ///   <param name=\"-index\" type=\"Number\">An integer indicating the position of the element, counting backwards  from the last element in the set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'error': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"error\" JavaScript event.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute when the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"error\" JavaScript event.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'even': function() {\n    /// <summary>Selects even elements, zero-indexed.  See also odd.</summary>\n  },\n  'fadeIn': function() {\n    /// <signature>\n    ///   <summary>Display the matched elements by fading them to opaque.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Display the matched elements by fading them to opaque.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"easing\" type=\"String\">A string indicating which easing function to use for the transition.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'fadeOut': function() {\n    /// <signature>\n    ///   <summary>Hide the matched elements by fading them to transparent.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Hide the matched elements by fading them to transparent.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"easing\" type=\"String\">A string indicating which easing function to use for the transition.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'fadeTo': function() {\n    /// <signature>\n    ///   <summary>Adjust the opacity of the matched elements.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"opacity\" type=\"Number\">A number between 0 and 1 denoting the target opacity.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Adjust the opacity of the matched elements.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"opacity\" type=\"Number\">A number between 0 and 1 denoting the target opacity.</param>\n    ///   <param name=\"easing\" type=\"String\">A string indicating which easing function to use for the transition.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'fadeToggle': function() {\n    /// <signature>\n    ///   <summary>Display or hide the matched elements by animating their opacity.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"easing\" type=\"String\">A string indicating which easing function to use for the transition.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'file': function() {\n    /// <summary>Selects all elements of type file.</summary>\n  },\n  'filter': function() {\n    /// <signature>\n    ///   <summary>Reduce the set of matched elements to those that match the selector or pass the function's test.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to match the current set of elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Reduce the set of matched elements to those that match the selector or pass the function's test.</summary>\n    ///   <param name=\"function(index)\" type=\"Function\">A function used as a test for each element in the set. this is the current DOM element.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Reduce the set of matched elements to those that match the selector or pass the function's test.</summary>\n    ///   <param name=\"element\" type=\"Element\">An element to match the current set of elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Reduce the set of matched elements to those that match the selector or pass the function's test.</summary>\n    ///   <param name=\"jQuery object\" type=\"Object\">An existing jQuery object to match the current set of elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'find': function() {\n    /// <signature>\n    ///   <summary>Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.</summary>\n    ///   <param name=\"jQuery object\" type=\"Object\">A jQuery object to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.</summary>\n    ///   <param name=\"element\" type=\"Element\">An element to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'first': function() {\n    /// <summary>Selects the first matched element.</summary>\n  },\n  'first-child': function() {\n    /// <summary>Selects all elements that are the first child of their parent.</summary>\n  },\n  'focus': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"focus\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"focus\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'focusin': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"focusin\" event.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"focusin\" event.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'focusout': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"focusout\" JavaScript event.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"focusout\" JavaScript event.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'get': function() {\n    /// <signature>\n    ///   <summary>Retrieve the DOM elements matched by the jQuery object.</summary>\n    ///   <param name=\"index\" type=\"Number\">A zero-based integer indicating which element to retrieve.</param>\n    ///   <returns type=\"Element, Array\" />\n    /// </signature>\n  },\n  'gt': function() {\n    /// <signature>\n    ///   <summary>Select all elements at an index greater than index within the matched set.</summary>\n    ///   <param name=\"index\" type=\"Number\">Zero-based index.</param>\n    /// </signature>\n  },\n  'has': function() {\n    /// <signature>\n    ///   <summary>Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.</summary>\n    ///   <param name=\"contained\" type=\"Element\">A DOM element to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'hasClass': function() {\n    /// <signature>\n    ///   <summary>Determine whether any of the matched elements are assigned the given class.</summary>\n    ///   <param name=\"className\" type=\"String\">The class name to search for.</param>\n    ///   <returns type=\"Boolean\" />\n    /// </signature>\n  },\n  'header': function() {\n    /// <summary>Selects all elements that are headers, like h1, h2, h3 and so on.</summary>\n  },\n  'height': function() {\n    /// <signature>\n    ///   <summary>Set the CSS height of every matched element.</summary>\n    ///   <param name=\"value\" type=\"Number\">An integer representing the number of pixels, or an integer with an optional unit of measure appended (as a string).</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Set the CSS height of every matched element.</summary>\n    ///   <param name=\"function(index, height)\" type=\"Function\">A function returning the height to set. Receives the index position of the element in the set and the old height as arguments. Within the function, this refers to the current element in the set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'hidden': function() {\n    /// <summary>Selects all elements that are hidden.</summary>\n  },\n  'hide': function() {\n    /// <signature>\n    ///   <summary>Hide the matched elements.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Hide the matched elements.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"easing\" type=\"String\">A string indicating which easing function to use for the transition.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'hover': function() {\n    /// <signature>\n    ///   <summary>Bind two handlers to the matched elements, to be executed when the mouse pointer enters and leaves the elements.</summary>\n    ///   <param name=\"handlerIn(eventObject)\" type=\"Function\">A function to execute when the mouse pointer enters the element.</param>\n    ///   <param name=\"handlerOut(eventObject)\" type=\"Function\">A function to execute when the mouse pointer leaves the element.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'html': function() {\n    /// <signature>\n    ///   <summary>Set the HTML contents of each element in the set of matched elements.</summary>\n    ///   <param name=\"htmlString\" type=\"String\">A string of HTML to set as the content of each matched element.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Set the HTML contents of each element in the set of matched elements.</summary>\n    ///   <param name=\"function(index, oldhtml)\" type=\"Function\">A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'id': function() {\n    /// <signature>\n    ///   <summary>Selects a single element with the given id attribute.</summary>\n    ///   <param name=\"id\" type=\"String\">An ID to search for, specified via the id attribute of an element.</param>\n    /// </signature>\n  },\n  'image': function() {\n    /// <summary>Selects all elements of type image.</summary>\n  },\n  'index': function() {\n    /// <signature>\n    ///   <summary>Search for a given element from among the matched elements.</summary>\n    ///   <param name=\"selector\" type=\"String\">A selector representing a jQuery collection in which to look for an element.</param>\n    ///   <returns type=\"Number\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Search for a given element from among the matched elements.</summary>\n    ///   <param name=\"element\" type=\"jQuery\">The DOM element or first element within the jQuery object to look for.</param>\n    ///   <returns type=\"Number\" />\n    /// </signature>\n  },\n  'init': function() {\n    /// <signature>\n    ///   <summary>Accepts a string containing a CSS selector which is then used to match a set of elements.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression</param>\n    ///   <param name=\"context\" type=\"jQuery\">A DOM Element, Document, or jQuery to use as context</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Accepts a string containing a CSS selector which is then used to match a set of elements.</summary>\n    ///   <param name=\"element\" type=\"Element\">A DOM element to wrap in a jQuery object.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Accepts a string containing a CSS selector which is then used to match a set of elements.</summary>\n    ///   <param name=\"object\" type=\"Object\">A plain object to wrap in a jQuery object.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Accepts a string containing a CSS selector which is then used to match a set of elements.</summary>\n    ///   <param name=\"elementArray\" type=\"Array\">An array containing a set of DOM elements to wrap in a jQuery object.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Accepts a string containing a CSS selector which is then used to match a set of elements.</summary>\n    ///   <param name=\"jQuery object\" type=\"Object\">An existing jQuery object to clone.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'innerHeight': function() {\n    /// <summary>Get the current computed height for the first element in the set of matched elements, including padding but not border.</summary>\n    /// <returns type=\"Integer\" />\n  },\n  'innerWidth': function() {\n    /// <summary>Get the current computed width for the first element in the set of matched elements, including padding but not border.</summary>\n    /// <returns type=\"Integer\" />\n  },\n  'input': function() {\n    /// <summary>Selects all input, textarea, select and button elements.</summary>\n  },\n  'insertAfter': function() {\n    /// <signature>\n    ///   <summary>Insert every element in the set of matched elements after the target.</summary>\n    ///   <param name=\"target\" type=\"jQuery\">A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted after the element(s) specified by this parameter.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'insertBefore': function() {\n    /// <signature>\n    ///   <summary>Insert every element in the set of matched elements before the target.</summary>\n    ///   <param name=\"target\" type=\"jQuery\">A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted before the element(s) specified by this parameter.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'is': function() {\n    /// <signature>\n    ///   <summary>Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"Boolean\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.</summary>\n    ///   <param name=\"function(index)\" type=\"Function\">A function used as a test for the set of elements. It accepts one argument, index, which is the element's index in the jQuery collection.Within the function, this refers to the current DOM element.</param>\n    ///   <returns type=\"Boolean\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.</summary>\n    ///   <param name=\"jQuery object\" type=\"Object\">An existing jQuery object to match the current set of elements against.</param>\n    ///   <returns type=\"Boolean\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Check the current matched set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.</summary>\n    ///   <param name=\"element\" type=\"Element\">An element to match the current set of elements against.</param>\n    ///   <returns type=\"Boolean\" />\n    /// </signature>\n  },\n  'jquery': function() {\n    /// <summary>A string containing the jQuery version number.</summary>\n    /// <returns type=\"String\" />\n  },\n  'keydown': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"keydown\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"keydown\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'keypress': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"keypress\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"keypress\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'keyup': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"keyup\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"keyup\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'last': function() {\n    /// <summary>Selects the last matched element.</summary>\n  },\n  'last-child': function() {\n    /// <summary>Selects all elements that are the last child of their parent.</summary>\n  },\n  'length': function() {\n    /// <summary>The number of elements in the jQuery object.</summary>\n    /// <returns type=\"Number\" />\n  },\n  'live': function() {\n    /// <signature>\n    ///   <summary>Attach an event handler for all elements which match the current selector, now and in the future.</summary>\n    ///   <param name=\"events\" type=\"String\">A string containing a JavaScript event type, such as \"click\" or \"keydown.\" As of jQuery 1.4 the string can contain multiple, space-separated event types or custom event names.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute at the time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Attach an event handler for all elements which match the current selector, now and in the future.</summary>\n    ///   <param name=\"events\" type=\"String\">A string containing a JavaScript event type, such as \"click\" or \"keydown.\" As of jQuery 1.4 the string can contain multiple, space-separated event types or custom event names.</param>\n    ///   <param name=\"data\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute at the time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Attach an event handler for all elements which match the current selector, now and in the future.</summary>\n    ///   <param name=\"events-map\" type=\"Object\">A map of one or more JavaScript event types and functions to execute for them.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'load': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"load\" JavaScript event.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute when the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"load\" JavaScript event.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'lt': function() {\n    /// <signature>\n    ///   <summary>Select all elements at an index less than index within the matched set.</summary>\n    ///   <param name=\"index\" type=\"Number\">Zero-based index.</param>\n    /// </signature>\n  },\n  'map': function() {\n    /// <signature>\n    ///   <summary>Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.</summary>\n    ///   <param name=\"callback(index, domElement)\" type=\"Function\">A function object that will be invoked for each element in the current set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'mousedown': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"mousedown\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"mousedown\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'mouseenter': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to be fired when the mouse enters an element, or trigger that handler on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'mouseleave': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to be fired when the mouse leaves an element, or trigger that handler on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'mousemove': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"mousemove\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"mousemove\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'mouseout': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"mouseout\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"mouseout\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'mouseover': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"mouseover\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"mouseover\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'mouseup': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"mouseup\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"mouseup\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'multiple': function() {\n    /// <signature>\n    ///   <summary>Selects the combined results of all the specified selectors.</summary>\n    ///   <param name=\"selector1\" type=\"String\">Any valid selector.</param>\n    ///   <param name=\"selector2\" type=\"String\">Another valid selector.</param>\n    ///   <param name=\"selectorN\" type=\"String\">As many more valid selectors as you like.</param>\n    /// </signature>\n  },\n  'next': function() {\n    /// <signature>\n    ///   <summary>Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'next adjacent': function() {\n    /// <signature>\n    ///   <summary>Selects all next elements matching \"next\" that are immediately preceded by a sibling \"prev\".</summary>\n    ///   <param name=\"prev\" type=\"String\">Any valid selector.</param>\n    ///   <param name=\"next\" type=\"String\">A selector to match the element that is next to the first selector.</param>\n    /// </signature>\n  },\n  'next siblings': function() {\n    /// <signature>\n    ///   <summary>Selects all sibling elements that follow after the \"prev\" element, have the same parent, and match the filtering \"siblings\" selector.</summary>\n    ///   <param name=\"prev\" type=\"String\">Any valid selector.</param>\n    ///   <param name=\"siblings\" type=\"String\">A selector to filter elements that are the following siblings of the first selector.</param>\n    /// </signature>\n  },\n  'nextAll': function() {\n    /// <signature>\n    ///   <summary>Get all following siblings of each element in the set of matched elements, optionally filtered by a selector.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'nextUntil': function() {\n    /// <signature>\n    ///   <summary>Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to indicate where to stop matching following sibling elements.</param>\n    ///   <param name=\"filter\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Get all following siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object passed.</summary>\n    ///   <param name=\"element\" type=\"Element\">A DOM node or jQuery object indicating where to stop matching following sibling elements.</param>\n    ///   <param name=\"filter\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'not': function() {\n    /// <signature>\n    ///   <summary>Remove elements from the set of matched elements.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Remove elements from the set of matched elements.</summary>\n    ///   <param name=\"elements\" type=\"Array\">One or more DOM elements to remove from the matched set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Remove elements from the set of matched elements.</summary>\n    ///   <param name=\"function(index)\" type=\"Function\">A function used as a test for each element in the set. this is the current DOM element.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Remove elements from the set of matched elements.</summary>\n    ///   <param name=\"jQuery object\" type=\"Object\">An existing jQuery object to match the current set of elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'nth-child': function() {\n    /// <signature>\n    ///   <summary>Selects all elements that are the nth-child of their parent.</summary>\n    ///   <param name=\"index\" type=\"String\">The index of each child to match, starting with 1, the string even or odd, or an equation ( eg. :nth-child(even), :nth-child(4n) )</param>\n    /// </signature>\n  },\n  'odd': function() {\n    /// <summary>Selects odd elements, zero-indexed.  See also even.</summary>\n  },\n  'off': function() {\n    /// <signature>\n    ///   <summary>Remove an event handler.</summary>\n    ///   <param name=\"events\" type=\"String\">One or more space-separated event types and optional namespaces, or just namespaces, such as \"click\", \"keydown.myPlugin\", or \".myPlugin\".</param>\n    ///   <param name=\"selector\" type=\"String\">A selector which should match the one originally passed to .on() when attaching event handlers.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A handler function previously attached for the event(s), or the special value false.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Remove an event handler.</summary>\n    ///   <param name=\"events-map\" type=\"Object\">A map where the string keys represent one or more space-separated event types and optional namespaces, and the values represent handler functions previously attached for the event(s).</param>\n    ///   <param name=\"selector\" type=\"String\">A selector which should match the one originally passed to .on() when attaching event handlers.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'offset': function() {\n    /// <signature>\n    ///   <summary>Set the current coordinates of every element in the set of matched elements, relative to the document.</summary>\n    ///   <param name=\"coordinates\" type=\"Object\">An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Set the current coordinates of every element in the set of matched elements, relative to the document.</summary>\n    ///   <param name=\"function(index, coords)\" type=\"Function\">A function to return the coordinates to set. Receives the index of the element in the collection as the first argument and the current coordinates as the second argument. The function should return an object with the new top and left properties.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'offsetParent': function() {\n    /// <summary>Get the closest ancestor element that is positioned.</summary>\n    /// <returns type=\"jQuery\" />\n  },\n  'on': function() {\n    /// <signature>\n    ///   <summary>Attach an event handler function for one or more events to the selected elements.</summary>\n    ///   <param name=\"events\" type=\"String\">One or more space-separated event types and optional namespaces, such as \"click\" or \"keydown.myPlugin\".</param>\n    ///   <param name=\"selector\" type=\"String\">A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.</param>\n    ///   <param name=\"data\" type=\"Anything\">Data to be passed to the handler in event.data when an event is triggered.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Attach an event handler function for one or more events to the selected elements.</summary>\n    ///   <param name=\"events-map\" type=\"Object\">A map in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).</param>\n    ///   <param name=\"selector\" type=\"String\">A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element.</param>\n    ///   <param name=\"data\" type=\"Anything\">Data to be passed to the handler in event.data when an event occurs.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'one': function() {\n    /// <signature>\n    ///   <summary>Attach a handler to an event for the elements. The handler is executed at most once per element.</summary>\n    ///   <param name=\"events\" type=\"String\">A string containing one or more JavaScript event types, such as \"click\" or \"submit,\" or custom event names.</param>\n    ///   <param name=\"data\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute at the time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Attach a handler to an event for the elements. The handler is executed at most once per element.</summary>\n    ///   <param name=\"events\" type=\"String\">One or more space-separated event types and optional namespaces, such as \"click\" or \"keydown.myPlugin\".</param>\n    ///   <param name=\"selector\" type=\"String\">A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.</param>\n    ///   <param name=\"data\" type=\"Anything\">Data to be passed to the handler in event.data when an event is triggered.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Attach a handler to an event for the elements. The handler is executed at most once per element.</summary>\n    ///   <param name=\"events-map\" type=\"Object\">A map in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).</param>\n    ///   <param name=\"selector\" type=\"String\">A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element.</param>\n    ///   <param name=\"data\" type=\"Anything\">Data to be passed to the handler in event.data when an event occurs.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'only-child': function() {\n    /// <summary>Selects all elements that are the only child of their parent.</summary>\n  },\n  'outerHeight': function() {\n    /// <signature>\n    ///   <summary>Get the current computed height for the first element in the set of matched elements, including padding, border, and optionally margin. Returns an integer (without \"px\") representation of the value or null if called on an empty set of elements.</summary>\n    ///   <param name=\"includeMargin\" type=\"Boolean\">A Boolean indicating whether to include the element's margin in the calculation.</param>\n    ///   <returns type=\"Integer\" />\n    /// </signature>\n  },\n  'outerWidth': function() {\n    /// <signature>\n    ///   <summary>Get the current computed width for the first element in the set of matched elements, including padding and border.</summary>\n    ///   <param name=\"includeMargin\" type=\"Boolean\">A Boolean indicating whether to include the element's margin in the calculation.</param>\n    ///   <returns type=\"Integer\" />\n    /// </signature>\n  },\n  'parent': function() {\n    /// <signature>\n    ///   <summary>Get the parent of each element in the current set of matched elements, optionally filtered by a selector.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'parents': function() {\n    /// <signature>\n    ///   <summary>Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'parentsUntil': function() {\n    /// <signature>\n    ///   <summary>Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to indicate where to stop matching ancestor elements.</param>\n    ///   <param name=\"filter\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector, DOM node, or jQuery object.</summary>\n    ///   <param name=\"element\" type=\"Element\">A DOM node or jQuery object indicating where to stop matching ancestor elements.</param>\n    ///   <param name=\"filter\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'password': function() {\n    /// <summary>Selects all elements of type password.</summary>\n  },\n  'position': function() {\n    /// <summary>Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.</summary>\n    /// <returns type=\"Object\" />\n  },\n  'prepend': function() {\n    /// <signature>\n    ///   <summary>Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.</summary>\n    ///   <param name=\"content\" type=\"jQuery\">DOM element, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements.</param>\n    ///   <param name=\"content\" type=\"jQuery\">One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.</summary>\n    ///   <param name=\"function(index, html)\" type=\"Function\">A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'prependTo': function() {\n    /// <signature>\n    ///   <summary>Insert every element in the set of matched elements to the beginning of the target.</summary>\n    ///   <param name=\"target\" type=\"jQuery\">A selector, element, HTML string, or jQuery object; the matched set of elements will be inserted at the beginning of the element(s) specified by this parameter.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'prev': function() {\n    /// <signature>\n    ///   <summary>Get the immediately preceding sibling of each element in the set of matched elements, optionally filtered by a selector.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'prevAll': function() {\n    /// <signature>\n    ///   <summary>Get all preceding siblings of each element in the set of matched elements, optionally filtered by a selector.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'prevUntil': function() {\n    /// <signature>\n    ///   <summary>Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to indicate where to stop matching preceding sibling elements.</param>\n    ///   <param name=\"filter\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Get all preceding siblings of each element up to but not including the element matched by the selector, DOM node, or jQuery object.</summary>\n    ///   <param name=\"element\" type=\"Element\">A DOM node or jQuery object indicating where to stop matching preceding sibling elements.</param>\n    ///   <param name=\"filter\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'promise': function() {\n    /// <signature>\n    ///   <summary>Return a Promise object to observe when all actions of a certain type bound to the collection, queued or not, have finished.</summary>\n    ///   <param name=\"type\" type=\"String\">The type of queue that needs to be observed.</param>\n    ///   <param name=\"target\" type=\"Object\">Object onto which the promise methods have to be attached</param>\n    ///   <returns type=\"Promise\" />\n    /// </signature>\n  },\n  'prop': function() {\n    /// <signature>\n    ///   <summary>Set one or more properties for the set of matched elements.</summary>\n    ///   <param name=\"propertyName\" type=\"String\">The name of the property to set.</param>\n    ///   <param name=\"value\" type=\"Boolean\">A value to set for the property.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Set one or more properties for the set of matched elements.</summary>\n    ///   <param name=\"map\" type=\"Object\">A map of property-value pairs to set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Set one or more properties for the set of matched elements.</summary>\n    ///   <param name=\"propertyName\" type=\"String\">The name of the property to set.</param>\n    ///   <param name=\"function(index, oldPropertyValue)\" type=\"Function\">A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'pushStack': function() {\n    /// <signature>\n    ///   <summary>Add a collection of DOM elements onto the jQuery stack.</summary>\n    ///   <param name=\"elements\" type=\"Array\">An array of elements to push onto the stack and make into a new jQuery object.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Add a collection of DOM elements onto the jQuery stack.</summary>\n    ///   <param name=\"elements\" type=\"Array\">An array of elements to push onto the stack and make into a new jQuery object.</param>\n    ///   <param name=\"name\" type=\"String\">The name of a jQuery method that generated the array of elements.</param>\n    ///   <param name=\"arguments\" type=\"Array\">The arguments that were passed in to the jQuery method (for serialization).</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'queue': function() {\n    /// <signature>\n    ///   <summary>Manipulate the queue of functions to be executed on the matched elements.</summary>\n    ///   <param name=\"queueName\" type=\"String\">A string containing the name of the queue. Defaults to fx, the standard effects queue.</param>\n    ///   <param name=\"newQueue\" type=\"Array\">An array of functions to replace the current queue contents.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Manipulate the queue of functions to be executed on the matched elements.</summary>\n    ///   <param name=\"queueName\" type=\"String\">A string containing the name of the queue. Defaults to fx, the standard effects queue.</param>\n    ///   <param name=\"callback( next )\" type=\"Function\">The new function to add to the queue, with a function to call that will dequeue the next item.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'radio': function() {\n    /// <summary>Selects all  elements of type radio.</summary>\n  },\n  'ready': function() {\n    /// <signature>\n    ///   <summary>Specify a function to execute when the DOM is fully loaded.</summary>\n    ///   <param name=\"handler\" type=\"Function\">A function to execute after the DOM is ready.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'remove': function() {\n    /// <signature>\n    ///   <summary>Remove the set of matched elements from the DOM.</summary>\n    ///   <param name=\"selector\" type=\"String\">A selector expression that filters the set of matched elements to be removed.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'removeAttr': function() {\n    /// <signature>\n    ///   <summary>Remove an attribute from each element in the set of matched elements.</summary>\n    ///   <param name=\"attributeName\" type=\"String\">An attribute to remove; as of version 1.7, it can be a space-separated list of attributes.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'removeClass': function() {\n    /// <signature>\n    ///   <summary>Remove a single class, multiple classes, or all classes from each element in the set of matched elements.</summary>\n    ///   <param name=\"className\" type=\"String\">One or more space-separated classes to be removed from the class attribute of each matched element.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Remove a single class, multiple classes, or all classes from each element in the set of matched elements.</summary>\n    ///   <param name=\"function(index, class)\" type=\"Function\">A function returning one or more space-separated class names to be removed. Receives the index position of the element in the set and the old class value as arguments.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'removeData': function() {\n    /// <signature>\n    ///   <summary>Remove a previously-stored piece of data.</summary>\n    ///   <param name=\"name\" type=\"String\">A string naming the piece of data to delete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Remove a previously-stored piece of data.</summary>\n    ///   <param name=\"list\" type=\"String\">An array or space-separated string naming the pieces of data to delete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'removeProp': function() {\n    /// <signature>\n    ///   <summary>Remove a property for the set of matched elements.</summary>\n    ///   <param name=\"propertyName\" type=\"String\">The name of the property to set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'replaceAll': function() {\n    /// <signature>\n    ///   <summary>Replace each target element with the set of matched elements.</summary>\n    ///   <param name=\"target\" type=\"String\">A selector expression indicating which element(s) to replace.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'replaceWith': function() {\n    /// <signature>\n    ///   <summary>Replace each element in the set of matched elements with the provided new content.</summary>\n    ///   <param name=\"newContent\" type=\"jQuery\">The content to insert. May be an HTML string, DOM element, or jQuery object.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Replace each element in the set of matched elements with the provided new content.</summary>\n    ///   <param name=\"function\" type=\"Function\">A function that returns content with which to replace the set of matched elements.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'reset': function() {\n    /// <summary>Selects all elements of type reset.</summary>\n  },\n  'resize': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"resize\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"resize\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'scroll': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"scroll\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"scroll\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'scrollLeft': function() {\n    /// <signature>\n    ///   <summary>Set the current horizontal position of the scroll bar for each of the set of matched elements.</summary>\n    ///   <param name=\"value\" type=\"Number\">An integer indicating the new position to set the scroll bar to.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'scrollTop': function() {\n    /// <signature>\n    ///   <summary>Set the current vertical position of the scroll bar for each of the set of matched elements.</summary>\n    ///   <param name=\"value\" type=\"Number\">An integer indicating the new position to set the scroll bar to.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'select': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"select\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"select\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'selected': function() {\n    /// <summary>Selects all elements that are selected.</summary>\n  },\n  'serialize': function() {\n    /// <summary>Encode a set of form elements as a string for submission.</summary>\n    /// <returns type=\"String\" />\n  },\n  'serializeArray': function() {\n    /// <summary>Encode a set of form elements as an array of names and values.</summary>\n    /// <returns type=\"Array\" />\n  },\n  'show': function() {\n    /// <signature>\n    ///   <summary>Display the matched elements.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Display the matched elements.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"easing\" type=\"String\">A string indicating which easing function to use for the transition.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'siblings': function() {\n    /// <signature>\n    ///   <summary>Get the siblings of each element in the set of matched elements, optionally filtered by a selector.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression to match elements against.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'size': function() {\n    /// <summary>Return the number of elements in the jQuery object.</summary>\n    /// <returns type=\"Number\" />\n  },\n  'slice': function() {\n    /// <signature>\n    ///   <summary>Reduce the set of matched elements to a subset specified by a range of indices.</summary>\n    ///   <param name=\"start\" type=\"Number\">An integer indicating the 0-based position at which the elements begin to be selected. If negative, it indicates an offset from the end of the set.</param>\n    ///   <param name=\"end\" type=\"Number\">An integer indicating the 0-based position at which the elements stop being selected. If negative, it indicates an offset from the end of the set. If omitted, the range continues until the end of the set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'slideDown': function() {\n    /// <signature>\n    ///   <summary>Display the matched elements with a sliding motion.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Display the matched elements with a sliding motion.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"easing\" type=\"String\">A string indicating which easing function to use for the transition.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'slideToggle': function() {\n    /// <signature>\n    ///   <summary>Display or hide the matched elements with a sliding motion.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Display or hide the matched elements with a sliding motion.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"easing\" type=\"String\">A string indicating which easing function to use for the transition.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'slideUp': function() {\n    /// <signature>\n    ///   <summary>Hide the matched elements with a sliding motion.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Hide the matched elements with a sliding motion.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"easing\" type=\"String\">A string indicating which easing function to use for the transition.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'stop': function() {\n    /// <signature>\n    ///   <summary>Stop the currently-running animation on the matched elements.</summary>\n    ///   <param name=\"clearQueue\" type=\"Boolean\">A Boolean indicating whether to remove queued animation as well. Defaults to false.</param>\n    ///   <param name=\"jumpToEnd\" type=\"Boolean\">A Boolean indicating whether to complete the current animation immediately. Defaults to false.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Stop the currently-running animation on the matched elements.</summary>\n    ///   <param name=\"queue\" type=\"String\">The name of the queue in which to stop animations.</param>\n    ///   <param name=\"clearQueue\" type=\"Boolean\">A Boolean indicating whether to remove queued animation as well. Defaults to false.</param>\n    ///   <param name=\"jumpToEnd\" type=\"Boolean\">A Boolean indicating whether to complete the current animation immediately. Defaults to false.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'submit': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"submit\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"submit\" JavaScript event, or trigger that event on an element.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'text': function() {\n    /// <signature>\n    ///   <summary>Set the content of each element in the set of matched elements to the specified text.</summary>\n    ///   <param name=\"textString\" type=\"String\">A string of text to set as the content of each matched element.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Set the content of each element in the set of matched elements to the specified text.</summary>\n    ///   <param name=\"function(index, text)\" type=\"Function\">A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'toArray': function() {\n    /// <summary>Retrieve all the DOM elements contained in the jQuery set, as an array.</summary>\n    /// <returns type=\"Array\" />\n  },\n  'toggle': function() {\n    /// <signature>\n    ///   <summary>Display or hide the matched elements.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Display or hide the matched elements.</summary>\n    ///   <param name=\"duration\" type=\"Number\">A string or number determining how long the animation will run.</param>\n    ///   <param name=\"easing\" type=\"String\">A string indicating which easing function to use for the transition.</param>\n    ///   <param name=\"callback\" type=\"Function\">A function to call once the animation is complete.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Display or hide the matched elements.</summary>\n    ///   <param name=\"showOrHide\" type=\"Boolean\">A Boolean indicating whether to show or hide the elements.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'toggleClass': function() {\n    /// <signature>\n    ///   <summary>Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.</summary>\n    ///   <param name=\"className\" type=\"String\">One or more class names (separated by spaces) to be toggled for each element in the matched set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.</summary>\n    ///   <param name=\"className\" type=\"String\">One or more class names (separated by spaces) to be toggled for each element in the matched set.</param>\n    ///   <param name=\"switch\" type=\"Boolean\">A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.</summary>\n    ///   <param name=\"switch\" type=\"Boolean\">A boolean value to determine whether the class should be added or removed.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.</summary>\n    ///   <param name=\"function(index, class, switch)\" type=\"Function\">A function that returns class names to be toggled in the class attribute of each element in the matched set. Receives the index position of the element in the set, the old class value, and the switch as arguments.</param>\n    ///   <param name=\"switch\" type=\"Boolean\">A boolean value to determine whether the class should be added or removed.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'trigger': function() {\n    /// <signature>\n    ///   <summary>Execute all handlers and behaviors attached to the matched elements for the given event type.</summary>\n    ///   <param name=\"eventType\" type=\"String\">A string containing a JavaScript event type, such as click or submit.</param>\n    ///   <param name=\"extraParameters\" type=\"Object\">Additional parameters to pass along to the event handler.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Execute all handlers and behaviors attached to the matched elements for the given event type.</summary>\n    ///   <param name=\"event\" type=\"Event\">A jQuery.Event object.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'triggerHandler': function() {\n    /// <signature>\n    ///   <summary>Execute all handlers attached to an element for an event.</summary>\n    ///   <param name=\"eventType\" type=\"String\">A string containing a JavaScript event type, such as click or submit.</param>\n    ///   <param name=\"extraParameters\" type=\"Array\">An array of additional parameters to pass along to the event handler.</param>\n    ///   <returns type=\"Object\" />\n    /// </signature>\n  },\n  'unbind': function() {\n    /// <signature>\n    ///   <summary>Remove a previously-attached event handler from the elements.</summary>\n    ///   <param name=\"eventType\" type=\"String\">A string containing a JavaScript event type, such as click or submit.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">The function that is to be no longer executed.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Remove a previously-attached event handler from the elements.</summary>\n    ///   <param name=\"eventType\" type=\"String\">A string containing a JavaScript event type, such as click or submit.</param>\n    ///   <param name=\"false\" type=\"Boolean\">Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ).</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Remove a previously-attached event handler from the elements.</summary>\n    ///   <param name=\"event\" type=\"Object\">A JavaScript event object as passed to an event handler.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'undelegate': function() {\n    /// <signature>\n    ///   <summary>Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.</summary>\n    ///   <param name=\"selector\" type=\"String\">A selector which will be used to filter the event results.</param>\n    ///   <param name=\"eventType\" type=\"String\">A string containing a JavaScript event type, such as \"click\" or \"keydown\"</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.</summary>\n    ///   <param name=\"selector\" type=\"String\">A selector which will be used to filter the event results.</param>\n    ///   <param name=\"eventType\" type=\"String\">A string containing a JavaScript event type, such as \"click\" or \"keydown\"</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute at the time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.</summary>\n    ///   <param name=\"selector\" type=\"String\">A selector which will be used to filter the event results.</param>\n    ///   <param name=\"events\" type=\"Object\">A map of one or more event types and previously bound functions to unbind from them.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Remove a handler from the event for all elements which match the current selector, based upon a specific set of root elements.</summary>\n    ///   <param name=\"namespace\" type=\"String\">A string containing a namespace to unbind all events from.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'unload': function() {\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"unload\" JavaScript event.</summary>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute when the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Bind an event handler to the \"unload\" JavaScript event.</summary>\n    ///   <param name=\"eventData\" type=\"Object\">A map of data that will be passed to the event handler.</param>\n    ///   <param name=\"handler(eventObject)\" type=\"Function\">A function to execute each time the event is triggered.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'unwrap': function() {\n    /// <summary>Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.</summary>\n    /// <returns type=\"jQuery\" />\n  },\n  'val': function() {\n    /// <signature>\n    ///   <summary>Set the value of each element in the set of matched elements.</summary>\n    ///   <param name=\"value\" type=\"String\">A string of text or an array of strings corresponding to the value of each matched element to set as selected/checked.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Set the value of each element in the set of matched elements.</summary>\n    ///   <param name=\"function(index, value)\" type=\"Function\">A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'visible': function() {\n    /// <summary>Selects all elements that are visible.</summary>\n  },\n  'width': function() {\n    /// <signature>\n    ///   <summary>Set the CSS width of each element in the set of matched elements.</summary>\n    ///   <param name=\"value\" type=\"Number\">An integer representing the number of pixels, or an integer along with an optional unit of measure appended (as a string).</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Set the CSS width of each element in the set of matched elements.</summary>\n    ///   <param name=\"function(index, width)\" type=\"Function\">A function returning the width to set. Receives the index position of the element in the set and the old width as arguments. Within the function, this refers to the current element in the set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'wrap': function() {\n    /// <signature>\n    ///   <summary>Wrap an HTML structure around each element in the set of matched elements.</summary>\n    ///   <param name=\"wrappingElement\" type=\"jQuery\">An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the matched elements.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Wrap an HTML structure around each element in the set of matched elements.</summary>\n    ///   <param name=\"function(index)\" type=\"Function\">A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'wrapAll': function() {\n    /// <signature>\n    ///   <summary>Wrap an HTML structure around all elements in the set of matched elements.</summary>\n    ///   <param name=\"wrappingElement\" type=\"jQuery\">An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the matched elements.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n  'wrapInner': function() {\n    /// <signature>\n    ///   <summary>Wrap an HTML structure around the content of each element in the set of matched elements.</summary>\n    ///   <param name=\"wrappingElement\" type=\"String\">An HTML snippet, selector expression, jQuery object, or DOM element specifying the structure to wrap around the content of the matched elements.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Wrap an HTML structure around the content of each element in the set of matched elements.</summary>\n    ///   <param name=\"function(index)\" type=\"Function\">A callback function which generates a structure to wrap around the content of the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n});\n\nintellisense.annotate(window, {\n  '$': function() {\n    /// <signature>\n    ///   <summary>Accepts a string containing a CSS selector which is then used to match a set of elements.</summary>\n    ///   <param name=\"selector\" type=\"String\">A string containing a selector expression</param>\n    ///   <param name=\"context\" type=\"jQuery\">A DOM Element, Document, or jQuery to use as context</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Accepts a string containing a CSS selector which is then used to match a set of elements.</summary>\n    ///   <param name=\"element\" type=\"Element\">A DOM element to wrap in a jQuery object.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Accepts a string containing a CSS selector which is then used to match a set of elements.</summary>\n    ///   <param name=\"object\" type=\"Object\">A plain object to wrap in a jQuery object.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Accepts a string containing a CSS selector which is then used to match a set of elements.</summary>\n    ///   <param name=\"elementArray\" type=\"Array\">An array containing a set of DOM elements to wrap in a jQuery object.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n    /// <signature>\n    ///   <summary>Accepts a string containing a CSS selector which is then used to match a set of elements.</summary>\n    ///   <param name=\"jQuery object\" type=\"Object\">An existing jQuery object to clone.</param>\n    ///   <returns type=\"jQuery\" />\n    /// </signature>\n  },\n});\n\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Scripts/jquery-1.8.2.js",
    "content": "/*!\n * jQuery JavaScript Library v1.8.2\n * http://jquery.com/\n *\n * Includes Sizzle.js\n * http://sizzlejs.com/\n *\n * Copyright 2012 jQuery Foundation and other contributors\n * Released under the MIT license\n * http://jquery.org/license\n *\n * Date: Thu Sep 20 2012 21:13:05 GMT-0400 (Eastern Daylight Time)\n */\n(function( window, undefined ) {\nvar\n\t// A central reference to the root jQuery(document)\n\trootjQuery,\n\n\t// The deferred used on DOM ready\n\treadyList,\n\n\t// Use the correct document accordingly with window argument (sandbox)\n\tdocument = window.document,\n\tlocation = window.location,\n\tnavigator = window.navigator,\n\n\t// Map over jQuery in case of overwrite\n\t_jQuery = window.jQuery,\n\n\t// Map over the $ in case of overwrite\n\t_$ = window.$,\n\n\t// Save a reference to some core methods\n\tcore_push = Array.prototype.push,\n\tcore_slice = Array.prototype.slice,\n\tcore_indexOf = Array.prototype.indexOf,\n\tcore_toString = Object.prototype.toString,\n\tcore_hasOwn = Object.prototype.hasOwnProperty,\n\tcore_trim = String.prototype.trim,\n\n\t// Define a local copy of jQuery\n\tjQuery = function( selector, context ) {\n\t\t// The jQuery object is actually just the init constructor 'enhanced'\n\t\treturn new jQuery.fn.init( selector, context, rootjQuery );\n\t},\n\n\t// Used for matching numbers\n\tcore_pnum = /[\\-+]?(?:\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/.source,\n\n\t// Used for detecting and trimming whitespace\n\tcore_rnotwhite = /\\S/,\n\tcore_rspace = /\\s+/,\n\n\t// Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE)\n\trtrim = /^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g,\n\n\t// A simple way to check for HTML strings\n\t// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)\n\trquickExpr = /^(?:[^#<]*(<[\\w\\W]+>)[^>]*$|#([\\w\\-]*)$)/,\n\n\t// Match a standalone tag\n\trsingleTag = /^<(\\w+)\\s*\\/?>(?:<\\/\\1>|)$/,\n\n\t// JSON RegExp\n\trvalidchars = /^[\\],:{}\\s]*$/,\n\trvalidbraces = /(?:^|:|,)(?:\\s*\\[)+/g,\n\trvalidescape = /\\\\(?:[\"\\\\\\/bfnrt]|u[\\da-fA-F]{4})/g,\n\trvalidtokens = /\"[^\"\\\\\\r\\n]*\"|true|false|null|-?(?:\\d\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/g,\n\n\t// Matches dashed string for camelizing\n\trmsPrefix = /^-ms-/,\n\trdashAlpha = /-([\\da-z])/gi,\n\n\t// Used by jQuery.camelCase as callback to replace()\n\tfcamelCase = function( all, letter ) {\n\t\treturn ( letter + \"\" ).toUpperCase();\n\t},\n\n\t// The ready event handler and self cleanup method\n\tDOMContentLoaded = function() {\n\t\tif ( document.addEventListener ) {\n\t\t\tdocument.removeEventListener( \"DOMContentLoaded\", DOMContentLoaded, false );\n\t\t\tjQuery.ready();\n\t\t} else if ( document.readyState === \"complete\" ) {\n\t\t\t// we're here because readyState === \"complete\" in oldIE\n\t\t\t// which is good enough for us to call the dom ready!\n\t\t\tdocument.detachEvent( \"onreadystatechange\", DOMContentLoaded );\n\t\t\tjQuery.ready();\n\t\t}\n\t},\n\n\t// [[Class]] -> type pairs\n\tclass2type = {};\n\njQuery.fn = jQuery.prototype = {\n\tconstructor: jQuery,\n\tinit: function( selector, context, rootjQuery ) {\n\t\tvar match, elem, ret, doc;\n\n\t\t// Handle $(\"\"), $(null), $(undefined), $(false)\n\t\tif ( !selector ) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// Handle $(DOMElement)\n\t\tif ( selector.nodeType ) {\n\t\t\tthis.context = this[0] = selector;\n\t\t\tthis.length = 1;\n\t\t\treturn this;\n\t\t}\n\n\t\t// Handle HTML strings\n\t\tif ( typeof selector === \"string\" ) {\n\t\t\tif ( selector.charAt(0) === \"<\" && selector.charAt( selector.length - 1 ) === \">\" && selector.length >= 3 ) {\n\t\t\t\t// Assume that strings that start and end with <> are HTML and skip the regex check\n\t\t\t\tmatch = [ null, selector, null ];\n\n\t\t\t} else {\n\t\t\t\tmatch = rquickExpr.exec( selector );\n\t\t\t}\n\n\t\t\t// Match html or make sure no context is specified for #id\n\t\t\tif ( match && (match[1] || !context) ) {\n\n\t\t\t\t// HANDLE: $(html) -> $(array)\n\t\t\t\tif ( match[1] ) {\n\t\t\t\t\tcontext = context instanceof jQuery ? context[0] : context;\n\t\t\t\t\tdoc = ( context && context.nodeType ? context.ownerDocument || context : document );\n\n\t\t\t\t\t// scripts is true for back-compat\n\t\t\t\t\tselector = jQuery.parseHTML( match[1], doc, true );\n\t\t\t\t\tif ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) {\n\t\t\t\t\t\tthis.attr.call( selector, context, true );\n\t\t\t\t\t}\n\n\t\t\t\t\treturn jQuery.merge( this, selector );\n\n\t\t\t\t// HANDLE: $(#id)\n\t\t\t\t} else {\n\t\t\t\t\telem = document.getElementById( match[2] );\n\n\t\t\t\t\t// Check parentNode to catch when Blackberry 4.6 returns\n\t\t\t\t\t// nodes that are no longer in the document #6963\n\t\t\t\t\tif ( elem && elem.parentNode ) {\n\t\t\t\t\t\t// Handle the case where IE and Opera return items\n\t\t\t\t\t\t// by name instead of ID\n\t\t\t\t\t\tif ( elem.id !== match[2] ) {\n\t\t\t\t\t\t\treturn rootjQuery.find( selector );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Otherwise, we inject the element directly into the jQuery object\n\t\t\t\t\t\tthis.length = 1;\n\t\t\t\t\t\tthis[0] = elem;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.context = document;\n\t\t\t\t\tthis.selector = selector;\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\n\t\t\t// HANDLE: $(expr, $(...))\n\t\t\t} else if ( !context || context.jquery ) {\n\t\t\t\treturn ( context || rootjQuery ).find( selector );\n\n\t\t\t// HANDLE: $(expr, context)\n\t\t\t// (which is just equivalent to: $(context).find(expr)\n\t\t\t} else {\n\t\t\t\treturn this.constructor( context ).find( selector );\n\t\t\t}\n\n\t\t// HANDLE: $(function)\n\t\t// Shortcut for document ready\n\t\t} else if ( jQuery.isFunction( selector ) ) {\n\t\t\treturn rootjQuery.ready( selector );\n\t\t}\n\n\t\tif ( selector.selector !== undefined ) {\n\t\t\tthis.selector = selector.selector;\n\t\t\tthis.context = selector.context;\n\t\t}\n\n\t\treturn jQuery.makeArray( selector, this );\n\t},\n\n\t// Start with an empty selector\n\tselector: \"\",\n\n\t// The current version of jQuery being used\n\tjquery: \"1.8.2\",\n\n\t// The default length of a jQuery object is 0\n\tlength: 0,\n\n\t// The number of elements contained in the matched element set\n\tsize: function() {\n\t\treturn this.length;\n\t},\n\n\ttoArray: function() {\n\t\treturn core_slice.call( this );\n\t},\n\n\t// Get the Nth element in the matched element set OR\n\t// Get the whole matched element set as a clean array\n\tget: function( num ) {\n\t\treturn num == null ?\n\n\t\t\t// Return a 'clean' array\n\t\t\tthis.toArray() :\n\n\t\t\t// Return just the object\n\t\t\t( num < 0 ? this[ this.length + num ] : this[ num ] );\n\t},\n\n\t// Take an array of elements and push it onto the stack\n\t// (returning the new matched element set)\n\tpushStack: function( elems, name, selector ) {\n\n\t\t// Build a new jQuery matched element set\n\t\tvar ret = jQuery.merge( this.constructor(), elems );\n\n\t\t// Add the old object onto the stack (as a reference)\n\t\tret.prevObject = this;\n\n\t\tret.context = this.context;\n\n\t\tif ( name === \"find\" ) {\n\t\t\tret.selector = this.selector + ( this.selector ? \" \" : \"\" ) + selector;\n\t\t} else if ( name ) {\n\t\t\tret.selector = this.selector + \".\" + name + \"(\" + selector + \")\";\n\t\t}\n\n\t\t// Return the newly-formed element set\n\t\treturn ret;\n\t},\n\n\t// Execute a callback for every element in the matched set.\n\t// (You can seed the arguments with an array of args, but this is\n\t// only used internally.)\n\teach: function( callback, args ) {\n\t\treturn jQuery.each( this, callback, args );\n\t},\n\n\tready: function( fn ) {\n\t\t// Add the callback\n\t\tjQuery.ready.promise().done( fn );\n\n\t\treturn this;\n\t},\n\n\teq: function( i ) {\n\t\ti = +i;\n\t\treturn i === -1 ?\n\t\t\tthis.slice( i ) :\n\t\t\tthis.slice( i, i + 1 );\n\t},\n\n\tfirst: function() {\n\t\treturn this.eq( 0 );\n\t},\n\n\tlast: function() {\n\t\treturn this.eq( -1 );\n\t},\n\n\tslice: function() {\n\t\treturn this.pushStack( core_slice.apply( this, arguments ),\n\t\t\t\"slice\", core_slice.call(arguments).join(\",\") );\n\t},\n\n\tmap: function( callback ) {\n\t\treturn this.pushStack( jQuery.map(this, function( elem, i ) {\n\t\t\treturn callback.call( elem, i, elem );\n\t\t}));\n\t},\n\n\tend: function() {\n\t\treturn this.prevObject || this.constructor(null);\n\t},\n\n\t// For internal use only.\n\t// Behaves like an Array's method, not like a jQuery method.\n\tpush: core_push,\n\tsort: [].sort,\n\tsplice: [].splice\n};\n\n// Give the init function the jQuery prototype for later instantiation\njQuery.fn.init.prototype = jQuery.fn;\n\njQuery.extend = jQuery.fn.extend = function() {\n\tvar options, name, src, copy, copyIsArray, clone,\n\t\ttarget = arguments[0] || {},\n\t\ti = 1,\n\t\tlength = arguments.length,\n\t\tdeep = false;\n\n\t// Handle a deep copy situation\n\tif ( typeof target === \"boolean\" ) {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\n\t// Handle case when target is a string or something (possible in deep copy)\n\tif ( typeof target !== \"object\" && !jQuery.isFunction(target) ) {\n\t\ttarget = {};\n\t}\n\n\t// extend jQuery itself if only one argument is passed\n\tif ( length === i ) {\n\t\ttarget = this;\n\t\t--i;\n\t}\n\n\tfor ( ; i < length; i++ ) {\n\t\t// Only deal with non-null/undefined values\n\t\tif ( (options = arguments[ i ]) != null ) {\n\t\t\t// Extend the base object\n\t\t\tfor ( name in options ) {\n\t\t\t\tsrc = target[ name ];\n\t\t\t\tcopy = options[ name ];\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif ( target === copy ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\tif ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {\n\t\t\t\t\tif ( copyIsArray ) {\n\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\tclone = src && jQuery.isArray(src) ? src : [];\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tclone = src && jQuery.isPlainObject(src) ? src : {};\n\t\t\t\t\t}\n\n\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\ttarget[ name ] = jQuery.extend( deep, clone, copy );\n\n\t\t\t\t// Don't bring in undefined values\n\t\t\t\t} else if ( copy !== undefined ) {\n\t\t\t\t\ttarget[ name ] = copy;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n\njQuery.extend({\n\tnoConflict: function( deep ) {\n\t\tif ( window.$ === jQuery ) {\n\t\t\twindow.$ = _$;\n\t\t}\n\n\t\tif ( deep && window.jQuery === jQuery ) {\n\t\t\twindow.jQuery = _jQuery;\n\t\t}\n\n\t\treturn jQuery;\n\t},\n\n\t// Is the DOM ready to be used? Set to true once it occurs.\n\tisReady: false,\n\n\t// A counter to track how many items to wait for before\n\t// the ready event fires. See #6781\n\treadyWait: 1,\n\n\t// Hold (or release) the ready event\n\tholdReady: function( hold ) {\n\t\tif ( hold ) {\n\t\t\tjQuery.readyWait++;\n\t\t} else {\n\t\t\tjQuery.ready( true );\n\t\t}\n\t},\n\n\t// Handle when the DOM is ready\n\tready: function( wait ) {\n\n\t\t// Abort if there are pending holds or we're already ready\n\t\tif ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).\n\t\tif ( !document.body ) {\n\t\t\treturn setTimeout( jQuery.ready, 1 );\n\t\t}\n\n\t\t// Remember that the DOM is ready\n\t\tjQuery.isReady = true;\n\n\t\t// If a normal DOM Ready event fired, decrement, and wait if need be\n\t\tif ( wait !== true && --jQuery.readyWait > 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// If there are functions bound, to execute\n\t\treadyList.resolveWith( document, [ jQuery ] );\n\n\t\t// Trigger any bound ready events\n\t\tif ( jQuery.fn.trigger ) {\n\t\t\tjQuery( document ).trigger(\"ready\").off(\"ready\");\n\t\t}\n\t},\n\n\t// See test/unit/core.js for details concerning isFunction.\n\t// Since version 1.3, DOM methods and functions like alert\n\t// aren't supported. They return false on IE (#2968).\n\tisFunction: function( obj ) {\n\t\treturn jQuery.type(obj) === \"function\";\n\t},\n\n\tisArray: Array.isArray || function( obj ) {\n\t\treturn jQuery.type(obj) === \"array\";\n\t},\n\n\tisWindow: function( obj ) {\n\t\treturn obj != null && obj == obj.window;\n\t},\n\n\tisNumeric: function( obj ) {\n\t\treturn !isNaN( parseFloat(obj) ) && isFinite( obj );\n\t},\n\n\ttype: function( obj ) {\n\t\treturn obj == null ?\n\t\t\tString( obj ) :\n\t\t\tclass2type[ core_toString.call(obj) ] || \"object\";\n\t},\n\n\tisPlainObject: function( obj ) {\n\t\t// Must be an Object.\n\t\t// Because of IE, we also have to check the presence of the constructor property.\n\t\t// Make sure that DOM nodes and window objects don't pass through, as well\n\t\tif ( !obj || jQuery.type(obj) !== \"object\" || obj.nodeType || jQuery.isWindow( obj ) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\ttry {\n\t\t\t// Not own constructor property must be Object\n\t\t\tif ( obj.constructor &&\n\t\t\t\t!core_hasOwn.call(obj, \"constructor\") &&\n\t\t\t\t!core_hasOwn.call(obj.constructor.prototype, \"isPrototypeOf\") ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} catch ( e ) {\n\t\t\t// IE8,9 Will throw exceptions on certain host objects #9897\n\t\t\treturn false;\n\t\t}\n\n\t\t// Own properties are enumerated firstly, so to speed up,\n\t\t// if last one is own, then all properties are own.\n\n\t\tvar key;\n\t\tfor ( key in obj ) {}\n\n\t\treturn key === undefined || core_hasOwn.call( obj, key );\n\t},\n\n\tisEmptyObject: function( obj ) {\n\t\tvar name;\n\t\tfor ( name in obj ) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t},\n\n\terror: function( msg ) {\n\t\tthrow new Error( msg );\n\t},\n\n\t// data: string of html\n\t// context (optional): If specified, the fragment will be created in this context, defaults to document\n\t// scripts (optional): If true, will include scripts passed in the html string\n\tparseHTML: function( data, context, scripts ) {\n\t\tvar parsed;\n\t\tif ( !data || typeof data !== \"string\" ) {\n\t\t\treturn null;\n\t\t}\n\t\tif ( typeof context === \"boolean\" ) {\n\t\t\tscripts = context;\n\t\t\tcontext = 0;\n\t\t}\n\t\tcontext = context || document;\n\n\t\t// Single tag\n\t\tif ( (parsed = rsingleTag.exec( data )) ) {\n\t\t\treturn [ context.createElement( parsed[1] ) ];\n\t\t}\n\n\t\tparsed = jQuery.buildFragment( [ data ], context, scripts ? null : [] );\n\t\treturn jQuery.merge( [],\n\t\t\t(parsed.cacheable ? jQuery.clone( parsed.fragment ) : parsed.fragment).childNodes );\n\t},\n\n\tparseJSON: function( data ) {\n\t\tif ( !data || typeof data !== \"string\") {\n\t\t\treturn null;\n\t\t}\n\n\t\t// Make sure leading/trailing whitespace is removed (IE can't handle it)\n\t\tdata = jQuery.trim( data );\n\n\t\t// Attempt to parse using the native JSON parser first\n\t\tif ( window.JSON && window.JSON.parse ) {\n\t\t\treturn window.JSON.parse( data );\n\t\t}\n\n\t\t// Make sure the incoming data is actual JSON\n\t\t// Logic borrowed from http://json.org/json2.js\n\t\tif ( rvalidchars.test( data.replace( rvalidescape, \"@\" )\n\t\t\t.replace( rvalidtokens, \"]\" )\n\t\t\t.replace( rvalidbraces, \"\")) ) {\n\n\t\t\treturn ( new Function( \"return \" + data ) )();\n\n\t\t}\n\t\tjQuery.error( \"Invalid JSON: \" + data );\n\t},\n\n\t// Cross-browser xml parsing\n\tparseXML: function( data ) {\n\t\tvar xml, tmp;\n\t\tif ( !data || typeof data !== \"string\" ) {\n\t\t\treturn null;\n\t\t}\n\t\ttry {\n\t\t\tif ( window.DOMParser ) { // Standard\n\t\t\t\ttmp = new DOMParser();\n\t\t\t\txml = tmp.parseFromString( data , \"text/xml\" );\n\t\t\t} else { // IE\n\t\t\t\txml = new ActiveXObject( \"Microsoft.XMLDOM\" );\n\t\t\t\txml.async = \"false\";\n\t\t\t\txml.loadXML( data );\n\t\t\t}\n\t\t} catch( e ) {\n\t\t\txml = undefined;\n\t\t}\n\t\tif ( !xml || !xml.documentElement || xml.getElementsByTagName( \"parsererror\" ).length ) {\n\t\t\tjQuery.error( \"Invalid XML: \" + data );\n\t\t}\n\t\treturn xml;\n\t},\n\n\tnoop: function() {},\n\n\t// Evaluates a script in a global context\n\t// Workarounds based on findings by Jim Driscoll\n\t// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context\n\tglobalEval: function( data ) {\n\t\tif ( data && core_rnotwhite.test( data ) ) {\n\t\t\t// We use execScript on Internet Explorer\n\t\t\t// We use an anonymous function so that context is window\n\t\t\t// rather than jQuery in Firefox\n\t\t\t( window.execScript || function( data ) {\n\t\t\t\twindow[ \"eval\" ].call( window, data );\n\t\t\t} )( data );\n\t\t}\n\t},\n\n\t// Convert dashed to camelCase; used by the css and data modules\n\t// Microsoft forgot to hump their vendor prefix (#9572)\n\tcamelCase: function( string ) {\n\t\treturn string.replace( rmsPrefix, \"ms-\" ).replace( rdashAlpha, fcamelCase );\n\t},\n\n\tnodeName: function( elem, name ) {\n\t\treturn elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();\n\t},\n\n\t// args is for internal usage only\n\teach: function( obj, callback, args ) {\n\t\tvar name,\n\t\t\ti = 0,\n\t\t\tlength = obj.length,\n\t\t\tisObj = length === undefined || jQuery.isFunction( obj );\n\n\t\tif ( args ) {\n\t\t\tif ( isObj ) {\n\t\t\t\tfor ( name in obj ) {\n\t\t\t\t\tif ( callback.apply( obj[ name ], args ) === false ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor ( ; i < length; ) {\n\t\t\t\t\tif ( callback.apply( obj[ i++ ], args ) === false ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t// A special, fast, case for the most common use of each\n\t\t} else {\n\t\t\tif ( isObj ) {\n\t\t\t\tfor ( name in obj ) {\n\t\t\t\t\tif ( callback.call( obj[ name ], name, obj[ name ] ) === false ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor ( ; i < length; ) {\n\t\t\t\t\tif ( callback.call( obj[ i ], i, obj[ i++ ] ) === false ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn obj;\n\t},\n\n\t// Use native String.trim function wherever possible\n\ttrim: core_trim && !core_trim.call(\"\\uFEFF\\xA0\") ?\n\t\tfunction( text ) {\n\t\t\treturn text == null ?\n\t\t\t\t\"\" :\n\t\t\t\tcore_trim.call( text );\n\t\t} :\n\n\t\t// Otherwise use our own trimming functionality\n\t\tfunction( text ) {\n\t\t\treturn text == null ?\n\t\t\t\t\"\" :\n\t\t\t\t( text + \"\" ).replace( rtrim, \"\" );\n\t\t},\n\n\t// results is for internal usage only\n\tmakeArray: function( arr, results ) {\n\t\tvar type,\n\t\t\tret = results || [];\n\n\t\tif ( arr != null ) {\n\t\t\t// The window, strings (and functions) also have 'length'\n\t\t\t// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930\n\t\t\ttype = jQuery.type( arr );\n\n\t\t\tif ( arr.length == null || type === \"string\" || type === \"function\" || type === \"regexp\" || jQuery.isWindow( arr ) ) {\n\t\t\t\tcore_push.call( ret, arr );\n\t\t\t} else {\n\t\t\t\tjQuery.merge( ret, arr );\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\tinArray: function( elem, arr, i ) {\n\t\tvar len;\n\n\t\tif ( arr ) {\n\t\t\tif ( core_indexOf ) {\n\t\t\t\treturn core_indexOf.call( arr, elem, i );\n\t\t\t}\n\n\t\t\tlen = arr.length;\n\t\t\ti = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;\n\n\t\t\tfor ( ; i < len; i++ ) {\n\t\t\t\t// Skip accessing in sparse arrays\n\t\t\t\tif ( i in arr && arr[ i ] === elem ) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t},\n\n\tmerge: function( first, second ) {\n\t\tvar l = second.length,\n\t\t\ti = first.length,\n\t\t\tj = 0;\n\n\t\tif ( typeof l === \"number\" ) {\n\t\t\tfor ( ; j < l; j++ ) {\n\t\t\t\tfirst[ i++ ] = second[ j ];\n\t\t\t}\n\n\t\t} else {\n\t\t\twhile ( second[j] !== undefined ) {\n\t\t\t\tfirst[ i++ ] = second[ j++ ];\n\t\t\t}\n\t\t}\n\n\t\tfirst.length = i;\n\n\t\treturn first;\n\t},\n\n\tgrep: function( elems, callback, inv ) {\n\t\tvar retVal,\n\t\t\tret = [],\n\t\t\ti = 0,\n\t\t\tlength = elems.length;\n\t\tinv = !!inv;\n\n\t\t// Go through the array, only saving the items\n\t\t// that pass the validator function\n\t\tfor ( ; i < length; i++ ) {\n\t\t\tretVal = !!callback( elems[ i ], i );\n\t\t\tif ( inv !== retVal ) {\n\t\t\t\tret.push( elems[ i ] );\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\t// arg is for internal usage only\n\tmap: function( elems, callback, arg ) {\n\t\tvar value, key,\n\t\t\tret = [],\n\t\t\ti = 0,\n\t\t\tlength = elems.length,\n\t\t\t// jquery objects are treated as arrays\n\t\t\tisArray = elems instanceof jQuery || length !== undefined && typeof length === \"number\" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;\n\n\t\t// Go through the array, translating each of the items to their\n\t\tif ( isArray ) {\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tvalue = callback( elems[ i ], i, arg );\n\n\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret[ ret.length ] = value;\n\t\t\t\t}\n\t\t\t}\n\n\t\t// Go through every key on the object,\n\t\t} else {\n\t\t\tfor ( key in elems ) {\n\t\t\t\tvalue = callback( elems[ key ], key, arg );\n\n\t\t\t\tif ( value != null ) {\n\t\t\t\t\tret[ ret.length ] = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Flatten any nested arrays\n\t\treturn ret.concat.apply( [], ret );\n\t},\n\n\t// A global GUID counter for objects\n\tguid: 1,\n\n\t// Bind a function to a context, optionally partially applying any\n\t// arguments.\n\tproxy: function( fn, context ) {\n\t\tvar tmp, args, proxy;\n\n\t\tif ( typeof context === \"string\" ) {\n\t\t\ttmp = fn[ context ];\n\t\t\tcontext = fn;\n\t\t\tfn = tmp;\n\t\t}\n\n\t\t// Quick check to determine if target is callable, in the spec\n\t\t// this throws a TypeError, but we will just return undefined.\n\t\tif ( !jQuery.isFunction( fn ) ) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Simulated bind\n\t\targs = core_slice.call( arguments, 2 );\n\t\tproxy = function() {\n\t\t\treturn fn.apply( context, args.concat( core_slice.call( arguments ) ) );\n\t\t};\n\n\t\t// Set the guid of unique handler to the same of original handler, so it can be removed\n\t\tproxy.guid = fn.guid = fn.guid || jQuery.guid++;\n\n\t\treturn proxy;\n\t},\n\n\t// Multifunctional method to get and set values of a collection\n\t// The value/s can optionally be executed if it's a function\n\taccess: function( elems, fn, key, value, chainable, emptyGet, pass ) {\n\t\tvar exec,\n\t\t\tbulk = key == null,\n\t\t\ti = 0,\n\t\t\tlength = elems.length;\n\n\t\t// Sets many values\n\t\tif ( key && typeof key === \"object\" ) {\n\t\t\tfor ( i in key ) {\n\t\t\t\tjQuery.access( elems, fn, i, key[i], 1, emptyGet, value );\n\t\t\t}\n\t\t\tchainable = 1;\n\n\t\t// Sets one value\n\t\t} else if ( value !== undefined ) {\n\t\t\t// Optionally, function values get executed if exec is true\n\t\t\texec = pass === undefined && jQuery.isFunction( value );\n\n\t\t\tif ( bulk ) {\n\t\t\t\t// Bulk operations only iterate when executing function values\n\t\t\t\tif ( exec ) {\n\t\t\t\t\texec = fn;\n\t\t\t\t\tfn = function( elem, key, value ) {\n\t\t\t\t\t\treturn exec.call( jQuery( elem ), value );\n\t\t\t\t\t};\n\n\t\t\t\t// Otherwise they run against the entire set\n\t\t\t\t} else {\n\t\t\t\t\tfn.call( elems, value );\n\t\t\t\t\tfn = null;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( fn ) {\n\t\t\t\tfor (; i < length; i++ ) {\n\t\t\t\t\tfn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tchainable = 1;\n\t\t}\n\n\t\treturn chainable ?\n\t\t\telems :\n\n\t\t\t// Gets\n\t\t\tbulk ?\n\t\t\t\tfn.call( elems ) :\n\t\t\t\tlength ? fn( elems[0], key ) : emptyGet;\n\t},\n\n\tnow: function() {\n\t\treturn ( new Date() ).getTime();\n\t}\n});\n\njQuery.ready.promise = function( obj ) {\n\tif ( !readyList ) {\n\n\t\treadyList = jQuery.Deferred();\n\n\t\t// Catch cases where $(document).ready() is called after the browser event has already occurred.\n\t\t// we once tried to use readyState \"interactive\" here, but it caused issues like the one\n\t\t// discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15\n\t\tif ( document.readyState === \"complete\" ) {\n\t\t\t// Handle it asynchronously to allow scripts the opportunity to delay ready\n\t\t\tsetTimeout( jQuery.ready, 1 );\n\n\t\t// Standards-based browsers support DOMContentLoaded\n\t\t} else if ( document.addEventListener ) {\n\t\t\t// Use the handy event callback\n\t\t\tdocument.addEventListener( \"DOMContentLoaded\", DOMContentLoaded, false );\n\n\t\t\t// A fallback to window.onload, that will always work\n\t\t\twindow.addEventListener( \"load\", jQuery.ready, false );\n\n\t\t// If IE event model is used\n\t\t} else {\n\t\t\t// Ensure firing before onload, maybe late but safe also for iframes\n\t\t\tdocument.attachEvent( \"onreadystatechange\", DOMContentLoaded );\n\n\t\t\t// A fallback to window.onload, that will always work\n\t\t\twindow.attachEvent( \"onload\", jQuery.ready );\n\n\t\t\t// If IE and not a frame\n\t\t\t// continually check to see if the document is ready\n\t\t\tvar top = false;\n\n\t\t\ttry {\n\t\t\t\ttop = window.frameElement == null && document.documentElement;\n\t\t\t} catch(e) {}\n\n\t\t\tif ( top && top.doScroll ) {\n\t\t\t\t(function doScrollCheck() {\n\t\t\t\t\tif ( !jQuery.isReady ) {\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t// Use the trick by Diego Perini\n\t\t\t\t\t\t\t// http://javascript.nwbox.com/IEContentLoaded/\n\t\t\t\t\t\t\ttop.doScroll(\"left\");\n\t\t\t\t\t\t} catch(e) {\n\t\t\t\t\t\t\treturn setTimeout( doScrollCheck, 50 );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// and execute any waiting functions\n\t\t\t\t\t\tjQuery.ready();\n\t\t\t\t\t}\n\t\t\t\t})();\n\t\t\t}\n\t\t}\n\t}\n\treturn readyList.promise( obj );\n};\n\n// Populate the class2type map\njQuery.each(\"Boolean Number String Function Array Date RegExp Object\".split(\" \"), function(i, name) {\n\tclass2type[ \"[object \" + name + \"]\" ] = name.toLowerCase();\n});\n\n// All jQuery objects should point back to these\nrootjQuery = jQuery(document);\n// String to Object options format cache\nvar optionsCache = {};\n\n// Convert String-formatted options into Object-formatted ones and store in cache\nfunction createOptions( options ) {\n\tvar object = optionsCache[ options ] = {};\n\tjQuery.each( options.split( core_rspace ), function( _, flag ) {\n\t\tobject[ flag ] = true;\n\t});\n\treturn object;\n}\n\n/*\n * Create a callback list using the following parameters:\n *\n *\toptions: an optional list of space-separated options that will change how\n *\t\t\tthe callback list behaves or a more traditional option object\n *\n * By default a callback list will act like an event callback list and can be\n * \"fired\" multiple times.\n *\n * Possible options:\n *\n *\tonce:\t\t\twill ensure the callback list can only be fired once (like a Deferred)\n *\n *\tmemory:\t\t\twill keep track of previous values and will call any callback added\n *\t\t\t\t\tafter the list has been fired right away with the latest \"memorized\"\n *\t\t\t\t\tvalues (like a Deferred)\n *\n *\tunique:\t\t\twill ensure a callback can only be added once (no duplicate in the list)\n *\n *\tstopOnFalse:\tinterrupt callings when a callback returns false\n *\n */\njQuery.Callbacks = function( options ) {\n\n\t// Convert options from String-formatted to Object-formatted if needed\n\t// (we check in cache first)\n\toptions = typeof options === \"string\" ?\n\t\t( optionsCache[ options ] || createOptions( options ) ) :\n\t\tjQuery.extend( {}, options );\n\n\tvar // Last fire value (for non-forgettable lists)\n\t\tmemory,\n\t\t// Flag to know if list was already fired\n\t\tfired,\n\t\t// Flag to know if list is currently firing\n\t\tfiring,\n\t\t// First callback to fire (used internally by add and fireWith)\n\t\tfiringStart,\n\t\t// End of the loop when firing\n\t\tfiringLength,\n\t\t// Index of currently firing callback (modified by remove if needed)\n\t\tfiringIndex,\n\t\t// Actual callback list\n\t\tlist = [],\n\t\t// Stack of fire calls for repeatable lists\n\t\tstack = !options.once && [],\n\t\t// Fire callbacks\n\t\tfire = function( data ) {\n\t\t\tmemory = options.memory && data;\n\t\t\tfired = true;\n\t\t\tfiringIndex = firingStart || 0;\n\t\t\tfiringStart = 0;\n\t\t\tfiringLength = list.length;\n\t\t\tfiring = true;\n\t\t\tfor ( ; list && firingIndex < firingLength; firingIndex++ ) {\n\t\t\t\tif ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) {\n\t\t\t\t\tmemory = false; // To prevent further calls using add\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfiring = false;\n\t\t\tif ( list ) {\n\t\t\t\tif ( stack ) {\n\t\t\t\t\tif ( stack.length ) {\n\t\t\t\t\t\tfire( stack.shift() );\n\t\t\t\t\t}\n\t\t\t\t} else if ( memory ) {\n\t\t\t\t\tlist = [];\n\t\t\t\t} else {\n\t\t\t\t\tself.disable();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t// Actual Callbacks object\n\t\tself = {\n\t\t\t// Add a callback or a collection of callbacks to the list\n\t\t\tadd: function() {\n\t\t\t\tif ( list ) {\n\t\t\t\t\t// First, we save the current length\n\t\t\t\t\tvar start = list.length;\n\t\t\t\t\t(function add( args ) {\n\t\t\t\t\t\tjQuery.each( args, function( _, arg ) {\n\t\t\t\t\t\t\tvar type = jQuery.type( arg );\n\t\t\t\t\t\t\tif ( type === \"function\" && ( !options.unique || !self.has( arg ) ) ) {\n\t\t\t\t\t\t\t\tlist.push( arg );\n\t\t\t\t\t\t\t} else if ( arg && arg.length && type !== \"string\" ) {\n\t\t\t\t\t\t\t\t// Inspect recursively\n\t\t\t\t\t\t\t\tadd( arg );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t})( arguments );\n\t\t\t\t\t// Do we need to add the callbacks to the\n\t\t\t\t\t// current firing batch?\n\t\t\t\t\tif ( firing ) {\n\t\t\t\t\t\tfiringLength = list.length;\n\t\t\t\t\t// With memory, if we're not firing then\n\t\t\t\t\t// we should call right away\n\t\t\t\t\t} else if ( memory ) {\n\t\t\t\t\t\tfiringStart = start;\n\t\t\t\t\t\tfire( memory );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Remove a callback from the list\n\t\t\tremove: function() {\n\t\t\t\tif ( list ) {\n\t\t\t\t\tjQuery.each( arguments, function( _, arg ) {\n\t\t\t\t\t\tvar index;\n\t\t\t\t\t\twhile( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {\n\t\t\t\t\t\t\tlist.splice( index, 1 );\n\t\t\t\t\t\t\t// Handle firing indexes\n\t\t\t\t\t\t\tif ( firing ) {\n\t\t\t\t\t\t\t\tif ( index <= firingLength ) {\n\t\t\t\t\t\t\t\t\tfiringLength--;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif ( index <= firingIndex ) {\n\t\t\t\t\t\t\t\t\tfiringIndex--;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Control if a given callback is in the list\n\t\t\thas: function( fn ) {\n\t\t\t\treturn jQuery.inArray( fn, list ) > -1;\n\t\t\t},\n\t\t\t// Remove all callbacks from the list\n\t\t\tempty: function() {\n\t\t\t\tlist = [];\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Have the list do nothing anymore\n\t\t\tdisable: function() {\n\t\t\t\tlist = stack = memory = undefined;\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Is it disabled?\n\t\t\tdisabled: function() {\n\t\t\t\treturn !list;\n\t\t\t},\n\t\t\t// Lock the list in its current state\n\t\t\tlock: function() {\n\t\t\t\tstack = undefined;\n\t\t\t\tif ( !memory ) {\n\t\t\t\t\tself.disable();\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Is it locked?\n\t\t\tlocked: function() {\n\t\t\t\treturn !stack;\n\t\t\t},\n\t\t\t// Call all callbacks with the given context and arguments\n\t\t\tfireWith: function( context, args ) {\n\t\t\t\targs = args || [];\n\t\t\t\targs = [ context, args.slice ? args.slice() : args ];\n\t\t\t\tif ( list && ( !fired || stack ) ) {\n\t\t\t\t\tif ( firing ) {\n\t\t\t\t\t\tstack.push( args );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfire( args );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// Call all the callbacks with the given arguments\n\t\t\tfire: function() {\n\t\t\t\tself.fireWith( this, arguments );\n\t\t\t\treturn this;\n\t\t\t},\n\t\t\t// To know if the callbacks have already been called at least once\n\t\t\tfired: function() {\n\t\t\t\treturn !!fired;\n\t\t\t}\n\t\t};\n\n\treturn self;\n};\njQuery.extend({\n\n\tDeferred: function( func ) {\n\t\tvar tuples = [\n\t\t\t\t// action, add listener, listener list, final state\n\t\t\t\t[ \"resolve\", \"done\", jQuery.Callbacks(\"once memory\"), \"resolved\" ],\n\t\t\t\t[ \"reject\", \"fail\", jQuery.Callbacks(\"once memory\"), \"rejected\" ],\n\t\t\t\t[ \"notify\", \"progress\", jQuery.Callbacks(\"memory\") ]\n\t\t\t],\n\t\t\tstate = \"pending\",\n\t\t\tpromise = {\n\t\t\t\tstate: function() {\n\t\t\t\t\treturn state;\n\t\t\t\t},\n\t\t\t\talways: function() {\n\t\t\t\t\tdeferred.done( arguments ).fail( arguments );\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\t\t\t\tthen: function( /* fnDone, fnFail, fnProgress */ ) {\n\t\t\t\t\tvar fns = arguments;\n\t\t\t\t\treturn jQuery.Deferred(function( newDefer ) {\n\t\t\t\t\t\tjQuery.each( tuples, function( i, tuple ) {\n\t\t\t\t\t\t\tvar action = tuple[ 0 ],\n\t\t\t\t\t\t\t\tfn = fns[ i ];\n\t\t\t\t\t\t\t// deferred[ done | fail | progress ] for forwarding actions to newDefer\n\t\t\t\t\t\t\tdeferred[ tuple[1] ]( jQuery.isFunction( fn ) ?\n\t\t\t\t\t\t\t\tfunction() {\n\t\t\t\t\t\t\t\t\tvar returned = fn.apply( this, arguments );\n\t\t\t\t\t\t\t\t\tif ( returned && jQuery.isFunction( returned.promise ) ) {\n\t\t\t\t\t\t\t\t\t\treturned.promise()\n\t\t\t\t\t\t\t\t\t\t\t.done( newDefer.resolve )\n\t\t\t\t\t\t\t\t\t\t\t.fail( newDefer.reject )\n\t\t\t\t\t\t\t\t\t\t\t.progress( newDefer.notify );\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tnewDefer[ action + \"With\" ]( this === deferred ? newDefer : this, [ returned ] );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} :\n\t\t\t\t\t\t\t\tnewDefer[ action ]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t\tfns = null;\n\t\t\t\t\t}).promise();\n\t\t\t\t},\n\t\t\t\t// Get a promise for this deferred\n\t\t\t\t// If obj is provided, the promise aspect is added to the object\n\t\t\t\tpromise: function( obj ) {\n\t\t\t\t\treturn obj != null ? jQuery.extend( obj, promise ) : promise;\n\t\t\t\t}\n\t\t\t},\n\t\t\tdeferred = {};\n\n\t\t// Keep pipe for back-compat\n\t\tpromise.pipe = promise.then;\n\n\t\t// Add list-specific methods\n\t\tjQuery.each( tuples, function( i, tuple ) {\n\t\t\tvar list = tuple[ 2 ],\n\t\t\t\tstateString = tuple[ 3 ];\n\n\t\t\t// promise[ done | fail | progress ] = list.add\n\t\t\tpromise[ tuple[1] ] = list.add;\n\n\t\t\t// Handle state\n\t\t\tif ( stateString ) {\n\t\t\t\tlist.add(function() {\n\t\t\t\t\t// state = [ resolved | rejected ]\n\t\t\t\t\tstate = stateString;\n\n\t\t\t\t// [ reject_list | resolve_list ].disable; progress_list.lock\n\t\t\t\t}, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock );\n\t\t\t}\n\n\t\t\t// deferred[ resolve | reject | notify ] = list.fire\n\t\t\tdeferred[ tuple[0] ] = list.fire;\n\t\t\tdeferred[ tuple[0] + \"With\" ] = list.fireWith;\n\t\t});\n\n\t\t// Make the deferred a promise\n\t\tpromise.promise( deferred );\n\n\t\t// Call given func if any\n\t\tif ( func ) {\n\t\t\tfunc.call( deferred, deferred );\n\t\t}\n\n\t\t// All done!\n\t\treturn deferred;\n\t},\n\n\t// Deferred helper\n\twhen: function( subordinate /* , ..., subordinateN */ ) {\n\t\tvar i = 0,\n\t\t\tresolveValues = core_slice.call( arguments ),\n\t\t\tlength = resolveValues.length,\n\n\t\t\t// the count of uncompleted subordinates\n\t\t\tremaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0,\n\n\t\t\t// the master Deferred. If resolveValues consist of only a single Deferred, just use that.\n\t\t\tdeferred = remaining === 1 ? subordinate : jQuery.Deferred(),\n\n\t\t\t// Update function for both resolve and progress values\n\t\t\tupdateFunc = function( i, contexts, values ) {\n\t\t\t\treturn function( value ) {\n\t\t\t\t\tcontexts[ i ] = this;\n\t\t\t\t\tvalues[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value;\n\t\t\t\t\tif( values === progressValues ) {\n\t\t\t\t\t\tdeferred.notifyWith( contexts, values );\n\t\t\t\t\t} else if ( !( --remaining ) ) {\n\t\t\t\t\t\tdeferred.resolveWith( contexts, values );\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t},\n\n\t\t\tprogressValues, progressContexts, resolveContexts;\n\n\t\t// add listeners to Deferred subordinates; treat others as resolved\n\t\tif ( length > 1 ) {\n\t\t\tprogressValues = new Array( length );\n\t\t\tprogressContexts = new Array( length );\n\t\t\tresolveContexts = new Array( length );\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tif ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) {\n\t\t\t\t\tresolveValues[ i ].promise()\n\t\t\t\t\t\t.done( updateFunc( i, resolveContexts, resolveValues ) )\n\t\t\t\t\t\t.fail( deferred.reject )\n\t\t\t\t\t\t.progress( updateFunc( i, progressContexts, progressValues ) );\n\t\t\t\t} else {\n\t\t\t\t\t--remaining;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// if we're not waiting on anything, resolve the master\n\t\tif ( !remaining ) {\n\t\t\tdeferred.resolveWith( resolveContexts, resolveValues );\n\t\t}\n\n\t\treturn deferred.promise();\n\t}\n});\njQuery.support = (function() {\n\n\tvar support,\n\t\tall,\n\t\ta,\n\t\tselect,\n\t\topt,\n\t\tinput,\n\t\tfragment,\n\t\teventName,\n\t\ti,\n\t\tisSupported,\n\t\tclickFn,\n\t\tdiv = document.createElement(\"div\");\n\n\t// Preliminary tests\n\tdiv.setAttribute( \"className\", \"t\" );\n\tdiv.innerHTML = \"  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>\";\n\n\tall = div.getElementsByTagName(\"*\");\n\ta = div.getElementsByTagName(\"a\")[ 0 ];\n\ta.style.cssText = \"top:1px;float:left;opacity:.5\";\n\n\t// Can't get basic test support\n\tif ( !all || !all.length ) {\n\t\treturn {};\n\t}\n\n\t// First batch of supports tests\n\tselect = document.createElement(\"select\");\n\topt = select.appendChild( document.createElement(\"option\") );\n\tinput = div.getElementsByTagName(\"input\")[ 0 ];\n\n\tsupport = {\n\t\t// IE strips leading whitespace when .innerHTML is used\n\t\tleadingWhitespace: ( div.firstChild.nodeType === 3 ),\n\n\t\t// Make sure that tbody elements aren't automatically inserted\n\t\t// IE will insert them into empty tables\n\t\ttbody: !div.getElementsByTagName(\"tbody\").length,\n\n\t\t// Make sure that link elements get serialized correctly by innerHTML\n\t\t// This requires a wrapper element in IE\n\t\thtmlSerialize: !!div.getElementsByTagName(\"link\").length,\n\n\t\t// Get the style information from getAttribute\n\t\t// (IE uses .cssText instead)\n\t\tstyle: /top/.test( a.getAttribute(\"style\") ),\n\n\t\t// Make sure that URLs aren't manipulated\n\t\t// (IE normalizes it by default)\n\t\threfNormalized: ( a.getAttribute(\"href\") === \"/a\" ),\n\n\t\t// Make sure that element opacity exists\n\t\t// (IE uses filter instead)\n\t\t// Use a regex to work around a WebKit issue. See #5145\n\t\topacity: /^0.5/.test( a.style.opacity ),\n\n\t\t// Verify style float existence\n\t\t// (IE uses styleFloat instead of cssFloat)\n\t\tcssFloat: !!a.style.cssFloat,\n\n\t\t// Make sure that if no value is specified for a checkbox\n\t\t// that it defaults to \"on\".\n\t\t// (WebKit defaults to \"\" instead)\n\t\tcheckOn: ( input.value === \"on\" ),\n\n\t\t// Make sure that a selected-by-default option has a working selected property.\n\t\t// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)\n\t\toptSelected: opt.selected,\n\n\t\t// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)\n\t\tgetSetAttribute: div.className !== \"t\",\n\n\t\t// Tests for enctype support on a form(#6743)\n\t\tenctype: !!document.createElement(\"form\").enctype,\n\n\t\t// Makes sure cloning an html5 element does not cause problems\n\t\t// Where outerHTML is undefined, this still works\n\t\thtml5Clone: document.createElement(\"nav\").cloneNode( true ).outerHTML !== \"<:nav></:nav>\",\n\n\t\t// jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode\n\t\tboxModel: ( document.compatMode === \"CSS1Compat\" ),\n\n\t\t// Will be defined later\n\t\tsubmitBubbles: true,\n\t\tchangeBubbles: true,\n\t\tfocusinBubbles: false,\n\t\tdeleteExpando: true,\n\t\tnoCloneEvent: true,\n\t\tinlineBlockNeedsLayout: false,\n\t\tshrinkWrapBlocks: false,\n\t\treliableMarginRight: true,\n\t\tboxSizingReliable: true,\n\t\tpixelPosition: false\n\t};\n\n\t// Make sure checked status is properly cloned\n\tinput.checked = true;\n\tsupport.noCloneChecked = input.cloneNode( true ).checked;\n\n\t// Make sure that the options inside disabled selects aren't marked as disabled\n\t// (WebKit marks them as disabled)\n\tselect.disabled = true;\n\tsupport.optDisabled = !opt.disabled;\n\n\t// Test to see if it's possible to delete an expando from an element\n\t// Fails in Internet Explorer\n\ttry {\n\t\tdelete div.test;\n\t} catch( e ) {\n\t\tsupport.deleteExpando = false;\n\t}\n\n\tif ( !div.addEventListener && div.attachEvent && div.fireEvent ) {\n\t\tdiv.attachEvent( \"onclick\", clickFn = function() {\n\t\t\t// Cloning a node shouldn't copy over any\n\t\t\t// bound event handlers (IE does this)\n\t\t\tsupport.noCloneEvent = false;\n\t\t});\n\t\tdiv.cloneNode( true ).fireEvent(\"onclick\");\n\t\tdiv.detachEvent( \"onclick\", clickFn );\n\t}\n\n\t// Check if a radio maintains its value\n\t// after being appended to the DOM\n\tinput = document.createElement(\"input\");\n\tinput.value = \"t\";\n\tinput.setAttribute( \"type\", \"radio\" );\n\tsupport.radioValue = input.value === \"t\";\n\n\tinput.setAttribute( \"checked\", \"checked\" );\n\n\t// #11217 - WebKit loses check when the name is after the checked attribute\n\tinput.setAttribute( \"name\", \"t\" );\n\n\tdiv.appendChild( input );\n\tfragment = document.createDocumentFragment();\n\tfragment.appendChild( div.lastChild );\n\n\t// WebKit doesn't clone checked state correctly in fragments\n\tsupport.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;\n\n\t// Check if a disconnected checkbox will retain its checked\n\t// value of true after appended to the DOM (IE6/7)\n\tsupport.appendChecked = input.checked;\n\n\tfragment.removeChild( input );\n\tfragment.appendChild( div );\n\n\t// Technique from Juriy Zaytsev\n\t// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/\n\t// We only care about the case where non-standard event systems\n\t// are used, namely in IE. Short-circuiting here helps us to\n\t// avoid an eval call (in setAttribute) which can cause CSP\n\t// to go haywire. See: https://developer.mozilla.org/en/Security/CSP\n\tif ( div.attachEvent ) {\n\t\tfor ( i in {\n\t\t\tsubmit: true,\n\t\t\tchange: true,\n\t\t\tfocusin: true\n\t\t}) {\n\t\t\teventName = \"on\" + i;\n\t\t\tisSupported = ( eventName in div );\n\t\t\tif ( !isSupported ) {\n\t\t\t\tdiv.setAttribute( eventName, \"return;\" );\n\t\t\t\tisSupported = ( typeof div[ eventName ] === \"function\" );\n\t\t\t}\n\t\t\tsupport[ i + \"Bubbles\" ] = isSupported;\n\t\t}\n\t}\n\n\t// Run tests that need a body at doc ready\n\tjQuery(function() {\n\t\tvar container, div, tds, marginDiv,\n\t\t\tdivReset = \"padding:0;margin:0;border:0;display:block;overflow:hidden;\",\n\t\t\tbody = document.getElementsByTagName(\"body\")[0];\n\n\t\tif ( !body ) {\n\t\t\t// Return for frameset docs that don't have a body\n\t\t\treturn;\n\t\t}\n\n\t\tcontainer = document.createElement(\"div\");\n\t\tcontainer.style.cssText = \"visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px\";\n\t\tbody.insertBefore( container, body.firstChild );\n\n\t\t// Construct the test element\n\t\tdiv = document.createElement(\"div\");\n\t\tcontainer.appendChild( div );\n\n\t\t// Check if table cells still have offsetWidth/Height when they are set\n\t\t// to display:none and there are still other visible table cells in a\n\t\t// table row; if so, offsetWidth/Height are not reliable for use when\n\t\t// determining if an element has been hidden directly using\n\t\t// display:none (it is still safe to use offsets if a parent element is\n\t\t// hidden; don safety goggles and see bug #4512 for more information).\n\t\t// (only IE 8 fails this test)\n\t\tdiv.innerHTML = \"<table><tr><td></td><td>t</td></tr></table>\";\n\t\ttds = div.getElementsByTagName(\"td\");\n\t\ttds[ 0 ].style.cssText = \"padding:0;margin:0;border:0;display:none\";\n\t\tisSupported = ( tds[ 0 ].offsetHeight === 0 );\n\n\t\ttds[ 0 ].style.display = \"\";\n\t\ttds[ 1 ].style.display = \"none\";\n\n\t\t// Check if empty table cells still have offsetWidth/Height\n\t\t// (IE <= 8 fail this test)\n\t\tsupport.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );\n\n\t\t// Check box-sizing and margin behavior\n\t\tdiv.innerHTML = \"\";\n\t\tdiv.style.cssText = \"box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;\";\n\t\tsupport.boxSizing = ( div.offsetWidth === 4 );\n\t\tsupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 );\n\n\t\t// NOTE: To any future maintainer, we've window.getComputedStyle\n\t\t// because jsdom on node.js will break without it.\n\t\tif ( window.getComputedStyle ) {\n\t\t\tsupport.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== \"1%\";\n\t\t\tsupport.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: \"4px\" } ).width === \"4px\";\n\n\t\t\t// Check if div with explicit width and no margin-right incorrectly\n\t\t\t// gets computed margin-right based on width of container. For more\n\t\t\t// info see bug #3333\n\t\t\t// Fails in WebKit before Feb 2011 nightlies\n\t\t\t// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right\n\t\t\tmarginDiv = document.createElement(\"div\");\n\t\t\tmarginDiv.style.cssText = div.style.cssText = divReset;\n\t\t\tmarginDiv.style.marginRight = marginDiv.style.width = \"0\";\n\t\t\tdiv.style.width = \"1px\";\n\t\t\tdiv.appendChild( marginDiv );\n\t\t\tsupport.reliableMarginRight =\n\t\t\t\t!parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight );\n\t\t}\n\n\t\tif ( typeof div.style.zoom !== \"undefined\" ) {\n\t\t\t// Check if natively block-level elements act like inline-block\n\t\t\t// elements when setting their display to 'inline' and giving\n\t\t\t// them layout\n\t\t\t// (IE < 8 does this)\n\t\t\tdiv.innerHTML = \"\";\n\t\t\tdiv.style.cssText = divReset + \"width:1px;padding:1px;display:inline;zoom:1\";\n\t\t\tsupport.inlineBlockNeedsLayout = ( div.offsetWidth === 3 );\n\n\t\t\t// Check if elements with layout shrink-wrap their children\n\t\t\t// (IE 6 does this)\n\t\t\tdiv.style.display = \"block\";\n\t\t\tdiv.style.overflow = \"visible\";\n\t\t\tdiv.innerHTML = \"<div></div>\";\n\t\t\tdiv.firstChild.style.width = \"5px\";\n\t\t\tsupport.shrinkWrapBlocks = ( div.offsetWidth !== 3 );\n\n\t\t\tcontainer.style.zoom = 1;\n\t\t}\n\n\t\t// Null elements to avoid leaks in IE\n\t\tbody.removeChild( container );\n\t\tcontainer = div = tds = marginDiv = null;\n\t});\n\n\t// Null elements to avoid leaks in IE\n\tfragment.removeChild( div );\n\tall = a = select = opt = input = fragment = div = null;\n\n\treturn support;\n})();\nvar rbrace = /(?:\\{[\\s\\S]*\\}|\\[[\\s\\S]*\\])$/,\n\trmultiDash = /([A-Z])/g;\n\njQuery.extend({\n\tcache: {},\n\n\tdeletedIds: [],\n\n\t// Remove at next major release (1.9/2.0)\n\tuuid: 0,\n\n\t// Unique for each copy of jQuery on the page\n\t// Non-digits removed to match rinlinejQuery\n\texpando: \"jQuery\" + ( jQuery.fn.jquery + Math.random() ).replace( /\\D/g, \"\" ),\n\n\t// The following elements throw uncatchable exceptions if you\n\t// attempt to add expando properties to them.\n\tnoData: {\n\t\t\"embed\": true,\n\t\t// Ban all objects except for Flash (which handle expandos)\n\t\t\"object\": \"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\",\n\t\t\"applet\": true\n\t},\n\n\thasData: function( elem ) {\n\t\telem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];\n\t\treturn !!elem && !isEmptyDataObject( elem );\n\t},\n\n\tdata: function( elem, name, data, pvt /* Internal Use Only */ ) {\n\t\tif ( !jQuery.acceptData( elem ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar thisCache, ret,\n\t\t\tinternalKey = jQuery.expando,\n\t\t\tgetByName = typeof name === \"string\",\n\n\t\t\t// We have to handle DOM nodes and JS objects differently because IE6-7\n\t\t\t// can't GC object references properly across the DOM-JS boundary\n\t\t\tisNode = elem.nodeType,\n\n\t\t\t// Only DOM nodes need the global jQuery cache; JS object data is\n\t\t\t// attached directly to the object so GC can occur automatically\n\t\t\tcache = isNode ? jQuery.cache : elem,\n\n\t\t\t// Only defining an ID for JS objects if its cache already exists allows\n\t\t\t// the code to shortcut on the same path as a DOM node with no cache\n\t\t\tid = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey;\n\n\t\t// Avoid doing any more work than we need to when trying to get data on an\n\t\t// object that has no data at all\n\t\tif ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( !id ) {\n\t\t\t// Only DOM nodes need a new unique ID for each element since their data\n\t\t\t// ends up in the global cache\n\t\t\tif ( isNode ) {\n\t\t\t\telem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++;\n\t\t\t} else {\n\t\t\t\tid = internalKey;\n\t\t\t}\n\t\t}\n\n\t\tif ( !cache[ id ] ) {\n\t\t\tcache[ id ] = {};\n\n\t\t\t// Avoids exposing jQuery metadata on plain JS objects when the object\n\t\t\t// is serialized using JSON.stringify\n\t\t\tif ( !isNode ) {\n\t\t\t\tcache[ id ].toJSON = jQuery.noop;\n\t\t\t}\n\t\t}\n\n\t\t// An object can be passed to jQuery.data instead of a key/value pair; this gets\n\t\t// shallow copied over onto the existing cache\n\t\tif ( typeof name === \"object\" || typeof name === \"function\" ) {\n\t\t\tif ( pvt ) {\n\t\t\t\tcache[ id ] = jQuery.extend( cache[ id ], name );\n\t\t\t} else {\n\t\t\t\tcache[ id ].data = jQuery.extend( cache[ id ].data, name );\n\t\t\t}\n\t\t}\n\n\t\tthisCache = cache[ id ];\n\n\t\t// jQuery data() is stored in a separate object inside the object's internal data\n\t\t// cache in order to avoid key collisions between internal data and user-defined\n\t\t// data.\n\t\tif ( !pvt ) {\n\t\t\tif ( !thisCache.data ) {\n\t\t\t\tthisCache.data = {};\n\t\t\t}\n\n\t\t\tthisCache = thisCache.data;\n\t\t}\n\n\t\tif ( data !== undefined ) {\n\t\t\tthisCache[ jQuery.camelCase( name ) ] = data;\n\t\t}\n\n\t\t// Check for both converted-to-camel and non-converted data property names\n\t\t// If a data property was specified\n\t\tif ( getByName ) {\n\n\t\t\t// First Try to find as-is property data\n\t\t\tret = thisCache[ name ];\n\n\t\t\t// Test for null|undefined property data\n\t\t\tif ( ret == null ) {\n\n\t\t\t\t// Try to find the camelCased property\n\t\t\t\tret = thisCache[ jQuery.camelCase( name ) ];\n\t\t\t}\n\t\t} else {\n\t\t\tret = thisCache;\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\tremoveData: function( elem, name, pvt /* Internal Use Only */ ) {\n\t\tif ( !jQuery.acceptData( elem ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar thisCache, i, l,\n\n\t\t\tisNode = elem.nodeType,\n\n\t\t\t// See jQuery.data for more information\n\t\t\tcache = isNode ? jQuery.cache : elem,\n\t\t\tid = isNode ? elem[ jQuery.expando ] : jQuery.expando;\n\n\t\t// If there is already no cache entry for this object, there is no\n\t\t// purpose in continuing\n\t\tif ( !cache[ id ] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( name ) {\n\n\t\t\tthisCache = pvt ? cache[ id ] : cache[ id ].data;\n\n\t\t\tif ( thisCache ) {\n\n\t\t\t\t// Support array or space separated string names for data keys\n\t\t\t\tif ( !jQuery.isArray( name ) ) {\n\n\t\t\t\t\t// try the string as a key before any manipulation\n\t\t\t\t\tif ( name in thisCache ) {\n\t\t\t\t\t\tname = [ name ];\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// split the camel cased version by spaces unless a key with the spaces exists\n\t\t\t\t\t\tname = jQuery.camelCase( name );\n\t\t\t\t\t\tif ( name in thisCache ) {\n\t\t\t\t\t\t\tname = [ name ];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tname = name.split(\" \");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor ( i = 0, l = name.length; i < l; i++ ) {\n\t\t\t\t\tdelete thisCache[ name[i] ];\n\t\t\t\t}\n\n\t\t\t\t// If there is no data left in the cache, we want to continue\n\t\t\t\t// and let the cache object itself get destroyed\n\t\t\t\tif ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// See jQuery.data for more information\n\t\tif ( !pvt ) {\n\t\t\tdelete cache[ id ].data;\n\n\t\t\t// Don't destroy the parent cache unless the internal data object\n\t\t\t// had been the only thing left in it\n\t\t\tif ( !isEmptyDataObject( cache[ id ] ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\n\t\t// Destroy the cache\n\t\tif ( isNode ) {\n\t\t\tjQuery.cleanData( [ elem ], true );\n\n\t\t// Use delete when supported for expandos or `cache` is not a window per isWindow (#10080)\n\t\t} else if ( jQuery.support.deleteExpando || cache != cache.window ) {\n\t\t\tdelete cache[ id ];\n\n\t\t// When all else fails, null\n\t\t} else {\n\t\t\tcache[ id ] = null;\n\t\t}\n\t},\n\n\t// For internal use only.\n\t_data: function( elem, name, data ) {\n\t\treturn jQuery.data( elem, name, data, true );\n\t},\n\n\t// A method for determining if a DOM node can handle the data expando\n\tacceptData: function( elem ) {\n\t\tvar noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ];\n\n\t\t// nodes accept data unless otherwise specified; rejection can be conditional\n\t\treturn !noData || noData !== true && elem.getAttribute(\"classid\") === noData;\n\t}\n});\n\njQuery.fn.extend({\n\tdata: function( key, value ) {\n\t\tvar parts, part, attr, name, l,\n\t\t\telem = this[0],\n\t\t\ti = 0,\n\t\t\tdata = null;\n\n\t\t// Gets all values\n\t\tif ( key === undefined ) {\n\t\t\tif ( this.length ) {\n\t\t\t\tdata = jQuery.data( elem );\n\n\t\t\t\tif ( elem.nodeType === 1 && !jQuery._data( elem, \"parsedAttrs\" ) ) {\n\t\t\t\t\tattr = elem.attributes;\n\t\t\t\t\tfor ( l = attr.length; i < l; i++ ) {\n\t\t\t\t\t\tname = attr[i].name;\n\n\t\t\t\t\t\tif ( !name.indexOf( \"data-\" ) ) {\n\t\t\t\t\t\t\tname = jQuery.camelCase( name.substring(5) );\n\n\t\t\t\t\t\t\tdataAttr( elem, name, data[ name ] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tjQuery._data( elem, \"parsedAttrs\", true );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn data;\n\t\t}\n\n\t\t// Sets multiple values\n\t\tif ( typeof key === \"object\" ) {\n\t\t\treturn this.each(function() {\n\t\t\t\tjQuery.data( this, key );\n\t\t\t});\n\t\t}\n\n\t\tparts = key.split( \".\", 2 );\n\t\tparts[1] = parts[1] ? \".\" + parts[1] : \"\";\n\t\tpart = parts[1] + \"!\";\n\n\t\treturn jQuery.access( this, function( value ) {\n\n\t\t\tif ( value === undefined ) {\n\t\t\t\tdata = this.triggerHandler( \"getData\" + part, [ parts[0] ] );\n\n\t\t\t\t// Try to fetch any internally stored data first\n\t\t\t\tif ( data === undefined && elem ) {\n\t\t\t\t\tdata = jQuery.data( elem, key );\n\t\t\t\t\tdata = dataAttr( elem, key, data );\n\t\t\t\t}\n\n\t\t\t\treturn data === undefined && parts[1] ?\n\t\t\t\t\tthis.data( parts[0] ) :\n\t\t\t\t\tdata;\n\t\t\t}\n\n\t\t\tparts[1] = value;\n\t\t\tthis.each(function() {\n\t\t\t\tvar self = jQuery( this );\n\n\t\t\t\tself.triggerHandler( \"setData\" + part, parts );\n\t\t\t\tjQuery.data( this, key, value );\n\t\t\t\tself.triggerHandler( \"changeData\" + part, parts );\n\t\t\t});\n\t\t}, null, value, arguments.length > 1, null, false );\n\t},\n\n\tremoveData: function( key ) {\n\t\treturn this.each(function() {\n\t\t\tjQuery.removeData( this, key );\n\t\t});\n\t}\n});\n\nfunction dataAttr( elem, key, data ) {\n\t// If nothing was found internally, try to fetch any\n\t// data from the HTML5 data-* attribute\n\tif ( data === undefined && elem.nodeType === 1 ) {\n\n\t\tvar name = \"data-\" + key.replace( rmultiDash, \"-$1\" ).toLowerCase();\n\n\t\tdata = elem.getAttribute( name );\n\n\t\tif ( typeof data === \"string\" ) {\n\t\t\ttry {\n\t\t\t\tdata = data === \"true\" ? true :\n\t\t\t\tdata === \"false\" ? false :\n\t\t\t\tdata === \"null\" ? null :\n\t\t\t\t// Only convert to a number if it doesn't change the string\n\t\t\t\t+data + \"\" === data ? +data :\n\t\t\t\trbrace.test( data ) ? jQuery.parseJSON( data ) :\n\t\t\t\t\tdata;\n\t\t\t} catch( e ) {}\n\n\t\t\t// Make sure we set the data so it isn't changed later\n\t\t\tjQuery.data( elem, key, data );\n\n\t\t} else {\n\t\t\tdata = undefined;\n\t\t}\n\t}\n\n\treturn data;\n}\n\n// checks a cache object for emptiness\nfunction isEmptyDataObject( obj ) {\n\tvar name;\n\tfor ( name in obj ) {\n\n\t\t// if the public data object is empty, the private is still empty\n\t\tif ( name === \"data\" && jQuery.isEmptyObject( obj[name] ) ) {\n\t\t\tcontinue;\n\t\t}\n\t\tif ( name !== \"toJSON\" ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\treturn true;\n}\njQuery.extend({\n\tqueue: function( elem, type, data ) {\n\t\tvar queue;\n\n\t\tif ( elem ) {\n\t\t\ttype = ( type || \"fx\" ) + \"queue\";\n\t\t\tqueue = jQuery._data( elem, type );\n\n\t\t\t// Speed up dequeue by getting out quickly if this is just a lookup\n\t\t\tif ( data ) {\n\t\t\t\tif ( !queue || jQuery.isArray(data) ) {\n\t\t\t\t\tqueue = jQuery._data( elem, type, jQuery.makeArray(data) );\n\t\t\t\t} else {\n\t\t\t\t\tqueue.push( data );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn queue || [];\n\t\t}\n\t},\n\n\tdequeue: function( elem, type ) {\n\t\ttype = type || \"fx\";\n\n\t\tvar queue = jQuery.queue( elem, type ),\n\t\t\tstartLength = queue.length,\n\t\t\tfn = queue.shift(),\n\t\t\thooks = jQuery._queueHooks( elem, type ),\n\t\t\tnext = function() {\n\t\t\t\tjQuery.dequeue( elem, type );\n\t\t\t};\n\n\t\t// If the fx queue is dequeued, always remove the progress sentinel\n\t\tif ( fn === \"inprogress\" ) {\n\t\t\tfn = queue.shift();\n\t\t\tstartLength--;\n\t\t}\n\n\t\tif ( fn ) {\n\n\t\t\t// Add a progress sentinel to prevent the fx queue from being\n\t\t\t// automatically dequeued\n\t\t\tif ( type === \"fx\" ) {\n\t\t\t\tqueue.unshift( \"inprogress\" );\n\t\t\t}\n\n\t\t\t// clear up the last queue stop function\n\t\t\tdelete hooks.stop;\n\t\t\tfn.call( elem, next, hooks );\n\t\t}\n\n\t\tif ( !startLength && hooks ) {\n\t\t\thooks.empty.fire();\n\t\t}\n\t},\n\n\t// not intended for public consumption - generates a queueHooks object, or returns the current one\n\t_queueHooks: function( elem, type ) {\n\t\tvar key = type + \"queueHooks\";\n\t\treturn jQuery._data( elem, key ) || jQuery._data( elem, key, {\n\t\t\tempty: jQuery.Callbacks(\"once memory\").add(function() {\n\t\t\t\tjQuery.removeData( elem, type + \"queue\", true );\n\t\t\t\tjQuery.removeData( elem, key, true );\n\t\t\t})\n\t\t});\n\t}\n});\n\njQuery.fn.extend({\n\tqueue: function( type, data ) {\n\t\tvar setter = 2;\n\n\t\tif ( typeof type !== \"string\" ) {\n\t\t\tdata = type;\n\t\t\ttype = \"fx\";\n\t\t\tsetter--;\n\t\t}\n\n\t\tif ( arguments.length < setter ) {\n\t\t\treturn jQuery.queue( this[0], type );\n\t\t}\n\n\t\treturn data === undefined ?\n\t\t\tthis :\n\t\t\tthis.each(function() {\n\t\t\t\tvar queue = jQuery.queue( this, type, data );\n\n\t\t\t\t// ensure a hooks for this queue\n\t\t\t\tjQuery._queueHooks( this, type );\n\n\t\t\t\tif ( type === \"fx\" && queue[0] !== \"inprogress\" ) {\n\t\t\t\t\tjQuery.dequeue( this, type );\n\t\t\t\t}\n\t\t\t});\n\t},\n\tdequeue: function( type ) {\n\t\treturn this.each(function() {\n\t\t\tjQuery.dequeue( this, type );\n\t\t});\n\t},\n\t// Based off of the plugin by Clint Helfers, with permission.\n\t// http://blindsignals.com/index.php/2009/07/jquery-delay/\n\tdelay: function( time, type ) {\n\t\ttime = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;\n\t\ttype = type || \"fx\";\n\n\t\treturn this.queue( type, function( next, hooks ) {\n\t\t\tvar timeout = setTimeout( next, time );\n\t\t\thooks.stop = function() {\n\t\t\t\tclearTimeout( timeout );\n\t\t\t};\n\t\t});\n\t},\n\tclearQueue: function( type ) {\n\t\treturn this.queue( type || \"fx\", [] );\n\t},\n\t// Get a promise resolved when queues of a certain type\n\t// are emptied (fx is the type by default)\n\tpromise: function( type, obj ) {\n\t\tvar tmp,\n\t\t\tcount = 1,\n\t\t\tdefer = jQuery.Deferred(),\n\t\t\telements = this,\n\t\t\ti = this.length,\n\t\t\tresolve = function() {\n\t\t\t\tif ( !( --count ) ) {\n\t\t\t\t\tdefer.resolveWith( elements, [ elements ] );\n\t\t\t\t}\n\t\t\t};\n\n\t\tif ( typeof type !== \"string\" ) {\n\t\t\tobj = type;\n\t\t\ttype = undefined;\n\t\t}\n\t\ttype = type || \"fx\";\n\n\t\twhile( i-- ) {\n\t\t\ttmp = jQuery._data( elements[ i ], type + \"queueHooks\" );\n\t\t\tif ( tmp && tmp.empty ) {\n\t\t\t\tcount++;\n\t\t\t\ttmp.empty.add( resolve );\n\t\t\t}\n\t\t}\n\t\tresolve();\n\t\treturn defer.promise( obj );\n\t}\n});\nvar nodeHook, boolHook, fixSpecified,\n\trclass = /[\\t\\r\\n]/g,\n\trreturn = /\\r/g,\n\trtype = /^(?:button|input)$/i,\n\trfocusable = /^(?:button|input|object|select|textarea)$/i,\n\trclickable = /^a(?:rea|)$/i,\n\trboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,\n\tgetSetAttribute = jQuery.support.getSetAttribute;\n\njQuery.fn.extend({\n\tattr: function( name, value ) {\n\t\treturn jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 );\n\t},\n\n\tremoveAttr: function( name ) {\n\t\treturn this.each(function() {\n\t\t\tjQuery.removeAttr( this, name );\n\t\t});\n\t},\n\n\tprop: function( name, value ) {\n\t\treturn jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 );\n\t},\n\n\tremoveProp: function( name ) {\n\t\tname = jQuery.propFix[ name ] || name;\n\t\treturn this.each(function() {\n\t\t\t// try/catch handles cases where IE balks (such as removing a property on window)\n\t\t\ttry {\n\t\t\t\tthis[ name ] = undefined;\n\t\t\t\tdelete this[ name ];\n\t\t\t} catch( e ) {}\n\t\t});\n\t},\n\n\taddClass: function( value ) {\n\t\tvar classNames, i, l, elem,\n\t\t\tsetClass, c, cl;\n\n\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\treturn this.each(function( j ) {\n\t\t\t\tjQuery( this ).addClass( value.call(this, j, this.className) );\n\t\t\t});\n\t\t}\n\n\t\tif ( value && typeof value === \"string\" ) {\n\t\t\tclassNames = value.split( core_rspace );\n\n\t\t\tfor ( i = 0, l = this.length; i < l; i++ ) {\n\t\t\t\telem = this[ i ];\n\n\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\tif ( !elem.className && classNames.length === 1 ) {\n\t\t\t\t\t\telem.className = value;\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsetClass = \" \" + elem.className + \" \";\n\n\t\t\t\t\t\tfor ( c = 0, cl = classNames.length; c < cl; c++ ) {\n\t\t\t\t\t\t\tif ( setClass.indexOf( \" \" + classNames[ c ] + \" \" ) < 0 ) {\n\t\t\t\t\t\t\t\tsetClass += classNames[ c ] + \" \";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\telem.className = jQuery.trim( setClass );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tremoveClass: function( value ) {\n\t\tvar removes, className, elem, c, cl, i, l;\n\n\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\treturn this.each(function( j ) {\n\t\t\t\tjQuery( this ).removeClass( value.call(this, j, this.className) );\n\t\t\t});\n\t\t}\n\t\tif ( (value && typeof value === \"string\") || value === undefined ) {\n\t\t\tremoves = ( value || \"\" ).split( core_rspace );\n\n\t\t\tfor ( i = 0, l = this.length; i < l; i++ ) {\n\t\t\t\telem = this[ i ];\n\t\t\t\tif ( elem.nodeType === 1 && elem.className ) {\n\n\t\t\t\t\tclassName = (\" \" + elem.className + \" \").replace( rclass, \" \" );\n\n\t\t\t\t\t// loop over each item in the removal list\n\t\t\t\t\tfor ( c = 0, cl = removes.length; c < cl; c++ ) {\n\t\t\t\t\t\t// Remove until there is nothing to remove,\n\t\t\t\t\t\twhile ( className.indexOf(\" \" + removes[ c ] + \" \") >= 0 ) {\n\t\t\t\t\t\t\tclassName = className.replace( \" \" + removes[ c ] + \" \" , \" \" );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telem.className = value ? jQuery.trim( className ) : \"\";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\ttoggleClass: function( value, stateVal ) {\n\t\tvar type = typeof value,\n\t\t\tisBool = typeof stateVal === \"boolean\";\n\n\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\treturn this.each(function( i ) {\n\t\t\t\tjQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );\n\t\t\t});\n\t\t}\n\n\t\treturn this.each(function() {\n\t\t\tif ( type === \"string\" ) {\n\t\t\t\t// toggle individual class names\n\t\t\t\tvar className,\n\t\t\t\t\ti = 0,\n\t\t\t\t\tself = jQuery( this ),\n\t\t\t\t\tstate = stateVal,\n\t\t\t\t\tclassNames = value.split( core_rspace );\n\n\t\t\t\twhile ( (className = classNames[ i++ ]) ) {\n\t\t\t\t\t// check each className given, space separated list\n\t\t\t\t\tstate = isBool ? state : !self.hasClass( className );\n\t\t\t\t\tself[ state ? \"addClass\" : \"removeClass\" ]( className );\n\t\t\t\t}\n\n\t\t\t} else if ( type === \"undefined\" || type === \"boolean\" ) {\n\t\t\t\tif ( this.className ) {\n\t\t\t\t\t// store className if set\n\t\t\t\t\tjQuery._data( this, \"__className__\", this.className );\n\t\t\t\t}\n\n\t\t\t\t// toggle whole className\n\t\t\t\tthis.className = this.className || value === false ? \"\" : jQuery._data( this, \"__className__\" ) || \"\";\n\t\t\t}\n\t\t});\n\t},\n\n\thasClass: function( selector ) {\n\t\tvar className = \" \" + selector + \" \",\n\t\t\ti = 0,\n\t\t\tl = this.length;\n\t\tfor ( ; i < l; i++ ) {\n\t\t\tif ( this[i].nodeType === 1 && (\" \" + this[i].className + \" \").replace(rclass, \" \").indexOf( className ) >= 0 ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t},\n\n\tval: function( value ) {\n\t\tvar hooks, ret, isFunction,\n\t\t\telem = this[0];\n\n\t\tif ( !arguments.length ) {\n\t\t\tif ( elem ) {\n\t\t\t\thooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];\n\n\t\t\t\tif ( hooks && \"get\" in hooks && (ret = hooks.get( elem, \"value\" )) !== undefined ) {\n\t\t\t\t\treturn ret;\n\t\t\t\t}\n\n\t\t\t\tret = elem.value;\n\n\t\t\t\treturn typeof ret === \"string\" ?\n\t\t\t\t\t// handle most common string cases\n\t\t\t\t\tret.replace(rreturn, \"\") :\n\t\t\t\t\t// handle cases where value is null/undef or number\n\t\t\t\t\tret == null ? \"\" : ret;\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tisFunction = jQuery.isFunction( value );\n\n\t\treturn this.each(function( i ) {\n\t\t\tvar val,\n\t\t\t\tself = jQuery(this);\n\n\t\t\tif ( this.nodeType !== 1 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( isFunction ) {\n\t\t\t\tval = value.call( this, i, self.val() );\n\t\t\t} else {\n\t\t\t\tval = value;\n\t\t\t}\n\n\t\t\t// Treat null/undefined as \"\"; convert numbers to string\n\t\t\tif ( val == null ) {\n\t\t\t\tval = \"\";\n\t\t\t} else if ( typeof val === \"number\" ) {\n\t\t\t\tval += \"\";\n\t\t\t} else if ( jQuery.isArray( val ) ) {\n\t\t\t\tval = jQuery.map(val, function ( value ) {\n\t\t\t\t\treturn value == null ? \"\" : value + \"\";\n\t\t\t\t});\n\t\t\t}\n\n\t\t\thooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];\n\n\t\t\t// If set returns undefined, fall back to normal setting\n\t\t\tif ( !hooks || !(\"set\" in hooks) || hooks.set( this, val, \"value\" ) === undefined ) {\n\t\t\t\tthis.value = val;\n\t\t\t}\n\t\t});\n\t}\n});\n\njQuery.extend({\n\tvalHooks: {\n\t\toption: {\n\t\t\tget: function( elem ) {\n\t\t\t\t// attributes.value is undefined in Blackberry 4.7 but\n\t\t\t\t// uses .value. See #6932\n\t\t\t\tvar val = elem.attributes.value;\n\t\t\t\treturn !val || val.specified ? elem.value : elem.text;\n\t\t\t}\n\t\t},\n\t\tselect: {\n\t\t\tget: function( elem ) {\n\t\t\t\tvar value, i, max, option,\n\t\t\t\t\tindex = elem.selectedIndex,\n\t\t\t\t\tvalues = [],\n\t\t\t\t\toptions = elem.options,\n\t\t\t\t\tone = elem.type === \"select-one\";\n\n\t\t\t\t// Nothing was selected\n\t\t\t\tif ( index < 0 ) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\n\t\t\t\t// Loop through all the selected options\n\t\t\t\ti = one ? index : 0;\n\t\t\t\tmax = one ? index + 1 : options.length;\n\t\t\t\tfor ( ; i < max; i++ ) {\n\t\t\t\t\toption = options[ i ];\n\n\t\t\t\t\t// Don't return options that are disabled or in a disabled optgroup\n\t\t\t\t\tif ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute(\"disabled\") === null) &&\n\t\t\t\t\t\t\t(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, \"optgroup\" )) ) {\n\n\t\t\t\t\t\t// Get the specific value for the option\n\t\t\t\t\t\tvalue = jQuery( option ).val();\n\n\t\t\t\t\t\t// We don't need an array for one selects\n\t\t\t\t\t\tif ( one ) {\n\t\t\t\t\t\t\treturn value;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Multi-Selects return an array\n\t\t\t\t\t\tvalues.push( value );\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Fixes Bug #2551 -- select.val() broken in IE after form.reset()\n\t\t\t\tif ( one && !values.length && options.length ) {\n\t\t\t\t\treturn jQuery( options[ index ] ).val();\n\t\t\t\t}\n\n\t\t\t\treturn values;\n\t\t\t},\n\n\t\t\tset: function( elem, value ) {\n\t\t\t\tvar values = jQuery.makeArray( value );\n\n\t\t\t\tjQuery(elem).find(\"option\").each(function() {\n\t\t\t\t\tthis.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;\n\t\t\t\t});\n\n\t\t\t\tif ( !values.length ) {\n\t\t\t\t\telem.selectedIndex = -1;\n\t\t\t\t}\n\t\t\t\treturn values;\n\t\t\t}\n\t\t}\n\t},\n\n\t// Unused in 1.8, left in so attrFn-stabbers won't die; remove in 1.9\n\tattrFn: {},\n\n\tattr: function( elem, name, value, pass ) {\n\t\tvar ret, hooks, notxml,\n\t\t\tnType = elem.nodeType;\n\n\t\t// don't get/set attributes on text, comment and attribute nodes\n\t\tif ( !elem || nType === 3 || nType === 8 || nType === 2 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( pass && jQuery.isFunction( jQuery.fn[ name ] ) ) {\n\t\t\treturn jQuery( elem )[ name ]( value );\n\t\t}\n\n\t\t// Fallback to prop when attributes are not supported\n\t\tif ( typeof elem.getAttribute === \"undefined\" ) {\n\t\t\treturn jQuery.prop( elem, name, value );\n\t\t}\n\n\t\tnotxml = nType !== 1 || !jQuery.isXMLDoc( elem );\n\n\t\t// All attributes are lowercase\n\t\t// Grab necessary hook if one is defined\n\t\tif ( notxml ) {\n\t\t\tname = name.toLowerCase();\n\t\t\thooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );\n\t\t}\n\n\t\tif ( value !== undefined ) {\n\n\t\t\tif ( value === null ) {\n\t\t\t\tjQuery.removeAttr( elem, name );\n\t\t\t\treturn;\n\n\t\t\t} else if ( hooks && \"set\" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {\n\t\t\t\treturn ret;\n\n\t\t\t} else {\n\t\t\t\telem.setAttribute( name, value + \"\" );\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t} else if ( hooks && \"get\" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {\n\t\t\treturn ret;\n\n\t\t} else {\n\n\t\t\tret = elem.getAttribute( name );\n\n\t\t\t// Non-existent attributes return null, we normalize to undefined\n\t\t\treturn ret === null ?\n\t\t\t\tundefined :\n\t\t\t\tret;\n\t\t}\n\t},\n\n\tremoveAttr: function( elem, value ) {\n\t\tvar propName, attrNames, name, isBool,\n\t\t\ti = 0;\n\n\t\tif ( value && elem.nodeType === 1 ) {\n\n\t\t\tattrNames = value.split( core_rspace );\n\n\t\t\tfor ( ; i < attrNames.length; i++ ) {\n\t\t\t\tname = attrNames[ i ];\n\n\t\t\t\tif ( name ) {\n\t\t\t\t\tpropName = jQuery.propFix[ name ] || name;\n\t\t\t\t\tisBool = rboolean.test( name );\n\n\t\t\t\t\t// See #9699 for explanation of this approach (setting first, then removal)\n\t\t\t\t\t// Do not do this for boolean attributes (see #10870)\n\t\t\t\t\tif ( !isBool ) {\n\t\t\t\t\t\tjQuery.attr( elem, name, \"\" );\n\t\t\t\t\t}\n\t\t\t\t\telem.removeAttribute( getSetAttribute ? name : propName );\n\n\t\t\t\t\t// Set corresponding property to false for boolean attributes\n\t\t\t\t\tif ( isBool && propName in elem ) {\n\t\t\t\t\t\telem[ propName ] = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\tattrHooks: {\n\t\ttype: {\n\t\t\tset: function( elem, value ) {\n\t\t\t\t// We can't allow the type property to be changed (since it causes problems in IE)\n\t\t\t\tif ( rtype.test( elem.nodeName ) && elem.parentNode ) {\n\t\t\t\t\tjQuery.error( \"type property can't be changed\" );\n\t\t\t\t} else if ( !jQuery.support.radioValue && value === \"radio\" && jQuery.nodeName(elem, \"input\") ) {\n\t\t\t\t\t// Setting the type on a radio button after the value resets the value in IE6-9\n\t\t\t\t\t// Reset value to it's default in case type is set after value\n\t\t\t\t\t// This is for element creation\n\t\t\t\t\tvar val = elem.value;\n\t\t\t\t\telem.setAttribute( \"type\", value );\n\t\t\t\t\tif ( val ) {\n\t\t\t\t\t\telem.value = val;\n\t\t\t\t\t}\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t// Use the value property for back compat\n\t\t// Use the nodeHook for button elements in IE6/7 (#1954)\n\t\tvalue: {\n\t\t\tget: function( elem, name ) {\n\t\t\t\tif ( nodeHook && jQuery.nodeName( elem, \"button\" ) ) {\n\t\t\t\t\treturn nodeHook.get( elem, name );\n\t\t\t\t}\n\t\t\t\treturn name in elem ?\n\t\t\t\t\telem.value :\n\t\t\t\t\tnull;\n\t\t\t},\n\t\t\tset: function( elem, value, name ) {\n\t\t\t\tif ( nodeHook && jQuery.nodeName( elem, \"button\" ) ) {\n\t\t\t\t\treturn nodeHook.set( elem, value, name );\n\t\t\t\t}\n\t\t\t\t// Does not return so that setAttribute is also used\n\t\t\t\telem.value = value;\n\t\t\t}\n\t\t}\n\t},\n\n\tpropFix: {\n\t\ttabindex: \"tabIndex\",\n\t\treadonly: \"readOnly\",\n\t\t\"for\": \"htmlFor\",\n\t\t\"class\": \"className\",\n\t\tmaxlength: \"maxLength\",\n\t\tcellspacing: \"cellSpacing\",\n\t\tcellpadding: \"cellPadding\",\n\t\trowspan: \"rowSpan\",\n\t\tcolspan: \"colSpan\",\n\t\tusemap: \"useMap\",\n\t\tframeborder: \"frameBorder\",\n\t\tcontenteditable: \"contentEditable\"\n\t},\n\n\tprop: function( elem, name, value ) {\n\t\tvar ret, hooks, notxml,\n\t\t\tnType = elem.nodeType;\n\n\t\t// don't get/set properties on text, comment and attribute nodes\n\t\tif ( !elem || nType === 3 || nType === 8 || nType === 2 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tnotxml = nType !== 1 || !jQuery.isXMLDoc( elem );\n\n\t\tif ( notxml ) {\n\t\t\t// Fix name and attach hooks\n\t\t\tname = jQuery.propFix[ name ] || name;\n\t\t\thooks = jQuery.propHooks[ name ];\n\t\t}\n\n\t\tif ( value !== undefined ) {\n\t\t\tif ( hooks && \"set\" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {\n\t\t\t\treturn ret;\n\n\t\t\t} else {\n\t\t\t\treturn ( elem[ name ] = value );\n\t\t\t}\n\n\t\t} else {\n\t\t\tif ( hooks && \"get\" in hooks && (ret = hooks.get( elem, name )) !== null ) {\n\t\t\t\treturn ret;\n\n\t\t\t} else {\n\t\t\t\treturn elem[ name ];\n\t\t\t}\n\t\t}\n\t},\n\n\tpropHooks: {\n\t\ttabIndex: {\n\t\t\tget: function( elem ) {\n\t\t\t\t// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set\n\t\t\t\t// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/\n\t\t\t\tvar attributeNode = elem.getAttributeNode(\"tabindex\");\n\n\t\t\t\treturn attributeNode && attributeNode.specified ?\n\t\t\t\t\tparseInt( attributeNode.value, 10 ) :\n\t\t\t\t\trfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?\n\t\t\t\t\t\t0 :\n\t\t\t\t\t\tundefined;\n\t\t\t}\n\t\t}\n\t}\n});\n\n// Hook for boolean attributes\nboolHook = {\n\tget: function( elem, name ) {\n\t\t// Align boolean attributes with corresponding properties\n\t\t// Fall back to attribute presence where some booleans are not supported\n\t\tvar attrNode,\n\t\t\tproperty = jQuery.prop( elem, name );\n\t\treturn property === true || typeof property !== \"boolean\" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?\n\t\t\tname.toLowerCase() :\n\t\t\tundefined;\n\t},\n\tset: function( elem, value, name ) {\n\t\tvar propName;\n\t\tif ( value === false ) {\n\t\t\t// Remove boolean attributes when set to false\n\t\t\tjQuery.removeAttr( elem, name );\n\t\t} else {\n\t\t\t// value is true since we know at this point it's type boolean and not false\n\t\t\t// Set boolean attributes to the same name and set the DOM property\n\t\t\tpropName = jQuery.propFix[ name ] || name;\n\t\t\tif ( propName in elem ) {\n\t\t\t\t// Only set the IDL specifically if it already exists on the element\n\t\t\t\telem[ propName ] = true;\n\t\t\t}\n\n\t\t\telem.setAttribute( name, name.toLowerCase() );\n\t\t}\n\t\treturn name;\n\t}\n};\n\n// IE6/7 do not support getting/setting some attributes with get/setAttribute\nif ( !getSetAttribute ) {\n\n\tfixSpecified = {\n\t\tname: true,\n\t\tid: true,\n\t\tcoords: true\n\t};\n\n\t// Use this for any attribute in IE6/7\n\t// This fixes almost every IE6/7 issue\n\tnodeHook = jQuery.valHooks.button = {\n\t\tget: function( elem, name ) {\n\t\t\tvar ret;\n\t\t\tret = elem.getAttributeNode( name );\n\t\t\treturn ret && ( fixSpecified[ name ] ? ret.value !== \"\" : ret.specified ) ?\n\t\t\t\tret.value :\n\t\t\t\tundefined;\n\t\t},\n\t\tset: function( elem, value, name ) {\n\t\t\t// Set the existing or create a new attribute node\n\t\t\tvar ret = elem.getAttributeNode( name );\n\t\t\tif ( !ret ) {\n\t\t\t\tret = document.createAttribute( name );\n\t\t\t\telem.setAttributeNode( ret );\n\t\t\t}\n\t\t\treturn ( ret.value = value + \"\" );\n\t\t}\n\t};\n\n\t// Set width and height to auto instead of 0 on empty string( Bug #8150 )\n\t// This is for removals\n\tjQuery.each([ \"width\", \"height\" ], function( i, name ) {\n\t\tjQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {\n\t\t\tset: function( elem, value ) {\n\t\t\t\tif ( value === \"\" ) {\n\t\t\t\t\telem.setAttribute( name, \"auto\" );\n\t\t\t\t\treturn value;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n\n\t// Set contenteditable to false on removals(#10429)\n\t// Setting to empty string throws an error as an invalid value\n\tjQuery.attrHooks.contenteditable = {\n\t\tget: nodeHook.get,\n\t\tset: function( elem, value, name ) {\n\t\t\tif ( value === \"\" ) {\n\t\t\t\tvalue = \"false\";\n\t\t\t}\n\t\t\tnodeHook.set( elem, value, name );\n\t\t}\n\t};\n}\n\n\n// Some attributes require a special call on IE\nif ( !jQuery.support.hrefNormalized ) {\n\tjQuery.each([ \"href\", \"src\", \"width\", \"height\" ], function( i, name ) {\n\t\tjQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {\n\t\t\tget: function( elem ) {\n\t\t\t\tvar ret = elem.getAttribute( name, 2 );\n\t\t\t\treturn ret === null ? undefined : ret;\n\t\t\t}\n\t\t});\n\t});\n}\n\nif ( !jQuery.support.style ) {\n\tjQuery.attrHooks.style = {\n\t\tget: function( elem ) {\n\t\t\t// Return undefined in the case of empty string\n\t\t\t// Normalize to lowercase since IE uppercases css property names\n\t\t\treturn elem.style.cssText.toLowerCase() || undefined;\n\t\t},\n\t\tset: function( elem, value ) {\n\t\t\treturn ( elem.style.cssText = value + \"\" );\n\t\t}\n\t};\n}\n\n// Safari mis-reports the default selected property of an option\n// Accessing the parent's selectedIndex property fixes it\nif ( !jQuery.support.optSelected ) {\n\tjQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {\n\t\tget: function( elem ) {\n\t\t\tvar parent = elem.parentNode;\n\n\t\t\tif ( parent ) {\n\t\t\t\tparent.selectedIndex;\n\n\t\t\t\t// Make sure that it also works with optgroups, see #5701\n\t\t\t\tif ( parent.parentNode ) {\n\t\t\t\t\tparent.parentNode.selectedIndex;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\t});\n}\n\n// IE6/7 call enctype encoding\nif ( !jQuery.support.enctype ) {\n\tjQuery.propFix.enctype = \"encoding\";\n}\n\n// Radios and checkboxes getter/setter\nif ( !jQuery.support.checkOn ) {\n\tjQuery.each([ \"radio\", \"checkbox\" ], function() {\n\t\tjQuery.valHooks[ this ] = {\n\t\t\tget: function( elem ) {\n\t\t\t\t// Handle the case where in Webkit \"\" is returned instead of \"on\" if a value isn't specified\n\t\t\t\treturn elem.getAttribute(\"value\") === null ? \"on\" : elem.value;\n\t\t\t}\n\t\t};\n\t});\n}\njQuery.each([ \"radio\", \"checkbox\" ], function() {\n\tjQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {\n\t\tset: function( elem, value ) {\n\t\t\tif ( jQuery.isArray( value ) ) {\n\t\t\t\treturn ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );\n\t\t\t}\n\t\t}\n\t});\n});\nvar rformElems = /^(?:textarea|input|select)$/i,\n\trtypenamespace = /^([^\\.]*|)(?:\\.(.+)|)$/,\n\trhoverHack = /(?:^|\\s)hover(\\.\\S+|)\\b/,\n\trkeyEvent = /^key/,\n\trmouseEvent = /^(?:mouse|contextmenu)|click/,\n\trfocusMorph = /^(?:focusinfocus|focusoutblur)$/,\n\thoverHack = function( events ) {\n\t\treturn jQuery.event.special.hover ? events : events.replace( rhoverHack, \"mouseenter$1 mouseleave$1\" );\n\t};\n\n/*\n * Helper functions for managing events -- not part of the public interface.\n * Props to Dean Edwards' addEvent library for many of the ideas.\n */\njQuery.event = {\n\n\tadd: function( elem, types, handler, data, selector ) {\n\n\t\tvar elemData, eventHandle, events,\n\t\t\tt, tns, type, namespaces, handleObj,\n\t\t\thandleObjIn, handlers, special;\n\n\t\t// Don't attach events to noData or text/comment nodes (allow plain objects tho)\n\t\tif ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Caller can pass in an object of custom data in lieu of the handler\n\t\tif ( handler.handler ) {\n\t\t\thandleObjIn = handler;\n\t\t\thandler = handleObjIn.handler;\n\t\t\tselector = handleObjIn.selector;\n\t\t}\n\n\t\t// Make sure that the handler has a unique ID, used to find/remove it later\n\t\tif ( !handler.guid ) {\n\t\t\thandler.guid = jQuery.guid++;\n\t\t}\n\n\t\t// Init the element's event structure and main handler, if this is the first\n\t\tevents = elemData.events;\n\t\tif ( !events ) {\n\t\t\telemData.events = events = {};\n\t\t}\n\t\teventHandle = elemData.handle;\n\t\tif ( !eventHandle ) {\n\t\t\telemData.handle = eventHandle = function( e ) {\n\t\t\t\t// Discard the second event of a jQuery.event.trigger() and\n\t\t\t\t// when an event is called after a page has unloaded\n\t\t\t\treturn typeof jQuery !== \"undefined\" && (!e || jQuery.event.triggered !== e.type) ?\n\t\t\t\t\tjQuery.event.dispatch.apply( eventHandle.elem, arguments ) :\n\t\t\t\t\tundefined;\n\t\t\t};\n\t\t\t// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events\n\t\t\teventHandle.elem = elem;\n\t\t}\n\n\t\t// Handle multiple events separated by a space\n\t\t// jQuery(...).bind(\"mouseover mouseout\", fn);\n\t\ttypes = jQuery.trim( hoverHack(types) ).split( \" \" );\n\t\tfor ( t = 0; t < types.length; t++ ) {\n\n\t\t\ttns = rtypenamespace.exec( types[t] ) || [];\n\t\t\ttype = tns[1];\n\t\t\tnamespaces = ( tns[2] || \"\" ).split( \".\" ).sort();\n\n\t\t\t// If event changes its type, use the special event handlers for the changed type\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\n\t\t\t// If selector defined, determine special event api type, otherwise given type\n\t\t\ttype = ( selector ? special.delegateType : special.bindType ) || type;\n\n\t\t\t// Update special based on newly reset type\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\n\t\t\t// handleObj is passed to all event handlers\n\t\t\thandleObj = jQuery.extend({\n\t\t\t\ttype: type,\n\t\t\t\torigType: tns[1],\n\t\t\t\tdata: data,\n\t\t\t\thandler: handler,\n\t\t\t\tguid: handler.guid,\n\t\t\t\tselector: selector,\n\t\t\t\tneedsContext: selector && jQuery.expr.match.needsContext.test( selector ),\n\t\t\t\tnamespace: namespaces.join(\".\")\n\t\t\t}, handleObjIn );\n\n\t\t\t// Init the event handler queue if we're the first\n\t\t\thandlers = events[ type ];\n\t\t\tif ( !handlers ) {\n\t\t\t\thandlers = events[ type ] = [];\n\t\t\t\thandlers.delegateCount = 0;\n\n\t\t\t\t// Only use addEventListener/attachEvent if the special events handler returns false\n\t\t\t\tif ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {\n\t\t\t\t\t// Bind the global event handler to the element\n\t\t\t\t\tif ( elem.addEventListener ) {\n\t\t\t\t\t\telem.addEventListener( type, eventHandle, false );\n\n\t\t\t\t\t} else if ( elem.attachEvent ) {\n\t\t\t\t\t\telem.attachEvent( \"on\" + type, eventHandle );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( special.add ) {\n\t\t\t\tspecial.add.call( elem, handleObj );\n\n\t\t\t\tif ( !handleObj.handler.guid ) {\n\t\t\t\t\thandleObj.handler.guid = handler.guid;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Add to the element's handler list, delegates in front\n\t\t\tif ( selector ) {\n\t\t\t\thandlers.splice( handlers.delegateCount++, 0, handleObj );\n\t\t\t} else {\n\t\t\t\thandlers.push( handleObj );\n\t\t\t}\n\n\t\t\t// Keep track of which events have ever been used, for event optimization\n\t\t\tjQuery.event.global[ type ] = true;\n\t\t}\n\n\t\t// Nullify elem to prevent memory leaks in IE\n\t\telem = null;\n\t},\n\n\tglobal: {},\n\n\t// Detach an event or set of events from an element\n\tremove: function( elem, types, handler, selector, mappedTypes ) {\n\n\t\tvar t, tns, type, origType, namespaces, origCount,\n\t\t\tj, events, special, eventType, handleObj,\n\t\t\telemData = jQuery.hasData( elem ) && jQuery._data( elem );\n\n\t\tif ( !elemData || !(events = elemData.events) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Once for each type.namespace in types; type may be omitted\n\t\ttypes = jQuery.trim( hoverHack( types || \"\" ) ).split(\" \");\n\t\tfor ( t = 0; t < types.length; t++ ) {\n\t\t\ttns = rtypenamespace.exec( types[t] ) || [];\n\t\t\ttype = origType = tns[1];\n\t\t\tnamespaces = tns[2];\n\n\t\t\t// Unbind all events (on this namespace, if provided) for the element\n\t\t\tif ( !type ) {\n\t\t\t\tfor ( type in events ) {\n\t\t\t\t\tjQuery.event.remove( elem, type + types[ t ], handler, selector, true );\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tspecial = jQuery.event.special[ type ] || {};\n\t\t\ttype = ( selector? special.delegateType : special.bindType ) || type;\n\t\t\teventType = events[ type ] || [];\n\t\t\torigCount = eventType.length;\n\t\t\tnamespaces = namespaces ? new RegExp(\"(^|\\\\.)\" + namespaces.split(\".\").sort().join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\") : null;\n\n\t\t\t// Remove matching events\n\t\t\tfor ( j = 0; j < eventType.length; j++ ) {\n\t\t\t\thandleObj = eventType[ j ];\n\n\t\t\t\tif ( ( mappedTypes || origType === handleObj.origType ) &&\n\t\t\t\t\t ( !handler || handler.guid === handleObj.guid ) &&\n\t\t\t\t\t ( !namespaces || namespaces.test( handleObj.namespace ) ) &&\n\t\t\t\t\t ( !selector || selector === handleObj.selector || selector === \"**\" && handleObj.selector ) ) {\n\t\t\t\t\teventType.splice( j--, 1 );\n\n\t\t\t\t\tif ( handleObj.selector ) {\n\t\t\t\t\t\teventType.delegateCount--;\n\t\t\t\t\t}\n\t\t\t\t\tif ( special.remove ) {\n\t\t\t\t\t\tspecial.remove.call( elem, handleObj );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Remove generic event handler if we removed something and no more handlers exist\n\t\t\t// (avoids potential for endless recursion during removal of special event handlers)\n\t\t\tif ( eventType.length === 0 && origCount !== eventType.length ) {\n\t\t\t\tif ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) {\n\t\t\t\t\tjQuery.removeEvent( elem, type, elemData.handle );\n\t\t\t\t}\n\n\t\t\t\tdelete events[ type ];\n\t\t\t}\n\t\t}\n\n\t\t// Remove the expando if it's no longer used\n\t\tif ( jQuery.isEmptyObject( events ) ) {\n\t\t\tdelete elemData.handle;\n\n\t\t\t// removeData also checks for emptiness and clears the expando if empty\n\t\t\t// so use it instead of delete\n\t\t\tjQuery.removeData( elem, \"events\", true );\n\t\t}\n\t},\n\n\t// Events that are safe to short-circuit if no handlers are attached.\n\t// Native DOM events should not be added, they may have inline handlers.\n\tcustomEvent: {\n\t\t\"getData\": true,\n\t\t\"setData\": true,\n\t\t\"changeData\": true\n\t},\n\n\ttrigger: function( event, data, elem, onlyHandlers ) {\n\t\t// Don't do events on text and comment nodes\n\t\tif ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Event object or event type\n\t\tvar cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType,\n\t\t\ttype = event.type || event,\n\t\t\tnamespaces = [];\n\n\t\t// focus/blur morphs to focusin/out; ensure we're not firing them right now\n\t\tif ( rfocusMorph.test( type + jQuery.event.triggered ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( type.indexOf( \"!\" ) >= 0 ) {\n\t\t\t// Exclusive events trigger only for the exact event (no namespaces)\n\t\t\ttype = type.slice(0, -1);\n\t\t\texclusive = true;\n\t\t}\n\n\t\tif ( type.indexOf( \".\" ) >= 0 ) {\n\t\t\t// Namespaced trigger; create a regexp to match event type in handle()\n\t\t\tnamespaces = type.split(\".\");\n\t\t\ttype = namespaces.shift();\n\t\t\tnamespaces.sort();\n\t\t}\n\n\t\tif ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {\n\t\t\t// No jQuery handlers for this event type, and it can't have inline handlers\n\t\t\treturn;\n\t\t}\n\n\t\t// Caller can pass in an Event, Object, or just an event type string\n\t\tevent = typeof event === \"object\" ?\n\t\t\t// jQuery.Event object\n\t\t\tevent[ jQuery.expando ] ? event :\n\t\t\t// Object literal\n\t\t\tnew jQuery.Event( type, event ) :\n\t\t\t// Just the event type (string)\n\t\t\tnew jQuery.Event( type );\n\n\t\tevent.type = type;\n\t\tevent.isTrigger = true;\n\t\tevent.exclusive = exclusive;\n\t\tevent.namespace = namespaces.join( \".\" );\n\t\tevent.namespace_re = event.namespace? new RegExp(\"(^|\\\\.)\" + namespaces.join(\"\\\\.(?:.*\\\\.|)\") + \"(\\\\.|$)\") : null;\n\t\tontype = type.indexOf( \":\" ) < 0 ? \"on\" + type : \"\";\n\n\t\t// Handle a global trigger\n\t\tif ( !elem ) {\n\n\t\t\t// TODO: Stop taunting the data cache; remove global events and always attach to document\n\t\t\tcache = jQuery.cache;\n\t\t\tfor ( i in cache ) {\n\t\t\t\tif ( cache[ i ].events && cache[ i ].events[ type ] ) {\n\t\t\t\t\tjQuery.event.trigger( event, data, cache[ i ].handle.elem, true );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// Clean up the event in case it is being reused\n\t\tevent.result = undefined;\n\t\tif ( !event.target ) {\n\t\t\tevent.target = elem;\n\t\t}\n\n\t\t// Clone any incoming data and prepend the event, creating the handler arg list\n\t\tdata = data != null ? jQuery.makeArray( data ) : [];\n\t\tdata.unshift( event );\n\n\t\t// Allow special events to draw outside the lines\n\t\tspecial = jQuery.event.special[ type ] || {};\n\t\tif ( special.trigger && special.trigger.apply( elem, data ) === false ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Determine event propagation path in advance, per W3C events spec (#9951)\n\t\t// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)\n\t\teventPath = [[ elem, special.bindType || type ]];\n\t\tif ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {\n\n\t\t\tbubbleType = special.delegateType || type;\n\t\t\tcur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;\n\t\t\tfor ( old = elem; cur; cur = cur.parentNode ) {\n\t\t\t\teventPath.push([ cur, bubbleType ]);\n\t\t\t\told = cur;\n\t\t\t}\n\n\t\t\t// Only add window if we got to document (e.g., not plain obj or detached DOM)\n\t\t\tif ( old === (elem.ownerDocument || document) ) {\n\t\t\t\teventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);\n\t\t\t}\n\t\t}\n\n\t\t// Fire handlers on the event path\n\t\tfor ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {\n\n\t\t\tcur = eventPath[i][0];\n\t\t\tevent.type = eventPath[i][1];\n\n\t\t\thandle = ( jQuery._data( cur, \"events\" ) || {} )[ event.type ] && jQuery._data( cur, \"handle\" );\n\t\t\tif ( handle ) {\n\t\t\t\thandle.apply( cur, data );\n\t\t\t}\n\t\t\t// Note that this is a bare JS function and not a jQuery handler\n\t\t\thandle = ontype && cur[ ontype ];\n\t\t\tif ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t}\n\t\t}\n\t\tevent.type = type;\n\n\t\t// If nobody prevented the default action, do it now\n\t\tif ( !onlyHandlers && !event.isDefaultPrevented() ) {\n\n\t\t\tif ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&\n\t\t\t\t!(type === \"click\" && jQuery.nodeName( elem, \"a\" )) && jQuery.acceptData( elem ) ) {\n\n\t\t\t\t// Call a native DOM method on the target with the same name name as the event.\n\t\t\t\t// Can't use an .isFunction() check here because IE6/7 fails that test.\n\t\t\t\t// Don't do default actions on window, that's where global variables be (#6170)\n\t\t\t\t// IE<9 dies on focus/blur to hidden element (#1486)\n\t\t\t\tif ( ontype && elem[ type ] && ((type !== \"focus\" && type !== \"blur\") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {\n\n\t\t\t\t\t// Don't re-trigger an onFOO event when we call its FOO() method\n\t\t\t\t\told = elem[ ontype ];\n\n\t\t\t\t\tif ( old ) {\n\t\t\t\t\t\telem[ ontype ] = null;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Prevent re-triggering of the same event, since we already bubbled it above\n\t\t\t\t\tjQuery.event.triggered = type;\n\t\t\t\t\telem[ type ]();\n\t\t\t\t\tjQuery.event.triggered = undefined;\n\n\t\t\t\t\tif ( old ) {\n\t\t\t\t\t\telem[ ontype ] = old;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn event.result;\n\t},\n\n\tdispatch: function( event ) {\n\n\t\t// Make a writable jQuery.Event from the native event object\n\t\tevent = jQuery.event.fix( event || window.event );\n\n\t\tvar i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related,\n\t\t\thandlers = ( (jQuery._data( this, \"events\" ) || {} )[ event.type ] || []),\n\t\t\tdelegateCount = handlers.delegateCount,\n\t\t\targs = core_slice.call( arguments ),\n\t\t\trun_all = !event.exclusive && !event.namespace,\n\t\t\tspecial = jQuery.event.special[ event.type ] || {},\n\t\t\thandlerQueue = [];\n\n\t\t// Use the fix-ed jQuery.Event rather than the (read-only) native event\n\t\targs[0] = event;\n\t\tevent.delegateTarget = this;\n\n\t\t// Call the preDispatch hook for the mapped type, and let it bail if desired\n\t\tif ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Determine handlers that should run if there are delegated events\n\t\t// Avoid non-left-click bubbling in Firefox (#3861)\n\t\tif ( delegateCount && !(event.button && event.type === \"click\") ) {\n\n\t\t\tfor ( cur = event.target; cur != this; cur = cur.parentNode || this ) {\n\n\t\t\t\t// Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764)\n\t\t\t\tif ( cur.disabled !== true || event.type !== \"click\" ) {\n\t\t\t\t\tselMatch = {};\n\t\t\t\t\tmatches = [];\n\t\t\t\t\tfor ( i = 0; i < delegateCount; i++ ) {\n\t\t\t\t\t\thandleObj = handlers[ i ];\n\t\t\t\t\t\tsel = handleObj.selector;\n\n\t\t\t\t\t\tif ( selMatch[ sel ] === undefined ) {\n\t\t\t\t\t\t\tselMatch[ sel ] = handleObj.needsContext ?\n\t\t\t\t\t\t\t\tjQuery( sel, this ).index( cur ) >= 0 :\n\t\t\t\t\t\t\t\tjQuery.find( sel, this, null, [ cur ] ).length;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( selMatch[ sel ] ) {\n\t\t\t\t\t\t\tmatches.push( handleObj );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( matches.length ) {\n\t\t\t\t\t\thandlerQueue.push({ elem: cur, matches: matches });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Add the remaining (directly-bound) handlers\n\t\tif ( handlers.length > delegateCount ) {\n\t\t\thandlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });\n\t\t}\n\n\t\t// Run delegates first; they may want to stop propagation beneath us\n\t\tfor ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {\n\t\t\tmatched = handlerQueue[ i ];\n\t\t\tevent.currentTarget = matched.elem;\n\n\t\t\tfor ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {\n\t\t\t\thandleObj = matched.matches[ j ];\n\n\t\t\t\t// Triggered event must either 1) be non-exclusive and have no namespace, or\n\t\t\t\t// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).\n\t\t\t\tif ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {\n\n\t\t\t\t\tevent.data = handleObj.data;\n\t\t\t\t\tevent.handleObj = handleObj;\n\n\t\t\t\t\tret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )\n\t\t\t\t\t\t\t.apply( matched.elem, args );\n\n\t\t\t\t\tif ( ret !== undefined ) {\n\t\t\t\t\t\tevent.result = ret;\n\t\t\t\t\t\tif ( ret === false ) {\n\t\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Call the postDispatch hook for the mapped type\n\t\tif ( special.postDispatch ) {\n\t\t\tspecial.postDispatch.call( this, event );\n\t\t}\n\n\t\treturn event.result;\n\t},\n\n\t// Includes some event props shared by KeyEvent and MouseEvent\n\t// *** attrChange attrName relatedNode srcElement  are not normalized, non-W3C, deprecated, will be removed in 1.8 ***\n\tprops: \"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which\".split(\" \"),\n\n\tfixHooks: {},\n\n\tkeyHooks: {\n\t\tprops: \"char charCode key keyCode\".split(\" \"),\n\t\tfilter: function( event, original ) {\n\n\t\t\t// Add which for key events\n\t\t\tif ( event.which == null ) {\n\t\t\t\tevent.which = original.charCode != null ? original.charCode : original.keyCode;\n\t\t\t}\n\n\t\t\treturn event;\n\t\t}\n\t},\n\n\tmouseHooks: {\n\t\tprops: \"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement\".split(\" \"),\n\t\tfilter: function( event, original ) {\n\t\t\tvar eventDoc, doc, body,\n\t\t\t\tbutton = original.button,\n\t\t\t\tfromElement = original.fromElement;\n\n\t\t\t// Calculate pageX/Y if missing and clientX/Y available\n\t\t\tif ( event.pageX == null && original.clientX != null ) {\n\t\t\t\teventDoc = event.target.ownerDocument || document;\n\t\t\t\tdoc = eventDoc.documentElement;\n\t\t\t\tbody = eventDoc.body;\n\n\t\t\t\tevent.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );\n\t\t\t\tevent.pageY = original.clientY + ( doc && doc.scrollTop  || body && body.scrollTop  || 0 ) - ( doc && doc.clientTop  || body && body.clientTop  || 0 );\n\t\t\t}\n\n\t\t\t// Add relatedTarget, if necessary\n\t\t\tif ( !event.relatedTarget && fromElement ) {\n\t\t\t\tevent.relatedTarget = fromElement === event.target ? original.toElement : fromElement;\n\t\t\t}\n\n\t\t\t// Add which for click: 1 === left; 2 === middle; 3 === right\n\t\t\t// Note: button is not normalized, so don't use it\n\t\t\tif ( !event.which && button !== undefined ) {\n\t\t\t\tevent.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );\n\t\t\t}\n\n\t\t\treturn event;\n\t\t}\n\t},\n\n\tfix: function( event ) {\n\t\tif ( event[ jQuery.expando ] ) {\n\t\t\treturn event;\n\t\t}\n\n\t\t// Create a writable copy of the event object and normalize some properties\n\t\tvar i, prop,\n\t\t\toriginalEvent = event,\n\t\t\tfixHook = jQuery.event.fixHooks[ event.type ] || {},\n\t\t\tcopy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;\n\n\t\tevent = jQuery.Event( originalEvent );\n\n\t\tfor ( i = copy.length; i; ) {\n\t\t\tprop = copy[ --i ];\n\t\t\tevent[ prop ] = originalEvent[ prop ];\n\t\t}\n\n\t\t// Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)\n\t\tif ( !event.target ) {\n\t\t\tevent.target = originalEvent.srcElement || document;\n\t\t}\n\n\t\t// Target should not be a text node (#504, Safari)\n\t\tif ( event.target.nodeType === 3 ) {\n\t\t\tevent.target = event.target.parentNode;\n\t\t}\n\n\t\t// For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8)\n\t\tevent.metaKey = !!event.metaKey;\n\n\t\treturn fixHook.filter? fixHook.filter( event, originalEvent ) : event;\n\t},\n\n\tspecial: {\n\t\tload: {\n\t\t\t// Prevent triggered image.load events from bubbling to window.load\n\t\t\tnoBubble: true\n\t\t},\n\n\t\tfocus: {\n\t\t\tdelegateType: \"focusin\"\n\t\t},\n\t\tblur: {\n\t\t\tdelegateType: \"focusout\"\n\t\t},\n\n\t\tbeforeunload: {\n\t\t\tsetup: function( data, namespaces, eventHandle ) {\n\t\t\t\t// We only want to do this special case on windows\n\t\t\t\tif ( jQuery.isWindow( this ) ) {\n\t\t\t\t\tthis.onbeforeunload = eventHandle;\n\t\t\t\t}\n\t\t\t},\n\n\t\t\tteardown: function( namespaces, eventHandle ) {\n\t\t\t\tif ( this.onbeforeunload === eventHandle ) {\n\t\t\t\t\tthis.onbeforeunload = null;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\tsimulate: function( type, elem, event, bubble ) {\n\t\t// Piggyback on a donor event to simulate a different one.\n\t\t// Fake originalEvent to avoid donor's stopPropagation, but if the\n\t\t// simulated event prevents default then we do the same on the donor.\n\t\tvar e = jQuery.extend(\n\t\t\tnew jQuery.Event(),\n\t\t\tevent,\n\t\t\t{ type: type,\n\t\t\t\tisSimulated: true,\n\t\t\t\toriginalEvent: {}\n\t\t\t}\n\t\t);\n\t\tif ( bubble ) {\n\t\t\tjQuery.event.trigger( e, null, elem );\n\t\t} else {\n\t\t\tjQuery.event.dispatch.call( elem, e );\n\t\t}\n\t\tif ( e.isDefaultPrevented() ) {\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n};\n\n// Some plugins are using, but it's undocumented/deprecated and will be removed.\n// The 1.7 special event interface should provide all the hooks needed now.\njQuery.event.handle = jQuery.event.dispatch;\n\njQuery.removeEvent = document.removeEventListener ?\n\tfunction( elem, type, handle ) {\n\t\tif ( elem.removeEventListener ) {\n\t\t\telem.removeEventListener( type, handle, false );\n\t\t}\n\t} :\n\tfunction( elem, type, handle ) {\n\t\tvar name = \"on\" + type;\n\n\t\tif ( elem.detachEvent ) {\n\n\t\t\t// #8545, #7054, preventing memory leaks for custom events in IE6-8 –\n\t\t\t// detachEvent needed property on element, by name of that event, to properly expose it to GC\n\t\t\tif ( typeof elem[ name ] === \"undefined\" ) {\n\t\t\t\telem[ name ] = null;\n\t\t\t}\n\n\t\t\telem.detachEvent( name, handle );\n\t\t}\n\t};\n\njQuery.Event = function( src, props ) {\n\t// Allow instantiation without the 'new' keyword\n\tif ( !(this instanceof jQuery.Event) ) {\n\t\treturn new jQuery.Event( src, props );\n\t}\n\n\t// Event object\n\tif ( src && src.type ) {\n\t\tthis.originalEvent = src;\n\t\tthis.type = src.type;\n\n\t\t// Events bubbling up the document may have been marked as prevented\n\t\t// by a handler lower down the tree; reflect the correct value.\n\t\tthis.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||\n\t\t\tsrc.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;\n\n\t// Event type\n\t} else {\n\t\tthis.type = src;\n\t}\n\n\t// Put explicitly provided properties onto the event object\n\tif ( props ) {\n\t\tjQuery.extend( this, props );\n\t}\n\n\t// Create a timestamp if incoming event doesn't have one\n\tthis.timeStamp = src && src.timeStamp || jQuery.now();\n\n\t// Mark it as fixed\n\tthis[ jQuery.expando ] = true;\n};\n\nfunction returnFalse() {\n\treturn false;\n}\nfunction returnTrue() {\n\treturn true;\n}\n\n// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding\n// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html\njQuery.Event.prototype = {\n\tpreventDefault: function() {\n\t\tthis.isDefaultPrevented = returnTrue;\n\n\t\tvar e = this.originalEvent;\n\t\tif ( !e ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// if preventDefault exists run it on the original event\n\t\tif ( e.preventDefault ) {\n\t\t\te.preventDefault();\n\n\t\t// otherwise set the returnValue property of the original event to false (IE)\n\t\t} else {\n\t\t\te.returnValue = false;\n\t\t}\n\t},\n\tstopPropagation: function() {\n\t\tthis.isPropagationStopped = returnTrue;\n\n\t\tvar e = this.originalEvent;\n\t\tif ( !e ) {\n\t\t\treturn;\n\t\t}\n\t\t// if stopPropagation exists run it on the original event\n\t\tif ( e.stopPropagation ) {\n\t\t\te.stopPropagation();\n\t\t}\n\t\t// otherwise set the cancelBubble property of the original event to true (IE)\n\t\te.cancelBubble = true;\n\t},\n\tstopImmediatePropagation: function() {\n\t\tthis.isImmediatePropagationStopped = returnTrue;\n\t\tthis.stopPropagation();\n\t},\n\tisDefaultPrevented: returnFalse,\n\tisPropagationStopped: returnFalse,\n\tisImmediatePropagationStopped: returnFalse\n};\n\n// Create mouseenter/leave events using mouseover/out and event-time checks\njQuery.each({\n\tmouseenter: \"mouseover\",\n\tmouseleave: \"mouseout\"\n}, function( orig, fix ) {\n\tjQuery.event.special[ orig ] = {\n\t\tdelegateType: fix,\n\t\tbindType: fix,\n\n\t\thandle: function( event ) {\n\t\t\tvar ret,\n\t\t\t\ttarget = this,\n\t\t\t\trelated = event.relatedTarget,\n\t\t\t\thandleObj = event.handleObj,\n\t\t\t\tselector = handleObj.selector;\n\n\t\t\t// For mousenter/leave call the handler if related is outside the target.\n\t\t\t// NB: No relatedTarget if the mouse left/entered the browser window\n\t\t\tif ( !related || (related !== target && !jQuery.contains( target, related )) ) {\n\t\t\t\tevent.type = handleObj.origType;\n\t\t\t\tret = handleObj.handler.apply( this, arguments );\n\t\t\t\tevent.type = fix;\n\t\t\t}\n\t\t\treturn ret;\n\t\t}\n\t};\n});\n\n// IE submit delegation\nif ( !jQuery.support.submitBubbles ) {\n\n\tjQuery.event.special.submit = {\n\t\tsetup: function() {\n\t\t\t// Only need this for delegated form submit events\n\t\t\tif ( jQuery.nodeName( this, \"form\" ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Lazy-add a submit handler when a descendant form may potentially be submitted\n\t\t\tjQuery.event.add( this, \"click._submit keypress._submit\", function( e ) {\n\t\t\t\t// Node name check avoids a VML-related crash in IE (#9807)\n\t\t\t\tvar elem = e.target,\n\t\t\t\t\tform = jQuery.nodeName( elem, \"input\" ) || jQuery.nodeName( elem, \"button\" ) ? elem.form : undefined;\n\t\t\t\tif ( form && !jQuery._data( form, \"_submit_attached\" ) ) {\n\t\t\t\t\tjQuery.event.add( form, \"submit._submit\", function( event ) {\n\t\t\t\t\t\tevent._submit_bubble = true;\n\t\t\t\t\t});\n\t\t\t\t\tjQuery._data( form, \"_submit_attached\", true );\n\t\t\t\t}\n\t\t\t});\n\t\t\t// return undefined since we don't need an event listener\n\t\t},\n\n\t\tpostDispatch: function( event ) {\n\t\t\t// If form was submitted by the user, bubble the event up the tree\n\t\t\tif ( event._submit_bubble ) {\n\t\t\t\tdelete event._submit_bubble;\n\t\t\t\tif ( this.parentNode && !event.isTrigger ) {\n\t\t\t\t\tjQuery.event.simulate( \"submit\", this.parentNode, event, true );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\tteardown: function() {\n\t\t\t// Only need this for delegated form submit events\n\t\t\tif ( jQuery.nodeName( this, \"form\" ) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// Remove delegated handlers; cleanData eventually reaps submit handlers attached above\n\t\t\tjQuery.event.remove( this, \"._submit\" );\n\t\t}\n\t};\n}\n\n// IE change delegation and checkbox/radio fix\nif ( !jQuery.support.changeBubbles ) {\n\n\tjQuery.event.special.change = {\n\n\t\tsetup: function() {\n\n\t\t\tif ( rformElems.test( this.nodeName ) ) {\n\t\t\t\t// IE doesn't fire change on a check/radio until blur; trigger it on click\n\t\t\t\t// after a propertychange. Eat the blur-change in special.change.handle.\n\t\t\t\t// This still fires onchange a second time for check/radio after blur.\n\t\t\t\tif ( this.type === \"checkbox\" || this.type === \"radio\" ) {\n\t\t\t\t\tjQuery.event.add( this, \"propertychange._change\", function( event ) {\n\t\t\t\t\t\tif ( event.originalEvent.propertyName === \"checked\" ) {\n\t\t\t\t\t\t\tthis._just_changed = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tjQuery.event.add( this, \"click._change\", function( event ) {\n\t\t\t\t\t\tif ( this._just_changed && !event.isTrigger ) {\n\t\t\t\t\t\t\tthis._just_changed = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// Allow triggered, simulated change events (#11500)\n\t\t\t\t\t\tjQuery.event.simulate( \"change\", this, event, true );\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t// Delegated event; lazy-add a change handler on descendant inputs\n\t\t\tjQuery.event.add( this, \"beforeactivate._change\", function( e ) {\n\t\t\t\tvar elem = e.target;\n\n\t\t\t\tif ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, \"_change_attached\" ) ) {\n\t\t\t\t\tjQuery.event.add( elem, \"change._change\", function( event ) {\n\t\t\t\t\t\tif ( this.parentNode && !event.isSimulated && !event.isTrigger ) {\n\t\t\t\t\t\t\tjQuery.event.simulate( \"change\", this.parentNode, event, true );\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\tjQuery._data( elem, \"_change_attached\", true );\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\thandle: function( event ) {\n\t\t\tvar elem = event.target;\n\n\t\t\t// Swallow native change events from checkbox/radio, we already triggered them above\n\t\t\tif ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== \"radio\" && elem.type !== \"checkbox\") ) {\n\t\t\t\treturn event.handleObj.handler.apply( this, arguments );\n\t\t\t}\n\t\t},\n\n\t\tteardown: function() {\n\t\t\tjQuery.event.remove( this, \"._change\" );\n\n\t\t\treturn !rformElems.test( this.nodeName );\n\t\t}\n\t};\n}\n\n// Create \"bubbling\" focus and blur events\nif ( !jQuery.support.focusinBubbles ) {\n\tjQuery.each({ focus: \"focusin\", blur: \"focusout\" }, function( orig, fix ) {\n\n\t\t// Attach a single capturing handler while someone wants focusin/focusout\n\t\tvar attaches = 0,\n\t\t\thandler = function( event ) {\n\t\t\t\tjQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );\n\t\t\t};\n\n\t\tjQuery.event.special[ fix ] = {\n\t\t\tsetup: function() {\n\t\t\t\tif ( attaches++ === 0 ) {\n\t\t\t\t\tdocument.addEventListener( orig, handler, true );\n\t\t\t\t}\n\t\t\t},\n\t\t\tteardown: function() {\n\t\t\t\tif ( --attaches === 0 ) {\n\t\t\t\t\tdocument.removeEventListener( orig, handler, true );\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t});\n}\n\njQuery.fn.extend({\n\n\ton: function( types, selector, data, fn, /*INTERNAL*/ one ) {\n\t\tvar origFn, type;\n\n\t\t// Types can be a map of types/handlers\n\t\tif ( typeof types === \"object\" ) {\n\t\t\t// ( types-Object, selector, data )\n\t\t\tif ( typeof selector !== \"string\" ) { // && selector != null\n\t\t\t\t// ( types-Object, data )\n\t\t\t\tdata = data || selector;\n\t\t\t\tselector = undefined;\n\t\t\t}\n\t\t\tfor ( type in types ) {\n\t\t\t\tthis.on( type, selector, data, types[ type ], one );\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\n\t\tif ( data == null && fn == null ) {\n\t\t\t// ( types, fn )\n\t\t\tfn = selector;\n\t\t\tdata = selector = undefined;\n\t\t} else if ( fn == null ) {\n\t\t\tif ( typeof selector === \"string\" ) {\n\t\t\t\t// ( types, selector, fn )\n\t\t\t\tfn = data;\n\t\t\t\tdata = undefined;\n\t\t\t} else {\n\t\t\t\t// ( types, data, fn )\n\t\t\t\tfn = data;\n\t\t\t\tdata = selector;\n\t\t\t\tselector = undefined;\n\t\t\t}\n\t\t}\n\t\tif ( fn === false ) {\n\t\t\tfn = returnFalse;\n\t\t} else if ( !fn ) {\n\t\t\treturn this;\n\t\t}\n\n\t\tif ( one === 1 ) {\n\t\t\torigFn = fn;\n\t\t\tfn = function( event ) {\n\t\t\t\t// Can use an empty set, since event contains the info\n\t\t\t\tjQuery().off( event );\n\t\t\t\treturn origFn.apply( this, arguments );\n\t\t\t};\n\t\t\t// Use same guid so caller can remove using origFn\n\t\t\tfn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );\n\t\t}\n\t\treturn this.each( function() {\n\t\t\tjQuery.event.add( this, types, fn, data, selector );\n\t\t});\n\t},\n\tone: function( types, selector, data, fn ) {\n\t\treturn this.on( types, selector, data, fn, 1 );\n\t},\n\toff: function( types, selector, fn ) {\n\t\tvar handleObj, type;\n\t\tif ( types && types.preventDefault && types.handleObj ) {\n\t\t\t// ( event )  dispatched jQuery.Event\n\t\t\thandleObj = types.handleObj;\n\t\t\tjQuery( types.delegateTarget ).off(\n\t\t\t\thandleObj.namespace ? handleObj.origType + \".\" + handleObj.namespace : handleObj.origType,\n\t\t\t\thandleObj.selector,\n\t\t\t\thandleObj.handler\n\t\t\t);\n\t\t\treturn this;\n\t\t}\n\t\tif ( typeof types === \"object\" ) {\n\t\t\t// ( types-object [, selector] )\n\t\t\tfor ( type in types ) {\n\t\t\t\tthis.off( type, selector, types[ type ] );\n\t\t\t}\n\t\t\treturn this;\n\t\t}\n\t\tif ( selector === false || typeof selector === \"function\" ) {\n\t\t\t// ( types [, fn] )\n\t\t\tfn = selector;\n\t\t\tselector = undefined;\n\t\t}\n\t\tif ( fn === false ) {\n\t\t\tfn = returnFalse;\n\t\t}\n\t\treturn this.each(function() {\n\t\t\tjQuery.event.remove( this, types, fn, selector );\n\t\t});\n\t},\n\n\tbind: function( types, data, fn ) {\n\t\treturn this.on( types, null, data, fn );\n\t},\n\tunbind: function( types, fn ) {\n\t\treturn this.off( types, null, fn );\n\t},\n\n\tlive: function( types, data, fn ) {\n\t\tjQuery( this.context ).on( types, this.selector, data, fn );\n\t\treturn this;\n\t},\n\tdie: function( types, fn ) {\n\t\tjQuery( this.context ).off( types, this.selector || \"**\", fn );\n\t\treturn this;\n\t},\n\n\tdelegate: function( selector, types, data, fn ) {\n\t\treturn this.on( types, selector, data, fn );\n\t},\n\tundelegate: function( selector, types, fn ) {\n\t\t// ( namespace ) or ( selector, types [, fn] )\n\t\treturn arguments.length === 1 ? this.off( selector, \"**\" ) : this.off( types, selector || \"**\", fn );\n\t},\n\n\ttrigger: function( type, data ) {\n\t\treturn this.each(function() {\n\t\t\tjQuery.event.trigger( type, data, this );\n\t\t});\n\t},\n\ttriggerHandler: function( type, data ) {\n\t\tif ( this[0] ) {\n\t\t\treturn jQuery.event.trigger( type, data, this[0], true );\n\t\t}\n\t},\n\n\ttoggle: function( fn ) {\n\t\t// Save reference to arguments for access in closure\n\t\tvar args = arguments,\n\t\t\tguid = fn.guid || jQuery.guid++,\n\t\t\ti = 0,\n\t\t\ttoggler = function( event ) {\n\t\t\t\t// Figure out which function to execute\n\t\t\t\tvar lastToggle = ( jQuery._data( this, \"lastToggle\" + fn.guid ) || 0 ) % i;\n\t\t\t\tjQuery._data( this, \"lastToggle\" + fn.guid, lastToggle + 1 );\n\n\t\t\t\t// Make sure that clicks stop\n\t\t\t\tevent.preventDefault();\n\n\t\t\t\t// and execute the function\n\t\t\t\treturn args[ lastToggle ].apply( this, arguments ) || false;\n\t\t\t};\n\n\t\t// link all the functions, so any of them can unbind this click handler\n\t\ttoggler.guid = guid;\n\t\twhile ( i < args.length ) {\n\t\t\targs[ i++ ].guid = guid;\n\t\t}\n\n\t\treturn this.click( toggler );\n\t},\n\n\thover: function( fnOver, fnOut ) {\n\t\treturn this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );\n\t}\n});\n\njQuery.each( (\"blur focus focusin focusout load resize scroll unload click dblclick \" +\n\t\"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave \" +\n\t\"change select submit keydown keypress keyup error contextmenu\").split(\" \"), function( i, name ) {\n\n\t// Handle event binding\n\tjQuery.fn[ name ] = function( data, fn ) {\n\t\tif ( fn == null ) {\n\t\t\tfn = data;\n\t\t\tdata = null;\n\t\t}\n\n\t\treturn arguments.length > 0 ?\n\t\t\tthis.on( name, null, data, fn ) :\n\t\t\tthis.trigger( name );\n\t};\n\n\tif ( rkeyEvent.test( name ) ) {\n\t\tjQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;\n\t}\n\n\tif ( rmouseEvent.test( name ) ) {\n\t\tjQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;\n\t}\n});\n/*!\n * Sizzle CSS Selector Engine\n * Copyright 2012 jQuery Foundation and other contributors\n * Released under the MIT license\n * http://sizzlejs.com/\n */\n(function( window, undefined ) {\n\nvar cachedruns,\n\tassertGetIdNotName,\n\tExpr,\n\tgetText,\n\tisXML,\n\tcontains,\n\tcompile,\n\tsortOrder,\n\thasDuplicate,\n\toutermostContext,\n\n\tbaseHasDuplicate = true,\n\tstrundefined = \"undefined\",\n\n\texpando = ( \"sizcache\" + Math.random() ).replace( \".\", \"\" ),\n\n\tToken = String,\n\tdocument = window.document,\n\tdocElem = document.documentElement,\n\tdirruns = 0,\n\tdone = 0,\n\tpop = [].pop,\n\tpush = [].push,\n\tslice = [].slice,\n\t// Use a stripped-down indexOf if a native one is unavailable\n\tindexOf = [].indexOf || function( elem ) {\n\t\tvar i = 0,\n\t\t\tlen = this.length;\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( this[i] === elem ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t},\n\n\t// Augment a function for special use by Sizzle\n\tmarkFunction = function( fn, value ) {\n\t\tfn[ expando ] = value == null || value;\n\t\treturn fn;\n\t},\n\n\tcreateCache = function() {\n\t\tvar cache = {},\n\t\t\tkeys = [];\n\n\t\treturn markFunction(function( key, value ) {\n\t\t\t// Only keep the most recent entries\n\t\t\tif ( keys.push( key ) > Expr.cacheLength ) {\n\t\t\t\tdelete cache[ keys.shift() ];\n\t\t\t}\n\n\t\t\treturn (cache[ key ] = value);\n\t\t}, cache );\n\t},\n\n\tclassCache = createCache(),\n\ttokenCache = createCache(),\n\tcompilerCache = createCache(),\n\n\t// Regex\n\n\t// Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace\n\twhitespace = \"[\\\\x20\\\\t\\\\r\\\\n\\\\f]\",\n\t// http://www.w3.org/TR/css3-syntax/#characters\n\tcharacterEncoding = \"(?:\\\\\\\\.|[-\\\\w]|[^\\\\x00-\\\\xa0])+\",\n\n\t// Loosely modeled on CSS identifier characters\n\t// An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors)\n\t// Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier\n\tidentifier = characterEncoding.replace( \"w\", \"w#\" ),\n\n\t// Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors\n\toperators = \"([*^$|!~]?=)\",\n\tattributes = \"\\\\[\" + whitespace + \"*(\" + characterEncoding + \")\" + whitespace +\n\t\t\"*(?:\" + operators + whitespace + \"*(?:(['\\\"])((?:\\\\\\\\.|[^\\\\\\\\])*?)\\\\3|(\" + identifier + \")|)|)\" + whitespace + \"*\\\\]\",\n\n\t// Prefer arguments not in parens/brackets,\n\t//   then attribute selectors and non-pseudos (denoted by :),\n\t//   then anything else\n\t// These preferences are here to reduce the number of selectors\n\t//   needing tokenize in the PSEUDO preFilter\n\tpseudos = \":(\" + characterEncoding + \")(?:\\\\((?:(['\\\"])((?:\\\\\\\\.|[^\\\\\\\\])*?)\\\\2|([^()[\\\\]]*|(?:(?:\" + attributes + \")|[^:]|\\\\\\\\.)*|.*))\\\\)|)\",\n\n\t// For matchExpr.POS and matchExpr.needsContext\n\tpos = \":(even|odd|eq|gt|lt|nth|first|last)(?:\\\\(\" + whitespace +\n\t\t\"*((?:-\\\\d)?\\\\d*)\" + whitespace + \"*\\\\)|)(?=[^-]|$)\",\n\n\t// Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter\n\trtrim = new RegExp( \"^\" + whitespace + \"+|((?:^|[^\\\\\\\\])(?:\\\\\\\\.)*)\" + whitespace + \"+$\", \"g\" ),\n\n\trcomma = new RegExp( \"^\" + whitespace + \"*,\" + whitespace + \"*\" ),\n\trcombinators = new RegExp( \"^\" + whitespace + \"*([\\\\x20\\\\t\\\\r\\\\n\\\\f>+~])\" + whitespace + \"*\" ),\n\trpseudo = new RegExp( pseudos ),\n\n\t// Easily-parseable/retrievable ID or TAG or CLASS selectors\n\trquickExpr = /^(?:#([\\w\\-]+)|(\\w+)|\\.([\\w\\-]+))$/,\n\n\trnot = /^:not/,\n\trsibling = /[\\x20\\t\\r\\n\\f]*[+~]/,\n\trendsWithNot = /:not\\($/,\n\n\trheader = /h\\d/i,\n\trinputs = /input|select|textarea|button/i,\n\n\trbackslash = /\\\\(?!\\\\)/g,\n\n\tmatchExpr = {\n\t\t\"ID\": new RegExp( \"^#(\" + characterEncoding + \")\" ),\n\t\t\"CLASS\": new RegExp( \"^\\\\.(\" + characterEncoding + \")\" ),\n\t\t\"NAME\": new RegExp( \"^\\\\[name=['\\\"]?(\" + characterEncoding + \")['\\\"]?\\\\]\" ),\n\t\t\"TAG\": new RegExp( \"^(\" + characterEncoding.replace( \"w\", \"w*\" ) + \")\" ),\n\t\t\"ATTR\": new RegExp( \"^\" + attributes ),\n\t\t\"PSEUDO\": new RegExp( \"^\" + pseudos ),\n\t\t\"POS\": new RegExp( pos, \"i\" ),\n\t\t\"CHILD\": new RegExp( \"^:(only|nth|first|last)-child(?:\\\\(\" + whitespace +\n\t\t\t\"*(even|odd|(([+-]|)(\\\\d*)n|)\" + whitespace + \"*(?:([+-]|)\" + whitespace +\n\t\t\t\"*(\\\\d+)|))\" + whitespace + \"*\\\\)|)\", \"i\" ),\n\t\t// For use in libraries implementing .is()\n\t\t\"needsContext\": new RegExp( \"^\" + whitespace + \"*[>+~]|\" + pos, \"i\" )\n\t},\n\n\t// Support\n\n\t// Used for testing something on an element\n\tassert = function( fn ) {\n\t\tvar div = document.createElement(\"div\");\n\n\t\ttry {\n\t\t\treturn fn( div );\n\t\t} catch (e) {\n\t\t\treturn false;\n\t\t} finally {\n\t\t\t// release memory in IE\n\t\t\tdiv = null;\n\t\t}\n\t},\n\n\t// Check if getElementsByTagName(\"*\") returns only elements\n\tassertTagNameNoComments = assert(function( div ) {\n\t\tdiv.appendChild( document.createComment(\"\") );\n\t\treturn !div.getElementsByTagName(\"*\").length;\n\t}),\n\n\t// Check if getAttribute returns normalized href attributes\n\tassertHrefNotNormalized = assert(function( div ) {\n\t\tdiv.innerHTML = \"<a href='#'></a>\";\n\t\treturn div.firstChild && typeof div.firstChild.getAttribute !== strundefined &&\n\t\t\tdiv.firstChild.getAttribute(\"href\") === \"#\";\n\t}),\n\n\t// Check if attributes should be retrieved by attribute nodes\n\tassertAttributes = assert(function( div ) {\n\t\tdiv.innerHTML = \"<select></select>\";\n\t\tvar type = typeof div.lastChild.getAttribute(\"multiple\");\n\t\t// IE8 returns a string for some attributes even when not present\n\t\treturn type !== \"boolean\" && type !== \"string\";\n\t}),\n\n\t// Check if getElementsByClassName can be trusted\n\tassertUsableClassName = assert(function( div ) {\n\t\t// Opera can't find a second classname (in 9.6)\n\t\tdiv.innerHTML = \"<div class='hidden e'></div><div class='hidden'></div>\";\n\t\tif ( !div.getElementsByClassName || !div.getElementsByClassName(\"e\").length ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Safari 3.2 caches class attributes and doesn't catch changes\n\t\tdiv.lastChild.className = \"e\";\n\t\treturn div.getElementsByClassName(\"e\").length === 2;\n\t}),\n\n\t// Check if getElementById returns elements by name\n\t// Check if getElementsByName privileges form controls or returns elements by ID\n\tassertUsableName = assert(function( div ) {\n\t\t// Inject content\n\t\tdiv.id = expando + 0;\n\t\tdiv.innerHTML = \"<a name='\" + expando + \"'></a><div name='\" + expando + \"'></div>\";\n\t\tdocElem.insertBefore( div, docElem.firstChild );\n\n\t\t// Test\n\t\tvar pass = document.getElementsByName &&\n\t\t\t// buggy browsers will return fewer than the correct 2\n\t\t\tdocument.getElementsByName( expando ).length === 2 +\n\t\t\t// buggy browsers will return more than the correct 0\n\t\t\tdocument.getElementsByName( expando + 0 ).length;\n\t\tassertGetIdNotName = !document.getElementById( expando );\n\n\t\t// Cleanup\n\t\tdocElem.removeChild( div );\n\n\t\treturn pass;\n\t});\n\n// If slice is not available, provide a backup\ntry {\n\tslice.call( docElem.childNodes, 0 )[0].nodeType;\n} catch ( e ) {\n\tslice = function( i ) {\n\t\tvar elem,\n\t\t\tresults = [];\n\t\tfor ( ; (elem = this[i]); i++ ) {\n\t\t\tresults.push( elem );\n\t\t}\n\t\treturn results;\n\t};\n}\n\nfunction Sizzle( selector, context, results, seed ) {\n\tresults = results || [];\n\tcontext = context || document;\n\tvar match, elem, xml, m,\n\t\tnodeType = context.nodeType;\n\n\tif ( !selector || typeof selector !== \"string\" ) {\n\t\treturn results;\n\t}\n\n\tif ( nodeType !== 1 && nodeType !== 9 ) {\n\t\treturn [];\n\t}\n\n\txml = isXML( context );\n\n\tif ( !xml && !seed ) {\n\t\tif ( (match = rquickExpr.exec( selector )) ) {\n\t\t\t// Speed-up: Sizzle(\"#ID\")\n\t\t\tif ( (m = match[1]) ) {\n\t\t\t\tif ( nodeType === 9 ) {\n\t\t\t\t\telem = context.getElementById( m );\n\t\t\t\t\t// Check parentNode to catch when Blackberry 4.6 returns\n\t\t\t\t\t// nodes that are no longer in the document #6963\n\t\t\t\t\tif ( elem && elem.parentNode ) {\n\t\t\t\t\t\t// Handle the case where IE, Opera, and Webkit return items\n\t\t\t\t\t\t// by name instead of ID\n\t\t\t\t\t\tif ( elem.id === m ) {\n\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t// Context is not a document\n\t\t\t\t\tif ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) &&\n\t\t\t\t\t\tcontains( context, elem ) && elem.id === m ) {\n\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t// Speed-up: Sizzle(\"TAG\")\n\t\t\t} else if ( match[2] ) {\n\t\t\t\tpush.apply( results, slice.call(context.getElementsByTagName( selector ), 0) );\n\t\t\t\treturn results;\n\n\t\t\t// Speed-up: Sizzle(\".CLASS\")\n\t\t\t} else if ( (m = match[3]) && assertUsableClassName && context.getElementsByClassName ) {\n\t\t\t\tpush.apply( results, slice.call(context.getElementsByClassName( m ), 0) );\n\t\t\t\treturn results;\n\t\t\t}\n\t\t}\n\t}\n\n\t// All others\n\treturn select( selector.replace( rtrim, \"$1\" ), context, results, seed, xml );\n}\n\nSizzle.matches = function( expr, elements ) {\n\treturn Sizzle( expr, null, null, elements );\n};\n\nSizzle.matchesSelector = function( elem, expr ) {\n\treturn Sizzle( expr, null, null, [ elem ] ).length > 0;\n};\n\n// Returns a function to use in pseudos for input types\nfunction createInputPseudo( type ) {\n\treturn function( elem ) {\n\t\tvar name = elem.nodeName.toLowerCase();\n\t\treturn name === \"input\" && elem.type === type;\n\t};\n}\n\n// Returns a function to use in pseudos for buttons\nfunction createButtonPseudo( type ) {\n\treturn function( elem ) {\n\t\tvar name = elem.nodeName.toLowerCase();\n\t\treturn (name === \"input\" || name === \"button\") && elem.type === type;\n\t};\n}\n\n// Returns a function to use in pseudos for positionals\nfunction createPositionalPseudo( fn ) {\n\treturn markFunction(function( argument ) {\n\t\targument = +argument;\n\t\treturn markFunction(function( seed, matches ) {\n\t\t\tvar j,\n\t\t\t\tmatchIndexes = fn( [], seed.length, argument ),\n\t\t\t\ti = matchIndexes.length;\n\n\t\t\t// Match elements found at the specified indexes\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( seed[ (j = matchIndexes[i]) ] ) {\n\t\t\t\t\tseed[j] = !(matches[j] = seed[j]);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n}\n\n/**\n * Utility function for retrieving the text value of an array of DOM nodes\n * @param {Array|Element} elem\n */\ngetText = Sizzle.getText = function( elem ) {\n\tvar node,\n\t\tret = \"\",\n\t\ti = 0,\n\t\tnodeType = elem.nodeType;\n\n\tif ( nodeType ) {\n\t\tif ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {\n\t\t\t// Use textContent for elements\n\t\t\t// innerText usage removed for consistency of new lines (see #11153)\n\t\t\tif ( typeof elem.textContent === \"string\" ) {\n\t\t\t\treturn elem.textContent;\n\t\t\t} else {\n\t\t\t\t// Traverse its children\n\t\t\t\tfor ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {\n\t\t\t\t\tret += getText( elem );\n\t\t\t\t}\n\t\t\t}\n\t\t} else if ( nodeType === 3 || nodeType === 4 ) {\n\t\t\treturn elem.nodeValue;\n\t\t}\n\t\t// Do not include comment or processing instruction nodes\n\t} else {\n\n\t\t// If no nodeType, this is expected to be an array\n\t\tfor ( ; (node = elem[i]); i++ ) {\n\t\t\t// Do not traverse comment nodes\n\t\t\tret += getText( node );\n\t\t}\n\t}\n\treturn ret;\n};\n\nisXML = Sizzle.isXML = function( elem ) {\n\t// documentElement is verified for cases where it doesn't yet exist\n\t// (such as loading iframes in IE - #4833)\n\tvar documentElement = elem && (elem.ownerDocument || elem).documentElement;\n\treturn documentElement ? documentElement.nodeName !== \"HTML\" : false;\n};\n\n// Element contains another\ncontains = Sizzle.contains = docElem.contains ?\n\tfunction( a, b ) {\n\t\tvar adown = a.nodeType === 9 ? a.documentElement : a,\n\t\t\tbup = b && b.parentNode;\n\t\treturn a === bup || !!( bup && bup.nodeType === 1 && adown.contains && adown.contains(bup) );\n\t} :\n\tdocElem.compareDocumentPosition ?\n\tfunction( a, b ) {\n\t\treturn b && !!( a.compareDocumentPosition( b ) & 16 );\n\t} :\n\tfunction( a, b ) {\n\t\twhile ( (b = b.parentNode) ) {\n\t\t\tif ( b === a ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t};\n\nSizzle.attr = function( elem, name ) {\n\tvar val,\n\t\txml = isXML( elem );\n\n\tif ( !xml ) {\n\t\tname = name.toLowerCase();\n\t}\n\tif ( (val = Expr.attrHandle[ name ]) ) {\n\t\treturn val( elem );\n\t}\n\tif ( xml || assertAttributes ) {\n\t\treturn elem.getAttribute( name );\n\t}\n\tval = elem.getAttributeNode( name );\n\treturn val ?\n\t\ttypeof elem[ name ] === \"boolean\" ?\n\t\t\telem[ name ] ? name : null :\n\t\t\tval.specified ? val.value : null :\n\t\tnull;\n};\n\nExpr = Sizzle.selectors = {\n\n\t// Can be adjusted by the user\n\tcacheLength: 50,\n\n\tcreatePseudo: markFunction,\n\n\tmatch: matchExpr,\n\n\t// IE6/7 return a modified href\n\tattrHandle: assertHrefNotNormalized ?\n\t\t{} :\n\t\t{\n\t\t\t\"href\": function( elem ) {\n\t\t\t\treturn elem.getAttribute( \"href\", 2 );\n\t\t\t},\n\t\t\t\"type\": function( elem ) {\n\t\t\t\treturn elem.getAttribute(\"type\");\n\t\t\t}\n\t\t},\n\n\tfind: {\n\t\t\"ID\": assertGetIdNotName ?\n\t\t\tfunction( id, context, xml ) {\n\t\t\t\tif ( typeof context.getElementById !== strundefined && !xml ) {\n\t\t\t\t\tvar m = context.getElementById( id );\n\t\t\t\t\t// Check parentNode to catch when Blackberry 4.6 returns\n\t\t\t\t\t// nodes that are no longer in the document #6963\n\t\t\t\t\treturn m && m.parentNode ? [m] : [];\n\t\t\t\t}\n\t\t\t} :\n\t\t\tfunction( id, context, xml ) {\n\t\t\t\tif ( typeof context.getElementById !== strundefined && !xml ) {\n\t\t\t\t\tvar m = context.getElementById( id );\n\n\t\t\t\t\treturn m ?\n\t\t\t\t\t\tm.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode(\"id\").value === id ?\n\t\t\t\t\t\t\t[m] :\n\t\t\t\t\t\t\tundefined :\n\t\t\t\t\t\t[];\n\t\t\t\t}\n\t\t\t},\n\n\t\t\"TAG\": assertTagNameNoComments ?\n\t\t\tfunction( tag, context ) {\n\t\t\t\tif ( typeof context.getElementsByTagName !== strundefined ) {\n\t\t\t\t\treturn context.getElementsByTagName( tag );\n\t\t\t\t}\n\t\t\t} :\n\t\t\tfunction( tag, context ) {\n\t\t\t\tvar results = context.getElementsByTagName( tag );\n\n\t\t\t\t// Filter out possible comments\n\t\t\t\tif ( tag === \"*\" ) {\n\t\t\t\t\tvar elem,\n\t\t\t\t\t\ttmp = [],\n\t\t\t\t\t\ti = 0;\n\n\t\t\t\t\tfor ( ; (elem = results[i]); i++ ) {\n\t\t\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\t\t\ttmp.push( elem );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\treturn tmp;\n\t\t\t\t}\n\t\t\t\treturn results;\n\t\t\t},\n\n\t\t\"NAME\": assertUsableName && function( tag, context ) {\n\t\t\tif ( typeof context.getElementsByName !== strundefined ) {\n\t\t\t\treturn context.getElementsByName( name );\n\t\t\t}\n\t\t},\n\n\t\t\"CLASS\": assertUsableClassName && function( className, context, xml ) {\n\t\t\tif ( typeof context.getElementsByClassName !== strundefined && !xml ) {\n\t\t\t\treturn context.getElementsByClassName( className );\n\t\t\t}\n\t\t}\n\t},\n\n\trelative: {\n\t\t\">\": { dir: \"parentNode\", first: true },\n\t\t\" \": { dir: \"parentNode\" },\n\t\t\"+\": { dir: \"previousSibling\", first: true },\n\t\t\"~\": { dir: \"previousSibling\" }\n\t},\n\n\tpreFilter: {\n\t\t\"ATTR\": function( match ) {\n\t\t\tmatch[1] = match[1].replace( rbackslash, \"\" );\n\n\t\t\t// Move the given value to match[3] whether quoted or unquoted\n\t\t\tmatch[3] = ( match[4] || match[5] || \"\" ).replace( rbackslash, \"\" );\n\n\t\t\tif ( match[2] === \"~=\" ) {\n\t\t\t\tmatch[3] = \" \" + match[3] + \" \";\n\t\t\t}\n\n\t\t\treturn match.slice( 0, 4 );\n\t\t},\n\n\t\t\"CHILD\": function( match ) {\n\t\t\t/* matches from matchExpr[\"CHILD\"]\n\t\t\t\t1 type (only|nth|...)\n\t\t\t\t2 argument (even|odd|\\d*|\\d*n([+-]\\d+)?|...)\n\t\t\t\t3 xn-component of xn+y argument ([+-]?\\d*n|)\n\t\t\t\t4 sign of xn-component\n\t\t\t\t5 x of xn-component\n\t\t\t\t6 sign of y-component\n\t\t\t\t7 y of y-component\n\t\t\t*/\n\t\t\tmatch[1] = match[1].toLowerCase();\n\n\t\t\tif ( match[1] === \"nth\" ) {\n\t\t\t\t// nth-child requires argument\n\t\t\t\tif ( !match[2] ) {\n\t\t\t\t\tSizzle.error( match[0] );\n\t\t\t\t}\n\n\t\t\t\t// numeric x and y parameters for Expr.filter.CHILD\n\t\t\t\t// remember that false/true cast respectively to 0/1\n\t\t\t\tmatch[3] = +( match[3] ? match[4] + (match[5] || 1) : 2 * ( match[2] === \"even\" || match[2] === \"odd\" ) );\n\t\t\t\tmatch[4] = +( ( match[6] + match[7] ) || match[2] === \"odd\" );\n\n\t\t\t// other types prohibit arguments\n\t\t\t} else if ( match[2] ) {\n\t\t\t\tSizzle.error( match[0] );\n\t\t\t}\n\n\t\t\treturn match;\n\t\t},\n\n\t\t\"PSEUDO\": function( match ) {\n\t\t\tvar unquoted, excess;\n\t\t\tif ( matchExpr[\"CHILD\"].test( match[0] ) ) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tif ( match[3] ) {\n\t\t\t\tmatch[2] = match[3];\n\t\t\t} else if ( (unquoted = match[4]) ) {\n\t\t\t\t// Only check arguments that contain a pseudo\n\t\t\t\tif ( rpseudo.test(unquoted) &&\n\t\t\t\t\t// Get excess from tokenize (recursively)\n\t\t\t\t\t(excess = tokenize( unquoted, true )) &&\n\t\t\t\t\t// advance to the next closing parenthesis\n\t\t\t\t\t(excess = unquoted.indexOf( \")\", unquoted.length - excess ) - unquoted.length) ) {\n\n\t\t\t\t\t// excess is a negative index\n\t\t\t\t\tunquoted = unquoted.slice( 0, excess );\n\t\t\t\t\tmatch[0] = match[0].slice( 0, excess );\n\t\t\t\t}\n\t\t\t\tmatch[2] = unquoted;\n\t\t\t}\n\n\t\t\t// Return only captures needed by the pseudo filter method (type and argument)\n\t\t\treturn match.slice( 0, 3 );\n\t\t}\n\t},\n\n\tfilter: {\n\t\t\"ID\": assertGetIdNotName ?\n\t\t\tfunction( id ) {\n\t\t\t\tid = id.replace( rbackslash, \"\" );\n\t\t\t\treturn function( elem ) {\n\t\t\t\t\treturn elem.getAttribute(\"id\") === id;\n\t\t\t\t};\n\t\t\t} :\n\t\t\tfunction( id ) {\n\t\t\t\tid = id.replace( rbackslash, \"\" );\n\t\t\t\treturn function( elem ) {\n\t\t\t\t\tvar node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode(\"id\");\n\t\t\t\t\treturn node && node.value === id;\n\t\t\t\t};\n\t\t\t},\n\n\t\t\"TAG\": function( nodeName ) {\n\t\t\tif ( nodeName === \"*\" ) {\n\t\t\t\treturn function() { return true; };\n\t\t\t}\n\t\t\tnodeName = nodeName.replace( rbackslash, \"\" ).toLowerCase();\n\n\t\t\treturn function( elem ) {\n\t\t\t\treturn elem.nodeName && elem.nodeName.toLowerCase() === nodeName;\n\t\t\t};\n\t\t},\n\n\t\t\"CLASS\": function( className ) {\n\t\t\tvar pattern = classCache[ expando ][ className ];\n\t\t\tif ( !pattern ) {\n\t\t\t\tpattern = classCache( className, new RegExp(\"(^|\" + whitespace + \")\" + className + \"(\" + whitespace + \"|$)\") );\n\t\t\t}\n\t\t\treturn function( elem ) {\n\t\t\t\treturn pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute(\"class\")) || \"\" );\n\t\t\t};\n\t\t},\n\n\t\t\"ATTR\": function( name, operator, check ) {\n\t\t\treturn function( elem, context ) {\n\t\t\t\tvar result = Sizzle.attr( elem, name );\n\n\t\t\t\tif ( result == null ) {\n\t\t\t\t\treturn operator === \"!=\";\n\t\t\t\t}\n\t\t\t\tif ( !operator ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tresult += \"\";\n\n\t\t\t\treturn operator === \"=\" ? result === check :\n\t\t\t\t\toperator === \"!=\" ? result !== check :\n\t\t\t\t\toperator === \"^=\" ? check && result.indexOf( check ) === 0 :\n\t\t\t\t\toperator === \"*=\" ? check && result.indexOf( check ) > -1 :\n\t\t\t\t\toperator === \"$=\" ? check && result.substr( result.length - check.length ) === check :\n\t\t\t\t\toperator === \"~=\" ? ( \" \" + result + \" \" ).indexOf( check ) > -1 :\n\t\t\t\t\toperator === \"|=\" ? result === check || result.substr( 0, check.length + 1 ) === check + \"-\" :\n\t\t\t\t\tfalse;\n\t\t\t};\n\t\t},\n\n\t\t\"CHILD\": function( type, argument, first, last ) {\n\n\t\t\tif ( type === \"nth\" ) {\n\t\t\t\treturn function( elem ) {\n\t\t\t\t\tvar node, diff,\n\t\t\t\t\t\tparent = elem.parentNode;\n\n\t\t\t\t\tif ( first === 1 && last === 0 ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( parent ) {\n\t\t\t\t\t\tdiff = 0;\n\t\t\t\t\t\tfor ( node = parent.firstChild; node; node = node.nextSibling ) {\n\t\t\t\t\t\t\tif ( node.nodeType === 1 ) {\n\t\t\t\t\t\t\t\tdiff++;\n\t\t\t\t\t\t\t\tif ( elem === node ) {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Incorporate the offset (or cast to NaN), then check against cycle size\n\t\t\t\t\tdiff -= last;\n\t\t\t\t\treturn diff === first || ( diff % first === 0 && diff / first >= 0 );\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn function( elem ) {\n\t\t\t\tvar node = elem;\n\n\t\t\t\tswitch ( type ) {\n\t\t\t\t\tcase \"only\":\n\t\t\t\t\tcase \"first\":\n\t\t\t\t\t\twhile ( (node = node.previousSibling) ) {\n\t\t\t\t\t\t\tif ( node.nodeType === 1 ) {\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif ( type === \"first\" ) {\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tnode = elem;\n\n\t\t\t\t\t\t/* falls through */\n\t\t\t\t\tcase \"last\":\n\t\t\t\t\t\twhile ( (node = node.nextSibling) ) {\n\t\t\t\t\t\t\tif ( node.nodeType === 1 ) {\n\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t};\n\t\t},\n\n\t\t\"PSEUDO\": function( pseudo, argument ) {\n\t\t\t// pseudo-class names are case-insensitive\n\t\t\t// http://www.w3.org/TR/selectors/#pseudo-classes\n\t\t\t// Prioritize by case sensitivity in case custom pseudos are added with uppercase letters\n\t\t\t// Remember that setFilters inherits from pseudos\n\t\t\tvar args,\n\t\t\t\tfn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||\n\t\t\t\t\tSizzle.error( \"unsupported pseudo: \" + pseudo );\n\n\t\t\t// The user may use createPseudo to indicate that\n\t\t\t// arguments are needed to create the filter function\n\t\t\t// just as Sizzle does\n\t\t\tif ( fn[ expando ] ) {\n\t\t\t\treturn fn( argument );\n\t\t\t}\n\n\t\t\t// But maintain support for old signatures\n\t\t\tif ( fn.length > 1 ) {\n\t\t\t\targs = [ pseudo, pseudo, \"\", argument ];\n\t\t\t\treturn Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?\n\t\t\t\t\tmarkFunction(function( seed, matches ) {\n\t\t\t\t\t\tvar idx,\n\t\t\t\t\t\t\tmatched = fn( seed, argument ),\n\t\t\t\t\t\t\ti = matched.length;\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tidx = indexOf.call( seed, matched[i] );\n\t\t\t\t\t\t\tseed[ idx ] = !( matches[ idx ] = matched[i] );\n\t\t\t\t\t\t}\n\t\t\t\t\t}) :\n\t\t\t\t\tfunction( elem ) {\n\t\t\t\t\t\treturn fn( elem, 0, args );\n\t\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn fn;\n\t\t}\n\t},\n\n\tpseudos: {\n\t\t\"not\": markFunction(function( selector ) {\n\t\t\t// Trim the selector passed to compile\n\t\t\t// to avoid treating leading and trailing\n\t\t\t// spaces as combinators\n\t\t\tvar input = [],\n\t\t\t\tresults = [],\n\t\t\t\tmatcher = compile( selector.replace( rtrim, \"$1\" ) );\n\n\t\t\treturn matcher[ expando ] ?\n\t\t\t\tmarkFunction(function( seed, matches, context, xml ) {\n\t\t\t\t\tvar elem,\n\t\t\t\t\t\tunmatched = matcher( seed, null, xml, [] ),\n\t\t\t\t\t\ti = seed.length;\n\n\t\t\t\t\t// Match elements unmatched by `matcher`\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tif ( (elem = unmatched[i]) ) {\n\t\t\t\t\t\t\tseed[i] = !(matches[i] = elem);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}) :\n\t\t\t\tfunction( elem, context, xml ) {\n\t\t\t\t\tinput[0] = elem;\n\t\t\t\t\tmatcher( input, null, xml, results );\n\t\t\t\t\treturn !results.pop();\n\t\t\t\t};\n\t\t}),\n\n\t\t\"has\": markFunction(function( selector ) {\n\t\t\treturn function( elem ) {\n\t\t\t\treturn Sizzle( selector, elem ).length > 0;\n\t\t\t};\n\t\t}),\n\n\t\t\"contains\": markFunction(function( text ) {\n\t\t\treturn function( elem ) {\n\t\t\t\treturn ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;\n\t\t\t};\n\t\t}),\n\n\t\t\"enabled\": function( elem ) {\n\t\t\treturn elem.disabled === false;\n\t\t},\n\n\t\t\"disabled\": function( elem ) {\n\t\t\treturn elem.disabled === true;\n\t\t},\n\n\t\t\"checked\": function( elem ) {\n\t\t\t// In CSS3, :checked should return both checked and selected elements\n\t\t\t// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n\t\t\tvar nodeName = elem.nodeName.toLowerCase();\n\t\t\treturn (nodeName === \"input\" && !!elem.checked) || (nodeName === \"option\" && !!elem.selected);\n\t\t},\n\n\t\t\"selected\": function( elem ) {\n\t\t\t// Accessing this property makes selected-by-default\n\t\t\t// options in Safari work properly\n\t\t\tif ( elem.parentNode ) {\n\t\t\t\telem.parentNode.selectedIndex;\n\t\t\t}\n\n\t\t\treturn elem.selected === true;\n\t\t},\n\n\t\t\"parent\": function( elem ) {\n\t\t\treturn !Expr.pseudos[\"empty\"]( elem );\n\t\t},\n\n\t\t\"empty\": function( elem ) {\n\t\t\t// http://www.w3.org/TR/selectors/#empty-pseudo\n\t\t\t// :empty is only affected by element nodes and content nodes(including text(3), cdata(4)),\n\t\t\t//   not comment, processing instructions, or others\n\t\t\t// Thanks to Diego Perini for the nodeName shortcut\n\t\t\t//   Greater than \"@\" means alpha characters (specifically not starting with \"#\" or \"?\")\n\t\t\tvar nodeType;\n\t\t\telem = elem.firstChild;\n\t\t\twhile ( elem ) {\n\t\t\t\tif ( elem.nodeName > \"@\" || (nodeType = elem.nodeType) === 3 || nodeType === 4 ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\telem = elem.nextSibling;\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\n\t\t\"header\": function( elem ) {\n\t\t\treturn rheader.test( elem.nodeName );\n\t\t},\n\n\t\t\"text\": function( elem ) {\n\t\t\tvar type, attr;\n\t\t\t// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)\n\t\t\t// use getAttribute instead to test this case\n\t\t\treturn elem.nodeName.toLowerCase() === \"input\" &&\n\t\t\t\t(type = elem.type) === \"text\" &&\n\t\t\t\t( (attr = elem.getAttribute(\"type\")) == null || attr.toLowerCase() === type );\n\t\t},\n\n\t\t// Input types\n\t\t\"radio\": createInputPseudo(\"radio\"),\n\t\t\"checkbox\": createInputPseudo(\"checkbox\"),\n\t\t\"file\": createInputPseudo(\"file\"),\n\t\t\"password\": createInputPseudo(\"password\"),\n\t\t\"image\": createInputPseudo(\"image\"),\n\n\t\t\"submit\": createButtonPseudo(\"submit\"),\n\t\t\"reset\": createButtonPseudo(\"reset\"),\n\n\t\t\"button\": function( elem ) {\n\t\t\tvar name = elem.nodeName.toLowerCase();\n\t\t\treturn name === \"input\" && elem.type === \"button\" || name === \"button\";\n\t\t},\n\n\t\t\"input\": function( elem ) {\n\t\t\treturn rinputs.test( elem.nodeName );\n\t\t},\n\n\t\t\"focus\": function( elem ) {\n\t\t\tvar doc = elem.ownerDocument;\n\t\t\treturn elem === doc.activeElement && (!doc.hasFocus || doc.hasFocus()) && !!(elem.type || elem.href);\n\t\t},\n\n\t\t\"active\": function( elem ) {\n\t\t\treturn elem === elem.ownerDocument.activeElement;\n\t\t},\n\n\t\t// Positional types\n\t\t\"first\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\treturn [ 0 ];\n\t\t}),\n\n\t\t\"last\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\treturn [ length - 1 ];\n\t\t}),\n\n\t\t\"eq\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\treturn [ argument < 0 ? argument + length : argument ];\n\t\t}),\n\n\t\t\"even\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\tfor ( var i = 0; i < length; i += 2 ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"odd\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\tfor ( var i = 1; i < length; i += 2 ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"lt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\tfor ( var i = argument < 0 ? argument + length : argument; --i >= 0; ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t}),\n\n\t\t\"gt\": createPositionalPseudo(function( matchIndexes, length, argument ) {\n\t\t\tfor ( var i = argument < 0 ? argument + length : argument; ++i < length; ) {\n\t\t\t\tmatchIndexes.push( i );\n\t\t\t}\n\t\t\treturn matchIndexes;\n\t\t})\n\t}\n};\n\nfunction siblingCheck( a, b, ret ) {\n\tif ( a === b ) {\n\t\treturn ret;\n\t}\n\n\tvar cur = a.nextSibling;\n\n\twhile ( cur ) {\n\t\tif ( cur === b ) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tcur = cur.nextSibling;\n\t}\n\n\treturn 1;\n}\n\nsortOrder = docElem.compareDocumentPosition ?\n\tfunction( a, b ) {\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\t\t}\n\n\t\treturn ( !a.compareDocumentPosition || !b.compareDocumentPosition ?\n\t\t\ta.compareDocumentPosition :\n\t\t\ta.compareDocumentPosition(b) & 4\n\t\t) ? -1 : 1;\n\t} :\n\tfunction( a, b ) {\n\t\t// The nodes are identical, we can exit early\n\t\tif ( a === b ) {\n\t\t\thasDuplicate = true;\n\t\t\treturn 0;\n\n\t\t// Fallback to using sourceIndex (in IE) if it's available on both nodes\n\t\t} else if ( a.sourceIndex && b.sourceIndex ) {\n\t\t\treturn a.sourceIndex - b.sourceIndex;\n\t\t}\n\n\t\tvar al, bl,\n\t\t\tap = [],\n\t\t\tbp = [],\n\t\t\taup = a.parentNode,\n\t\t\tbup = b.parentNode,\n\t\t\tcur = aup;\n\n\t\t// If the nodes are siblings (or identical) we can do a quick check\n\t\tif ( aup === bup ) {\n\t\t\treturn siblingCheck( a, b );\n\n\t\t// If no parents were found then the nodes are disconnected\n\t\t} else if ( !aup ) {\n\t\t\treturn -1;\n\n\t\t} else if ( !bup ) {\n\t\t\treturn 1;\n\t\t}\n\n\t\t// Otherwise they're somewhere else in the tree so we need\n\t\t// to build up a full list of the parentNodes for comparison\n\t\twhile ( cur ) {\n\t\t\tap.unshift( cur );\n\t\t\tcur = cur.parentNode;\n\t\t}\n\n\t\tcur = bup;\n\n\t\twhile ( cur ) {\n\t\t\tbp.unshift( cur );\n\t\t\tcur = cur.parentNode;\n\t\t}\n\n\t\tal = ap.length;\n\t\tbl = bp.length;\n\n\t\t// Start walking down the tree looking for a discrepancy\n\t\tfor ( var i = 0; i < al && i < bl; i++ ) {\n\t\t\tif ( ap[i] !== bp[i] ) {\n\t\t\t\treturn siblingCheck( ap[i], bp[i] );\n\t\t\t}\n\t\t}\n\n\t\t// We ended someplace up the tree so do a sibling check\n\t\treturn i === al ?\n\t\t\tsiblingCheck( a, bp[i], -1 ) :\n\t\t\tsiblingCheck( ap[i], b, 1 );\n\t};\n\n// Always assume the presence of duplicates if sort doesn't\n// pass them to our comparison function (as in Google Chrome).\n[0, 0].sort( sortOrder );\nbaseHasDuplicate = !hasDuplicate;\n\n// Document sorting and removing duplicates\nSizzle.uniqueSort = function( results ) {\n\tvar elem,\n\t\ti = 1;\n\n\thasDuplicate = baseHasDuplicate;\n\tresults.sort( sortOrder );\n\n\tif ( hasDuplicate ) {\n\t\tfor ( ; (elem = results[i]); i++ ) {\n\t\t\tif ( elem === results[ i - 1 ] ) {\n\t\t\t\tresults.splice( i--, 1 );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn results;\n};\n\nSizzle.error = function( msg ) {\n\tthrow new Error( \"Syntax error, unrecognized expression: \" + msg );\n};\n\nfunction tokenize( selector, parseOnly ) {\n\tvar matched, match, tokens, type, soFar, groups, preFilters,\n\t\tcached = tokenCache[ expando ][ selector ];\n\n\tif ( cached ) {\n\t\treturn parseOnly ? 0 : cached.slice( 0 );\n\t}\n\n\tsoFar = selector;\n\tgroups = [];\n\tpreFilters = Expr.preFilter;\n\n\twhile ( soFar ) {\n\n\t\t// Comma and first run\n\t\tif ( !matched || (match = rcomma.exec( soFar )) ) {\n\t\t\tif ( match ) {\n\t\t\t\tsoFar = soFar.slice( match[0].length );\n\t\t\t}\n\t\t\tgroups.push( tokens = [] );\n\t\t}\n\n\t\tmatched = false;\n\n\t\t// Combinators\n\t\tif ( (match = rcombinators.exec( soFar )) ) {\n\t\t\ttokens.push( matched = new Token( match.shift() ) );\n\t\t\tsoFar = soFar.slice( matched.length );\n\n\t\t\t// Cast descendant combinators to space\n\t\t\tmatched.type = match[0].replace( rtrim, \" \" );\n\t\t}\n\n\t\t// Filters\n\t\tfor ( type in Expr.filter ) {\n\t\t\tif ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||\n\t\t\t\t// The last two arguments here are (context, xml) for backCompat\n\t\t\t\t(match = preFilters[ type ]( match, document, true ))) ) {\n\n\t\t\t\ttokens.push( matched = new Token( match.shift() ) );\n\t\t\t\tsoFar = soFar.slice( matched.length );\n\t\t\t\tmatched.type = type;\n\t\t\t\tmatched.matches = match;\n\t\t\t}\n\t\t}\n\n\t\tif ( !matched ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t// Return the length of the invalid excess\n\t// if we're just parsing\n\t// Otherwise, throw an error or return tokens\n\treturn parseOnly ?\n\t\tsoFar.length :\n\t\tsoFar ?\n\t\t\tSizzle.error( selector ) :\n\t\t\t// Cache the tokens\n\t\t\ttokenCache( selector, groups ).slice( 0 );\n}\n\nfunction addCombinator( matcher, combinator, base ) {\n\tvar dir = combinator.dir,\n\t\tcheckNonElements = base && combinator.dir === \"parentNode\",\n\t\tdoneName = done++;\n\n\treturn combinator.first ?\n\t\t// Check against closest ancestor/preceding element\n\t\tfunction( elem, context, xml ) {\n\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\tif ( checkNonElements || elem.nodeType === 1  ) {\n\t\t\t\t\treturn matcher( elem, context, xml );\n\t\t\t\t}\n\t\t\t}\n\t\t} :\n\n\t\t// Check against all ancestor/preceding elements\n\t\tfunction( elem, context, xml ) {\n\t\t\t// We can't set arbitrary data on XML nodes, so they don't benefit from dir caching\n\t\t\tif ( !xml ) {\n\t\t\t\tvar cache,\n\t\t\t\t\tdirkey = dirruns + \" \" + doneName + \" \",\n\t\t\t\t\tcachedkey = dirkey + cachedruns;\n\t\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\t\tif ( checkNonElements || elem.nodeType === 1 ) {\n\t\t\t\t\t\tif ( (cache = elem[ expando ]) === cachedkey ) {\n\t\t\t\t\t\t\treturn elem.sizset;\n\t\t\t\t\t\t} else if ( typeof cache === \"string\" && cache.indexOf(dirkey) === 0 ) {\n\t\t\t\t\t\t\tif ( elem.sizset ) {\n\t\t\t\t\t\t\t\treturn elem;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\telem[ expando ] = cachedkey;\n\t\t\t\t\t\t\tif ( matcher( elem, context, xml ) ) {\n\t\t\t\t\t\t\t\telem.sizset = true;\n\t\t\t\t\t\t\t\treturn elem;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telem.sizset = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\twhile ( (elem = elem[ dir ]) ) {\n\t\t\t\t\tif ( checkNonElements || elem.nodeType === 1 ) {\n\t\t\t\t\t\tif ( matcher( elem, context, xml ) ) {\n\t\t\t\t\t\t\treturn elem;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n}\n\nfunction elementMatcher( matchers ) {\n\treturn matchers.length > 1 ?\n\t\tfunction( elem, context, xml ) {\n\t\t\tvar i = matchers.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( !matchers[i]( elem, context, xml ) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t} :\n\t\tmatchers[0];\n}\n\nfunction condense( unmatched, map, filter, context, xml ) {\n\tvar elem,\n\t\tnewUnmatched = [],\n\t\ti = 0,\n\t\tlen = unmatched.length,\n\t\tmapped = map != null;\n\n\tfor ( ; i < len; i++ ) {\n\t\tif ( (elem = unmatched[i]) ) {\n\t\t\tif ( !filter || filter( elem, context, xml ) ) {\n\t\t\t\tnewUnmatched.push( elem );\n\t\t\t\tif ( mapped ) {\n\t\t\t\t\tmap.push( i );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn newUnmatched;\n}\n\nfunction setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {\n\tif ( postFilter && !postFilter[ expando ] ) {\n\t\tpostFilter = setMatcher( postFilter );\n\t}\n\tif ( postFinder && !postFinder[ expando ] ) {\n\t\tpostFinder = setMatcher( postFinder, postSelector );\n\t}\n\treturn markFunction(function( seed, results, context, xml ) {\n\t\t// Positional selectors apply to seed elements, so it is invalid to follow them with relative ones\n\t\tif ( seed && postFinder ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar i, elem, postFilterIn,\n\t\t\tpreMap = [],\n\t\t\tpostMap = [],\n\t\t\tpreexisting = results.length,\n\n\t\t\t// Get initial elements from seed or context\n\t\t\telems = seed || multipleContexts( selector || \"*\", context.nodeType ? [ context ] : context, [], seed ),\n\n\t\t\t// Prefilter to get matcher input, preserving a map for seed-results synchronization\n\t\t\tmatcherIn = preFilter && ( seed || !selector ) ?\n\t\t\t\tcondense( elems, preMap, preFilter, context, xml ) :\n\t\t\t\telems,\n\n\t\t\tmatcherOut = matcher ?\n\t\t\t\t// If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,\n\t\t\t\tpostFinder || ( seed ? preFilter : preexisting || postFilter ) ?\n\n\t\t\t\t\t// ...intermediate processing is necessary\n\t\t\t\t\t[] :\n\n\t\t\t\t\t// ...otherwise use results directly\n\t\t\t\t\tresults :\n\t\t\t\tmatcherIn;\n\n\t\t// Find primary matches\n\t\tif ( matcher ) {\n\t\t\tmatcher( matcherIn, matcherOut, context, xml );\n\t\t}\n\n\t\t// Apply postFilter\n\t\tif ( postFilter ) {\n\t\t\tpostFilterIn = condense( matcherOut, postMap );\n\t\t\tpostFilter( postFilterIn, [], context, xml );\n\n\t\t\t// Un-match failing elements by moving them back to matcherIn\n\t\t\ti = postFilterIn.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( (elem = postFilterIn[i]) ) {\n\t\t\t\t\tmatcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Keep seed and results synchronized\n\t\tif ( seed ) {\n\t\t\t// Ignore postFinder because it can't coexist with seed\n\t\t\ti = preFilter && matcherOut.length;\n\t\t\twhile ( i-- ) {\n\t\t\t\tif ( (elem = matcherOut[i]) ) {\n\t\t\t\t\tseed[ preMap[i] ] = !(results[ preMap[i] ] = elem);\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tmatcherOut = condense(\n\t\t\t\tmatcherOut === results ?\n\t\t\t\t\tmatcherOut.splice( preexisting, matcherOut.length ) :\n\t\t\t\t\tmatcherOut\n\t\t\t);\n\t\t\tif ( postFinder ) {\n\t\t\t\tpostFinder( null, results, matcherOut, xml );\n\t\t\t} else {\n\t\t\t\tpush.apply( results, matcherOut );\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction matcherFromTokens( tokens ) {\n\tvar checkContext, matcher, j,\n\t\tlen = tokens.length,\n\t\tleadingRelative = Expr.relative[ tokens[0].type ],\n\t\timplicitRelative = leadingRelative || Expr.relative[\" \"],\n\t\ti = leadingRelative ? 1 : 0,\n\n\t\t// The foundational matcher ensures that elements are reachable from top-level context(s)\n\t\tmatchContext = addCombinator( function( elem ) {\n\t\t\treturn elem === checkContext;\n\t\t}, implicitRelative, true ),\n\t\tmatchAnyContext = addCombinator( function( elem ) {\n\t\t\treturn indexOf.call( checkContext, elem ) > -1;\n\t\t}, implicitRelative, true ),\n\t\tmatchers = [ function( elem, context, xml ) {\n\t\t\treturn ( !leadingRelative && ( xml || context !== outermostContext ) ) || (\n\t\t\t\t(checkContext = context).nodeType ?\n\t\t\t\t\tmatchContext( elem, context, xml ) :\n\t\t\t\t\tmatchAnyContext( elem, context, xml ) );\n\t\t} ];\n\n\tfor ( ; i < len; i++ ) {\n\t\tif ( (matcher = Expr.relative[ tokens[i].type ]) ) {\n\t\t\tmatchers = [ addCombinator( elementMatcher( matchers ), matcher ) ];\n\t\t} else {\n\t\t\t// The concatenated values are (context, xml) for backCompat\n\t\t\tmatcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );\n\n\t\t\t// Return special upon seeing a positional matcher\n\t\t\tif ( matcher[ expando ] ) {\n\t\t\t\t// Find the next relative operator (if any) for proper handling\n\t\t\t\tj = ++i;\n\t\t\t\tfor ( ; j < len; j++ ) {\n\t\t\t\t\tif ( Expr.relative[ tokens[j].type ] ) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn setMatcher(\n\t\t\t\t\ti > 1 && elementMatcher( matchers ),\n\t\t\t\t\ti > 1 && tokens.slice( 0, i - 1 ).join(\"\").replace( rtrim, \"$1\" ),\n\t\t\t\t\tmatcher,\n\t\t\t\t\ti < j && matcherFromTokens( tokens.slice( i, j ) ),\n\t\t\t\t\tj < len && matcherFromTokens( (tokens = tokens.slice( j )) ),\n\t\t\t\t\tj < len && tokens.join(\"\")\n\t\t\t\t);\n\t\t\t}\n\t\t\tmatchers.push( matcher );\n\t\t}\n\t}\n\n\treturn elementMatcher( matchers );\n}\n\nfunction matcherFromGroupMatchers( elementMatchers, setMatchers ) {\n\tvar bySet = setMatchers.length > 0,\n\t\tbyElement = elementMatchers.length > 0,\n\t\tsuperMatcher = function( seed, context, xml, results, expandContext ) {\n\t\t\tvar elem, j, matcher,\n\t\t\t\tsetMatched = [],\n\t\t\t\tmatchedCount = 0,\n\t\t\t\ti = \"0\",\n\t\t\t\tunmatched = seed && [],\n\t\t\t\toutermost = expandContext != null,\n\t\t\t\tcontextBackup = outermostContext,\n\t\t\t\t// We must always have either seed elements or context\n\t\t\t\telems = seed || byElement && Expr.find[\"TAG\"]( \"*\", expandContext && context.parentNode || context ),\n\t\t\t\t// Nested matchers should use non-integer dirruns\n\t\t\t\tdirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E);\n\n\t\t\tif ( outermost ) {\n\t\t\t\toutermostContext = context !== document && context;\n\t\t\t\tcachedruns = superMatcher.el;\n\t\t\t}\n\n\t\t\t// Add elements passing elementMatchers directly to results\n\t\t\tfor ( ; (elem = elems[i]) != null; i++ ) {\n\t\t\t\tif ( byElement && elem ) {\n\t\t\t\t\tfor ( j = 0; (matcher = elementMatchers[j]); j++ ) {\n\t\t\t\t\t\tif ( matcher( elem, context, xml ) ) {\n\t\t\t\t\t\t\tresults.push( elem );\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif ( outermost ) {\n\t\t\t\t\t\tdirruns = dirrunsUnique;\n\t\t\t\t\t\tcachedruns = ++superMatcher.el;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Track unmatched elements for set filters\n\t\t\t\tif ( bySet ) {\n\t\t\t\t\t// They will have gone through all possible matchers\n\t\t\t\t\tif ( (elem = !matcher && elem) ) {\n\t\t\t\t\t\tmatchedCount--;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Lengthen the array for every element, matched or not\n\t\t\t\t\tif ( seed ) {\n\t\t\t\t\t\tunmatched.push( elem );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Apply set filters to unmatched elements\n\t\t\tmatchedCount += i;\n\t\t\tif ( bySet && i !== matchedCount ) {\n\t\t\t\tfor ( j = 0; (matcher = setMatchers[j]); j++ ) {\n\t\t\t\t\tmatcher( unmatched, setMatched, context, xml );\n\t\t\t\t}\n\n\t\t\t\tif ( seed ) {\n\t\t\t\t\t// Reintegrate element matches to eliminate the need for sorting\n\t\t\t\t\tif ( matchedCount > 0 ) {\n\t\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\t\tif ( !(unmatched[i] || setMatched[i]) ) {\n\t\t\t\t\t\t\t\tsetMatched[i] = pop.call( results );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Discard index placeholder values to get only actual matches\n\t\t\t\t\tsetMatched = condense( setMatched );\n\t\t\t\t}\n\n\t\t\t\t// Add matches to results\n\t\t\t\tpush.apply( results, setMatched );\n\n\t\t\t\t// Seedless set matches succeeding multiple successful matchers stipulate sorting\n\t\t\t\tif ( outermost && !seed && setMatched.length > 0 &&\n\t\t\t\t\t( matchedCount + setMatchers.length ) > 1 ) {\n\n\t\t\t\t\tSizzle.uniqueSort( results );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Override manipulation of globals by nested matchers\n\t\t\tif ( outermost ) {\n\t\t\t\tdirruns = dirrunsUnique;\n\t\t\t\toutermostContext = contextBackup;\n\t\t\t}\n\n\t\t\treturn unmatched;\n\t\t};\n\n\tsuperMatcher.el = 0;\n\treturn bySet ?\n\t\tmarkFunction( superMatcher ) :\n\t\tsuperMatcher;\n}\n\ncompile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) {\n\tvar i,\n\t\tsetMatchers = [],\n\t\telementMatchers = [],\n\t\tcached = compilerCache[ expando ][ selector ];\n\n\tif ( !cached ) {\n\t\t// Generate a function of recursive functions that can be used to check each element\n\t\tif ( !group ) {\n\t\t\tgroup = tokenize( selector );\n\t\t}\n\t\ti = group.length;\n\t\twhile ( i-- ) {\n\t\t\tcached = matcherFromTokens( group[i] );\n\t\t\tif ( cached[ expando ] ) {\n\t\t\t\tsetMatchers.push( cached );\n\t\t\t} else {\n\t\t\t\telementMatchers.push( cached );\n\t\t\t}\n\t\t}\n\n\t\t// Cache the compiled function\n\t\tcached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );\n\t}\n\treturn cached;\n};\n\nfunction multipleContexts( selector, contexts, results, seed ) {\n\tvar i = 0,\n\t\tlen = contexts.length;\n\tfor ( ; i < len; i++ ) {\n\t\tSizzle( selector, contexts[i], results, seed );\n\t}\n\treturn results;\n}\n\nfunction select( selector, context, results, seed, xml ) {\n\tvar i, tokens, token, type, find,\n\t\tmatch = tokenize( selector ),\n\t\tj = match.length;\n\n\tif ( !seed ) {\n\t\t// Try to minimize operations if there is only one group\n\t\tif ( match.length === 1 ) {\n\n\t\t\t// Take a shortcut and set the context if the root selector is an ID\n\t\t\ttokens = match[0] = match[0].slice( 0 );\n\t\t\tif ( tokens.length > 2 && (token = tokens[0]).type === \"ID\" &&\n\t\t\t\t\tcontext.nodeType === 9 && !xml &&\n\t\t\t\t\tExpr.relative[ tokens[1].type ] ) {\n\n\t\t\t\tcontext = Expr.find[\"ID\"]( token.matches[0].replace( rbackslash, \"\" ), context, xml )[0];\n\t\t\t\tif ( !context ) {\n\t\t\t\t\treturn results;\n\t\t\t\t}\n\n\t\t\t\tselector = selector.slice( tokens.shift().length );\n\t\t\t}\n\n\t\t\t// Fetch a seed set for right-to-left matching\n\t\t\tfor ( i = matchExpr[\"POS\"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) {\n\t\t\t\ttoken = tokens[i];\n\n\t\t\t\t// Abort if we hit a combinator\n\t\t\t\tif ( Expr.relative[ (type = token.type) ] ) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif ( (find = Expr.find[ type ]) ) {\n\t\t\t\t\t// Search, expanding context for leading sibling combinators\n\t\t\t\t\tif ( (seed = find(\n\t\t\t\t\t\ttoken.matches[0].replace( rbackslash, \"\" ),\n\t\t\t\t\t\trsibling.test( tokens[0].type ) && context.parentNode || context,\n\t\t\t\t\t\txml\n\t\t\t\t\t)) ) {\n\n\t\t\t\t\t\t// If seed is empty or no tokens remain, we can return early\n\t\t\t\t\t\ttokens.splice( i, 1 );\n\t\t\t\t\t\tselector = seed.length && tokens.join(\"\");\n\t\t\t\t\t\tif ( !selector ) {\n\t\t\t\t\t\t\tpush.apply( results, slice.call( seed, 0 ) );\n\t\t\t\t\t\t\treturn results;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Compile and execute a filtering function\n\t// Provide `match` to avoid retokenization if we modified the selector above\n\tcompile( selector, match )(\n\t\tseed,\n\t\tcontext,\n\t\txml,\n\t\tresults,\n\t\trsibling.test( selector )\n\t);\n\treturn results;\n}\n\nif ( document.querySelectorAll ) {\n\t(function() {\n\t\tvar disconnectedMatch,\n\t\t\toldSelect = select,\n\t\t\trescape = /'|\\\\/g,\n\t\t\trattributeQuotes = /\\=[\\x20\\t\\r\\n\\f]*([^'\"\\]]*)[\\x20\\t\\r\\n\\f]*\\]/g,\n\n\t\t\t// qSa(:focus) reports false when true (Chrome 21),\n\t\t\t// A support test would require too much code (would include document ready)\n\t\t\trbuggyQSA = [\":focus\"],\n\n\t\t\t// matchesSelector(:focus) reports false when true (Chrome 21),\n\t\t\t// matchesSelector(:active) reports false when true (IE9/Opera 11.5)\n\t\t\t// A support test would require too much code (would include document ready)\n\t\t\t// just skip matchesSelector for :active\n\t\t\trbuggyMatches = [ \":active\", \":focus\" ],\n\t\t\tmatches = docElem.matchesSelector ||\n\t\t\t\tdocElem.mozMatchesSelector ||\n\t\t\t\tdocElem.webkitMatchesSelector ||\n\t\t\t\tdocElem.oMatchesSelector ||\n\t\t\t\tdocElem.msMatchesSelector;\n\n\t\t// Build QSA regex\n\t\t// Regex strategy adopted from Diego Perini\n\t\tassert(function( div ) {\n\t\t\t// Select is set to empty string on purpose\n\t\t\t// This is to test IE's treatment of not explictly\n\t\t\t// setting a boolean content attribute,\n\t\t\t// since its presence should be enough\n\t\t\t// http://bugs.jquery.com/ticket/12359\n\t\t\tdiv.innerHTML = \"<select><option selected=''></option></select>\";\n\n\t\t\t// IE8 - Some boolean attributes are not treated correctly\n\t\t\tif ( !div.querySelectorAll(\"[selected]\").length ) {\n\t\t\t\trbuggyQSA.push( \"\\\\[\" + whitespace + \"*(?:checked|disabled|ismap|multiple|readonly|selected|value)\" );\n\t\t\t}\n\n\t\t\t// Webkit/Opera - :checked should return selected option elements\n\t\t\t// http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked\n\t\t\t// IE8 throws error here (do not put tests after this one)\n\t\t\tif ( !div.querySelectorAll(\":checked\").length ) {\n\t\t\t\trbuggyQSA.push(\":checked\");\n\t\t\t}\n\t\t});\n\n\t\tassert(function( div ) {\n\n\t\t\t// Opera 10-12/IE9 - ^= $= *= and empty values\n\t\t\t// Should not select anything\n\t\t\tdiv.innerHTML = \"<p test=''></p>\";\n\t\t\tif ( div.querySelectorAll(\"[test^='']\").length ) {\n\t\t\t\trbuggyQSA.push( \"[*^$]=\" + whitespace + \"*(?:\\\"\\\"|'')\" );\n\t\t\t}\n\n\t\t\t// FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)\n\t\t\t// IE8 throws error here (do not put tests after this one)\n\t\t\tdiv.innerHTML = \"<input type='hidden'/>\";\n\t\t\tif ( !div.querySelectorAll(\":enabled\").length ) {\n\t\t\t\trbuggyQSA.push(\":enabled\", \":disabled\");\n\t\t\t}\n\t\t});\n\n\t\t// rbuggyQSA always contains :focus, so no need for a length check\n\t\trbuggyQSA = /* rbuggyQSA.length && */ new RegExp( rbuggyQSA.join(\"|\") );\n\n\t\tselect = function( selector, context, results, seed, xml ) {\n\t\t\t// Only use querySelectorAll when not filtering,\n\t\t\t// when this is not xml,\n\t\t\t// and when no QSA bugs apply\n\t\t\tif ( !seed && !xml && (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {\n\t\t\t\tvar groups, i,\n\t\t\t\t\told = true,\n\t\t\t\t\tnid = expando,\n\t\t\t\t\tnewContext = context,\n\t\t\t\t\tnewSelector = context.nodeType === 9 && selector;\n\n\t\t\t\t// qSA works strangely on Element-rooted queries\n\t\t\t\t// We can work around this by specifying an extra ID on the root\n\t\t\t\t// and working up from there (Thanks to Andrew Dupont for the technique)\n\t\t\t\t// IE 8 doesn't work on object elements\n\t\t\t\tif ( context.nodeType === 1 && context.nodeName.toLowerCase() !== \"object\" ) {\n\t\t\t\t\tgroups = tokenize( selector );\n\n\t\t\t\t\tif ( (old = context.getAttribute(\"id\")) ) {\n\t\t\t\t\t\tnid = old.replace( rescape, \"\\\\$&\" );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontext.setAttribute( \"id\", nid );\n\t\t\t\t\t}\n\t\t\t\t\tnid = \"[id='\" + nid + \"'] \";\n\n\t\t\t\t\ti = groups.length;\n\t\t\t\t\twhile ( i-- ) {\n\t\t\t\t\t\tgroups[i] = nid + groups[i].join(\"\");\n\t\t\t\t\t}\n\t\t\t\t\tnewContext = rsibling.test( selector ) && context.parentNode || context;\n\t\t\t\t\tnewSelector = groups.join(\",\");\n\t\t\t\t}\n\n\t\t\t\tif ( newSelector ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tpush.apply( results, slice.call( newContext.querySelectorAll(\n\t\t\t\t\t\t\tnewSelector\n\t\t\t\t\t\t), 0 ) );\n\t\t\t\t\t\treturn results;\n\t\t\t\t\t} catch(qsaError) {\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tif ( !old ) {\n\t\t\t\t\t\t\tcontext.removeAttribute(\"id\");\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn oldSelect( selector, context, results, seed, xml );\n\t\t};\n\n\t\tif ( matches ) {\n\t\t\tassert(function( div ) {\n\t\t\t\t// Check to see if it's possible to do matchesSelector\n\t\t\t\t// on a disconnected node (IE 9)\n\t\t\t\tdisconnectedMatch = matches.call( div, \"div\" );\n\n\t\t\t\t// This should fail with an exception\n\t\t\t\t// Gecko does not error, returns false instead\n\t\t\t\ttry {\n\t\t\t\t\tmatches.call( div, \"[test!='']:sizzle\" );\n\t\t\t\t\trbuggyMatches.push( \"!=\", pseudos );\n\t\t\t\t} catch ( e ) {}\n\t\t\t});\n\n\t\t\t// rbuggyMatches always contains :active and :focus, so no need for a length check\n\t\t\trbuggyMatches = /* rbuggyMatches.length && */ new RegExp( rbuggyMatches.join(\"|\") );\n\n\t\t\tSizzle.matchesSelector = function( elem, expr ) {\n\t\t\t\t// Make sure that attribute selectors are quoted\n\t\t\t\texpr = expr.replace( rattributeQuotes, \"='$1']\" );\n\n\t\t\t\t// rbuggyMatches always contains :active, so no need for an existence check\n\t\t\t\tif ( !isXML( elem ) && !rbuggyMatches.test( expr ) && (!rbuggyQSA || !rbuggyQSA.test( expr )) ) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tvar ret = matches.call( elem, expr );\n\n\t\t\t\t\t\t// IE 9's matchesSelector returns false on disconnected nodes\n\t\t\t\t\t\tif ( ret || disconnectedMatch ||\n\t\t\t\t\t\t\t\t// As well, disconnected nodes are said to be in a document\n\t\t\t\t\t\t\t\t// fragment in IE 9\n\t\t\t\t\t\t\t\telem.document && elem.document.nodeType !== 11 ) {\n\t\t\t\t\t\t\treturn ret;\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch(e) {}\n\t\t\t\t}\n\n\t\t\t\treturn Sizzle( expr, null, null, [ elem ] ).length > 0;\n\t\t\t};\n\t\t}\n\t})();\n}\n\n// Deprecated\nExpr.pseudos[\"nth\"] = Expr.pseudos[\"eq\"];\n\n// Back-compat\nfunction setFilters() {}\nExpr.filters = setFilters.prototype = Expr.pseudos;\nExpr.setFilters = new setFilters();\n\n// Override sizzle attribute retrieval\nSizzle.attr = jQuery.attr;\njQuery.find = Sizzle;\njQuery.expr = Sizzle.selectors;\njQuery.expr[\":\"] = jQuery.expr.pseudos;\njQuery.unique = Sizzle.uniqueSort;\njQuery.text = Sizzle.getText;\njQuery.isXMLDoc = Sizzle.isXML;\njQuery.contains = Sizzle.contains;\n\n\n})( window );\nvar runtil = /Until$/,\n\trparentsprev = /^(?:parents|prev(?:Until|All))/,\n\tisSimple = /^.[^:#\\[\\.,]*$/,\n\trneedsContext = jQuery.expr.match.needsContext,\n\t// methods guaranteed to produce a unique set when starting from a unique set\n\tguaranteedUnique = {\n\t\tchildren: true,\n\t\tcontents: true,\n\t\tnext: true,\n\t\tprev: true\n\t};\n\njQuery.fn.extend({\n\tfind: function( selector ) {\n\t\tvar i, l, length, n, r, ret,\n\t\t\tself = this;\n\n\t\tif ( typeof selector !== \"string\" ) {\n\t\t\treturn jQuery( selector ).filter(function() {\n\t\t\t\tfor ( i = 0, l = self.length; i < l; i++ ) {\n\t\t\t\t\tif ( jQuery.contains( self[ i ], this ) ) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tret = this.pushStack( \"\", \"find\", selector );\n\n\t\tfor ( i = 0, l = this.length; i < l; i++ ) {\n\t\t\tlength = ret.length;\n\t\t\tjQuery.find( selector, this[i], ret );\n\n\t\t\tif ( i > 0 ) {\n\t\t\t\t// Make sure that the results are unique\n\t\t\t\tfor ( n = length; n < ret.length; n++ ) {\n\t\t\t\t\tfor ( r = 0; r < length; r++ ) {\n\t\t\t\t\t\tif ( ret[r] === ret[n] ) {\n\t\t\t\t\t\t\tret.splice(n--, 1);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\thas: function( target ) {\n\t\tvar i,\n\t\t\ttargets = jQuery( target, this ),\n\t\t\tlen = targets.length;\n\n\t\treturn this.filter(function() {\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tif ( jQuery.contains( this, targets[i] ) ) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t},\n\n\tnot: function( selector ) {\n\t\treturn this.pushStack( winnow(this, selector, false), \"not\", selector);\n\t},\n\n\tfilter: function( selector ) {\n\t\treturn this.pushStack( winnow(this, selector, true), \"filter\", selector );\n\t},\n\n\tis: function( selector ) {\n\t\treturn !!selector && (\n\t\t\ttypeof selector === \"string\" ?\n\t\t\t\t// If this is a positional/relative selector, check membership in the returned set\n\t\t\t\t// so $(\"p:first\").is(\"p:last\") won't return true for a doc with two \"p\".\n\t\t\t\trneedsContext.test( selector ) ?\n\t\t\t\t\tjQuery( selector, this.context ).index( this[0] ) >= 0 :\n\t\t\t\t\tjQuery.filter( selector, this ).length > 0 :\n\t\t\t\tthis.filter( selector ).length > 0 );\n\t},\n\n\tclosest: function( selectors, context ) {\n\t\tvar cur,\n\t\t\ti = 0,\n\t\t\tl = this.length,\n\t\t\tret = [],\n\t\t\tpos = rneedsContext.test( selectors ) || typeof selectors !== \"string\" ?\n\t\t\t\tjQuery( selectors, context || this.context ) :\n\t\t\t\t0;\n\n\t\tfor ( ; i < l; i++ ) {\n\t\t\tcur = this[i];\n\n\t\t\twhile ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) {\n\t\t\t\tif ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {\n\t\t\t\t\tret.push( cur );\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcur = cur.parentNode;\n\t\t\t}\n\t\t}\n\n\t\tret = ret.length > 1 ? jQuery.unique( ret ) : ret;\n\n\t\treturn this.pushStack( ret, \"closest\", selectors );\n\t},\n\n\t// Determine the position of an element within\n\t// the matched set of elements\n\tindex: function( elem ) {\n\n\t\t// No argument, return index in parent\n\t\tif ( !elem ) {\n\t\t\treturn ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;\n\t\t}\n\n\t\t// index in selector\n\t\tif ( typeof elem === \"string\" ) {\n\t\t\treturn jQuery.inArray( this[0], jQuery( elem ) );\n\t\t}\n\n\t\t// Locate the position of the desired element\n\t\treturn jQuery.inArray(\n\t\t\t// If it receives a jQuery object, the first element is used\n\t\t\telem.jquery ? elem[0] : elem, this );\n\t},\n\n\tadd: function( selector, context ) {\n\t\tvar set = typeof selector === \"string\" ?\n\t\t\t\tjQuery( selector, context ) :\n\t\t\t\tjQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),\n\t\t\tall = jQuery.merge( this.get(), set );\n\n\t\treturn this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?\n\t\t\tall :\n\t\t\tjQuery.unique( all ) );\n\t},\n\n\taddBack: function( selector ) {\n\t\treturn this.add( selector == null ?\n\t\t\tthis.prevObject : this.prevObject.filter(selector)\n\t\t);\n\t}\n});\n\njQuery.fn.andSelf = jQuery.fn.addBack;\n\n// A painfully simple check to see if an element is disconnected\n// from a document (should be improved, where feasible).\nfunction isDisconnected( node ) {\n\treturn !node || !node.parentNode || node.parentNode.nodeType === 11;\n}\n\nfunction sibling( cur, dir ) {\n\tdo {\n\t\tcur = cur[ dir ];\n\t} while ( cur && cur.nodeType !== 1 );\n\n\treturn cur;\n}\n\njQuery.each({\n\tparent: function( elem ) {\n\t\tvar parent = elem.parentNode;\n\t\treturn parent && parent.nodeType !== 11 ? parent : null;\n\t},\n\tparents: function( elem ) {\n\t\treturn jQuery.dir( elem, \"parentNode\" );\n\t},\n\tparentsUntil: function( elem, i, until ) {\n\t\treturn jQuery.dir( elem, \"parentNode\", until );\n\t},\n\tnext: function( elem ) {\n\t\treturn sibling( elem, \"nextSibling\" );\n\t},\n\tprev: function( elem ) {\n\t\treturn sibling( elem, \"previousSibling\" );\n\t},\n\tnextAll: function( elem ) {\n\t\treturn jQuery.dir( elem, \"nextSibling\" );\n\t},\n\tprevAll: function( elem ) {\n\t\treturn jQuery.dir( elem, \"previousSibling\" );\n\t},\n\tnextUntil: function( elem, i, until ) {\n\t\treturn jQuery.dir( elem, \"nextSibling\", until );\n\t},\n\tprevUntil: function( elem, i, until ) {\n\t\treturn jQuery.dir( elem, \"previousSibling\", until );\n\t},\n\tsiblings: function( elem ) {\n\t\treturn jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem );\n\t},\n\tchildren: function( elem ) {\n\t\treturn jQuery.sibling( elem.firstChild );\n\t},\n\tcontents: function( elem ) {\n\t\treturn jQuery.nodeName( elem, \"iframe\" ) ?\n\t\t\telem.contentDocument || elem.contentWindow.document :\n\t\t\tjQuery.merge( [], elem.childNodes );\n\t}\n}, function( name, fn ) {\n\tjQuery.fn[ name ] = function( until, selector ) {\n\t\tvar ret = jQuery.map( this, fn, until );\n\n\t\tif ( !runtil.test( name ) ) {\n\t\t\tselector = until;\n\t\t}\n\n\t\tif ( selector && typeof selector === \"string\" ) {\n\t\t\tret = jQuery.filter( selector, ret );\n\t\t}\n\n\t\tret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;\n\n\t\tif ( this.length > 1 && rparentsprev.test( name ) ) {\n\t\t\tret = ret.reverse();\n\t\t}\n\n\t\treturn this.pushStack( ret, name, core_slice.call( arguments ).join(\",\") );\n\t};\n});\n\njQuery.extend({\n\tfilter: function( expr, elems, not ) {\n\t\tif ( not ) {\n\t\t\texpr = \":not(\" + expr + \")\";\n\t\t}\n\n\t\treturn elems.length === 1 ?\n\t\t\tjQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :\n\t\t\tjQuery.find.matches(expr, elems);\n\t},\n\n\tdir: function( elem, dir, until ) {\n\t\tvar matched = [],\n\t\t\tcur = elem[ dir ];\n\n\t\twhile ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {\n\t\t\tif ( cur.nodeType === 1 ) {\n\t\t\t\tmatched.push( cur );\n\t\t\t}\n\t\t\tcur = cur[dir];\n\t\t}\n\t\treturn matched;\n\t},\n\n\tsibling: function( n, elem ) {\n\t\tvar r = [];\n\n\t\tfor ( ; n; n = n.nextSibling ) {\n\t\t\tif ( n.nodeType === 1 && n !== elem ) {\n\t\t\t\tr.push( n );\n\t\t\t}\n\t\t}\n\n\t\treturn r;\n\t}\n});\n\n// Implement the identical functionality for filter and not\nfunction winnow( elements, qualifier, keep ) {\n\n\t// Can't pass null or undefined to indexOf in Firefox 4\n\t// Set to 0 to skip string check\n\tqualifier = qualifier || 0;\n\n\tif ( jQuery.isFunction( qualifier ) ) {\n\t\treturn jQuery.grep(elements, function( elem, i ) {\n\t\t\tvar retVal = !!qualifier.call( elem, i, elem );\n\t\t\treturn retVal === keep;\n\t\t});\n\n\t} else if ( qualifier.nodeType ) {\n\t\treturn jQuery.grep(elements, function( elem, i ) {\n\t\t\treturn ( elem === qualifier ) === keep;\n\t\t});\n\n\t} else if ( typeof qualifier === \"string\" ) {\n\t\tvar filtered = jQuery.grep(elements, function( elem ) {\n\t\t\treturn elem.nodeType === 1;\n\t\t});\n\n\t\tif ( isSimple.test( qualifier ) ) {\n\t\t\treturn jQuery.filter(qualifier, filtered, !keep);\n\t\t} else {\n\t\t\tqualifier = jQuery.filter( qualifier, filtered );\n\t\t}\n\t}\n\n\treturn jQuery.grep(elements, function( elem, i ) {\n\t\treturn ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;\n\t});\n}\nfunction createSafeFragment( document ) {\n\tvar list = nodeNames.split( \"|\" ),\n\tsafeFrag = document.createDocumentFragment();\n\n\tif ( safeFrag.createElement ) {\n\t\twhile ( list.length ) {\n\t\t\tsafeFrag.createElement(\n\t\t\t\tlist.pop()\n\t\t\t);\n\t\t}\n\t}\n\treturn safeFrag;\n}\n\nvar nodeNames = \"abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|\" +\n\t\t\"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video\",\n\trinlinejQuery = / jQuery\\d+=\"(?:null|\\d+)\"/g,\n\trleadingWhitespace = /^\\s+/,\n\trxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:]+)[^>]*)\\/>/gi,\n\trtagName = /<([\\w:]+)/,\n\trtbody = /<tbody/i,\n\trhtml = /<|&#?\\w+;/,\n\trnoInnerhtml = /<(?:script|style|link)/i,\n\trnocache = /<(?:script|object|embed|option|style)/i,\n\trnoshimcache = new RegExp(\"<(?:\" + nodeNames + \")[\\\\s/>]\", \"i\"),\n\trcheckableType = /^(?:checkbox|radio)$/,\n\t// checked=\"checked\" or checked\n\trchecked = /checked\\s*(?:[^=]|=\\s*.checked.)/i,\n\trscriptType = /\\/(java|ecma)script/i,\n\trcleanScript = /^\\s*<!(?:\\[CDATA\\[|\\-\\-)|[\\]\\-]{2}>\\s*$/g,\n\twrapMap = {\n\t\toption: [ 1, \"<select multiple='multiple'>\", \"</select>\" ],\n\t\tlegend: [ 1, \"<fieldset>\", \"</fieldset>\" ],\n\t\tthead: [ 1, \"<table>\", \"</table>\" ],\n\t\ttr: [ 2, \"<table><tbody>\", \"</tbody></table>\" ],\n\t\ttd: [ 3, \"<table><tbody><tr>\", \"</tr></tbody></table>\" ],\n\t\tcol: [ 2, \"<table><tbody></tbody><colgroup>\", \"</colgroup></table>\" ],\n\t\tarea: [ 1, \"<map>\", \"</map>\" ],\n\t\t_default: [ 0, \"\", \"\" ]\n\t},\n\tsafeFragment = createSafeFragment( document ),\n\tfragmentDiv = safeFragment.appendChild( document.createElement(\"div\") );\n\nwrapMap.optgroup = wrapMap.option;\nwrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;\nwrapMap.th = wrapMap.td;\n\n// IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,\n// unless wrapped in a div with non-breaking characters in front of it.\nif ( !jQuery.support.htmlSerialize ) {\n\twrapMap._default = [ 1, \"X<div>\", \"</div>\" ];\n}\n\njQuery.fn.extend({\n\ttext: function( value ) {\n\t\treturn jQuery.access( this, function( value ) {\n\t\t\treturn value === undefined ?\n\t\t\t\tjQuery.text( this ) :\n\t\t\t\tthis.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );\n\t\t}, null, value, arguments.length );\n\t},\n\n\twrapAll: function( html ) {\n\t\tif ( jQuery.isFunction( html ) ) {\n\t\t\treturn this.each(function(i) {\n\t\t\t\tjQuery(this).wrapAll( html.call(this, i) );\n\t\t\t});\n\t\t}\n\n\t\tif ( this[0] ) {\n\t\t\t// The elements to wrap the target around\n\t\t\tvar wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);\n\n\t\t\tif ( this[0].parentNode ) {\n\t\t\t\twrap.insertBefore( this[0] );\n\t\t\t}\n\n\t\t\twrap.map(function() {\n\t\t\t\tvar elem = this;\n\n\t\t\t\twhile ( elem.firstChild && elem.firstChild.nodeType === 1 ) {\n\t\t\t\t\telem = elem.firstChild;\n\t\t\t\t}\n\n\t\t\t\treturn elem;\n\t\t\t}).append( this );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\twrapInner: function( html ) {\n\t\tif ( jQuery.isFunction( html ) ) {\n\t\t\treturn this.each(function(i) {\n\t\t\t\tjQuery(this).wrapInner( html.call(this, i) );\n\t\t\t});\n\t\t}\n\n\t\treturn this.each(function() {\n\t\t\tvar self = jQuery( this ),\n\t\t\t\tcontents = self.contents();\n\n\t\t\tif ( contents.length ) {\n\t\t\t\tcontents.wrapAll( html );\n\n\t\t\t} else {\n\t\t\t\tself.append( html );\n\t\t\t}\n\t\t});\n\t},\n\n\twrap: function( html ) {\n\t\tvar isFunction = jQuery.isFunction( html );\n\n\t\treturn this.each(function(i) {\n\t\t\tjQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );\n\t\t});\n\t},\n\n\tunwrap: function() {\n\t\treturn this.parent().each(function() {\n\t\t\tif ( !jQuery.nodeName( this, \"body\" ) ) {\n\t\t\t\tjQuery( this ).replaceWith( this.childNodes );\n\t\t\t}\n\t\t}).end();\n\t},\n\n\tappend: function() {\n\t\treturn this.domManip(arguments, true, function( elem ) {\n\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 ) {\n\t\t\t\tthis.appendChild( elem );\n\t\t\t}\n\t\t});\n\t},\n\n\tprepend: function() {\n\t\treturn this.domManip(arguments, true, function( elem ) {\n\t\t\tif ( this.nodeType === 1 || this.nodeType === 11 ) {\n\t\t\t\tthis.insertBefore( elem, this.firstChild );\n\t\t\t}\n\t\t});\n\t},\n\n\tbefore: function() {\n\t\tif ( !isDisconnected( this[0] ) ) {\n\t\t\treturn this.domManip(arguments, false, function( elem ) {\n\t\t\t\tthis.parentNode.insertBefore( elem, this );\n\t\t\t});\n\t\t}\n\n\t\tif ( arguments.length ) {\n\t\t\tvar set = jQuery.clean( arguments );\n\t\t\treturn this.pushStack( jQuery.merge( set, this ), \"before\", this.selector );\n\t\t}\n\t},\n\n\tafter: function() {\n\t\tif ( !isDisconnected( this[0] ) ) {\n\t\t\treturn this.domManip(arguments, false, function( elem ) {\n\t\t\t\tthis.parentNode.insertBefore( elem, this.nextSibling );\n\t\t\t});\n\t\t}\n\n\t\tif ( arguments.length ) {\n\t\t\tvar set = jQuery.clean( arguments );\n\t\t\treturn this.pushStack( jQuery.merge( this, set ), \"after\", this.selector );\n\t\t}\n\t},\n\n\t// keepData is for internal use only--do not document\n\tremove: function( selector, keepData ) {\n\t\tvar elem,\n\t\t\ti = 0;\n\n\t\tfor ( ; (elem = this[i]) != null; i++ ) {\n\t\t\tif ( !selector || jQuery.filter( selector, [ elem ] ).length ) {\n\t\t\t\tif ( !keepData && elem.nodeType === 1 ) {\n\t\t\t\t\tjQuery.cleanData( elem.getElementsByTagName(\"*\") );\n\t\t\t\t\tjQuery.cleanData( [ elem ] );\n\t\t\t\t}\n\n\t\t\t\tif ( elem.parentNode ) {\n\t\t\t\t\telem.parentNode.removeChild( elem );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tempty: function() {\n\t\tvar elem,\n\t\t\ti = 0;\n\n\t\tfor ( ; (elem = this[i]) != null; i++ ) {\n\t\t\t// Remove element nodes and prevent memory leaks\n\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\tjQuery.cleanData( elem.getElementsByTagName(\"*\") );\n\t\t\t}\n\n\t\t\t// Remove any remaining nodes\n\t\t\twhile ( elem.firstChild ) {\n\t\t\t\telem.removeChild( elem.firstChild );\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tclone: function( dataAndEvents, deepDataAndEvents ) {\n\t\tdataAndEvents = dataAndEvents == null ? false : dataAndEvents;\n\t\tdeepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;\n\n\t\treturn this.map( function () {\n\t\t\treturn jQuery.clone( this, dataAndEvents, deepDataAndEvents );\n\t\t});\n\t},\n\n\thtml: function( value ) {\n\t\treturn jQuery.access( this, function( value ) {\n\t\t\tvar elem = this[0] || {},\n\t\t\t\ti = 0,\n\t\t\t\tl = this.length;\n\n\t\t\tif ( value === undefined ) {\n\t\t\t\treturn elem.nodeType === 1 ?\n\t\t\t\t\telem.innerHTML.replace( rinlinejQuery, \"\" ) :\n\t\t\t\t\tundefined;\n\t\t\t}\n\n\t\t\t// See if we can take a shortcut and just use innerHTML\n\t\t\tif ( typeof value === \"string\" && !rnoInnerhtml.test( value ) &&\n\t\t\t\t( jQuery.support.htmlSerialize || !rnoshimcache.test( value )  ) &&\n\t\t\t\t( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) &&\n\t\t\t\t!wrapMap[ ( rtagName.exec( value ) || [\"\", \"\"] )[1].toLowerCase() ] ) {\n\n\t\t\t\tvalue = value.replace( rxhtmlTag, \"<$1></$2>\" );\n\n\t\t\t\ttry {\n\t\t\t\t\tfor (; i < l; i++ ) {\n\t\t\t\t\t\t// Remove element nodes and prevent memory leaks\n\t\t\t\t\t\telem = this[i] || {};\n\t\t\t\t\t\tif ( elem.nodeType === 1 ) {\n\t\t\t\t\t\t\tjQuery.cleanData( elem.getElementsByTagName( \"*\" ) );\n\t\t\t\t\t\t\telem.innerHTML = value;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\telem = 0;\n\n\t\t\t\t// If using innerHTML throws an exception, use the fallback method\n\t\t\t\t} catch(e) {}\n\t\t\t}\n\n\t\t\tif ( elem ) {\n\t\t\t\tthis.empty().append( value );\n\t\t\t}\n\t\t}, null, value, arguments.length );\n\t},\n\n\treplaceWith: function( value ) {\n\t\tif ( !isDisconnected( this[0] ) ) {\n\t\t\t// Make sure that the elements are removed from the DOM before they are inserted\n\t\t\t// this can help fix replacing a parent with child elements\n\t\t\tif ( jQuery.isFunction( value ) ) {\n\t\t\t\treturn this.each(function(i) {\n\t\t\t\t\tvar self = jQuery(this), old = self.html();\n\t\t\t\t\tself.replaceWith( value.call( this, i, old ) );\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif ( typeof value !== \"string\" ) {\n\t\t\t\tvalue = jQuery( value ).detach();\n\t\t\t}\n\n\t\t\treturn this.each(function() {\n\t\t\t\tvar next = this.nextSibling,\n\t\t\t\t\tparent = this.parentNode;\n\n\t\t\t\tjQuery( this ).remove();\n\n\t\t\t\tif ( next ) {\n\t\t\t\t\tjQuery(next).before( value );\n\t\t\t\t} else {\n\t\t\t\t\tjQuery(parent).append( value );\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn this.length ?\n\t\t\tthis.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), \"replaceWith\", value ) :\n\t\t\tthis;\n\t},\n\n\tdetach: function( selector ) {\n\t\treturn this.remove( selector, true );\n\t},\n\n\tdomManip: function( args, table, callback ) {\n\n\t\t// Flatten any nested arrays\n\t\targs = [].concat.apply( [], args );\n\n\t\tvar results, first, fragment, iNoClone,\n\t\t\ti = 0,\n\t\t\tvalue = args[0],\n\t\t\tscripts = [],\n\t\t\tl = this.length;\n\n\t\t// We can't cloneNode fragments that contain checked, in WebKit\n\t\tif ( !jQuery.support.checkClone && l > 1 && typeof value === \"string\" && rchecked.test( value ) ) {\n\t\t\treturn this.each(function() {\n\t\t\t\tjQuery(this).domManip( args, table, callback );\n\t\t\t});\n\t\t}\n\n\t\tif ( jQuery.isFunction(value) ) {\n\t\t\treturn this.each(function(i) {\n\t\t\t\tvar self = jQuery(this);\n\t\t\t\targs[0] = value.call( this, i, table ? self.html() : undefined );\n\t\t\t\tself.domManip( args, table, callback );\n\t\t\t});\n\t\t}\n\n\t\tif ( this[0] ) {\n\t\t\tresults = jQuery.buildFragment( args, this, scripts );\n\t\t\tfragment = results.fragment;\n\t\t\tfirst = fragment.firstChild;\n\n\t\t\tif ( fragment.childNodes.length === 1 ) {\n\t\t\t\tfragment = first;\n\t\t\t}\n\n\t\t\tif ( first ) {\n\t\t\t\ttable = table && jQuery.nodeName( first, \"tr\" );\n\n\t\t\t\t// Use the original fragment for the last item instead of the first because it can end up\n\t\t\t\t// being emptied incorrectly in certain situations (#8070).\n\t\t\t\t// Fragments from the fragment cache must always be cloned and never used in place.\n\t\t\t\tfor ( iNoClone = results.cacheable || l - 1; i < l; i++ ) {\n\t\t\t\t\tcallback.call(\n\t\t\t\t\t\ttable && jQuery.nodeName( this[i], \"table\" ) ?\n\t\t\t\t\t\t\tfindOrAppend( this[i], \"tbody\" ) :\n\t\t\t\t\t\t\tthis[i],\n\t\t\t\t\t\ti === iNoClone ?\n\t\t\t\t\t\t\tfragment :\n\t\t\t\t\t\t\tjQuery.clone( fragment, true, true )\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Fix #11809: Avoid leaking memory\n\t\t\tfragment = first = null;\n\n\t\t\tif ( scripts.length ) {\n\t\t\t\tjQuery.each( scripts, function( i, elem ) {\n\t\t\t\t\tif ( elem.src ) {\n\t\t\t\t\t\tif ( jQuery.ajax ) {\n\t\t\t\t\t\t\tjQuery.ajax({\n\t\t\t\t\t\t\t\turl: elem.src,\n\t\t\t\t\t\t\t\ttype: \"GET\",\n\t\t\t\t\t\t\t\tdataType: \"script\",\n\t\t\t\t\t\t\t\tasync: false,\n\t\t\t\t\t\t\t\tglobal: false,\n\t\t\t\t\t\t\t\t\"throws\": true\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tjQuery.error(\"no ajax\");\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tjQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || \"\" ).replace( rcleanScript, \"\" ) );\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( elem.parentNode ) {\n\t\t\t\t\t\telem.parentNode.removeChild( elem );\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\t}\n});\n\nfunction findOrAppend( elem, tag ) {\n\treturn elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) );\n}\n\nfunction cloneCopyEvent( src, dest ) {\n\n\tif ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {\n\t\treturn;\n\t}\n\n\tvar type, i, l,\n\t\toldData = jQuery._data( src ),\n\t\tcurData = jQuery._data( dest, oldData ),\n\t\tevents = oldData.events;\n\n\tif ( events ) {\n\t\tdelete curData.handle;\n\t\tcurData.events = {};\n\n\t\tfor ( type in events ) {\n\t\t\tfor ( i = 0, l = events[ type ].length; i < l; i++ ) {\n\t\t\t\tjQuery.event.add( dest, type, events[ type ][ i ] );\n\t\t\t}\n\t\t}\n\t}\n\n\t// make the cloned public data object a copy from the original\n\tif ( curData.data ) {\n\t\tcurData.data = jQuery.extend( {}, curData.data );\n\t}\n}\n\nfunction cloneFixAttributes( src, dest ) {\n\tvar nodeName;\n\n\t// We do not need to do anything for non-Elements\n\tif ( dest.nodeType !== 1 ) {\n\t\treturn;\n\t}\n\n\t// clearAttributes removes the attributes, which we don't want,\n\t// but also removes the attachEvent events, which we *do* want\n\tif ( dest.clearAttributes ) {\n\t\tdest.clearAttributes();\n\t}\n\n\t// mergeAttributes, in contrast, only merges back on the\n\t// original attributes, not the events\n\tif ( dest.mergeAttributes ) {\n\t\tdest.mergeAttributes( src );\n\t}\n\n\tnodeName = dest.nodeName.toLowerCase();\n\n\tif ( nodeName === \"object\" ) {\n\t\t// IE6-10 improperly clones children of object elements using classid.\n\t\t// IE10 throws NoModificationAllowedError if parent is null, #12132.\n\t\tif ( dest.parentNode ) {\n\t\t\tdest.outerHTML = src.outerHTML;\n\t\t}\n\n\t\t// This path appears unavoidable for IE9. When cloning an object\n\t\t// element in IE9, the outerHTML strategy above is not sufficient.\n\t\t// If the src has innerHTML and the destination does not,\n\t\t// copy the src.innerHTML into the dest.innerHTML. #10324\n\t\tif ( jQuery.support.html5Clone && (src.innerHTML && !jQuery.trim(dest.innerHTML)) ) {\n\t\t\tdest.innerHTML = src.innerHTML;\n\t\t}\n\n\t} else if ( nodeName === \"input\" && rcheckableType.test( src.type ) ) {\n\t\t// IE6-8 fails to persist the checked state of a cloned checkbox\n\t\t// or radio button. Worse, IE6-7 fail to give the cloned element\n\t\t// a checked appearance if the defaultChecked value isn't also set\n\n\t\tdest.defaultChecked = dest.checked = src.checked;\n\n\t\t// IE6-7 get confused and end up setting the value of a cloned\n\t\t// checkbox/radio button to an empty string instead of \"on\"\n\t\tif ( dest.value !== src.value ) {\n\t\t\tdest.value = src.value;\n\t\t}\n\n\t// IE6-8 fails to return the selected option to the default selected\n\t// state when cloning options\n\t} else if ( nodeName === \"option\" ) {\n\t\tdest.selected = src.defaultSelected;\n\n\t// IE6-8 fails to set the defaultValue to the correct value when\n\t// cloning other types of input fields\n\t} else if ( nodeName === \"input\" || nodeName === \"textarea\" ) {\n\t\tdest.defaultValue = src.defaultValue;\n\n\t// IE blanks contents when cloning scripts\n\t} else if ( nodeName === \"script\" && dest.text !== src.text ) {\n\t\tdest.text = src.text;\n\t}\n\n\t// Event data gets referenced instead of copied if the expando\n\t// gets copied too\n\tdest.removeAttribute( jQuery.expando );\n}\n\njQuery.buildFragment = function( args, context, scripts ) {\n\tvar fragment, cacheable, cachehit,\n\t\tfirst = args[ 0 ];\n\n\t// Set context from what may come in as undefined or a jQuery collection or a node\n\t// Updated to fix #12266 where accessing context[0] could throw an exception in IE9/10 &\n\t// also doubles as fix for #8950 where plain objects caused createDocumentFragment exception\n\tcontext = context || document;\n\tcontext = !context.nodeType && context[0] || context;\n\tcontext = context.ownerDocument || context;\n\n\t// Only cache \"small\" (1/2 KB) HTML strings that are associated with the main document\n\t// Cloning options loses the selected state, so don't cache them\n\t// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment\n\t// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache\n\t// Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501\n\tif ( args.length === 1 && typeof first === \"string\" && first.length < 512 && context === document &&\n\t\tfirst.charAt(0) === \"<\" && !rnocache.test( first ) &&\n\t\t(jQuery.support.checkClone || !rchecked.test( first )) &&\n\t\t(jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {\n\n\t\t// Mark cacheable and look for a hit\n\t\tcacheable = true;\n\t\tfragment = jQuery.fragments[ first ];\n\t\tcachehit = fragment !== undefined;\n\t}\n\n\tif ( !fragment ) {\n\t\tfragment = context.createDocumentFragment();\n\t\tjQuery.clean( args, context, fragment, scripts );\n\n\t\t// Update the cache, but only store false\n\t\t// unless this is a second parsing of the same content\n\t\tif ( cacheable ) {\n\t\t\tjQuery.fragments[ first ] = cachehit && fragment;\n\t\t}\n\t}\n\n\treturn { fragment: fragment, cacheable: cacheable };\n};\n\njQuery.fragments = {};\n\njQuery.each({\n\tappendTo: \"append\",\n\tprependTo: \"prepend\",\n\tinsertBefore: \"before\",\n\tinsertAfter: \"after\",\n\treplaceAll: \"replaceWith\"\n}, function( name, original ) {\n\tjQuery.fn[ name ] = function( selector ) {\n\t\tvar elems,\n\t\t\ti = 0,\n\t\t\tret = [],\n\t\t\tinsert = jQuery( selector ),\n\t\t\tl = insert.length,\n\t\t\tparent = this.length === 1 && this[0].parentNode;\n\n\t\tif ( (parent == null || parent && parent.nodeType === 11 && parent.childNodes.length === 1) && l === 1 ) {\n\t\t\tinsert[ original ]( this[0] );\n\t\t\treturn this;\n\t\t} else {\n\t\t\tfor ( ; i < l; i++ ) {\n\t\t\t\telems = ( i > 0 ? this.clone(true) : this ).get();\n\t\t\t\tjQuery( insert[i] )[ original ]( elems );\n\t\t\t\tret = ret.concat( elems );\n\t\t\t}\n\n\t\t\treturn this.pushStack( ret, name, insert.selector );\n\t\t}\n\t};\n});\n\nfunction getAll( elem ) {\n\tif ( typeof elem.getElementsByTagName !== \"undefined\" ) {\n\t\treturn elem.getElementsByTagName( \"*\" );\n\n\t} else if ( typeof elem.querySelectorAll !== \"undefined\" ) {\n\t\treturn elem.querySelectorAll( \"*\" );\n\n\t} else {\n\t\treturn [];\n\t}\n}\n\n// Used in clean, fixes the defaultChecked property\nfunction fixDefaultChecked( elem ) {\n\tif ( rcheckableType.test( elem.type ) ) {\n\t\telem.defaultChecked = elem.checked;\n\t}\n}\n\njQuery.extend({\n\tclone: function( elem, dataAndEvents, deepDataAndEvents ) {\n\t\tvar srcElements,\n\t\t\tdestElements,\n\t\t\ti,\n\t\t\tclone;\n\n\t\tif ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( \"<\" + elem.nodeName + \">\" ) ) {\n\t\t\tclone = elem.cloneNode( true );\n\n\t\t// IE<=8 does not properly clone detached, unknown element nodes\n\t\t} else {\n\t\t\tfragmentDiv.innerHTML = elem.outerHTML;\n\t\t\tfragmentDiv.removeChild( clone = fragmentDiv.firstChild );\n\t\t}\n\n\t\tif ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&\n\t\t\t\t(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {\n\t\t\t// IE copies events bound via attachEvent when using cloneNode.\n\t\t\t// Calling detachEvent on the clone will also remove the events\n\t\t\t// from the original. In order to get around this, we use some\n\t\t\t// proprietary methods to clear the events. Thanks to MooTools\n\t\t\t// guys for this hotness.\n\n\t\t\tcloneFixAttributes( elem, clone );\n\n\t\t\t// Using Sizzle here is crazy slow, so we use getElementsByTagName instead\n\t\t\tsrcElements = getAll( elem );\n\t\t\tdestElements = getAll( clone );\n\n\t\t\t// Weird iteration because IE will replace the length property\n\t\t\t// with an element if you are cloning the body and one of the\n\t\t\t// elements on the page has a name or id of \"length\"\n\t\t\tfor ( i = 0; srcElements[i]; ++i ) {\n\t\t\t\t// Ensure that the destination node is not null; Fixes #9587\n\t\t\t\tif ( destElements[i] ) {\n\t\t\t\t\tcloneFixAttributes( srcElements[i], destElements[i] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Copy the events from the original to the clone\n\t\tif ( dataAndEvents ) {\n\t\t\tcloneCopyEvent( elem, clone );\n\n\t\t\tif ( deepDataAndEvents ) {\n\t\t\t\tsrcElements = getAll( elem );\n\t\t\t\tdestElements = getAll( clone );\n\n\t\t\t\tfor ( i = 0; srcElements[i]; ++i ) {\n\t\t\t\t\tcloneCopyEvent( srcElements[i], destElements[i] );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsrcElements = destElements = null;\n\n\t\t// Return the cloned set\n\t\treturn clone;\n\t},\n\n\tclean: function( elems, context, fragment, scripts ) {\n\t\tvar i, j, elem, tag, wrap, depth, div, hasBody, tbody, len, handleScript, jsTags,\n\t\t\tsafe = context === document && safeFragment,\n\t\t\tret = [];\n\n\t\t// Ensure that context is a document\n\t\tif ( !context || typeof context.createDocumentFragment === \"undefined\" ) {\n\t\t\tcontext = document;\n\t\t}\n\n\t\t// Use the already-created safe fragment if context permits\n\t\tfor ( i = 0; (elem = elems[i]) != null; i++ ) {\n\t\t\tif ( typeof elem === \"number\" ) {\n\t\t\t\telem += \"\";\n\t\t\t}\n\n\t\t\tif ( !elem ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// Convert html string into DOM nodes\n\t\t\tif ( typeof elem === \"string\" ) {\n\t\t\t\tif ( !rhtml.test( elem ) ) {\n\t\t\t\t\telem = context.createTextNode( elem );\n\t\t\t\t} else {\n\t\t\t\t\t// Ensure a safe container in which to render the html\n\t\t\t\t\tsafe = safe || createSafeFragment( context );\n\t\t\t\t\tdiv = context.createElement(\"div\");\n\t\t\t\t\tsafe.appendChild( div );\n\n\t\t\t\t\t// Fix \"XHTML\"-style tags in all browsers\n\t\t\t\t\telem = elem.replace(rxhtmlTag, \"<$1></$2>\");\n\n\t\t\t\t\t// Go to html and back, then peel off extra wrappers\n\t\t\t\t\ttag = ( rtagName.exec( elem ) || [\"\", \"\"] )[1].toLowerCase();\n\t\t\t\t\twrap = wrapMap[ tag ] || wrapMap._default;\n\t\t\t\t\tdepth = wrap[0];\n\t\t\t\t\tdiv.innerHTML = wrap[1] + elem + wrap[2];\n\n\t\t\t\t\t// Move to the right depth\n\t\t\t\t\twhile ( depth-- ) {\n\t\t\t\t\t\tdiv = div.lastChild;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Remove IE's autoinserted <tbody> from table fragments\n\t\t\t\t\tif ( !jQuery.support.tbody ) {\n\n\t\t\t\t\t\t// String was a <table>, *may* have spurious <tbody>\n\t\t\t\t\t\thasBody = rtbody.test(elem);\n\t\t\t\t\t\t\ttbody = tag === \"table\" && !hasBody ?\n\t\t\t\t\t\t\t\tdiv.firstChild && div.firstChild.childNodes :\n\n\t\t\t\t\t\t\t\t// String was a bare <thead> or <tfoot>\n\t\t\t\t\t\t\t\twrap[1] === \"<table>\" && !hasBody ?\n\t\t\t\t\t\t\t\t\tdiv.childNodes :\n\t\t\t\t\t\t\t\t\t[];\n\n\t\t\t\t\t\tfor ( j = tbody.length - 1; j >= 0 ; --j ) {\n\t\t\t\t\t\t\tif ( jQuery.nodeName( tbody[ j ], \"tbody\" ) && !tbody[ j ].childNodes.length ) {\n\t\t\t\t\t\t\t\ttbody[ j ].parentNode.removeChild( tbody[ j ] );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// IE completely kills leading whitespace when innerHTML is used\n\t\t\t\t\tif ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {\n\t\t\t\t\t\tdiv.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );\n\t\t\t\t\t}\n\n\t\t\t\t\telem = div.childNodes;\n\n\t\t\t\t\t// Take out of fragment container (we need a fresh div each time)\n\t\t\t\t\tdiv.parentNode.removeChild( div );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( elem.nodeType ) {\n\t\t\t\tret.push( elem );\n\t\t\t} else {\n\t\t\t\tjQuery.merge( ret, elem );\n\t\t\t}\n\t\t}\n\n\t\t// Fix #11356: Clear elements from safeFragment\n\t\tif ( div ) {\n\t\t\telem = div = safe = null;\n\t\t}\n\n\t\t// Reset defaultChecked for any radios and checkboxes\n\t\t// about to be appended to the DOM in IE 6/7 (#8060)\n\t\tif ( !jQuery.support.appendChecked ) {\n\t\t\tfor ( i = 0; (elem = ret[i]) != null; i++ ) {\n\t\t\t\tif ( jQuery.nodeName( elem, \"input\" ) ) {\n\t\t\t\t\tfixDefaultChecked( elem );\n\t\t\t\t} else if ( typeof elem.getElementsByTagName !== \"undefined\" ) {\n\t\t\t\t\tjQuery.grep( elem.getElementsByTagName(\"input\"), fixDefaultChecked );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Append elements to a provided document fragment\n\t\tif ( fragment ) {\n\t\t\t// Special handling of each script element\n\t\t\thandleScript = function( elem ) {\n\t\t\t\t// Check if we consider it executable\n\t\t\t\tif ( !elem.type || rscriptType.test( elem.type ) ) {\n\t\t\t\t\t// Detach the script and store it in the scripts array (if provided) or the fragment\n\t\t\t\t\t// Return truthy to indicate that it has been handled\n\t\t\t\t\treturn scripts ?\n\t\t\t\t\t\tscripts.push( elem.parentNode ? elem.parentNode.removeChild( elem ) : elem ) :\n\t\t\t\t\t\tfragment.appendChild( elem );\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tfor ( i = 0; (elem = ret[i]) != null; i++ ) {\n\t\t\t\t// Check if we're done after handling an executable script\n\t\t\t\tif ( !( jQuery.nodeName( elem, \"script\" ) && handleScript( elem ) ) ) {\n\t\t\t\t\t// Append to fragment and handle embedded scripts\n\t\t\t\t\tfragment.appendChild( elem );\n\t\t\t\t\tif ( typeof elem.getElementsByTagName !== \"undefined\" ) {\n\t\t\t\t\t\t// handleScript alters the DOM, so use jQuery.merge to ensure snapshot iteration\n\t\t\t\t\t\tjsTags = jQuery.grep( jQuery.merge( [], elem.getElementsByTagName(\"script\") ), handleScript );\n\n\t\t\t\t\t\t// Splice the scripts into ret after their former ancestor and advance our index beyond them\n\t\t\t\t\t\tret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );\n\t\t\t\t\t\ti += jsTags.length;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t},\n\n\tcleanData: function( elems, /* internal */ acceptData ) {\n\t\tvar data, id, elem, type,\n\t\t\ti = 0,\n\t\t\tinternalKey = jQuery.expando,\n\t\t\tcache = jQuery.cache,\n\t\t\tdeleteExpando = jQuery.support.deleteExpando,\n\t\t\tspecial = jQuery.event.special;\n\n\t\tfor ( ; (elem = elems[i]) != null; i++ ) {\n\n\t\t\tif ( acceptData || jQuery.acceptData( elem ) ) {\n\n\t\t\t\tid = elem[ internalKey ];\n\t\t\t\tdata = id && cache[ id ];\n\n\t\t\t\tif ( data ) {\n\t\t\t\t\tif ( data.events ) {\n\t\t\t\t\t\tfor ( type in data.events ) {\n\t\t\t\t\t\t\tif ( special[ type ] ) {\n\t\t\t\t\t\t\t\tjQuery.event.remove( elem, type );\n\n\t\t\t\t\t\t\t// This is a shortcut to avoid jQuery.event.remove's overhead\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tjQuery.removeEvent( elem, type, data.handle );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Remove cache only if it was not already removed by jQuery.event.remove\n\t\t\t\t\tif ( cache[ id ] ) {\n\n\t\t\t\t\t\tdelete cache[ id ];\n\n\t\t\t\t\t\t// IE does not allow us to delete expando properties from nodes,\n\t\t\t\t\t\t// nor does it have a removeAttribute function on Document nodes;\n\t\t\t\t\t\t// we must handle all of these cases\n\t\t\t\t\t\tif ( deleteExpando ) {\n\t\t\t\t\t\t\tdelete elem[ internalKey ];\n\n\t\t\t\t\t\t} else if ( elem.removeAttribute ) {\n\t\t\t\t\t\t\telem.removeAttribute( internalKey );\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\telem[ internalKey ] = null;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tjQuery.deletedIds.push( id );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n});\n// Limit scope pollution from any deprecated API\n(function() {\n\nvar matched, browser;\n\n// Use of jQuery.browser is frowned upon.\n// More details: http://api.jquery.com/jQuery.browser\n// jQuery.uaMatch maintained for back-compat\njQuery.uaMatch = function( ua ) {\n\tua = ua.toLowerCase();\n\n\tvar match = /(chrome)[ \\/]([\\w.]+)/.exec( ua ) ||\n\t\t/(webkit)[ \\/]([\\w.]+)/.exec( ua ) ||\n\t\t/(opera)(?:.*version|)[ \\/]([\\w.]+)/.exec( ua ) ||\n\t\t/(msie) ([\\w.]+)/.exec( ua ) ||\n\t\tua.indexOf(\"compatible\") < 0 && /(mozilla)(?:.*? rv:([\\w.]+)|)/.exec( ua ) ||\n\t\t[];\n\n\treturn {\n\t\tbrowser: match[ 1 ] || \"\",\n\t\tversion: match[ 2 ] || \"0\"\n\t};\n};\n\nmatched = jQuery.uaMatch( navigator.userAgent );\nbrowser = {};\n\nif ( matched.browser ) {\n\tbrowser[ matched.browser ] = true;\n\tbrowser.version = matched.version;\n}\n\n// Chrome is Webkit, but Webkit is also Safari.\nif ( browser.chrome ) {\n\tbrowser.webkit = true;\n} else if ( browser.webkit ) {\n\tbrowser.safari = true;\n}\n\njQuery.browser = browser;\n\njQuery.sub = function() {\n\tfunction jQuerySub( selector, context ) {\n\t\treturn new jQuerySub.fn.init( selector, context );\n\t}\n\tjQuery.extend( true, jQuerySub, this );\n\tjQuerySub.superclass = this;\n\tjQuerySub.fn = jQuerySub.prototype = this();\n\tjQuerySub.fn.constructor = jQuerySub;\n\tjQuerySub.sub = this.sub;\n\tjQuerySub.fn.init = function init( selector, context ) {\n\t\tif ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {\n\t\t\tcontext = jQuerySub( context );\n\t\t}\n\n\t\treturn jQuery.fn.init.call( this, selector, context, rootjQuerySub );\n\t};\n\tjQuerySub.fn.init.prototype = jQuerySub.fn;\n\tvar rootjQuerySub = jQuerySub(document);\n\treturn jQuerySub;\n};\n\n})();\nvar curCSS, iframe, iframeDoc,\n\tralpha = /alpha\\([^)]*\\)/i,\n\tropacity = /opacity=([^)]*)/,\n\trposition = /^(top|right|bottom|left)$/,\n\t// swappable if display is none or starts with table except \"table\", \"table-cell\", or \"table-caption\"\n\t// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display\n\trdisplayswap = /^(none|table(?!-c[ea]).+)/,\n\trmargin = /^margin/,\n\trnumsplit = new RegExp( \"^(\" + core_pnum + \")(.*)$\", \"i\" ),\n\trnumnonpx = new RegExp( \"^(\" + core_pnum + \")(?!px)[a-z%]+$\", \"i\" ),\n\trrelNum = new RegExp( \"^([-+])=(\" + core_pnum + \")\", \"i\" ),\n\telemdisplay = {},\n\n\tcssShow = { position: \"absolute\", visibility: \"hidden\", display: \"block\" },\n\tcssNormalTransform = {\n\t\tletterSpacing: 0,\n\t\tfontWeight: 400\n\t},\n\n\tcssExpand = [ \"Top\", \"Right\", \"Bottom\", \"Left\" ],\n\tcssPrefixes = [ \"Webkit\", \"O\", \"Moz\", \"ms\" ],\n\n\teventsToggle = jQuery.fn.toggle;\n\n// return a css property mapped to a potentially vendor prefixed property\nfunction vendorPropName( style, name ) {\n\n\t// shortcut for names that are not vendor prefixed\n\tif ( name in style ) {\n\t\treturn name;\n\t}\n\n\t// check for vendor prefixed names\n\tvar capName = name.charAt(0).toUpperCase() + name.slice(1),\n\t\torigName = name,\n\t\ti = cssPrefixes.length;\n\n\twhile ( i-- ) {\n\t\tname = cssPrefixes[ i ] + capName;\n\t\tif ( name in style ) {\n\t\t\treturn name;\n\t\t}\n\t}\n\n\treturn origName;\n}\n\nfunction isHidden( elem, el ) {\n\telem = el || elem;\n\treturn jQuery.css( elem, \"display\" ) === \"none\" || !jQuery.contains( elem.ownerDocument, elem );\n}\n\nfunction showHide( elements, show ) {\n\tvar elem, display,\n\t\tvalues = [],\n\t\tindex = 0,\n\t\tlength = elements.length;\n\n\tfor ( ; index < length; index++ ) {\n\t\telem = elements[ index ];\n\t\tif ( !elem.style ) {\n\t\t\tcontinue;\n\t\t}\n\t\tvalues[ index ] = jQuery._data( elem, \"olddisplay\" );\n\t\tif ( show ) {\n\t\t\t// Reset the inline display of this element to learn if it is\n\t\t\t// being hidden by cascaded rules or not\n\t\t\tif ( !values[ index ] && elem.style.display === \"none\" ) {\n\t\t\t\telem.style.display = \"\";\n\t\t\t}\n\n\t\t\t// Set elements which have been overridden with display: none\n\t\t\t// in a stylesheet to whatever the default browser style is\n\t\t\t// for such an element\n\t\t\tif ( elem.style.display === \"\" && isHidden( elem ) ) {\n\t\t\t\tvalues[ index ] = jQuery._data( elem, \"olddisplay\", css_defaultDisplay(elem.nodeName) );\n\t\t\t}\n\t\t} else {\n\t\t\tdisplay = curCSS( elem, \"display\" );\n\n\t\t\tif ( !values[ index ] && display !== \"none\" ) {\n\t\t\t\tjQuery._data( elem, \"olddisplay\", display );\n\t\t\t}\n\t\t}\n\t}\n\n\t// Set the display of most of the elements in a second loop\n\t// to avoid the constant reflow\n\tfor ( index = 0; index < length; index++ ) {\n\t\telem = elements[ index ];\n\t\tif ( !elem.style ) {\n\t\t\tcontinue;\n\t\t}\n\t\tif ( !show || elem.style.display === \"none\" || elem.style.display === \"\" ) {\n\t\t\telem.style.display = show ? values[ index ] || \"\" : \"none\";\n\t\t}\n\t}\n\n\treturn elements;\n}\n\njQuery.fn.extend({\n\tcss: function( name, value ) {\n\t\treturn jQuery.access( this, function( elem, name, value ) {\n\t\t\treturn value !== undefined ?\n\t\t\t\tjQuery.style( elem, name, value ) :\n\t\t\t\tjQuery.css( elem, name );\n\t\t}, name, value, arguments.length > 1 );\n\t},\n\tshow: function() {\n\t\treturn showHide( this, true );\n\t},\n\thide: function() {\n\t\treturn showHide( this );\n\t},\n\ttoggle: function( state, fn2 ) {\n\t\tvar bool = typeof state === \"boolean\";\n\n\t\tif ( jQuery.isFunction( state ) && jQuery.isFunction( fn2 ) ) {\n\t\t\treturn eventsToggle.apply( this, arguments );\n\t\t}\n\n\t\treturn this.each(function() {\n\t\t\tif ( bool ? state : isHidden( this ) ) {\n\t\t\t\tjQuery( this ).show();\n\t\t\t} else {\n\t\t\t\tjQuery( this ).hide();\n\t\t\t}\n\t\t});\n\t}\n});\n\njQuery.extend({\n\t// Add in style property hooks for overriding the default\n\t// behavior of getting and setting a style property\n\tcssHooks: {\n\t\topacity: {\n\t\t\tget: function( elem, computed ) {\n\t\t\t\tif ( computed ) {\n\t\t\t\t\t// We should always get a number back from opacity\n\t\t\t\t\tvar ret = curCSS( elem, \"opacity\" );\n\t\t\t\t\treturn ret === \"\" ? \"1\" : ret;\n\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\t// Exclude the following css properties to add px\n\tcssNumber: {\n\t\t\"fillOpacity\": true,\n\t\t\"fontWeight\": true,\n\t\t\"lineHeight\": true,\n\t\t\"opacity\": true,\n\t\t\"orphans\": true,\n\t\t\"widows\": true,\n\t\t\"zIndex\": true,\n\t\t\"zoom\": true\n\t},\n\n\t// Add in properties whose names you wish to fix before\n\t// setting or getting the value\n\tcssProps: {\n\t\t// normalize float css property\n\t\t\"float\": jQuery.support.cssFloat ? \"cssFloat\" : \"styleFloat\"\n\t},\n\n\t// Get and set the style property on a DOM Node\n\tstyle: function( elem, name, value, extra ) {\n\t\t// Don't set styles on text and comment nodes\n\t\tif ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Make sure that we're working with the right name\n\t\tvar ret, type, hooks,\n\t\t\torigName = jQuery.camelCase( name ),\n\t\t\tstyle = elem.style;\n\n\t\tname = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) );\n\n\t\t// gets hook for the prefixed version\n\t\t// followed by the unprefixed version\n\t\thooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];\n\n\t\t// Check if we're setting a value\n\t\tif ( value !== undefined ) {\n\t\t\ttype = typeof value;\n\n\t\t\t// convert relative number strings (+= or -=) to relative numbers. #7345\n\t\t\tif ( type === \"string\" && (ret = rrelNum.exec( value )) ) {\n\t\t\t\tvalue = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) );\n\t\t\t\t// Fixes bug #9237\n\t\t\t\ttype = \"number\";\n\t\t\t}\n\n\t\t\t// Make sure that NaN and null values aren't set. See: #7116\n\t\t\tif ( value == null || type === \"number\" && isNaN( value ) ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// If a number was passed in, add 'px' to the (except for certain CSS properties)\n\t\t\tif ( type === \"number\" && !jQuery.cssNumber[ origName ] ) {\n\t\t\t\tvalue += \"px\";\n\t\t\t}\n\n\t\t\t// If a hook was provided, use that value, otherwise just set the specified value\n\t\t\tif ( !hooks || !(\"set\" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) {\n\t\t\t\t// Wrapped to prevent IE from throwing errors when 'invalid' values are provided\n\t\t\t\t// Fixes bug #5509\n\t\t\t\ttry {\n\t\t\t\t\tstyle[ name ] = value;\n\t\t\t\t} catch(e) {}\n\t\t\t}\n\n\t\t} else {\n\t\t\t// If a hook was provided get the non-computed value from there\n\t\t\tif ( hooks && \"get\" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {\n\t\t\t\treturn ret;\n\t\t\t}\n\n\t\t\t// Otherwise just get the value from the style object\n\t\t\treturn style[ name ];\n\t\t}\n\t},\n\n\tcss: function( elem, name, numeric, extra ) {\n\t\tvar val, num, hooks,\n\t\t\torigName = jQuery.camelCase( name );\n\n\t\t// Make sure that we're working with the right name\n\t\tname = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) );\n\n\t\t// gets hook for the prefixed version\n\t\t// followed by the unprefixed version\n\t\thooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];\n\n\t\t// If a hook was provided get the computed value from there\n\t\tif ( hooks && \"get\" in hooks ) {\n\t\t\tval = hooks.get( elem, true, extra );\n\t\t}\n\n\t\t// Otherwise, if a way to get the computed value exists, use that\n\t\tif ( val === undefined ) {\n\t\t\tval = curCSS( elem, name );\n\t\t}\n\n\t\t//convert \"normal\" to computed value\n\t\tif ( val === \"normal\" && name in cssNormalTransform ) {\n\t\t\tval = cssNormalTransform[ name ];\n\t\t}\n\n\t\t// Return, converting to number if forced or a qualifier was provided and val looks numeric\n\t\tif ( numeric || extra !== undefined ) {\n\t\t\tnum = parseFloat( val );\n\t\t\treturn numeric || jQuery.isNumeric( num ) ? num || 0 : val;\n\t\t}\n\t\treturn val;\n\t},\n\n\t// A method for quickly swapping in/out CSS properties to get correct calculations\n\tswap: function( elem, options, callback ) {\n\t\tvar ret, name,\n\t\t\told = {};\n\n\t\t// Remember the old values, and insert the new ones\n\t\tfor ( name in options ) {\n\t\t\told[ name ] = elem.style[ name ];\n\t\t\telem.style[ name ] = options[ name ];\n\t\t}\n\n\t\tret = callback.call( elem );\n\n\t\t// Revert the old values\n\t\tfor ( name in options ) {\n\t\t\telem.style[ name ] = old[ name ];\n\t\t}\n\n\t\treturn ret;\n\t}\n});\n\n// NOTE: To any future maintainer, we've window.getComputedStyle\n// because jsdom on node.js will break without it.\nif ( window.getComputedStyle ) {\n\tcurCSS = function( elem, name ) {\n\t\tvar ret, width, minWidth, maxWidth,\n\t\t\tcomputed = window.getComputedStyle( elem, null ),\n\t\t\tstyle = elem.style;\n\n\t\tif ( computed ) {\n\n\t\t\tret = computed[ name ];\n\t\t\tif ( ret === \"\" && !jQuery.contains( elem.ownerDocument, elem ) ) {\n\t\t\t\tret = jQuery.style( elem, name );\n\t\t\t}\n\n\t\t\t// A tribute to the \"awesome hack by Dean Edwards\"\n\t\t\t// Chrome < 17 and Safari 5.0 uses \"computed value\" instead of \"used value\" for margin-right\n\t\t\t// Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels\n\t\t\t// this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values\n\t\t\tif ( rnumnonpx.test( ret ) && rmargin.test( name ) ) {\n\t\t\t\twidth = style.width;\n\t\t\t\tminWidth = style.minWidth;\n\t\t\t\tmaxWidth = style.maxWidth;\n\n\t\t\t\tstyle.minWidth = style.maxWidth = style.width = ret;\n\t\t\t\tret = computed.width;\n\n\t\t\t\tstyle.width = width;\n\t\t\t\tstyle.minWidth = minWidth;\n\t\t\t\tstyle.maxWidth = maxWidth;\n\t\t\t}\n\t\t}\n\n\t\treturn ret;\n\t};\n} else if ( document.documentElement.currentStyle ) {\n\tcurCSS = function( elem, name ) {\n\t\tvar left, rsLeft,\n\t\t\tret = elem.currentStyle && elem.currentStyle[ name ],\n\t\t\tstyle = elem.style;\n\n\t\t// Avoid setting ret to empty string here\n\t\t// so we don't default to auto\n\t\tif ( ret == null && style && style[ name ] ) {\n\t\t\tret = style[ name ];\n\t\t}\n\n\t\t// From the awesome hack by Dean Edwards\n\t\t// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291\n\n\t\t// If we're not dealing with a regular pixel number\n\t\t// but a number that has a weird ending, we need to convert it to pixels\n\t\t// but not position css attributes, as those are proportional to the parent element instead\n\t\t// and we can't measure the parent instead because it might trigger a \"stacking dolls\" problem\n\t\tif ( rnumnonpx.test( ret ) && !rposition.test( name ) ) {\n\n\t\t\t// Remember the original values\n\t\t\tleft = style.left;\n\t\t\trsLeft = elem.runtimeStyle && elem.runtimeStyle.left;\n\n\t\t\t// Put in the new values to get a computed value out\n\t\t\tif ( rsLeft ) {\n\t\t\t\telem.runtimeStyle.left = elem.currentStyle.left;\n\t\t\t}\n\t\t\tstyle.left = name === \"fontSize\" ? \"1em\" : ret;\n\t\t\tret = style.pixelLeft + \"px\";\n\n\t\t\t// Revert the changed values\n\t\t\tstyle.left = left;\n\t\t\tif ( rsLeft ) {\n\t\t\t\telem.runtimeStyle.left = rsLeft;\n\t\t\t}\n\t\t}\n\n\t\treturn ret === \"\" ? \"auto\" : ret;\n\t};\n}\n\nfunction setPositiveNumber( elem, value, subtract ) {\n\tvar matches = rnumsplit.exec( value );\n\treturn matches ?\n\t\t\tMath.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || \"px\" ) :\n\t\t\tvalue;\n}\n\nfunction augmentWidthOrHeight( elem, name, extra, isBorderBox ) {\n\tvar i = extra === ( isBorderBox ? \"border\" : \"content\" ) ?\n\t\t// If we already have the right measurement, avoid augmentation\n\t\t4 :\n\t\t// Otherwise initialize for horizontal or vertical properties\n\t\tname === \"width\" ? 1 : 0,\n\n\t\tval = 0;\n\n\tfor ( ; i < 4; i += 2 ) {\n\t\t// both box models exclude margin, so add it if we want it\n\t\tif ( extra === \"margin\" ) {\n\t\t\t// we use jQuery.css instead of curCSS here\n\t\t\t// because of the reliableMarginRight CSS hook!\n\t\t\tval += jQuery.css( elem, extra + cssExpand[ i ], true );\n\t\t}\n\n\t\t// From this point on we use curCSS for maximum performance (relevant in animations)\n\t\tif ( isBorderBox ) {\n\t\t\t// border-box includes padding, so remove it if we want content\n\t\t\tif ( extra === \"content\" ) {\n\t\t\t\tval -= parseFloat( curCSS( elem, \"padding\" + cssExpand[ i ] ) ) || 0;\n\t\t\t}\n\n\t\t\t// at this point, extra isn't border nor margin, so remove border\n\t\t\tif ( extra !== \"margin\" ) {\n\t\t\t\tval -= parseFloat( curCSS( elem, \"border\" + cssExpand[ i ] + \"Width\" ) ) || 0;\n\t\t\t}\n\t\t} else {\n\t\t\t// at this point, extra isn't content, so add padding\n\t\t\tval += parseFloat( curCSS( elem, \"padding\" + cssExpand[ i ] ) ) || 0;\n\n\t\t\t// at this point, extra isn't content nor padding, so add border\n\t\t\tif ( extra !== \"padding\" ) {\n\t\t\t\tval += parseFloat( curCSS( elem, \"border\" + cssExpand[ i ] + \"Width\" ) ) || 0;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn val;\n}\n\nfunction getWidthOrHeight( elem, name, extra ) {\n\n\t// Start with offset property, which is equivalent to the border-box value\n\tvar val = name === \"width\" ? elem.offsetWidth : elem.offsetHeight,\n\t\tvalueIsBorderBox = true,\n\t\tisBorderBox = jQuery.support.boxSizing && jQuery.css( elem, \"boxSizing\" ) === \"border-box\";\n\n\t// some non-html elements return undefined for offsetWidth, so check for null/undefined\n\t// svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285\n\t// MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668\n\tif ( val <= 0 || val == null ) {\n\t\t// Fall back to computed then uncomputed css if necessary\n\t\tval = curCSS( elem, name );\n\t\tif ( val < 0 || val == null ) {\n\t\t\tval = elem.style[ name ];\n\t\t}\n\n\t\t// Computed unit is not pixels. Stop here and return.\n\t\tif ( rnumnonpx.test(val) ) {\n\t\t\treturn val;\n\t\t}\n\n\t\t// we need the check for style in case a browser which returns unreliable values\n\t\t// for getComputedStyle silently falls back to the reliable elem.style\n\t\tvalueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] );\n\n\t\t// Normalize \"\", auto, and prepare for extra\n\t\tval = parseFloat( val ) || 0;\n\t}\n\n\t// use the active box-sizing model to add/subtract irrelevant styles\n\treturn ( val +\n\t\taugmentWidthOrHeight(\n\t\t\telem,\n\t\t\tname,\n\t\t\textra || ( isBorderBox ? \"border\" : \"content\" ),\n\t\t\tvalueIsBorderBox\n\t\t)\n\t) + \"px\";\n}\n\n\n// Try to determine the default display value of an element\nfunction css_defaultDisplay( nodeName ) {\n\tif ( elemdisplay[ nodeName ] ) {\n\t\treturn elemdisplay[ nodeName ];\n\t}\n\n\tvar elem = jQuery( \"<\" + nodeName + \">\" ).appendTo( document.body ),\n\t\tdisplay = elem.css(\"display\");\n\telem.remove();\n\n\t// If the simple way fails,\n\t// get element's real default display by attaching it to a temp iframe\n\tif ( display === \"none\" || display === \"\" ) {\n\t\t// Use the already-created iframe if possible\n\t\tiframe = document.body.appendChild(\n\t\t\tiframe || jQuery.extend( document.createElement(\"iframe\"), {\n\t\t\t\tframeBorder: 0,\n\t\t\t\twidth: 0,\n\t\t\t\theight: 0\n\t\t\t})\n\t\t);\n\n\t\t// Create a cacheable copy of the iframe document on first call.\n\t\t// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML\n\t\t// document to it; WebKit & Firefox won't allow reusing the iframe document.\n\t\tif ( !iframeDoc || !iframe.createElement ) {\n\t\t\tiframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;\n\t\t\tiframeDoc.write(\"<!doctype html><html><body>\");\n\t\t\tiframeDoc.close();\n\t\t}\n\n\t\telem = iframeDoc.body.appendChild( iframeDoc.createElement(nodeName) );\n\n\t\tdisplay = curCSS( elem, \"display\" );\n\t\tdocument.body.removeChild( iframe );\n\t}\n\n\t// Store the correct default display\n\telemdisplay[ nodeName ] = display;\n\n\treturn display;\n}\n\njQuery.each([ \"height\", \"width\" ], function( i, name ) {\n\tjQuery.cssHooks[ name ] = {\n\t\tget: function( elem, computed, extra ) {\n\t\t\tif ( computed ) {\n\t\t\t\t// certain elements can have dimension info if we invisibly show them\n\t\t\t\t// however, it must have a current display style that would benefit from this\n\t\t\t\tif ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, \"display\" ) ) ) {\n\t\t\t\t\treturn jQuery.swap( elem, cssShow, function() {\n\t\t\t\t\t\treturn getWidthOrHeight( elem, name, extra );\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\treturn getWidthOrHeight( elem, name, extra );\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\tset: function( elem, value, extra ) {\n\t\t\treturn setPositiveNumber( elem, value, extra ?\n\t\t\t\taugmentWidthOrHeight(\n\t\t\t\t\telem,\n\t\t\t\t\tname,\n\t\t\t\t\textra,\n\t\t\t\t\tjQuery.support.boxSizing && jQuery.css( elem, \"boxSizing\" ) === \"border-box\"\n\t\t\t\t) : 0\n\t\t\t);\n\t\t}\n\t};\n});\n\nif ( !jQuery.support.opacity ) {\n\tjQuery.cssHooks.opacity = {\n\t\tget: function( elem, computed ) {\n\t\t\t// IE uses filters for opacity\n\t\t\treturn ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || \"\" ) ?\n\t\t\t\t( 0.01 * parseFloat( RegExp.$1 ) ) + \"\" :\n\t\t\t\tcomputed ? \"1\" : \"\";\n\t\t},\n\n\t\tset: function( elem, value ) {\n\t\t\tvar style = elem.style,\n\t\t\t\tcurrentStyle = elem.currentStyle,\n\t\t\t\topacity = jQuery.isNumeric( value ) ? \"alpha(opacity=\" + value * 100 + \")\" : \"\",\n\t\t\t\tfilter = currentStyle && currentStyle.filter || style.filter || \"\";\n\n\t\t\t// IE has trouble with opacity if it does not have layout\n\t\t\t// Force it by setting the zoom level\n\t\t\tstyle.zoom = 1;\n\n\t\t\t// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652\n\t\t\tif ( value >= 1 && jQuery.trim( filter.replace( ralpha, \"\" ) ) === \"\" &&\n\t\t\t\tstyle.removeAttribute ) {\n\n\t\t\t\t// Setting style.filter to null, \"\" & \" \" still leave \"filter:\" in the cssText\n\t\t\t\t// if \"filter:\" is present at all, clearType is disabled, we want to avoid this\n\t\t\t\t// style.removeAttribute is IE Only, but so apparently is this code path...\n\t\t\t\tstyle.removeAttribute( \"filter\" );\n\n\t\t\t\t// if there there is no filter style applied in a css rule, we are done\n\t\t\t\tif ( currentStyle && !currentStyle.filter ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// otherwise, set new filter values\n\t\t\tstyle.filter = ralpha.test( filter ) ?\n\t\t\t\tfilter.replace( ralpha, opacity ) :\n\t\t\t\tfilter + \" \" + opacity;\n\t\t}\n\t};\n}\n\n// These hooks cannot be added until DOM ready because the support test\n// for it is not run until after DOM ready\njQuery(function() {\n\tif ( !jQuery.support.reliableMarginRight ) {\n\t\tjQuery.cssHooks.marginRight = {\n\t\t\tget: function( elem, computed ) {\n\t\t\t\t// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right\n\t\t\t\t// Work around by temporarily setting element display to inline-block\n\t\t\t\treturn jQuery.swap( elem, { \"display\": \"inline-block\" }, function() {\n\t\t\t\t\tif ( computed ) {\n\t\t\t\t\t\treturn curCSS( elem, \"marginRight\" );\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t};\n\t}\n\n\t// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084\n\t// getComputedStyle returns percent when specified for top/left/bottom/right\n\t// rather than make the css module depend on the offset module, we just check for it here\n\tif ( !jQuery.support.pixelPosition && jQuery.fn.position ) {\n\t\tjQuery.each( [ \"top\", \"left\" ], function( i, prop ) {\n\t\t\tjQuery.cssHooks[ prop ] = {\n\t\t\t\tget: function( elem, computed ) {\n\t\t\t\t\tif ( computed ) {\n\t\t\t\t\t\tvar ret = curCSS( elem, prop );\n\t\t\t\t\t\t// if curCSS returns percentage, fallback to offset\n\t\t\t\t\t\treturn rnumnonpx.test( ret ) ? jQuery( elem ).position()[ prop ] + \"px\" : ret;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t});\n\t}\n\n});\n\nif ( jQuery.expr && jQuery.expr.filters ) {\n\tjQuery.expr.filters.hidden = function( elem ) {\n\t\treturn ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || curCSS( elem, \"display\" )) === \"none\");\n\t};\n\n\tjQuery.expr.filters.visible = function( elem ) {\n\t\treturn !jQuery.expr.filters.hidden( elem );\n\t};\n}\n\n// These hooks are used by animate to expand properties\njQuery.each({\n\tmargin: \"\",\n\tpadding: \"\",\n\tborder: \"Width\"\n}, function( prefix, suffix ) {\n\tjQuery.cssHooks[ prefix + suffix ] = {\n\t\texpand: function( value ) {\n\t\t\tvar i,\n\n\t\t\t\t// assumes a single number if not a string\n\t\t\t\tparts = typeof value === \"string\" ? value.split(\" \") : [ value ],\n\t\t\t\texpanded = {};\n\n\t\t\tfor ( i = 0; i < 4; i++ ) {\n\t\t\t\texpanded[ prefix + cssExpand[ i ] + suffix ] =\n\t\t\t\t\tparts[ i ] || parts[ i - 2 ] || parts[ 0 ];\n\t\t\t}\n\n\t\t\treturn expanded;\n\t\t}\n\t};\n\n\tif ( !rmargin.test( prefix ) ) {\n\t\tjQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;\n\t}\n});\nvar r20 = /%20/g,\n\trbracket = /\\[\\]$/,\n\trCRLF = /\\r?\\n/g,\n\trinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,\n\trselectTextarea = /^(?:select|textarea)/i;\n\njQuery.fn.extend({\n\tserialize: function() {\n\t\treturn jQuery.param( this.serializeArray() );\n\t},\n\tserializeArray: function() {\n\t\treturn this.map(function(){\n\t\t\treturn this.elements ? jQuery.makeArray( this.elements ) : this;\n\t\t})\n\t\t.filter(function(){\n\t\t\treturn this.name && !this.disabled &&\n\t\t\t\t( this.checked || rselectTextarea.test( this.nodeName ) ||\n\t\t\t\t\trinput.test( this.type ) );\n\t\t})\n\t\t.map(function( i, elem ){\n\t\t\tvar val = jQuery( this ).val();\n\n\t\t\treturn val == null ?\n\t\t\t\tnull :\n\t\t\t\tjQuery.isArray( val ) ?\n\t\t\t\t\tjQuery.map( val, function( val, i ){\n\t\t\t\t\t\treturn { name: elem.name, value: val.replace( rCRLF, \"\\r\\n\" ) };\n\t\t\t\t\t}) :\n\t\t\t\t\t{ name: elem.name, value: val.replace( rCRLF, \"\\r\\n\" ) };\n\t\t}).get();\n\t}\n});\n\n//Serialize an array of form elements or a set of\n//key/values into a query string\njQuery.param = function( a, traditional ) {\n\tvar prefix,\n\t\ts = [],\n\t\tadd = function( key, value ) {\n\t\t\t// If value is a function, invoke it and return its value\n\t\t\tvalue = jQuery.isFunction( value ) ? value() : ( value == null ? \"\" : value );\n\t\t\ts[ s.length ] = encodeURIComponent( key ) + \"=\" + encodeURIComponent( value );\n\t\t};\n\n\t// Set traditional to true for jQuery <= 1.3.2 behavior.\n\tif ( traditional === undefined ) {\n\t\ttraditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional;\n\t}\n\n\t// If an array was passed in, assume that it is an array of form elements.\n\tif ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {\n\t\t// Serialize the form elements\n\t\tjQuery.each( a, function() {\n\t\t\tadd( this.name, this.value );\n\t\t});\n\n\t} else {\n\t\t// If traditional, encode the \"old\" way (the way 1.3.2 or older\n\t\t// did it), otherwise encode params recursively.\n\t\tfor ( prefix in a ) {\n\t\t\tbuildParams( prefix, a[ prefix ], traditional, add );\n\t\t}\n\t}\n\n\t// Return the resulting serialization\n\treturn s.join( \"&\" ).replace( r20, \"+\" );\n};\n\nfunction buildParams( prefix, obj, traditional, add ) {\n\tvar name;\n\n\tif ( jQuery.isArray( obj ) ) {\n\t\t// Serialize array item.\n\t\tjQuery.each( obj, function( i, v ) {\n\t\t\tif ( traditional || rbracket.test( prefix ) ) {\n\t\t\t\t// Treat each array item as a scalar.\n\t\t\t\tadd( prefix, v );\n\n\t\t\t} else {\n\t\t\t\t// If array item is non-scalar (array or object), encode its\n\t\t\t\t// numeric index to resolve deserialization ambiguity issues.\n\t\t\t\t// Note that rack (as of 1.0.0) can't currently deserialize\n\t\t\t\t// nested arrays properly, and attempting to do so may cause\n\t\t\t\t// a server error. Possible fixes are to modify rack's\n\t\t\t\t// deserialization algorithm or to provide an option or flag\n\t\t\t\t// to force array serialization to be shallow.\n\t\t\t\tbuildParams( prefix + \"[\" + ( typeof v === \"object\" ? i : \"\" ) + \"]\", v, traditional, add );\n\t\t\t}\n\t\t});\n\n\t} else if ( !traditional && jQuery.type( obj ) === \"object\" ) {\n\t\t// Serialize object item.\n\t\tfor ( name in obj ) {\n\t\t\tbuildParams( prefix + \"[\" + name + \"]\", obj[ name ], traditional, add );\n\t\t}\n\n\t} else {\n\t\t// Serialize scalar item.\n\t\tadd( prefix, obj );\n\t}\n}\nvar\n\t// Document location\n\tajaxLocParts,\n\tajaxLocation,\n\n\trhash = /#.*$/,\n\trheaders = /^(.*?):[ \\t]*([^\\r\\n]*)\\r?$/mg, // IE leaves an \\r character at EOL\n\t// #7653, #8125, #8152: local protocol detection\n\trlocalProtocol = /^(?:about|app|app\\-storage|.+\\-extension|file|res|widget):$/,\n\trnoContent = /^(?:GET|HEAD)$/,\n\trprotocol = /^\\/\\//,\n\trquery = /\\?/,\n\trscript = /<script\\b[^<]*(?:(?!<\\/script>)<[^<]*)*<\\/script>/gi,\n\trts = /([?&])_=[^&]*/,\n\trurl = /^([\\w\\+\\.\\-]+:)(?:\\/\\/([^\\/?#:]*)(?::(\\d+)|)|)/,\n\n\t// Keep a copy of the old load method\n\t_load = jQuery.fn.load,\n\n\t/* Prefilters\n\t * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)\n\t * 2) These are called:\n\t *    - BEFORE asking for a transport\n\t *    - AFTER param serialization (s.data is a string if s.processData is true)\n\t * 3) key is the dataType\n\t * 4) the catchall symbol \"*\" can be used\n\t * 5) execution will start with transport dataType and THEN continue down to \"*\" if needed\n\t */\n\tprefilters = {},\n\n\t/* Transports bindings\n\t * 1) key is the dataType\n\t * 2) the catchall symbol \"*\" can be used\n\t * 3) selection will start with transport dataType and THEN go to \"*\" if needed\n\t */\n\ttransports = {},\n\n\t// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression\n\tallTypes = [\"*/\"] + [\"*\"];\n\n// #8138, IE may throw an exception when accessing\n// a field from window.location if document.domain has been set\ntry {\n\tajaxLocation = location.href;\n} catch( e ) {\n\t// Use the href attribute of an A element\n\t// since IE will modify it given document.location\n\tajaxLocation = document.createElement( \"a\" );\n\tajaxLocation.href = \"\";\n\tajaxLocation = ajaxLocation.href;\n}\n\n// Segment location into parts\najaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];\n\n// Base \"constructor\" for jQuery.ajaxPrefilter and jQuery.ajaxTransport\nfunction addToPrefiltersOrTransports( structure ) {\n\n\t// dataTypeExpression is optional and defaults to \"*\"\n\treturn function( dataTypeExpression, func ) {\n\n\t\tif ( typeof dataTypeExpression !== \"string\" ) {\n\t\t\tfunc = dataTypeExpression;\n\t\t\tdataTypeExpression = \"*\";\n\t\t}\n\n\t\tvar dataType, list, placeBefore,\n\t\t\tdataTypes = dataTypeExpression.toLowerCase().split( core_rspace ),\n\t\t\ti = 0,\n\t\t\tlength = dataTypes.length;\n\n\t\tif ( jQuery.isFunction( func ) ) {\n\t\t\t// For each dataType in the dataTypeExpression\n\t\t\tfor ( ; i < length; i++ ) {\n\t\t\t\tdataType = dataTypes[ i ];\n\t\t\t\t// We control if we're asked to add before\n\t\t\t\t// any existing element\n\t\t\t\tplaceBefore = /^\\+/.test( dataType );\n\t\t\t\tif ( placeBefore ) {\n\t\t\t\t\tdataType = dataType.substr( 1 ) || \"*\";\n\t\t\t\t}\n\t\t\t\tlist = structure[ dataType ] = structure[ dataType ] || [];\n\t\t\t\t// then we add to the structure accordingly\n\t\t\t\tlist[ placeBefore ? \"unshift\" : \"push\" ]( func );\n\t\t\t}\n\t\t}\n\t};\n}\n\n// Base inspection function for prefilters and transports\nfunction inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,\n\t\tdataType /* internal */, inspected /* internal */ ) {\n\n\tdataType = dataType || options.dataTypes[ 0 ];\n\tinspected = inspected || {};\n\n\tinspected[ dataType ] = true;\n\n\tvar selection,\n\t\tlist = structure[ dataType ],\n\t\ti = 0,\n\t\tlength = list ? list.length : 0,\n\t\texecuteOnly = ( structure === prefilters );\n\n\tfor ( ; i < length && ( executeOnly || !selection ); i++ ) {\n\t\tselection = list[ i ]( options, originalOptions, jqXHR );\n\t\t// If we got redirected to another dataType\n\t\t// we try there if executing only and not done already\n\t\tif ( typeof selection === \"string\" ) {\n\t\t\tif ( !executeOnly || inspected[ selection ] ) {\n\t\t\t\tselection = undefined;\n\t\t\t} else {\n\t\t\t\toptions.dataTypes.unshift( selection );\n\t\t\t\tselection = inspectPrefiltersOrTransports(\n\t\t\t\t\t\tstructure, options, originalOptions, jqXHR, selection, inspected );\n\t\t\t}\n\t\t}\n\t}\n\t// If we're only executing or nothing was selected\n\t// we try the catchall dataType if not done already\n\tif ( ( executeOnly || !selection ) && !inspected[ \"*\" ] ) {\n\t\tselection = inspectPrefiltersOrTransports(\n\t\t\t\tstructure, options, originalOptions, jqXHR, \"*\", inspected );\n\t}\n\t// unnecessary when only executing (prefilters)\n\t// but it'll be ignored by the caller in that case\n\treturn selection;\n}\n\n// A special extend for ajax options\n// that takes \"flat\" options (not to be deep extended)\n// Fixes #9887\nfunction ajaxExtend( target, src ) {\n\tvar key, deep,\n\t\tflatOptions = jQuery.ajaxSettings.flatOptions || {};\n\tfor ( key in src ) {\n\t\tif ( src[ key ] !== undefined ) {\n\t\t\t( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];\n\t\t}\n\t}\n\tif ( deep ) {\n\t\tjQuery.extend( true, target, deep );\n\t}\n}\n\njQuery.fn.load = function( url, params, callback ) {\n\tif ( typeof url !== \"string\" && _load ) {\n\t\treturn _load.apply( this, arguments );\n\t}\n\n\t// Don't do a request if no elements are being requested\n\tif ( !this.length ) {\n\t\treturn this;\n\t}\n\n\tvar selector, type, response,\n\t\tself = this,\n\t\toff = url.indexOf(\" \");\n\n\tif ( off >= 0 ) {\n\t\tselector = url.slice( off, url.length );\n\t\turl = url.slice( 0, off );\n\t}\n\n\t// If it's a function\n\tif ( jQuery.isFunction( params ) ) {\n\n\t\t// We assume that it's the callback\n\t\tcallback = params;\n\t\tparams = undefined;\n\n\t// Otherwise, build a param string\n\t} else if ( params && typeof params === \"object\" ) {\n\t\ttype = \"POST\";\n\t}\n\n\t// Request the remote document\n\tjQuery.ajax({\n\t\turl: url,\n\n\t\t// if \"type\" variable is undefined, then \"GET\" method will be used\n\t\ttype: type,\n\t\tdataType: \"html\",\n\t\tdata: params,\n\t\tcomplete: function( jqXHR, status ) {\n\t\t\tif ( callback ) {\n\t\t\t\tself.each( callback, response || [ jqXHR.responseText, status, jqXHR ] );\n\t\t\t}\n\t\t}\n\t}).done(function( responseText ) {\n\n\t\t// Save response for use in complete callback\n\t\tresponse = arguments;\n\n\t\t// See if a selector was specified\n\t\tself.html( selector ?\n\n\t\t\t// Create a dummy div to hold the results\n\t\t\tjQuery(\"<div>\")\n\n\t\t\t\t// inject the contents of the document in, removing the scripts\n\t\t\t\t// to avoid any 'Permission Denied' errors in IE\n\t\t\t\t.append( responseText.replace( rscript, \"\" ) )\n\n\t\t\t\t// Locate the specified elements\n\t\t\t\t.find( selector ) :\n\n\t\t\t// If not, just inject the full result\n\t\t\tresponseText );\n\n\t});\n\n\treturn this;\n};\n\n// Attach a bunch of functions for handling common AJAX events\njQuery.each( \"ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend\".split( \" \" ), function( i, o ){\n\tjQuery.fn[ o ] = function( f ){\n\t\treturn this.on( o, f );\n\t};\n});\n\njQuery.each( [ \"get\", \"post\" ], function( i, method ) {\n\tjQuery[ method ] = function( url, data, callback, type ) {\n\t\t// shift arguments if data argument was omitted\n\t\tif ( jQuery.isFunction( data ) ) {\n\t\t\ttype = type || callback;\n\t\t\tcallback = data;\n\t\t\tdata = undefined;\n\t\t}\n\n\t\treturn jQuery.ajax({\n\t\t\ttype: method,\n\t\t\turl: url,\n\t\t\tdata: data,\n\t\t\tsuccess: callback,\n\t\t\tdataType: type\n\t\t});\n\t};\n});\n\njQuery.extend({\n\n\tgetScript: function( url, callback ) {\n\t\treturn jQuery.get( url, undefined, callback, \"script\" );\n\t},\n\n\tgetJSON: function( url, data, callback ) {\n\t\treturn jQuery.get( url, data, callback, \"json\" );\n\t},\n\n\t// Creates a full fledged settings object into target\n\t// with both ajaxSettings and settings fields.\n\t// If target is omitted, writes into ajaxSettings.\n\tajaxSetup: function( target, settings ) {\n\t\tif ( settings ) {\n\t\t\t// Building a settings object\n\t\t\tajaxExtend( target, jQuery.ajaxSettings );\n\t\t} else {\n\t\t\t// Extending ajaxSettings\n\t\t\tsettings = target;\n\t\t\ttarget = jQuery.ajaxSettings;\n\t\t}\n\t\tajaxExtend( target, settings );\n\t\treturn target;\n\t},\n\n\tajaxSettings: {\n\t\turl: ajaxLocation,\n\t\tisLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),\n\t\tglobal: true,\n\t\ttype: \"GET\",\n\t\tcontentType: \"application/x-www-form-urlencoded; charset=UTF-8\",\n\t\tprocessData: true,\n\t\tasync: true,\n\t\t/*\n\t\ttimeout: 0,\n\t\tdata: null,\n\t\tdataType: null,\n\t\tusername: null,\n\t\tpassword: null,\n\t\tcache: null,\n\t\tthrows: false,\n\t\ttraditional: false,\n\t\theaders: {},\n\t\t*/\n\n\t\taccepts: {\n\t\t\txml: \"application/xml, text/xml\",\n\t\t\thtml: \"text/html\",\n\t\t\ttext: \"text/plain\",\n\t\t\tjson: \"application/json, text/javascript\",\n\t\t\t\"*\": allTypes\n\t\t},\n\n\t\tcontents: {\n\t\t\txml: /xml/,\n\t\t\thtml: /html/,\n\t\t\tjson: /json/\n\t\t},\n\n\t\tresponseFields: {\n\t\t\txml: \"responseXML\",\n\t\t\ttext: \"responseText\"\n\t\t},\n\n\t\t// List of data converters\n\t\t// 1) key format is \"source_type destination_type\" (a single space in-between)\n\t\t// 2) the catchall symbol \"*\" can be used for source_type\n\t\tconverters: {\n\n\t\t\t// Convert anything to text\n\t\t\t\"* text\": window.String,\n\n\t\t\t// Text to html (true = no transformation)\n\t\t\t\"text html\": true,\n\n\t\t\t// Evaluate text as a json expression\n\t\t\t\"text json\": jQuery.parseJSON,\n\n\t\t\t// Parse text as xml\n\t\t\t\"text xml\": jQuery.parseXML\n\t\t},\n\n\t\t// For options that shouldn't be deep extended:\n\t\t// you can add your own custom options here if\n\t\t// and when you create one that shouldn't be\n\t\t// deep extended (see ajaxExtend)\n\t\tflatOptions: {\n\t\t\tcontext: true,\n\t\t\turl: true\n\t\t}\n\t},\n\n\tajaxPrefilter: addToPrefiltersOrTransports( prefilters ),\n\tajaxTransport: addToPrefiltersOrTransports( transports ),\n\n\t// Main method\n\tajax: function( url, options ) {\n\n\t\t// If url is an object, simulate pre-1.5 signature\n\t\tif ( typeof url === \"object\" ) {\n\t\t\toptions = url;\n\t\t\turl = undefined;\n\t\t}\n\n\t\t// Force options to be an object\n\t\toptions = options || {};\n\n\t\tvar // ifModified key\n\t\t\tifModifiedKey,\n\t\t\t// Response headers\n\t\t\tresponseHeadersString,\n\t\t\tresponseHeaders,\n\t\t\t// transport\n\t\t\ttransport,\n\t\t\t// timeout handle\n\t\t\ttimeoutTimer,\n\t\t\t// Cross-domain detection vars\n\t\t\tparts,\n\t\t\t// To know if global events are to be dispatched\n\t\t\tfireGlobals,\n\t\t\t// Loop variable\n\t\t\ti,\n\t\t\t// Create the final options object\n\t\t\ts = jQuery.ajaxSetup( {}, options ),\n\t\t\t// Callbacks context\n\t\t\tcallbackContext = s.context || s,\n\t\t\t// Context for global events\n\t\t\t// It's the callbackContext if one was provided in the options\n\t\t\t// and if it's a DOM node or a jQuery collection\n\t\t\tglobalEventContext = callbackContext !== s &&\n\t\t\t\t( callbackContext.nodeType || callbackContext instanceof jQuery ) ?\n\t\t\t\t\t\tjQuery( callbackContext ) : jQuery.event,\n\t\t\t// Deferreds\n\t\t\tdeferred = jQuery.Deferred(),\n\t\t\tcompleteDeferred = jQuery.Callbacks( \"once memory\" ),\n\t\t\t// Status-dependent callbacks\n\t\t\tstatusCode = s.statusCode || {},\n\t\t\t// Headers (they are sent all at once)\n\t\t\trequestHeaders = {},\n\t\t\trequestHeadersNames = {},\n\t\t\t// The jqXHR state\n\t\t\tstate = 0,\n\t\t\t// Default abort message\n\t\t\tstrAbort = \"canceled\",\n\t\t\t// Fake xhr\n\t\t\tjqXHR = {\n\n\t\t\t\treadyState: 0,\n\n\t\t\t\t// Caches the header\n\t\t\t\tsetRequestHeader: function( name, value ) {\n\t\t\t\t\tif ( !state ) {\n\t\t\t\t\t\tvar lname = name.toLowerCase();\n\t\t\t\t\t\tname = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;\n\t\t\t\t\t\trequestHeaders[ name ] = value;\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Raw string\n\t\t\t\tgetAllResponseHeaders: function() {\n\t\t\t\t\treturn state === 2 ? responseHeadersString : null;\n\t\t\t\t},\n\n\t\t\t\t// Builds headers hashtable if needed\n\t\t\t\tgetResponseHeader: function( key ) {\n\t\t\t\t\tvar match;\n\t\t\t\t\tif ( state === 2 ) {\n\t\t\t\t\t\tif ( !responseHeaders ) {\n\t\t\t\t\t\t\tresponseHeaders = {};\n\t\t\t\t\t\t\twhile( ( match = rheaders.exec( responseHeadersString ) ) ) {\n\t\t\t\t\t\t\t\tresponseHeaders[ match[1].toLowerCase() ] = match[ 2 ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmatch = responseHeaders[ key.toLowerCase() ];\n\t\t\t\t\t}\n\t\t\t\t\treturn match === undefined ? null : match;\n\t\t\t\t},\n\n\t\t\t\t// Overrides response content-type header\n\t\t\t\toverrideMimeType: function( type ) {\n\t\t\t\t\tif ( !state ) {\n\t\t\t\t\t\ts.mimeType = type;\n\t\t\t\t\t}\n\t\t\t\t\treturn this;\n\t\t\t\t},\n\n\t\t\t\t// Cancel the request\n\t\t\t\tabort: function( statusText ) {\n\t\t\t\t\tstatusText = statusText || strAbort;\n\t\t\t\t\tif ( transport ) {\n\t\t\t\t\t\ttransport.abort( statusText );\n\t\t\t\t\t}\n\t\t\t\t\tdone( 0, statusText );\n\t\t\t\t\treturn this;\n\t\t\t\t}\n\t\t\t};\n\n\t\t// Callback for when everything is done\n\t\t// It is defined here because jslint complains if it is declared\n\t\t// at the end of the function (which would be more logical and readable)\n\t\tfunction done( status, nativeStatusText, responses, headers ) {\n\t\t\tvar isSuccess, success, error, response, modified,\n\t\t\t\tstatusText = nativeStatusText;\n\n\t\t\t// Called once\n\t\t\tif ( state === 2 ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// State is \"done\" now\n\t\t\tstate = 2;\n\n\t\t\t// Clear timeout if it exists\n\t\t\tif ( timeoutTimer ) {\n\t\t\t\tclearTimeout( timeoutTimer );\n\t\t\t}\n\n\t\t\t// Dereference transport for early garbage collection\n\t\t\t// (no matter how long the jqXHR object will be used)\n\t\t\ttransport = undefined;\n\n\t\t\t// Cache response headers\n\t\t\tresponseHeadersString = headers || \"\";\n\n\t\t\t// Set readyState\n\t\t\tjqXHR.readyState = status > 0 ? 4 : 0;\n\n\t\t\t// Get response data\n\t\t\tif ( responses ) {\n\t\t\t\tresponse = ajaxHandleResponses( s, jqXHR, responses );\n\t\t\t}\n\n\t\t\t// If successful, handle type chaining\n\t\t\tif ( status >= 200 && status < 300 || status === 304 ) {\n\n\t\t\t\t// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n\t\t\t\tif ( s.ifModified ) {\n\n\t\t\t\t\tmodified = jqXHR.getResponseHeader(\"Last-Modified\");\n\t\t\t\t\tif ( modified ) {\n\t\t\t\t\t\tjQuery.lastModified[ ifModifiedKey ] = modified;\n\t\t\t\t\t}\n\t\t\t\t\tmodified = jqXHR.getResponseHeader(\"Etag\");\n\t\t\t\t\tif ( modified ) {\n\t\t\t\t\t\tjQuery.etag[ ifModifiedKey ] = modified;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If not modified\n\t\t\t\tif ( status === 304 ) {\n\n\t\t\t\t\tstatusText = \"notmodified\";\n\t\t\t\t\tisSuccess = true;\n\n\t\t\t\t// If we have data\n\t\t\t\t} else {\n\n\t\t\t\t\tisSuccess = ajaxConvert( s, response );\n\t\t\t\t\tstatusText = isSuccess.state;\n\t\t\t\t\tsuccess = isSuccess.data;\n\t\t\t\t\terror = isSuccess.error;\n\t\t\t\t\tisSuccess = !error;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// We extract error from statusText\n\t\t\t\t// then normalize statusText and status for non-aborts\n\t\t\t\terror = statusText;\n\t\t\t\tif ( !statusText || status ) {\n\t\t\t\t\tstatusText = \"error\";\n\t\t\t\t\tif ( status < 0 ) {\n\t\t\t\t\t\tstatus = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Set data for the fake xhr object\n\t\t\tjqXHR.status = status;\n\t\t\tjqXHR.statusText = ( nativeStatusText || statusText ) + \"\";\n\n\t\t\t// Success/Error\n\t\t\tif ( isSuccess ) {\n\t\t\t\tdeferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );\n\t\t\t} else {\n\t\t\t\tdeferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );\n\t\t\t}\n\n\t\t\t// Status-dependent callbacks\n\t\t\tjqXHR.statusCode( statusCode );\n\t\t\tstatusCode = undefined;\n\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( \"ajax\" + ( isSuccess ? \"Success\" : \"Error\" ),\n\t\t\t\t\t\t[ jqXHR, s, isSuccess ? success : error ] );\n\t\t\t}\n\n\t\t\t// Complete\n\t\t\tcompleteDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );\n\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( \"ajaxComplete\", [ jqXHR, s ] );\n\t\t\t\t// Handle the global AJAX counter\n\t\t\t\tif ( !( --jQuery.active ) ) {\n\t\t\t\t\tjQuery.event.trigger( \"ajaxStop\" );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Attach deferreds\n\t\tdeferred.promise( jqXHR );\n\t\tjqXHR.success = jqXHR.done;\n\t\tjqXHR.error = jqXHR.fail;\n\t\tjqXHR.complete = completeDeferred.add;\n\n\t\t// Status-dependent callbacks\n\t\tjqXHR.statusCode = function( map ) {\n\t\t\tif ( map ) {\n\t\t\t\tvar tmp;\n\t\t\t\tif ( state < 2 ) {\n\t\t\t\t\tfor ( tmp in map ) {\n\t\t\t\t\t\tstatusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttmp = map[ jqXHR.status ];\n\t\t\t\t\tjqXHR.always( tmp );\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this;\n\t\t};\n\n\t\t// Remove hash character (#7531: and string promotion)\n\t\t// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)\n\t\t// We also use the url parameter if available\n\t\ts.url = ( ( url || s.url ) + \"\" ).replace( rhash, \"\" ).replace( rprotocol, ajaxLocParts[ 1 ] + \"//\" );\n\n\t\t// Extract dataTypes list\n\t\ts.dataTypes = jQuery.trim( s.dataType || \"*\" ).toLowerCase().split( core_rspace );\n\n\t\t// A cross-domain request is in order when we have a protocol:host:port mismatch\n\t\tif ( s.crossDomain == null ) {\n\t\t\tparts = rurl.exec( s.url.toLowerCase() ) || false;\n\t\t\ts.crossDomain = parts && ( parts.join(\":\") + ( parts[ 3 ] ? \"\" : parts[ 1 ] === \"http:\" ? 80 : 443 ) ) !==\n\t\t\t\t( ajaxLocParts.join(\":\") + ( ajaxLocParts[ 3 ] ? \"\" : ajaxLocParts[ 1 ] === \"http:\" ? 80 : 443 ) );\n\t\t}\n\n\t\t// Convert data if not already a string\n\t\tif ( s.data && s.processData && typeof s.data !== \"string\" ) {\n\t\t\ts.data = jQuery.param( s.data, s.traditional );\n\t\t}\n\n\t\t// Apply prefilters\n\t\tinspectPrefiltersOrTransports( prefilters, s, options, jqXHR );\n\n\t\t// If request was aborted inside a prefilter, stop there\n\t\tif ( state === 2 ) {\n\t\t\treturn jqXHR;\n\t\t}\n\n\t\t// We can fire global events as of now if asked to\n\t\tfireGlobals = s.global;\n\n\t\t// Uppercase the type\n\t\ts.type = s.type.toUpperCase();\n\n\t\t// Determine if request has content\n\t\ts.hasContent = !rnoContent.test( s.type );\n\n\t\t// Watch for a new set of requests\n\t\tif ( fireGlobals && jQuery.active++ === 0 ) {\n\t\t\tjQuery.event.trigger( \"ajaxStart\" );\n\t\t}\n\n\t\t// More options handling for requests with no content\n\t\tif ( !s.hasContent ) {\n\n\t\t\t// If data is available, append data to url\n\t\t\tif ( s.data ) {\n\t\t\t\ts.url += ( rquery.test( s.url ) ? \"&\" : \"?\" ) + s.data;\n\t\t\t\t// #9682: remove data so that it's not used in an eventual retry\n\t\t\t\tdelete s.data;\n\t\t\t}\n\n\t\t\t// Get ifModifiedKey before adding the anti-cache parameter\n\t\t\tifModifiedKey = s.url;\n\n\t\t\t// Add anti-cache in url if needed\n\t\t\tif ( s.cache === false ) {\n\n\t\t\t\tvar ts = jQuery.now(),\n\t\t\t\t\t// try replacing _= if it is there\n\t\t\t\t\tret = s.url.replace( rts, \"$1_=\" + ts );\n\n\t\t\t\t// if nothing was replaced, add timestamp to the end\n\t\t\t\ts.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? \"&\" : \"?\" ) + \"_=\" + ts : \"\" );\n\t\t\t}\n\t\t}\n\n\t\t// Set the correct header, if data is being sent\n\t\tif ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {\n\t\t\tjqXHR.setRequestHeader( \"Content-Type\", s.contentType );\n\t\t}\n\n\t\t// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.\n\t\tif ( s.ifModified ) {\n\t\t\tifModifiedKey = ifModifiedKey || s.url;\n\t\t\tif ( jQuery.lastModified[ ifModifiedKey ] ) {\n\t\t\t\tjqXHR.setRequestHeader( \"If-Modified-Since\", jQuery.lastModified[ ifModifiedKey ] );\n\t\t\t}\n\t\t\tif ( jQuery.etag[ ifModifiedKey ] ) {\n\t\t\t\tjqXHR.setRequestHeader( \"If-None-Match\", jQuery.etag[ ifModifiedKey ] );\n\t\t\t}\n\t\t}\n\n\t\t// Set the Accepts header for the server, depending on the dataType\n\t\tjqXHR.setRequestHeader(\n\t\t\t\"Accept\",\n\t\t\ts.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?\n\t\t\t\ts.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== \"*\" ? \", \" + allTypes + \"; q=0.01\" : \"\" ) :\n\t\t\t\ts.accepts[ \"*\" ]\n\t\t);\n\n\t\t// Check for headers option\n\t\tfor ( i in s.headers ) {\n\t\t\tjqXHR.setRequestHeader( i, s.headers[ i ] );\n\t\t}\n\n\t\t// Allow custom headers/mimetypes and early abort\n\t\tif ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {\n\t\t\t\t// Abort if not done already and return\n\t\t\t\treturn jqXHR.abort();\n\n\t\t}\n\n\t\t// aborting is no longer a cancellation\n\t\tstrAbort = \"abort\";\n\n\t\t// Install callbacks on deferreds\n\t\tfor ( i in { success: 1, error: 1, complete: 1 } ) {\n\t\t\tjqXHR[ i ]( s[ i ] );\n\t\t}\n\n\t\t// Get transport\n\t\ttransport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );\n\n\t\t// If no transport, we auto-abort\n\t\tif ( !transport ) {\n\t\t\tdone( -1, \"No Transport\" );\n\t\t} else {\n\t\t\tjqXHR.readyState = 1;\n\t\t\t// Send global event\n\t\t\tif ( fireGlobals ) {\n\t\t\t\tglobalEventContext.trigger( \"ajaxSend\", [ jqXHR, s ] );\n\t\t\t}\n\t\t\t// Timeout\n\t\t\tif ( s.async && s.timeout > 0 ) {\n\t\t\t\ttimeoutTimer = setTimeout( function(){\n\t\t\t\t\tjqXHR.abort( \"timeout\" );\n\t\t\t\t}, s.timeout );\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tstate = 1;\n\t\t\t\ttransport.send( requestHeaders, done );\n\t\t\t} catch (e) {\n\t\t\t\t// Propagate exception as error if not done\n\t\t\t\tif ( state < 2 ) {\n\t\t\t\t\tdone( -1, e );\n\t\t\t\t// Simply rethrow otherwise\n\t\t\t\t} else {\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn jqXHR;\n\t},\n\n\t// Counter for holding the number of active queries\n\tactive: 0,\n\n\t// Last-Modified header cache for next request\n\tlastModified: {},\n\tetag: {}\n\n});\n\n/* Handles responses to an ajax request:\n * - sets all responseXXX fields accordingly\n * - finds the right dataType (mediates between content-type and expected dataType)\n * - returns the corresponding response\n */\nfunction ajaxHandleResponses( s, jqXHR, responses ) {\n\n\tvar ct, type, finalDataType, firstDataType,\n\t\tcontents = s.contents,\n\t\tdataTypes = s.dataTypes,\n\t\tresponseFields = s.responseFields;\n\n\t// Fill responseXXX fields\n\tfor ( type in responseFields ) {\n\t\tif ( type in responses ) {\n\t\t\tjqXHR[ responseFields[type] ] = responses[ type ];\n\t\t}\n\t}\n\n\t// Remove auto dataType and get content-type in the process\n\twhile( dataTypes[ 0 ] === \"*\" ) {\n\t\tdataTypes.shift();\n\t\tif ( ct === undefined ) {\n\t\t\tct = s.mimeType || jqXHR.getResponseHeader( \"content-type\" );\n\t\t}\n\t}\n\n\t// Check if we're dealing with a known content-type\n\tif ( ct ) {\n\t\tfor ( type in contents ) {\n\t\t\tif ( contents[ type ] && contents[ type ].test( ct ) ) {\n\t\t\t\tdataTypes.unshift( type );\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t// Check to see if we have a response for the expected dataType\n\tif ( dataTypes[ 0 ] in responses ) {\n\t\tfinalDataType = dataTypes[ 0 ];\n\t} else {\n\t\t// Try convertible dataTypes\n\t\tfor ( type in responses ) {\n\t\t\tif ( !dataTypes[ 0 ] || s.converters[ type + \" \" + dataTypes[0] ] ) {\n\t\t\t\tfinalDataType = type;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ( !firstDataType ) {\n\t\t\t\tfirstDataType = type;\n\t\t\t}\n\t\t}\n\t\t// Or just use first one\n\t\tfinalDataType = finalDataType || firstDataType;\n\t}\n\n\t// If we found a dataType\n\t// We add the dataType to the list if needed\n\t// and return the corresponding response\n\tif ( finalDataType ) {\n\t\tif ( finalDataType !== dataTypes[ 0 ] ) {\n\t\t\tdataTypes.unshift( finalDataType );\n\t\t}\n\t\treturn responses[ finalDataType ];\n\t}\n}\n\n// Chain conversions given the request and the original response\nfunction ajaxConvert( s, response ) {\n\n\tvar conv, conv2, current, tmp,\n\t\t// Work with a copy of dataTypes in case we need to modify it for conversion\n\t\tdataTypes = s.dataTypes.slice(),\n\t\tprev = dataTypes[ 0 ],\n\t\tconverters = {},\n\t\ti = 0;\n\n\t// Apply the dataFilter if provided\n\tif ( s.dataFilter ) {\n\t\tresponse = s.dataFilter( response, s.dataType );\n\t}\n\n\t// Create converters map with lowercased keys\n\tif ( dataTypes[ 1 ] ) {\n\t\tfor ( conv in s.converters ) {\n\t\t\tconverters[ conv.toLowerCase() ] = s.converters[ conv ];\n\t\t}\n\t}\n\n\t// Convert to each sequential dataType, tolerating list modification\n\tfor ( ; (current = dataTypes[++i]); ) {\n\n\t\t// There's only work to do if current dataType is non-auto\n\t\tif ( current !== \"*\" ) {\n\n\t\t\t// Convert response if prev dataType is non-auto and differs from current\n\t\t\tif ( prev !== \"*\" && prev !== current ) {\n\n\t\t\t\t// Seek a direct converter\n\t\t\t\tconv = converters[ prev + \" \" + current ] || converters[ \"* \" + current ];\n\n\t\t\t\t// If none found, seek a pair\n\t\t\t\tif ( !conv ) {\n\t\t\t\t\tfor ( conv2 in converters ) {\n\n\t\t\t\t\t\t// If conv2 outputs current\n\t\t\t\t\t\ttmp = conv2.split(\" \");\n\t\t\t\t\t\tif ( tmp[ 1 ] === current ) {\n\n\t\t\t\t\t\t\t// If prev can be converted to accepted input\n\t\t\t\t\t\t\tconv = converters[ prev + \" \" + tmp[ 0 ] ] ||\n\t\t\t\t\t\t\t\tconverters[ \"* \" + tmp[ 0 ] ];\n\t\t\t\t\t\t\tif ( conv ) {\n\t\t\t\t\t\t\t\t// Condense equivalence converters\n\t\t\t\t\t\t\t\tif ( conv === true ) {\n\t\t\t\t\t\t\t\t\tconv = converters[ conv2 ];\n\n\t\t\t\t\t\t\t\t// Otherwise, insert the intermediate dataType\n\t\t\t\t\t\t\t\t} else if ( converters[ conv2 ] !== true ) {\n\t\t\t\t\t\t\t\t\tcurrent = tmp[ 0 ];\n\t\t\t\t\t\t\t\t\tdataTypes.splice( i--, 0, current );\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Apply converter (if not an equivalence)\n\t\t\t\tif ( conv !== true ) {\n\n\t\t\t\t\t// Unless errors are allowed to bubble, catch and return them\n\t\t\t\t\tif ( conv && s[\"throws\"] ) {\n\t\t\t\t\t\tresponse = conv( response );\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tresponse = conv( response );\n\t\t\t\t\t\t} catch ( e ) {\n\t\t\t\t\t\t\treturn { state: \"parsererror\", error: conv ? e : \"No conversion from \" + prev + \" to \" + current };\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Update prev for next iteration\n\t\t\tprev = current;\n\t\t}\n\t}\n\n\treturn { state: \"success\", data: response };\n}\nvar oldCallbacks = [],\n\trquestion = /\\?/,\n\trjsonp = /(=)\\?(?=&|$)|\\?\\?/,\n\tnonce = jQuery.now();\n\n// Default jsonp settings\njQuery.ajaxSetup({\n\tjsonp: \"callback\",\n\tjsonpCallback: function() {\n\t\tvar callback = oldCallbacks.pop() || ( jQuery.expando + \"_\" + ( nonce++ ) );\n\t\tthis[ callback ] = true;\n\t\treturn callback;\n\t}\n});\n\n// Detect, normalize options and install callbacks for jsonp requests\njQuery.ajaxPrefilter( \"json jsonp\", function( s, originalSettings, jqXHR ) {\n\n\tvar callbackName, overwritten, responseContainer,\n\t\tdata = s.data,\n\t\turl = s.url,\n\t\thasCallback = s.jsonp !== false,\n\t\treplaceInUrl = hasCallback && rjsonp.test( url ),\n\t\treplaceInData = hasCallback && !replaceInUrl && typeof data === \"string\" &&\n\t\t\t!( s.contentType || \"\" ).indexOf(\"application/x-www-form-urlencoded\") &&\n\t\t\trjsonp.test( data );\n\n\t// Handle iff the expected data type is \"jsonp\" or we have a parameter to set\n\tif ( s.dataTypes[ 0 ] === \"jsonp\" || replaceInUrl || replaceInData ) {\n\n\t\t// Get callback name, remembering preexisting value associated with it\n\t\tcallbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ?\n\t\t\ts.jsonpCallback() :\n\t\t\ts.jsonpCallback;\n\t\toverwritten = window[ callbackName ];\n\n\t\t// Insert callback into url or form data\n\t\tif ( replaceInUrl ) {\n\t\t\ts.url = url.replace( rjsonp, \"$1\" + callbackName );\n\t\t} else if ( replaceInData ) {\n\t\t\ts.data = data.replace( rjsonp, \"$1\" + callbackName );\n\t\t} else if ( hasCallback ) {\n\t\t\ts.url += ( rquestion.test( url ) ? \"&\" : \"?\" ) + s.jsonp + \"=\" + callbackName;\n\t\t}\n\n\t\t// Use data converter to retrieve json after script execution\n\t\ts.converters[\"script json\"] = function() {\n\t\t\tif ( !responseContainer ) {\n\t\t\t\tjQuery.error( callbackName + \" was not called\" );\n\t\t\t}\n\t\t\treturn responseContainer[ 0 ];\n\t\t};\n\n\t\t// force json dataType\n\t\ts.dataTypes[ 0 ] = \"json\";\n\n\t\t// Install callback\n\t\twindow[ callbackName ] = function() {\n\t\t\tresponseContainer = arguments;\n\t\t};\n\n\t\t// Clean-up function (fires after converters)\n\t\tjqXHR.always(function() {\n\t\t\t// Restore preexisting value\n\t\t\twindow[ callbackName ] = overwritten;\n\n\t\t\t// Save back as free\n\t\t\tif ( s[ callbackName ] ) {\n\t\t\t\t// make sure that re-using the options doesn't screw things around\n\t\t\t\ts.jsonpCallback = originalSettings.jsonpCallback;\n\n\t\t\t\t// save the callback name for future use\n\t\t\t\toldCallbacks.push( callbackName );\n\t\t\t}\n\n\t\t\t// Call if it was a function and we have a response\n\t\t\tif ( responseContainer && jQuery.isFunction( overwritten ) ) {\n\t\t\t\toverwritten( responseContainer[ 0 ] );\n\t\t\t}\n\n\t\t\tresponseContainer = overwritten = undefined;\n\t\t});\n\n\t\t// Delegate to script\n\t\treturn \"script\";\n\t}\n});\n// Install script dataType\njQuery.ajaxSetup({\n\taccepts: {\n\t\tscript: \"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript\"\n\t},\n\tcontents: {\n\t\tscript: /javascript|ecmascript/\n\t},\n\tconverters: {\n\t\t\"text script\": function( text ) {\n\t\t\tjQuery.globalEval( text );\n\t\t\treturn text;\n\t\t}\n\t}\n});\n\n// Handle cache's special case and global\njQuery.ajaxPrefilter( \"script\", function( s ) {\n\tif ( s.cache === undefined ) {\n\t\ts.cache = false;\n\t}\n\tif ( s.crossDomain ) {\n\t\ts.type = \"GET\";\n\t\ts.global = false;\n\t}\n});\n\n// Bind script tag hack transport\njQuery.ajaxTransport( \"script\", function(s) {\n\n\t// This transport only deals with cross domain requests\n\tif ( s.crossDomain ) {\n\n\t\tvar script,\n\t\t\thead = document.head || document.getElementsByTagName( \"head\" )[0] || document.documentElement;\n\n\t\treturn {\n\n\t\t\tsend: function( _, callback ) {\n\n\t\t\t\tscript = document.createElement( \"script\" );\n\n\t\t\t\tscript.async = \"async\";\n\n\t\t\t\tif ( s.scriptCharset ) {\n\t\t\t\t\tscript.charset = s.scriptCharset;\n\t\t\t\t}\n\n\t\t\t\tscript.src = s.url;\n\n\t\t\t\t// Attach handlers for all browsers\n\t\t\t\tscript.onload = script.onreadystatechange = function( _, isAbort ) {\n\n\t\t\t\t\tif ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {\n\n\t\t\t\t\t\t// Handle memory leak in IE\n\t\t\t\t\t\tscript.onload = script.onreadystatechange = null;\n\n\t\t\t\t\t\t// Remove the script\n\t\t\t\t\t\tif ( head && script.parentNode ) {\n\t\t\t\t\t\t\thead.removeChild( script );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Dereference the script\n\t\t\t\t\t\tscript = undefined;\n\n\t\t\t\t\t\t// Callback if not abort\n\t\t\t\t\t\tif ( !isAbort ) {\n\t\t\t\t\t\t\tcallback( 200, \"success\" );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\t// Use insertBefore instead of appendChild  to circumvent an IE6 bug.\n\t\t\t\t// This arises when a base node is used (#2709 and #4378).\n\t\t\t\thead.insertBefore( script, head.firstChild );\n\t\t\t},\n\n\t\t\tabort: function() {\n\t\t\t\tif ( script ) {\n\t\t\t\t\tscript.onload( 0, 1 );\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}\n});\nvar xhrCallbacks,\n\t// #5280: Internet Explorer will keep connections alive if we don't abort on unload\n\txhrOnUnloadAbort = window.ActiveXObject ? function() {\n\t\t// Abort all pending requests\n\t\tfor ( var key in xhrCallbacks ) {\n\t\t\txhrCallbacks[ key ]( 0, 1 );\n\t\t}\n\t} : false,\n\txhrId = 0;\n\n// Functions to create xhrs\nfunction createStandardXHR() {\n\ttry {\n\t\treturn new window.XMLHttpRequest();\n\t} catch( e ) {}\n}\n\nfunction createActiveXHR() {\n\ttry {\n\t\treturn new window.ActiveXObject( \"Microsoft.XMLHTTP\" );\n\t} catch( e ) {}\n}\n\n// Create the request object\n// (This is still attached to ajaxSettings for backward compatibility)\njQuery.ajaxSettings.xhr = window.ActiveXObject ?\n\t/* Microsoft failed to properly\n\t * implement the XMLHttpRequest in IE7 (can't request local files),\n\t * so we use the ActiveXObject when it is available\n\t * Additionally XMLHttpRequest can be disabled in IE7/IE8 so\n\t * we need a fallback.\n\t */\n\tfunction() {\n\t\treturn !this.isLocal && createStandardXHR() || createActiveXHR();\n\t} :\n\t// For all other browsers, use the standard XMLHttpRequest object\n\tcreateStandardXHR;\n\n// Determine support properties\n(function( xhr ) {\n\tjQuery.extend( jQuery.support, {\n\t\tajax: !!xhr,\n\t\tcors: !!xhr && ( \"withCredentials\" in xhr )\n\t});\n})( jQuery.ajaxSettings.xhr() );\n\n// Create transport if the browser can provide an xhr\nif ( jQuery.support.ajax ) {\n\n\tjQuery.ajaxTransport(function( s ) {\n\t\t// Cross domain only allowed if supported through XMLHttpRequest\n\t\tif ( !s.crossDomain || jQuery.support.cors ) {\n\n\t\t\tvar callback;\n\n\t\t\treturn {\n\t\t\t\tsend: function( headers, complete ) {\n\n\t\t\t\t\t// Get a new xhr\n\t\t\t\t\tvar handle, i,\n\t\t\t\t\t\txhr = s.xhr();\n\n\t\t\t\t\t// Open the socket\n\t\t\t\t\t// Passing null username, generates a login popup on Opera (#2865)\n\t\t\t\t\tif ( s.username ) {\n\t\t\t\t\t\txhr.open( s.type, s.url, s.async, s.username, s.password );\n\t\t\t\t\t} else {\n\t\t\t\t\t\txhr.open( s.type, s.url, s.async );\n\t\t\t\t\t}\n\n\t\t\t\t\t// Apply custom fields if provided\n\t\t\t\t\tif ( s.xhrFields ) {\n\t\t\t\t\t\tfor ( i in s.xhrFields ) {\n\t\t\t\t\t\t\txhr[ i ] = s.xhrFields[ i ];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// Override mime type if needed\n\t\t\t\t\tif ( s.mimeType && xhr.overrideMimeType ) {\n\t\t\t\t\t\txhr.overrideMimeType( s.mimeType );\n\t\t\t\t\t}\n\n\t\t\t\t\t// X-Requested-With header\n\t\t\t\t\t// For cross-domain requests, seeing as conditions for a preflight are\n\t\t\t\t\t// akin to a jigsaw puzzle, we simply never set it to be sure.\n\t\t\t\t\t// (it can always be set on a per-request basis or even using ajaxSetup)\n\t\t\t\t\t// For same-domain requests, won't change header if already provided.\n\t\t\t\t\tif ( !s.crossDomain && !headers[\"X-Requested-With\"] ) {\n\t\t\t\t\t\theaders[ \"X-Requested-With\" ] = \"XMLHttpRequest\";\n\t\t\t\t\t}\n\n\t\t\t\t\t// Need an extra try/catch for cross domain requests in Firefox 3\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfor ( i in headers ) {\n\t\t\t\t\t\t\txhr.setRequestHeader( i, headers[ i ] );\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch( _ ) {}\n\n\t\t\t\t\t// Do send the request\n\t\t\t\t\t// This may raise an exception which is actually\n\t\t\t\t\t// handled in jQuery.ajax (so no try/catch here)\n\t\t\t\t\txhr.send( ( s.hasContent && s.data ) || null );\n\n\t\t\t\t\t// Listener\n\t\t\t\t\tcallback = function( _, isAbort ) {\n\n\t\t\t\t\t\tvar status,\n\t\t\t\t\t\t\tstatusText,\n\t\t\t\t\t\t\tresponseHeaders,\n\t\t\t\t\t\t\tresponses,\n\t\t\t\t\t\t\txml;\n\n\t\t\t\t\t\t// Firefox throws exceptions when accessing properties\n\t\t\t\t\t\t// of an xhr when a network error occurred\n\t\t\t\t\t\t// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)\n\t\t\t\t\t\ttry {\n\n\t\t\t\t\t\t\t// Was never called and is aborted or complete\n\t\t\t\t\t\t\tif ( callback && ( isAbort || xhr.readyState === 4 ) ) {\n\n\t\t\t\t\t\t\t\t// Only called once\n\t\t\t\t\t\t\t\tcallback = undefined;\n\n\t\t\t\t\t\t\t\t// Do not keep as active anymore\n\t\t\t\t\t\t\t\tif ( handle ) {\n\t\t\t\t\t\t\t\t\txhr.onreadystatechange = jQuery.noop;\n\t\t\t\t\t\t\t\t\tif ( xhrOnUnloadAbort ) {\n\t\t\t\t\t\t\t\t\t\tdelete xhrCallbacks[ handle ];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// If it's an abort\n\t\t\t\t\t\t\t\tif ( isAbort ) {\n\t\t\t\t\t\t\t\t\t// Abort it manually if needed\n\t\t\t\t\t\t\t\t\tif ( xhr.readyState !== 4 ) {\n\t\t\t\t\t\t\t\t\t\txhr.abort();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tstatus = xhr.status;\n\t\t\t\t\t\t\t\t\tresponseHeaders = xhr.getAllResponseHeaders();\n\t\t\t\t\t\t\t\t\tresponses = {};\n\t\t\t\t\t\t\t\t\txml = xhr.responseXML;\n\n\t\t\t\t\t\t\t\t\t// Construct response list\n\t\t\t\t\t\t\t\t\tif ( xml && xml.documentElement /* #4958 */ ) {\n\t\t\t\t\t\t\t\t\t\tresponses.xml = xml;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// When requesting binary data, IE6-9 will throw an exception\n\t\t\t\t\t\t\t\t\t// on any attempt to access responseText (#11426)\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tresponses.text = xhr.responseText;\n\t\t\t\t\t\t\t\t\t} catch( _ ) {\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// Firefox throws an exception when accessing\n\t\t\t\t\t\t\t\t\t// statusText for faulty cross-domain requests\n\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\tstatusText = xhr.statusText;\n\t\t\t\t\t\t\t\t\t} catch( e ) {\n\t\t\t\t\t\t\t\t\t\t// We normalize with Webkit giving an empty statusText\n\t\t\t\t\t\t\t\t\t\tstatusText = \"\";\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t// Filter status for non standard behaviors\n\n\t\t\t\t\t\t\t\t\t// If the request is local and we have data: assume a success\n\t\t\t\t\t\t\t\t\t// (success with no data won't get notified, that's the best we\n\t\t\t\t\t\t\t\t\t// can do given current implementations)\n\t\t\t\t\t\t\t\t\tif ( !status && s.isLocal && !s.crossDomain ) {\n\t\t\t\t\t\t\t\t\t\tstatus = responses.text ? 200 : 404;\n\t\t\t\t\t\t\t\t\t// IE - #1450: sometimes returns 1223 when it should be 204\n\t\t\t\t\t\t\t\t\t} else if ( status === 1223 ) {\n\t\t\t\t\t\t\t\t\t\tstatus = 204;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch( firefoxAccessException ) {\n\t\t\t\t\t\t\tif ( !isAbort ) {\n\t\t\t\t\t\t\t\tcomplete( -1, firefoxAccessException );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Call complete if needed\n\t\t\t\t\t\tif ( responses ) {\n\t\t\t\t\t\t\tcomplete( status, statusText, responses, responseHeaders );\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\tif ( !s.async ) {\n\t\t\t\t\t\t// if we're in sync mode we fire the callback\n\t\t\t\t\t\tcallback();\n\t\t\t\t\t} else if ( xhr.readyState === 4 ) {\n\t\t\t\t\t\t// (IE6 & IE7) if it's in cache and has been\n\t\t\t\t\t\t// retrieved directly we need to fire the callback\n\t\t\t\t\t\tsetTimeout( callback, 0 );\n\t\t\t\t\t} else {\n\t\t\t\t\t\thandle = ++xhrId;\n\t\t\t\t\t\tif ( xhrOnUnloadAbort ) {\n\t\t\t\t\t\t\t// Create the active xhrs callbacks list if needed\n\t\t\t\t\t\t\t// and attach the unload handler\n\t\t\t\t\t\t\tif ( !xhrCallbacks ) {\n\t\t\t\t\t\t\t\txhrCallbacks = {};\n\t\t\t\t\t\t\t\tjQuery( window ).unload( xhrOnUnloadAbort );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// Add to list of active xhrs callbacks\n\t\t\t\t\t\t\txhrCallbacks[ handle ] = callback;\n\t\t\t\t\t\t}\n\t\t\t\t\t\txhr.onreadystatechange = callback;\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\tabort: function() {\n\t\t\t\t\tif ( callback ) {\n\t\t\t\t\t\tcallback(0,1);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t});\n}\nvar fxNow, timerId,\n\trfxtypes = /^(?:toggle|show|hide)$/,\n\trfxnum = new RegExp( \"^(?:([-+])=|)(\" + core_pnum + \")([a-z%]*)$\", \"i\" ),\n\trrun = /queueHooks$/,\n\tanimationPrefilters = [ defaultPrefilter ],\n\ttweeners = {\n\t\t\"*\": [function( prop, value ) {\n\t\t\tvar end, unit,\n\t\t\t\ttween = this.createTween( prop, value ),\n\t\t\t\tparts = rfxnum.exec( value ),\n\t\t\t\ttarget = tween.cur(),\n\t\t\t\tstart = +target || 0,\n\t\t\t\tscale = 1,\n\t\t\t\tmaxIterations = 20;\n\n\t\t\tif ( parts ) {\n\t\t\t\tend = +parts[2];\n\t\t\t\tunit = parts[3] || ( jQuery.cssNumber[ prop ] ? \"\" : \"px\" );\n\n\t\t\t\t// We need to compute starting value\n\t\t\t\tif ( unit !== \"px\" && start ) {\n\t\t\t\t\t// Iteratively approximate from a nonzero starting point\n\t\t\t\t\t// Prefer the current property, because this process will be trivial if it uses the same units\n\t\t\t\t\t// Fallback to end or a simple constant\n\t\t\t\t\tstart = jQuery.css( tween.elem, prop, true ) || end || 1;\n\n\t\t\t\t\tdo {\n\t\t\t\t\t\t// If previous iteration zeroed out, double until we get *something*\n\t\t\t\t\t\t// Use a string for doubling factor so we don't accidentally see scale as unchanged below\n\t\t\t\t\t\tscale = scale || \".5\";\n\n\t\t\t\t\t\t// Adjust and apply\n\t\t\t\t\t\tstart = start / scale;\n\t\t\t\t\t\tjQuery.style( tween.elem, prop, start + unit );\n\n\t\t\t\t\t// Update scale, tolerating zero or NaN from tween.cur()\n\t\t\t\t\t// And breaking the loop if scale is unchanged or perfect, or if we've just had enough\n\t\t\t\t\t} while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations );\n\t\t\t\t}\n\n\t\t\t\ttween.unit = unit;\n\t\t\t\ttween.start = start;\n\t\t\t\t// If a +=/-= token was provided, we're doing a relative animation\n\t\t\t\ttween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end;\n\t\t\t}\n\t\t\treturn tween;\n\t\t}]\n\t};\n\n// Animations created synchronously will run synchronously\nfunction createFxNow() {\n\tsetTimeout(function() {\n\t\tfxNow = undefined;\n\t}, 0 );\n\treturn ( fxNow = jQuery.now() );\n}\n\nfunction createTweens( animation, props ) {\n\tjQuery.each( props, function( prop, value ) {\n\t\tvar collection = ( tweeners[ prop ] || [] ).concat( tweeners[ \"*\" ] ),\n\t\t\tindex = 0,\n\t\t\tlength = collection.length;\n\t\tfor ( ; index < length; index++ ) {\n\t\t\tif ( collection[ index ].call( animation, prop, value ) ) {\n\n\t\t\t\t// we're done with this property\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t});\n}\n\nfunction Animation( elem, properties, options ) {\n\tvar result,\n\t\tindex = 0,\n\t\ttweenerIndex = 0,\n\t\tlength = animationPrefilters.length,\n\t\tdeferred = jQuery.Deferred().always( function() {\n\t\t\t// don't match elem in the :animated selector\n\t\t\tdelete tick.elem;\n\t\t}),\n\t\ttick = function() {\n\t\t\tvar currentTime = fxNow || createFxNow(),\n\t\t\t\tremaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),\n\t\t\t\tpercent = 1 - ( remaining / animation.duration || 0 ),\n\t\t\t\tindex = 0,\n\t\t\t\tlength = animation.tweens.length;\n\n\t\t\tfor ( ; index < length ; index++ ) {\n\t\t\t\tanimation.tweens[ index ].run( percent );\n\t\t\t}\n\n\t\t\tdeferred.notifyWith( elem, [ animation, percent, remaining ]);\n\n\t\t\tif ( percent < 1 && length ) {\n\t\t\t\treturn remaining;\n\t\t\t} else {\n\t\t\t\tdeferred.resolveWith( elem, [ animation ] );\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\tanimation = deferred.promise({\n\t\t\telem: elem,\n\t\t\tprops: jQuery.extend( {}, properties ),\n\t\t\topts: jQuery.extend( true, { specialEasing: {} }, options ),\n\t\t\toriginalProperties: properties,\n\t\t\toriginalOptions: options,\n\t\t\tstartTime: fxNow || createFxNow(),\n\t\t\tduration: options.duration,\n\t\t\ttweens: [],\n\t\t\tcreateTween: function( prop, end, easing ) {\n\t\t\t\tvar tween = jQuery.Tween( elem, animation.opts, prop, end,\n\t\t\t\t\t\tanimation.opts.specialEasing[ prop ] || animation.opts.easing );\n\t\t\t\tanimation.tweens.push( tween );\n\t\t\t\treturn tween;\n\t\t\t},\n\t\t\tstop: function( gotoEnd ) {\n\t\t\t\tvar index = 0,\n\t\t\t\t\t// if we are going to the end, we want to run all the tweens\n\t\t\t\t\t// otherwise we skip this part\n\t\t\t\t\tlength = gotoEnd ? animation.tweens.length : 0;\n\n\t\t\t\tfor ( ; index < length ; index++ ) {\n\t\t\t\t\tanimation.tweens[ index ].run( 1 );\n\t\t\t\t}\n\n\t\t\t\t// resolve when we played the last frame\n\t\t\t\t// otherwise, reject\n\t\t\t\tif ( gotoEnd ) {\n\t\t\t\t\tdeferred.resolveWith( elem, [ animation, gotoEnd ] );\n\t\t\t\t} else {\n\t\t\t\t\tdeferred.rejectWith( elem, [ animation, gotoEnd ] );\n\t\t\t\t}\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}),\n\t\tprops = animation.props;\n\n\tpropFilter( props, animation.opts.specialEasing );\n\n\tfor ( ; index < length ; index++ ) {\n\t\tresult = animationPrefilters[ index ].call( animation, elem, props, animation.opts );\n\t\tif ( result ) {\n\t\t\treturn result;\n\t\t}\n\t}\n\n\tcreateTweens( animation, props );\n\n\tif ( jQuery.isFunction( animation.opts.start ) ) {\n\t\tanimation.opts.start.call( elem, animation );\n\t}\n\n\tjQuery.fx.timer(\n\t\tjQuery.extend( tick, {\n\t\t\tanim: animation,\n\t\t\tqueue: animation.opts.queue,\n\t\t\telem: elem\n\t\t})\n\t);\n\n\t// attach callbacks from options\n\treturn animation.progress( animation.opts.progress )\n\t\t.done( animation.opts.done, animation.opts.complete )\n\t\t.fail( animation.opts.fail )\n\t\t.always( animation.opts.always );\n}\n\nfunction propFilter( props, specialEasing ) {\n\tvar index, name, easing, value, hooks;\n\n\t// camelCase, specialEasing and expand cssHook pass\n\tfor ( index in props ) {\n\t\tname = jQuery.camelCase( index );\n\t\teasing = specialEasing[ name ];\n\t\tvalue = props[ index ];\n\t\tif ( jQuery.isArray( value ) ) {\n\t\t\teasing = value[ 1 ];\n\t\t\tvalue = props[ index ] = value[ 0 ];\n\t\t}\n\n\t\tif ( index !== name ) {\n\t\t\tprops[ name ] = value;\n\t\t\tdelete props[ index ];\n\t\t}\n\n\t\thooks = jQuery.cssHooks[ name ];\n\t\tif ( hooks && \"expand\" in hooks ) {\n\t\t\tvalue = hooks.expand( value );\n\t\t\tdelete props[ name ];\n\n\t\t\t// not quite $.extend, this wont overwrite keys already present.\n\t\t\t// also - reusing 'index' from above because we have the correct \"name\"\n\t\t\tfor ( index in value ) {\n\t\t\t\tif ( !( index in props ) ) {\n\t\t\t\t\tprops[ index ] = value[ index ];\n\t\t\t\t\tspecialEasing[ index ] = easing;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tspecialEasing[ name ] = easing;\n\t\t}\n\t}\n}\n\njQuery.Animation = jQuery.extend( Animation, {\n\n\ttweener: function( props, callback ) {\n\t\tif ( jQuery.isFunction( props ) ) {\n\t\t\tcallback = props;\n\t\t\tprops = [ \"*\" ];\n\t\t} else {\n\t\t\tprops = props.split(\" \");\n\t\t}\n\n\t\tvar prop,\n\t\t\tindex = 0,\n\t\t\tlength = props.length;\n\n\t\tfor ( ; index < length ; index++ ) {\n\t\t\tprop = props[ index ];\n\t\t\ttweeners[ prop ] = tweeners[ prop ] || [];\n\t\t\ttweeners[ prop ].unshift( callback );\n\t\t}\n\t},\n\n\tprefilter: function( callback, prepend ) {\n\t\tif ( prepend ) {\n\t\t\tanimationPrefilters.unshift( callback );\n\t\t} else {\n\t\t\tanimationPrefilters.push( callback );\n\t\t}\n\t}\n});\n\nfunction defaultPrefilter( elem, props, opts ) {\n\tvar index, prop, value, length, dataShow, tween, hooks, oldfire,\n\t\tanim = this,\n\t\tstyle = elem.style,\n\t\torig = {},\n\t\thandled = [],\n\t\thidden = elem.nodeType && isHidden( elem );\n\n\t// handle queue: false promises\n\tif ( !opts.queue ) {\n\t\thooks = jQuery._queueHooks( elem, \"fx\" );\n\t\tif ( hooks.unqueued == null ) {\n\t\t\thooks.unqueued = 0;\n\t\t\toldfire = hooks.empty.fire;\n\t\t\thooks.empty.fire = function() {\n\t\t\t\tif ( !hooks.unqueued ) {\n\t\t\t\t\toldfire();\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t\thooks.unqueued++;\n\n\t\tanim.always(function() {\n\t\t\t// doing this makes sure that the complete handler will be called\n\t\t\t// before this completes\n\t\t\tanim.always(function() {\n\t\t\t\thooks.unqueued--;\n\t\t\t\tif ( !jQuery.queue( elem, \"fx\" ).length ) {\n\t\t\t\t\thooks.empty.fire();\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\t// height/width overflow pass\n\tif ( elem.nodeType === 1 && ( \"height\" in props || \"width\" in props ) ) {\n\t\t// Make sure that nothing sneaks out\n\t\t// Record all 3 overflow attributes because IE does not\n\t\t// change the overflow attribute when overflowX and\n\t\t// overflowY are set to the same value\n\t\topts.overflow = [ style.overflow, style.overflowX, style.overflowY ];\n\n\t\t// Set display property to inline-block for height/width\n\t\t// animations on inline elements that are having width/height animated\n\t\tif ( jQuery.css( elem, \"display\" ) === \"inline\" &&\n\t\t\t\tjQuery.css( elem, \"float\" ) === \"none\" ) {\n\n\t\t\t// inline-level elements accept inline-block;\n\t\t\t// block-level elements need to be inline with layout\n\t\t\tif ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === \"inline\" ) {\n\t\t\t\tstyle.display = \"inline-block\";\n\n\t\t\t} else {\n\t\t\t\tstyle.zoom = 1;\n\t\t\t}\n\t\t}\n\t}\n\n\tif ( opts.overflow ) {\n\t\tstyle.overflow = \"hidden\";\n\t\tif ( !jQuery.support.shrinkWrapBlocks ) {\n\t\t\tanim.done(function() {\n\t\t\t\tstyle.overflow = opts.overflow[ 0 ];\n\t\t\t\tstyle.overflowX = opts.overflow[ 1 ];\n\t\t\t\tstyle.overflowY = opts.overflow[ 2 ];\n\t\t\t});\n\t\t}\n\t}\n\n\n\t// show/hide pass\n\tfor ( index in props ) {\n\t\tvalue = props[ index ];\n\t\tif ( rfxtypes.exec( value ) ) {\n\t\t\tdelete props[ index ];\n\t\t\tif ( value === ( hidden ? \"hide\" : \"show\" ) ) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\thandled.push( index );\n\t\t}\n\t}\n\n\tlength = handled.length;\n\tif ( length ) {\n\t\tdataShow = jQuery._data( elem, \"fxshow\" ) || jQuery._data( elem, \"fxshow\", {} );\n\t\tif ( hidden ) {\n\t\t\tjQuery( elem ).show();\n\t\t} else {\n\t\t\tanim.done(function() {\n\t\t\t\tjQuery( elem ).hide();\n\t\t\t});\n\t\t}\n\t\tanim.done(function() {\n\t\t\tvar prop;\n\t\t\tjQuery.removeData( elem, \"fxshow\", true );\n\t\t\tfor ( prop in orig ) {\n\t\t\t\tjQuery.style( elem, prop, orig[ prop ] );\n\t\t\t}\n\t\t});\n\t\tfor ( index = 0 ; index < length ; index++ ) {\n\t\t\tprop = handled[ index ];\n\t\t\ttween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 );\n\t\t\torig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop );\n\n\t\t\tif ( !( prop in dataShow ) ) {\n\t\t\t\tdataShow[ prop ] = tween.start;\n\t\t\t\tif ( hidden ) {\n\t\t\t\t\ttween.end = tween.start;\n\t\t\t\t\ttween.start = prop === \"width\" || prop === \"height\" ? 1 : 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction Tween( elem, options, prop, end, easing ) {\n\treturn new Tween.prototype.init( elem, options, prop, end, easing );\n}\njQuery.Tween = Tween;\n\nTween.prototype = {\n\tconstructor: Tween,\n\tinit: function( elem, options, prop, end, easing, unit ) {\n\t\tthis.elem = elem;\n\t\tthis.prop = prop;\n\t\tthis.easing = easing || \"swing\";\n\t\tthis.options = options;\n\t\tthis.start = this.now = this.cur();\n\t\tthis.end = end;\n\t\tthis.unit = unit || ( jQuery.cssNumber[ prop ] ? \"\" : \"px\" );\n\t},\n\tcur: function() {\n\t\tvar hooks = Tween.propHooks[ this.prop ];\n\n\t\treturn hooks && hooks.get ?\n\t\t\thooks.get( this ) :\n\t\t\tTween.propHooks._default.get( this );\n\t},\n\trun: function( percent ) {\n\t\tvar eased,\n\t\t\thooks = Tween.propHooks[ this.prop ];\n\n\t\tif ( this.options.duration ) {\n\t\t\tthis.pos = eased = jQuery.easing[ this.easing ](\n\t\t\t\tpercent, this.options.duration * percent, 0, 1, this.options.duration\n\t\t\t);\n\t\t} else {\n\t\t\tthis.pos = eased = percent;\n\t\t}\n\t\tthis.now = ( this.end - this.start ) * eased + this.start;\n\n\t\tif ( this.options.step ) {\n\t\t\tthis.options.step.call( this.elem, this.now, this );\n\t\t}\n\n\t\tif ( hooks && hooks.set ) {\n\t\t\thooks.set( this );\n\t\t} else {\n\t\t\tTween.propHooks._default.set( this );\n\t\t}\n\t\treturn this;\n\t}\n};\n\nTween.prototype.init.prototype = Tween.prototype;\n\nTween.propHooks = {\n\t_default: {\n\t\tget: function( tween ) {\n\t\t\tvar result;\n\n\t\t\tif ( tween.elem[ tween.prop ] != null &&\n\t\t\t\t(!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) {\n\t\t\t\treturn tween.elem[ tween.prop ];\n\t\t\t}\n\n\t\t\t// passing any value as a 4th parameter to .css will automatically\n\t\t\t// attempt a parseFloat and fallback to a string if the parse fails\n\t\t\t// so, simple values such as \"10px\" are parsed to Float.\n\t\t\t// complex values such as \"rotate(1rad)\" are returned as is.\n\t\t\tresult = jQuery.css( tween.elem, tween.prop, false, \"\" );\n\t\t\t// Empty strings, null, undefined and \"auto\" are converted to 0.\n\t\t\treturn !result || result === \"auto\" ? 0 : result;\n\t\t},\n\t\tset: function( tween ) {\n\t\t\t// use step hook for back compat - use cssHook if its there - use .style if its\n\t\t\t// available and use plain properties where available\n\t\t\tif ( jQuery.fx.step[ tween.prop ] ) {\n\t\t\t\tjQuery.fx.step[ tween.prop ]( tween );\n\t\t\t} else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) {\n\t\t\t\tjQuery.style( tween.elem, tween.prop, tween.now + tween.unit );\n\t\t\t} else {\n\t\t\t\ttween.elem[ tween.prop ] = tween.now;\n\t\t\t}\n\t\t}\n\t}\n};\n\n// Remove in 2.0 - this supports IE8's panic based approach\n// to setting things on disconnected nodes\n\nTween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {\n\tset: function( tween ) {\n\t\tif ( tween.elem.nodeType && tween.elem.parentNode ) {\n\t\t\ttween.elem[ tween.prop ] = tween.now;\n\t\t}\n\t}\n};\n\njQuery.each([ \"toggle\", \"show\", \"hide\" ], function( i, name ) {\n\tvar cssFn = jQuery.fn[ name ];\n\tjQuery.fn[ name ] = function( speed, easing, callback ) {\n\t\treturn speed == null || typeof speed === \"boolean\" ||\n\t\t\t// special check for .toggle( handler, handler, ... )\n\t\t\t( !i && jQuery.isFunction( speed ) && jQuery.isFunction( easing ) ) ?\n\t\t\tcssFn.apply( this, arguments ) :\n\t\t\tthis.animate( genFx( name, true ), speed, easing, callback );\n\t};\n});\n\njQuery.fn.extend({\n\tfadeTo: function( speed, to, easing, callback ) {\n\n\t\t// show any hidden elements after setting opacity to 0\n\t\treturn this.filter( isHidden ).css( \"opacity\", 0 ).show()\n\n\t\t\t// animate to the value specified\n\t\t\t.end().animate({ opacity: to }, speed, easing, callback );\n\t},\n\tanimate: function( prop, speed, easing, callback ) {\n\t\tvar empty = jQuery.isEmptyObject( prop ),\n\t\t\toptall = jQuery.speed( speed, easing, callback ),\n\t\t\tdoAnimation = function() {\n\t\t\t\t// Operate on a copy of prop so per-property easing won't be lost\n\t\t\t\tvar anim = Animation( this, jQuery.extend( {}, prop ), optall );\n\n\t\t\t\t// Empty animations resolve immediately\n\t\t\t\tif ( empty ) {\n\t\t\t\t\tanim.stop( true );\n\t\t\t\t}\n\t\t\t};\n\n\t\treturn empty || optall.queue === false ?\n\t\t\tthis.each( doAnimation ) :\n\t\t\tthis.queue( optall.queue, doAnimation );\n\t},\n\tstop: function( type, clearQueue, gotoEnd ) {\n\t\tvar stopQueue = function( hooks ) {\n\t\t\tvar stop = hooks.stop;\n\t\t\tdelete hooks.stop;\n\t\t\tstop( gotoEnd );\n\t\t};\n\n\t\tif ( typeof type !== \"string\" ) {\n\t\t\tgotoEnd = clearQueue;\n\t\t\tclearQueue = type;\n\t\t\ttype = undefined;\n\t\t}\n\t\tif ( clearQueue && type !== false ) {\n\t\t\tthis.queue( type || \"fx\", [] );\n\t\t}\n\n\t\treturn this.each(function() {\n\t\t\tvar dequeue = true,\n\t\t\t\tindex = type != null && type + \"queueHooks\",\n\t\t\t\ttimers = jQuery.timers,\n\t\t\t\tdata = jQuery._data( this );\n\n\t\t\tif ( index ) {\n\t\t\t\tif ( data[ index ] && data[ index ].stop ) {\n\t\t\t\t\tstopQueue( data[ index ] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor ( index in data ) {\n\t\t\t\t\tif ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {\n\t\t\t\t\t\tstopQueue( data[ index ] );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor ( index = timers.length; index--; ) {\n\t\t\t\tif ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {\n\t\t\t\t\ttimers[ index ].anim.stop( gotoEnd );\n\t\t\t\t\tdequeue = false;\n\t\t\t\t\ttimers.splice( index, 1 );\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// start the next in the queue if the last step wasn't forced\n\t\t\t// timers currently will call their complete callbacks, which will dequeue\n\t\t\t// but only if they were gotoEnd\n\t\t\tif ( dequeue || !gotoEnd ) {\n\t\t\t\tjQuery.dequeue( this, type );\n\t\t\t}\n\t\t});\n\t}\n});\n\n// Generate parameters to create a standard animation\nfunction genFx( type, includeWidth ) {\n\tvar which,\n\t\tattrs = { height: type },\n\t\ti = 0;\n\n\t// if we include width, step value is 1 to do all cssExpand values,\n\t// if we don't include width, step value is 2 to skip over Left and Right\n\tincludeWidth = includeWidth? 1 : 0;\n\tfor( ; i < 4 ; i += 2 - includeWidth ) {\n\t\twhich = cssExpand[ i ];\n\t\tattrs[ \"margin\" + which ] = attrs[ \"padding\" + which ] = type;\n\t}\n\n\tif ( includeWidth ) {\n\t\tattrs.opacity = attrs.width = type;\n\t}\n\n\treturn attrs;\n}\n\n// Generate shortcuts for custom animations\njQuery.each({\n\tslideDown: genFx(\"show\"),\n\tslideUp: genFx(\"hide\"),\n\tslideToggle: genFx(\"toggle\"),\n\tfadeIn: { opacity: \"show\" },\n\tfadeOut: { opacity: \"hide\" },\n\tfadeToggle: { opacity: \"toggle\" }\n}, function( name, props ) {\n\tjQuery.fn[ name ] = function( speed, easing, callback ) {\n\t\treturn this.animate( props, speed, easing, callback );\n\t};\n});\n\njQuery.speed = function( speed, easing, fn ) {\n\tvar opt = speed && typeof speed === \"object\" ? jQuery.extend( {}, speed ) : {\n\t\tcomplete: fn || !fn && easing ||\n\t\t\tjQuery.isFunction( speed ) && speed,\n\t\tduration: speed,\n\t\teasing: fn && easing || easing && !jQuery.isFunction( easing ) && easing\n\t};\n\n\topt.duration = jQuery.fx.off ? 0 : typeof opt.duration === \"number\" ? opt.duration :\n\t\topt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;\n\n\t// normalize opt.queue - true/undefined/null -> \"fx\"\n\tif ( opt.queue == null || opt.queue === true ) {\n\t\topt.queue = \"fx\";\n\t}\n\n\t// Queueing\n\topt.old = opt.complete;\n\n\topt.complete = function() {\n\t\tif ( jQuery.isFunction( opt.old ) ) {\n\t\t\topt.old.call( this );\n\t\t}\n\n\t\tif ( opt.queue ) {\n\t\t\tjQuery.dequeue( this, opt.queue );\n\t\t}\n\t};\n\n\treturn opt;\n};\n\njQuery.easing = {\n\tlinear: function( p ) {\n\t\treturn p;\n\t},\n\tswing: function( p ) {\n\t\treturn 0.5 - Math.cos( p*Math.PI ) / 2;\n\t}\n};\n\njQuery.timers = [];\njQuery.fx = Tween.prototype.init;\njQuery.fx.tick = function() {\n\tvar timer,\n\t\ttimers = jQuery.timers,\n\t\ti = 0;\n\n\tfor ( ; i < timers.length; i++ ) {\n\t\ttimer = timers[ i ];\n\t\t// Checks the timer has not already been removed\n\t\tif ( !timer() && timers[ i ] === timer ) {\n\t\t\ttimers.splice( i--, 1 );\n\t\t}\n\t}\n\n\tif ( !timers.length ) {\n\t\tjQuery.fx.stop();\n\t}\n};\n\njQuery.fx.timer = function( timer ) {\n\tif ( timer() && jQuery.timers.push( timer ) && !timerId ) {\n\t\ttimerId = setInterval( jQuery.fx.tick, jQuery.fx.interval );\n\t}\n};\n\njQuery.fx.interval = 13;\n\njQuery.fx.stop = function() {\n\tclearInterval( timerId );\n\ttimerId = null;\n};\n\njQuery.fx.speeds = {\n\tslow: 600,\n\tfast: 200,\n\t// Default speed\n\t_default: 400\n};\n\n// Back Compat <1.8 extension point\njQuery.fx.step = {};\n\nif ( jQuery.expr && jQuery.expr.filters ) {\n\tjQuery.expr.filters.animated = function( elem ) {\n\t\treturn jQuery.grep(jQuery.timers, function( fn ) {\n\t\t\treturn elem === fn.elem;\n\t\t}).length;\n\t};\n}\nvar rroot = /^(?:body|html)$/i;\n\njQuery.fn.offset = function( options ) {\n\tif ( arguments.length ) {\n\t\treturn options === undefined ?\n\t\t\tthis :\n\t\t\tthis.each(function( i ) {\n\t\t\t\tjQuery.offset.setOffset( this, options, i );\n\t\t\t});\n\t}\n\n\tvar docElem, body, win, clientTop, clientLeft, scrollTop, scrollLeft,\n\t\tbox = { top: 0, left: 0 },\n\t\telem = this[ 0 ],\n\t\tdoc = elem && elem.ownerDocument;\n\n\tif ( !doc ) {\n\t\treturn;\n\t}\n\n\tif ( (body = doc.body) === elem ) {\n\t\treturn jQuery.offset.bodyOffset( elem );\n\t}\n\n\tdocElem = doc.documentElement;\n\n\t// Make sure it's not a disconnected DOM node\n\tif ( !jQuery.contains( docElem, elem ) ) {\n\t\treturn box;\n\t}\n\n\t// If we don't have gBCR, just use 0,0 rather than error\n\t// BlackBerry 5, iOS 3 (original iPhone)\n\tif ( typeof elem.getBoundingClientRect !== \"undefined\" ) {\n\t\tbox = elem.getBoundingClientRect();\n\t}\n\twin = getWindow( doc );\n\tclientTop  = docElem.clientTop  || body.clientTop  || 0;\n\tclientLeft = docElem.clientLeft || body.clientLeft || 0;\n\tscrollTop  = win.pageYOffset || docElem.scrollTop;\n\tscrollLeft = win.pageXOffset || docElem.scrollLeft;\n\treturn {\n\t\ttop: box.top  + scrollTop  - clientTop,\n\t\tleft: box.left + scrollLeft - clientLeft\n\t};\n};\n\njQuery.offset = {\n\n\tbodyOffset: function( body ) {\n\t\tvar top = body.offsetTop,\n\t\t\tleft = body.offsetLeft;\n\n\t\tif ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {\n\t\t\ttop  += parseFloat( jQuery.css(body, \"marginTop\") ) || 0;\n\t\t\tleft += parseFloat( jQuery.css(body, \"marginLeft\") ) || 0;\n\t\t}\n\n\t\treturn { top: top, left: left };\n\t},\n\n\tsetOffset: function( elem, options, i ) {\n\t\tvar position = jQuery.css( elem, \"position\" );\n\n\t\t// set position first, in-case top/left are set even on static elem\n\t\tif ( position === \"static\" ) {\n\t\t\telem.style.position = \"relative\";\n\t\t}\n\n\t\tvar curElem = jQuery( elem ),\n\t\t\tcurOffset = curElem.offset(),\n\t\t\tcurCSSTop = jQuery.css( elem, \"top\" ),\n\t\t\tcurCSSLeft = jQuery.css( elem, \"left\" ),\n\t\t\tcalculatePosition = ( position === \"absolute\" || position === \"fixed\" ) && jQuery.inArray(\"auto\", [curCSSTop, curCSSLeft]) > -1,\n\t\t\tprops = {}, curPosition = {}, curTop, curLeft;\n\n\t\t// need to be able to calculate position if either top or left is auto and position is either absolute or fixed\n\t\tif ( calculatePosition ) {\n\t\t\tcurPosition = curElem.position();\n\t\t\tcurTop = curPosition.top;\n\t\t\tcurLeft = curPosition.left;\n\t\t} else {\n\t\t\tcurTop = parseFloat( curCSSTop ) || 0;\n\t\t\tcurLeft = parseFloat( curCSSLeft ) || 0;\n\t\t}\n\n\t\tif ( jQuery.isFunction( options ) ) {\n\t\t\toptions = options.call( elem, i, curOffset );\n\t\t}\n\n\t\tif ( options.top != null ) {\n\t\t\tprops.top = ( options.top - curOffset.top ) + curTop;\n\t\t}\n\t\tif ( options.left != null ) {\n\t\t\tprops.left = ( options.left - curOffset.left ) + curLeft;\n\t\t}\n\n\t\tif ( \"using\" in options ) {\n\t\t\toptions.using.call( elem, props );\n\t\t} else {\n\t\t\tcurElem.css( props );\n\t\t}\n\t}\n};\n\n\njQuery.fn.extend({\n\n\tposition: function() {\n\t\tif ( !this[0] ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar elem = this[0],\n\n\t\t// Get *real* offsetParent\n\t\toffsetParent = this.offsetParent(),\n\n\t\t// Get correct offsets\n\t\toffset       = this.offset(),\n\t\tparentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();\n\n\t\t// Subtract element margins\n\t\t// note: when an element has margin: auto the offsetLeft and marginLeft\n\t\t// are the same in Safari causing offset.left to incorrectly be 0\n\t\toffset.top  -= parseFloat( jQuery.css(elem, \"marginTop\") ) || 0;\n\t\toffset.left -= parseFloat( jQuery.css(elem, \"marginLeft\") ) || 0;\n\n\t\t// Add offsetParent borders\n\t\tparentOffset.top  += parseFloat( jQuery.css(offsetParent[0], \"borderTopWidth\") ) || 0;\n\t\tparentOffset.left += parseFloat( jQuery.css(offsetParent[0], \"borderLeftWidth\") ) || 0;\n\n\t\t// Subtract the two offsets\n\t\treturn {\n\t\t\ttop:  offset.top  - parentOffset.top,\n\t\t\tleft: offset.left - parentOffset.left\n\t\t};\n\t},\n\n\toffsetParent: function() {\n\t\treturn this.map(function() {\n\t\t\tvar offsetParent = this.offsetParent || document.body;\n\t\t\twhile ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, \"position\") === \"static\") ) {\n\t\t\t\toffsetParent = offsetParent.offsetParent;\n\t\t\t}\n\t\t\treturn offsetParent || document.body;\n\t\t});\n\t}\n});\n\n\n// Create scrollLeft and scrollTop methods\njQuery.each( {scrollLeft: \"pageXOffset\", scrollTop: \"pageYOffset\"}, function( method, prop ) {\n\tvar top = /Y/.test( prop );\n\n\tjQuery.fn[ method ] = function( val ) {\n\t\treturn jQuery.access( this, function( elem, method, val ) {\n\t\t\tvar win = getWindow( elem );\n\n\t\t\tif ( val === undefined ) {\n\t\t\t\treturn win ? (prop in win) ? win[ prop ] :\n\t\t\t\t\twin.document.documentElement[ method ] :\n\t\t\t\t\telem[ method ];\n\t\t\t}\n\n\t\t\tif ( win ) {\n\t\t\t\twin.scrollTo(\n\t\t\t\t\t!top ? val : jQuery( win ).scrollLeft(),\n\t\t\t\t\t top ? val : jQuery( win ).scrollTop()\n\t\t\t\t);\n\n\t\t\t} else {\n\t\t\t\telem[ method ] = val;\n\t\t\t}\n\t\t}, method, val, arguments.length, null );\n\t};\n});\n\nfunction getWindow( elem ) {\n\treturn jQuery.isWindow( elem ) ?\n\t\telem :\n\t\telem.nodeType === 9 ?\n\t\t\telem.defaultView || elem.parentWindow :\n\t\t\tfalse;\n}\n// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods\njQuery.each( { Height: \"height\", Width: \"width\" }, function( name, type ) {\n\tjQuery.each( { padding: \"inner\" + name, content: type, \"\": \"outer\" + name }, function( defaultExtra, funcName ) {\n\t\t// margin is only for outerHeight, outerWidth\n\t\tjQuery.fn[ funcName ] = function( margin, value ) {\n\t\t\tvar chainable = arguments.length && ( defaultExtra || typeof margin !== \"boolean\" ),\n\t\t\t\textra = defaultExtra || ( margin === true || value === true ? \"margin\" : \"border\" );\n\n\t\t\treturn jQuery.access( this, function( elem, type, value ) {\n\t\t\t\tvar doc;\n\n\t\t\t\tif ( jQuery.isWindow( elem ) ) {\n\t\t\t\t\t// As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there\n\t\t\t\t\t// isn't a whole lot we can do. See pull request at this URL for discussion:\n\t\t\t\t\t// https://github.com/jquery/jquery/pull/764\n\t\t\t\t\treturn elem.document.documentElement[ \"client\" + name ];\n\t\t\t\t}\n\n\t\t\t\t// Get document width or height\n\t\t\t\tif ( elem.nodeType === 9 ) {\n\t\t\t\t\tdoc = elem.documentElement;\n\n\t\t\t\t\t// Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest\n\t\t\t\t\t// unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it.\n\t\t\t\t\treturn Math.max(\n\t\t\t\t\t\telem.body[ \"scroll\" + name ], doc[ \"scroll\" + name ],\n\t\t\t\t\t\telem.body[ \"offset\" + name ], doc[ \"offset\" + name ],\n\t\t\t\t\t\tdoc[ \"client\" + name ]\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn value === undefined ?\n\t\t\t\t\t// Get width or height on the element, requesting but not forcing parseFloat\n\t\t\t\t\tjQuery.css( elem, type, value, extra ) :\n\n\t\t\t\t\t// Set width or height on the element\n\t\t\t\t\tjQuery.style( elem, type, value, extra );\n\t\t\t}, type, chainable ? margin : undefined, chainable, null );\n\t\t};\n\t});\n});\n// Expose jQuery to the global object\nwindow.jQuery = window.$ = jQuery;\n\n// Expose jQuery as an AMD module, but only for AMD loaders that\n// understand the issues with loading multiple versions of jQuery\n// in a page that all might call define(). The loader will indicate\n// they have special allowances for multiple jQuery versions by\n// specifying define.amd.jQuery = true. Register as a named module,\n// since jQuery can be concatenated with other files that may use define,\n// but not use a proper concatenation script that understands anonymous\n// AMD modules. A named AMD is safest and most robust way to register.\n// Lowercase jquery is used because AMD module names are derived from\n// file names, and jQuery is normally delivered in a lowercase file name.\n// Do this after creating the global so that if an AMD module wants to call\n// noConflict to hide this version of jQuery, it will work.\nif ( typeof define === \"function\" && define.amd && define.amd.jQuery ) {\n\tdefine( \"jquery\", [], function () { return jQuery; } );\n}\n\n})( window );\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Scripts/jquery-ui-1.8.24.js",
    "content": "/*! jQuery UI - v1.8.24 - 2012-09-28\n* https://github.com/jquery/jquery-ui\n* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.draggable.js, jquery.ui.droppable.js, jquery.ui.resizable.js, jquery.ui.selectable.js, jquery.ui.sortable.js, jquery.effects.core.js, jquery.effects.blind.js, jquery.effects.bounce.js, jquery.effects.clip.js, jquery.effects.drop.js, jquery.effects.explode.js, jquery.effects.fade.js, jquery.effects.fold.js, jquery.effects.highlight.js, jquery.effects.pulsate.js, jquery.effects.scale.js, jquery.effects.shake.js, jquery.effects.slide.js, jquery.effects.transfer.js, jquery.ui.accordion.js, jquery.ui.autocomplete.js, jquery.ui.button.js, jquery.ui.datepicker.js, jquery.ui.dialog.js, jquery.ui.position.js, jquery.ui.progressbar.js, jquery.ui.slider.js, jquery.ui.tabs.js\n* Copyright (c) 2012 AUTHORS.txt; Licensed MIT */\n\n(function( $, undefined ) {\n\n// prevent duplicate loading\n// this is only a problem because we proxy existing functions\n// and we don't want to double proxy them\n$.ui = $.ui || {};\nif ( $.ui.version ) {\n\treturn;\n}\n\n$.extend( $.ui, {\n\tversion: \"1.8.24\",\n\n\tkeyCode: {\n\t\tALT: 18,\n\t\tBACKSPACE: 8,\n\t\tCAPS_LOCK: 20,\n\t\tCOMMA: 188,\n\t\tCOMMAND: 91,\n\t\tCOMMAND_LEFT: 91, // COMMAND\n\t\tCOMMAND_RIGHT: 93,\n\t\tCONTROL: 17,\n\t\tDELETE: 46,\n\t\tDOWN: 40,\n\t\tEND: 35,\n\t\tENTER: 13,\n\t\tESCAPE: 27,\n\t\tHOME: 36,\n\t\tINSERT: 45,\n\t\tLEFT: 37,\n\t\tMENU: 93, // COMMAND_RIGHT\n\t\tNUMPAD_ADD: 107,\n\t\tNUMPAD_DECIMAL: 110,\n\t\tNUMPAD_DIVIDE: 111,\n\t\tNUMPAD_ENTER: 108,\n\t\tNUMPAD_MULTIPLY: 106,\n\t\tNUMPAD_SUBTRACT: 109,\n\t\tPAGE_DOWN: 34,\n\t\tPAGE_UP: 33,\n\t\tPERIOD: 190,\n\t\tRIGHT: 39,\n\t\tSHIFT: 16,\n\t\tSPACE: 32,\n\t\tTAB: 9,\n\t\tUP: 38,\n\t\tWINDOWS: 91 // COMMAND\n\t}\n});\n\n// plugins\n$.fn.extend({\n\tpropAttr: $.fn.prop || $.fn.attr,\n\n\t_focus: $.fn.focus,\n\tfocus: function( delay, fn ) {\n\t\treturn typeof delay === \"number\" ?\n\t\t\tthis.each(function() {\n\t\t\t\tvar elem = this;\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t$( elem ).focus();\n\t\t\t\t\tif ( fn ) {\n\t\t\t\t\t\tfn.call( elem );\n\t\t\t\t\t}\n\t\t\t\t}, delay );\n\t\t\t}) :\n\t\t\tthis._focus.apply( this, arguments );\n\t},\n\n\tscrollParent: function() {\n\t\tvar scrollParent;\n\t\tif (($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {\n\t\t\tscrollParent = this.parents().filter(function() {\n\t\t\t\treturn (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));\n\t\t\t}).eq(0);\n\t\t} else {\n\t\t\tscrollParent = this.parents().filter(function() {\n\t\t\t\treturn (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));\n\t\t\t}).eq(0);\n\t\t}\n\n\t\treturn (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;\n\t},\n\n\tzIndex: function( zIndex ) {\n\t\tif ( zIndex !== undefined ) {\n\t\t\treturn this.css( \"zIndex\", zIndex );\n\t\t}\n\n\t\tif ( this.length ) {\n\t\t\tvar elem = $( this[ 0 ] ), position, value;\n\t\t\twhile ( elem.length && elem[ 0 ] !== document ) {\n\t\t\t\t// Ignore z-index if position is set to a value where z-index is ignored by the browser\n\t\t\t\t// This makes behavior of this function consistent across browsers\n\t\t\t\t// WebKit always returns auto if the element is positioned\n\t\t\t\tposition = elem.css( \"position\" );\n\t\t\t\tif ( position === \"absolute\" || position === \"relative\" || position === \"fixed\" ) {\n\t\t\t\t\t// IE returns 0 when zIndex is not specified\n\t\t\t\t\t// other browsers return a string\n\t\t\t\t\t// we ignore the case of nested elements with an explicit value of 0\n\t\t\t\t\t// <div style=\"z-index: -10;\"><div style=\"z-index: 0;\"></div></div>\n\t\t\t\t\tvalue = parseInt( elem.css( \"zIndex\" ), 10 );\n\t\t\t\t\tif ( !isNaN( value ) && value !== 0 ) {\n\t\t\t\t\t\treturn value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telem = elem.parent();\n\t\t\t}\n\t\t}\n\n\t\treturn 0;\n\t},\n\n\tdisableSelection: function() {\n\t\treturn this.bind( ( $.support.selectstart ? \"selectstart\" : \"mousedown\" ) +\n\t\t\t\".ui-disableSelection\", function( event ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t});\n\t},\n\n\tenableSelection: function() {\n\t\treturn this.unbind( \".ui-disableSelection\" );\n\t}\n});\n\n// support: jQuery <1.8\nif ( !$( \"<a>\" ).outerWidth( 1 ).jquery ) {\n\t$.each( [ \"Width\", \"Height\" ], function( i, name ) {\n\t\tvar side = name === \"Width\" ? [ \"Left\", \"Right\" ] : [ \"Top\", \"Bottom\" ],\n\t\t\ttype = name.toLowerCase(),\n\t\t\torig = {\n\t\t\t\tinnerWidth: $.fn.innerWidth,\n\t\t\t\tinnerHeight: $.fn.innerHeight,\n\t\t\t\touterWidth: $.fn.outerWidth,\n\t\t\t\touterHeight: $.fn.outerHeight\n\t\t\t};\n\n\t\tfunction reduce( elem, size, border, margin ) {\n\t\t\t$.each( side, function() {\n\t\t\t\tsize -= parseFloat( $.curCSS( elem, \"padding\" + this, true) ) || 0;\n\t\t\t\tif ( border ) {\n\t\t\t\t\tsize -= parseFloat( $.curCSS( elem, \"border\" + this + \"Width\", true) ) || 0;\n\t\t\t\t}\n\t\t\t\tif ( margin ) {\n\t\t\t\t\tsize -= parseFloat( $.curCSS( elem, \"margin\" + this, true) ) || 0;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn size;\n\t\t}\n\n\t\t$.fn[ \"inner\" + name ] = function( size ) {\n\t\t\tif ( size === undefined ) {\n\t\t\t\treturn orig[ \"inner\" + name ].call( this );\n\t\t\t}\n\n\t\t\treturn this.each(function() {\n\t\t\t\t$( this ).css( type, reduce( this, size ) + \"px\" );\n\t\t\t});\n\t\t};\n\n\t\t$.fn[ \"outer\" + name] = function( size, margin ) {\n\t\t\tif ( typeof size !== \"number\" ) {\n\t\t\t\treturn orig[ \"outer\" + name ].call( this, size );\n\t\t\t}\n\n\t\t\treturn this.each(function() {\n\t\t\t\t$( this).css( type, reduce( this, size, true, margin ) + \"px\" );\n\t\t\t});\n\t\t};\n\t});\n}\n\n// selectors\nfunction focusable( element, isTabIndexNotNaN ) {\n\tvar nodeName = element.nodeName.toLowerCase();\n\tif ( \"area\" === nodeName ) {\n\t\tvar map = element.parentNode,\n\t\t\tmapName = map.name,\n\t\t\timg;\n\t\tif ( !element.href || !mapName || map.nodeName.toLowerCase() !== \"map\" ) {\n\t\t\treturn false;\n\t\t}\n\t\timg = $( \"img[usemap=#\" + mapName + \"]\" )[0];\n\t\treturn !!img && visible( img );\n\t}\n\treturn ( /input|select|textarea|button|object/.test( nodeName )\n\t\t? !element.disabled\n\t\t: \"a\" == nodeName\n\t\t\t? element.href || isTabIndexNotNaN\n\t\t\t: isTabIndexNotNaN)\n\t\t// the element and all of its ancestors must be visible\n\t\t&& visible( element );\n}\n\nfunction visible( element ) {\n\treturn !$( element ).parents().andSelf().filter(function() {\n\t\treturn $.curCSS( this, \"visibility\" ) === \"hidden\" ||\n\t\t\t$.expr.filters.hidden( this );\n\t}).length;\n}\n\n$.extend( $.expr[ \":\" ], {\n\tdata: $.expr.createPseudo ?\n\t\t$.expr.createPseudo(function( dataName ) {\n\t\t\treturn function( elem ) {\n\t\t\t\treturn !!$.data( elem, dataName );\n\t\t\t};\n\t\t}) :\n\t\t// support: jQuery <1.8\n\t\tfunction( elem, i, match ) {\n\t\t\treturn !!$.data( elem, match[ 3 ] );\n\t\t},\n\n\tfocusable: function( element ) {\n\t\treturn focusable( element, !isNaN( $.attr( element, \"tabindex\" ) ) );\n\t},\n\n\ttabbable: function( element ) {\n\t\tvar tabIndex = $.attr( element, \"tabindex\" ),\n\t\t\tisTabIndexNaN = isNaN( tabIndex );\n\t\treturn ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN );\n\t}\n});\n\n// support\n$(function() {\n\tvar body = document.body,\n\t\tdiv = body.appendChild( div = document.createElement( \"div\" ) );\n\n\t// access offsetHeight before setting the style to prevent a layout bug\n\t// in IE 9 which causes the elemnt to continue to take up space even\n\t// after it is removed from the DOM (#8026)\n\tdiv.offsetHeight;\n\n\t$.extend( div.style, {\n\t\tminHeight: \"100px\",\n\t\theight: \"auto\",\n\t\tpadding: 0,\n\t\tborderWidth: 0\n\t});\n\n\t$.support.minHeight = div.offsetHeight === 100;\n\t$.support.selectstart = \"onselectstart\" in div;\n\n\t// set display to none to avoid a layout bug in IE\n\t// http://dev.jquery.com/ticket/4014\n\tbody.removeChild( div ).style.display = \"none\";\n});\n\n// jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css\nif ( !$.curCSS ) {\n\t$.curCSS = $.css;\n}\n\n\n\n\n\n// deprecated\n$.extend( $.ui, {\n\t// $.ui.plugin is deprecated.  Use the proxy pattern instead.\n\tplugin: {\n\t\tadd: function( module, option, set ) {\n\t\t\tvar proto = $.ui[ module ].prototype;\n\t\t\tfor ( var i in set ) {\n\t\t\t\tproto.plugins[ i ] = proto.plugins[ i ] || [];\n\t\t\t\tproto.plugins[ i ].push( [ option, set[ i ] ] );\n\t\t\t}\n\t\t},\n\t\tcall: function( instance, name, args ) {\n\t\t\tvar set = instance.plugins[ name ];\n\t\t\tif ( !set || !instance.element[ 0 ].parentNode ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\n\t\t\tfor ( var i = 0; i < set.length; i++ ) {\n\t\t\t\tif ( instance.options[ set[ i ][ 0 ] ] ) {\n\t\t\t\t\tset[ i ][ 1 ].apply( instance.element, args );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t\n\t// will be deprecated when we switch to jQuery 1.4 - use jQuery.contains()\n\tcontains: function( a, b ) {\n\t\treturn document.compareDocumentPosition ?\n\t\t\ta.compareDocumentPosition( b ) & 16 :\n\t\t\ta !== b && a.contains( b );\n\t},\n\t\n\t// only used by resizable\n\thasScroll: function( el, a ) {\n\t\n\t\t//If overflow is hidden, the element might have extra content, but the user wants to hide it\n\t\tif ( $( el ).css( \"overflow\" ) === \"hidden\") {\n\t\t\treturn false;\n\t\t}\n\t\n\t\tvar scroll = ( a && a === \"left\" ) ? \"scrollLeft\" : \"scrollTop\",\n\t\t\thas = false;\n\t\n\t\tif ( el[ scroll ] > 0 ) {\n\t\t\treturn true;\n\t\t}\n\t\n\t\t// TODO: determine which cases actually cause this to happen\n\t\t// if the element doesn't have the scroll set, see if it's possible to\n\t\t// set the scroll\n\t\tel[ scroll ] = 1;\n\t\thas = ( el[ scroll ] > 0 );\n\t\tel[ scroll ] = 0;\n\t\treturn has;\n\t},\n\t\n\t// these are odd functions, fix the API or move into individual plugins\n\tisOverAxis: function( x, reference, size ) {\n\t\t//Determines when x coordinate is over \"b\" element axis\n\t\treturn ( x > reference ) && ( x < ( reference + size ) );\n\t},\n\tisOver: function( y, x, top, left, height, width ) {\n\t\t//Determines when x, y coordinates is over \"b\" element\n\t\treturn $.ui.isOverAxis( y, top, height ) && $.ui.isOverAxis( x, left, width );\n\t}\n});\n\n})( jQuery );\n\n(function( $, undefined ) {\n\n// jQuery 1.4+\nif ( $.cleanData ) {\n\tvar _cleanData = $.cleanData;\n\t$.cleanData = function( elems ) {\n\t\tfor ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {\n\t\t\ttry {\n\t\t\t\t$( elem ).triggerHandler( \"remove\" );\n\t\t\t// http://bugs.jquery.com/ticket/8235\n\t\t\t} catch( e ) {}\n\t\t}\n\t\t_cleanData( elems );\n\t};\n} else {\n\tvar _remove = $.fn.remove;\n\t$.fn.remove = function( selector, keepData ) {\n\t\treturn this.each(function() {\n\t\t\tif ( !keepData ) {\n\t\t\t\tif ( !selector || $.filter( selector, [ this ] ).length ) {\n\t\t\t\t\t$( \"*\", this ).add( [ this ] ).each(function() {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t$( this ).triggerHandler( \"remove\" );\n\t\t\t\t\t\t// http://bugs.jquery.com/ticket/8235\n\t\t\t\t\t\t} catch( e ) {}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn _remove.call( $(this), selector, keepData );\n\t\t});\n\t};\n}\n\n$.widget = function( name, base, prototype ) {\n\tvar namespace = name.split( \".\" )[ 0 ],\n\t\tfullName;\n\tname = name.split( \".\" )[ 1 ];\n\tfullName = namespace + \"-\" + name;\n\n\tif ( !prototype ) {\n\t\tprototype = base;\n\t\tbase = $.Widget;\n\t}\n\n\t// create selector for plugin\n\t$.expr[ \":\" ][ fullName ] = function( elem ) {\n\t\treturn !!$.data( elem, name );\n\t};\n\n\t$[ namespace ] = $[ namespace ] || {};\n\t$[ namespace ][ name ] = function( options, element ) {\n\t\t// allow instantiation without initializing for simple inheritance\n\t\tif ( arguments.length ) {\n\t\t\tthis._createWidget( options, element );\n\t\t}\n\t};\n\n\tvar basePrototype = new base();\n\t// we need to make the options hash a property directly on the new instance\n\t// otherwise we'll modify the options hash on the prototype that we're\n\t// inheriting from\n//\t$.each( basePrototype, function( key, val ) {\n//\t\tif ( $.isPlainObject(val) ) {\n//\t\t\tbasePrototype[ key ] = $.extend( {}, val );\n//\t\t}\n//\t});\n\tbasePrototype.options = $.extend( true, {}, basePrototype.options );\n\t$[ namespace ][ name ].prototype = $.extend( true, basePrototype, {\n\t\tnamespace: namespace,\n\t\twidgetName: name,\n\t\twidgetEventPrefix: $[ namespace ][ name ].prototype.widgetEventPrefix || name,\n\t\twidgetBaseClass: fullName\n\t}, prototype );\n\n\t$.widget.bridge( name, $[ namespace ][ name ] );\n};\n\n$.widget.bridge = function( name, object ) {\n\t$.fn[ name ] = function( options ) {\n\t\tvar isMethodCall = typeof options === \"string\",\n\t\t\targs = Array.prototype.slice.call( arguments, 1 ),\n\t\t\treturnValue = this;\n\n\t\t// allow multiple hashes to be passed on init\n\t\toptions = !isMethodCall && args.length ?\n\t\t\t$.extend.apply( null, [ true, options ].concat(args) ) :\n\t\t\toptions;\n\n\t\t// prevent calls to internal methods\n\t\tif ( isMethodCall && options.charAt( 0 ) === \"_\" ) {\n\t\t\treturn returnValue;\n\t\t}\n\n\t\tif ( isMethodCall ) {\n\t\t\tthis.each(function() {\n\t\t\t\tvar instance = $.data( this, name ),\n\t\t\t\t\tmethodValue = instance && $.isFunction( instance[options] ) ?\n\t\t\t\t\t\tinstance[ options ].apply( instance, args ) :\n\t\t\t\t\t\tinstance;\n\t\t\t\t// TODO: add this back in 1.9 and use $.error() (see #5972)\n//\t\t\t\tif ( !instance ) {\n//\t\t\t\t\tthrow \"cannot call methods on \" + name + \" prior to initialization; \" +\n//\t\t\t\t\t\t\"attempted to call method '\" + options + \"'\";\n//\t\t\t\t}\n//\t\t\t\tif ( !$.isFunction( instance[options] ) ) {\n//\t\t\t\t\tthrow \"no such method '\" + options + \"' for \" + name + \" widget instance\";\n//\t\t\t\t}\n//\t\t\t\tvar methodValue = instance[ options ].apply( instance, args );\n\t\t\t\tif ( methodValue !== instance && methodValue !== undefined ) {\n\t\t\t\t\treturnValue = methodValue;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tthis.each(function() {\n\t\t\t\tvar instance = $.data( this, name );\n\t\t\t\tif ( instance ) {\n\t\t\t\t\tinstance.option( options || {} )._init();\n\t\t\t\t} else {\n\t\t\t\t\t$.data( this, name, new object( options, this ) );\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn returnValue;\n\t};\n};\n\n$.Widget = function( options, element ) {\n\t// allow instantiation without initializing for simple inheritance\n\tif ( arguments.length ) {\n\t\tthis._createWidget( options, element );\n\t}\n};\n\n$.Widget.prototype = {\n\twidgetName: \"widget\",\n\twidgetEventPrefix: \"\",\n\toptions: {\n\t\tdisabled: false\n\t},\n\t_createWidget: function( options, element ) {\n\t\t// $.widget.bridge stores the plugin instance, but we do it anyway\n\t\t// so that it's stored even before the _create function runs\n\t\t$.data( element, this.widgetName, this );\n\t\tthis.element = $( element );\n\t\tthis.options = $.extend( true, {},\n\t\t\tthis.options,\n\t\t\tthis._getCreateOptions(),\n\t\t\toptions );\n\n\t\tvar self = this;\n\t\tthis.element.bind( \"remove.\" + this.widgetName, function() {\n\t\t\tself.destroy();\n\t\t});\n\n\t\tthis._create();\n\t\tthis._trigger( \"create\" );\n\t\tthis._init();\n\t},\n\t_getCreateOptions: function() {\n\t\treturn $.metadata && $.metadata.get( this.element[0] )[ this.widgetName ];\n\t},\n\t_create: function() {},\n\t_init: function() {},\n\n\tdestroy: function() {\n\t\tthis.element\n\t\t\t.unbind( \".\" + this.widgetName )\n\t\t\t.removeData( this.widgetName );\n\t\tthis.widget()\n\t\t\t.unbind( \".\" + this.widgetName )\n\t\t\t.removeAttr( \"aria-disabled\" )\n\t\t\t.removeClass(\n\t\t\t\tthis.widgetBaseClass + \"-disabled \" +\n\t\t\t\t\"ui-state-disabled\" );\n\t},\n\n\twidget: function() {\n\t\treturn this.element;\n\t},\n\n\toption: function( key, value ) {\n\t\tvar options = key;\n\n\t\tif ( arguments.length === 0 ) {\n\t\t\t// don't return a reference to the internal hash\n\t\t\treturn $.extend( {}, this.options );\n\t\t}\n\n\t\tif  (typeof key === \"string\" ) {\n\t\t\tif ( value === undefined ) {\n\t\t\t\treturn this.options[ key ];\n\t\t\t}\n\t\t\toptions = {};\n\t\t\toptions[ key ] = value;\n\t\t}\n\n\t\tthis._setOptions( options );\n\n\t\treturn this;\n\t},\n\t_setOptions: function( options ) {\n\t\tvar self = this;\n\t\t$.each( options, function( key, value ) {\n\t\t\tself._setOption( key, value );\n\t\t});\n\n\t\treturn this;\n\t},\n\t_setOption: function( key, value ) {\n\t\tthis.options[ key ] = value;\n\n\t\tif ( key === \"disabled\" ) {\n\t\t\tthis.widget()\n\t\t\t\t[ value ? \"addClass\" : \"removeClass\"](\n\t\t\t\t\tthis.widgetBaseClass + \"-disabled\" + \" \" +\n\t\t\t\t\t\"ui-state-disabled\" )\n\t\t\t\t.attr( \"aria-disabled\", value );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tenable: function() {\n\t\treturn this._setOption( \"disabled\", false );\n\t},\n\tdisable: function() {\n\t\treturn this._setOption( \"disabled\", true );\n\t},\n\n\t_trigger: function( type, event, data ) {\n\t\tvar prop, orig,\n\t\t\tcallback = this.options[ type ];\n\n\t\tdata = data || {};\n\t\tevent = $.Event( event );\n\t\tevent.type = ( type === this.widgetEventPrefix ?\n\t\t\ttype :\n\t\t\tthis.widgetEventPrefix + type ).toLowerCase();\n\t\t// the original event may come from any element\n\t\t// so we need to reset the target on the new event\n\t\tevent.target = this.element[ 0 ];\n\n\t\t// copy original event properties over to the new event\n\t\torig = event.originalEvent;\n\t\tif ( orig ) {\n\t\t\tfor ( prop in orig ) {\n\t\t\t\tif ( !( prop in event ) ) {\n\t\t\t\t\tevent[ prop ] = orig[ prop ];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tthis.element.trigger( event, data );\n\n\t\treturn !( $.isFunction(callback) &&\n\t\t\tcallback.call( this.element[0], event, data ) === false ||\n\t\t\tevent.isDefaultPrevented() );\n\t}\n};\n\n})( jQuery );\n\n(function( $, undefined ) {\n\nvar mouseHandled = false;\n$( document ).mouseup( function( e ) {\n\tmouseHandled = false;\n});\n\n$.widget(\"ui.mouse\", {\n\toptions: {\n\t\tcancel: ':input,option',\n\t\tdistance: 1,\n\t\tdelay: 0\n\t},\n\t_mouseInit: function() {\n\t\tvar self = this;\n\n\t\tthis.element\n\t\t\t.bind('mousedown.'+this.widgetName, function(event) {\n\t\t\t\treturn self._mouseDown(event);\n\t\t\t})\n\t\t\t.bind('click.'+this.widgetName, function(event) {\n\t\t\t\tif (true === $.data(event.target, self.widgetName + '.preventClickEvent')) {\n\t\t\t\t    $.removeData(event.target, self.widgetName + '.preventClickEvent');\n\t\t\t\t\tevent.stopImmediatePropagation();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\n\t\tthis.started = false;\n\t},\n\n\t// TODO: make sure destroying one instance of mouse doesn't mess with\n\t// other instances of mouse\n\t_mouseDestroy: function() {\n\t\tthis.element.unbind('.'+this.widgetName);\n\t\tif ( this._mouseMoveDelegate ) {\n\t\t\t$(document)\n\t\t\t\t.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)\n\t\t\t\t.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);\n\t\t}\n\t},\n\n\t_mouseDown: function(event) {\n\t\t// don't let more than one widget handle mouseStart\n\t\tif( mouseHandled ) { return };\n\n\t\t// we may have missed mouseup (out of window)\n\t\t(this._mouseStarted && this._mouseUp(event));\n\n\t\tthis._mouseDownEvent = event;\n\n\t\tvar self = this,\n\t\t\tbtnIsLeft = (event.which == 1),\n\t\t\t// event.target.nodeName works around a bug in IE 8 with\n\t\t\t// disabled inputs (#7620)\n\t\t\telIsCancel = (typeof this.options.cancel == \"string\" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false);\n\t\tif (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {\n\t\t\treturn true;\n\t\t}\n\n\t\tthis.mouseDelayMet = !this.options.delay;\n\t\tif (!this.mouseDelayMet) {\n\t\t\tthis._mouseDelayTimer = setTimeout(function() {\n\t\t\t\tself.mouseDelayMet = true;\n\t\t\t}, this.options.delay);\n\t\t}\n\n\t\tif (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {\n\t\t\tthis._mouseStarted = (this._mouseStart(event) !== false);\n\t\t\tif (!this._mouseStarted) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\t// Click event may never have fired (Gecko & Opera)\n\t\tif (true === $.data(event.target, this.widgetName + '.preventClickEvent')) {\n\t\t\t$.removeData(event.target, this.widgetName + '.preventClickEvent');\n\t\t}\n\n\t\t// these delegates are required to keep context\n\t\tthis._mouseMoveDelegate = function(event) {\n\t\t\treturn self._mouseMove(event);\n\t\t};\n\t\tthis._mouseUpDelegate = function(event) {\n\t\t\treturn self._mouseUp(event);\n\t\t};\n\t\t$(document)\n\t\t\t.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)\n\t\t\t.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);\n\n\t\tevent.preventDefault();\n\t\t\n\t\tmouseHandled = true;\n\t\treturn true;\n\t},\n\n\t_mouseMove: function(event) {\n\t\t// IE mouseup check - mouseup happened when mouse was out of window\n\t\tif ($.browser.msie && !(document.documentMode >= 9) && !event.button) {\n\t\t\treturn this._mouseUp(event);\n\t\t}\n\n\t\tif (this._mouseStarted) {\n\t\t\tthis._mouseDrag(event);\n\t\t\treturn event.preventDefault();\n\t\t}\n\n\t\tif (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {\n\t\t\tthis._mouseStarted =\n\t\t\t\t(this._mouseStart(this._mouseDownEvent, event) !== false);\n\t\t\t(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));\n\t\t}\n\n\t\treturn !this._mouseStarted;\n\t},\n\n\t_mouseUp: function(event) {\n\t\t$(document)\n\t\t\t.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)\n\t\t\t.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);\n\n\t\tif (this._mouseStarted) {\n\t\t\tthis._mouseStarted = false;\n\n\t\t\tif (event.target == this._mouseDownEvent.target) {\n\t\t\t    $.data(event.target, this.widgetName + '.preventClickEvent', true);\n\t\t\t}\n\n\t\t\tthis._mouseStop(event);\n\t\t}\n\n\t\treturn false;\n\t},\n\n\t_mouseDistanceMet: function(event) {\n\t\treturn (Math.max(\n\t\t\t\tMath.abs(this._mouseDownEvent.pageX - event.pageX),\n\t\t\t\tMath.abs(this._mouseDownEvent.pageY - event.pageY)\n\t\t\t) >= this.options.distance\n\t\t);\n\t},\n\n\t_mouseDelayMet: function(event) {\n\t\treturn this.mouseDelayMet;\n\t},\n\n\t// These are placeholder methods, to be overriden by extending plugin\n\t_mouseStart: function(event) {},\n\t_mouseDrag: function(event) {},\n\t_mouseStop: function(event) {},\n\t_mouseCapture: function(event) { return true; }\n});\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.widget(\"ui.draggable\", $.ui.mouse, {\n\twidgetEventPrefix: \"drag\",\n\toptions: {\n\t\taddClasses: true,\n\t\tappendTo: \"parent\",\n\t\taxis: false,\n\t\tconnectToSortable: false,\n\t\tcontainment: false,\n\t\tcursor: \"auto\",\n\t\tcursorAt: false,\n\t\tgrid: false,\n\t\thandle: false,\n\t\thelper: \"original\",\n\t\tiframeFix: false,\n\t\topacity: false,\n\t\trefreshPositions: false,\n\t\trevert: false,\n\t\trevertDuration: 500,\n\t\tscope: \"default\",\n\t\tscroll: true,\n\t\tscrollSensitivity: 20,\n\t\tscrollSpeed: 20,\n\t\tsnap: false,\n\t\tsnapMode: \"both\",\n\t\tsnapTolerance: 20,\n\t\tstack: false,\n\t\tzIndex: false\n\t},\n\t_create: function() {\n\n\t\tif (this.options.helper == 'original' && !(/^(?:r|a|f)/).test(this.element.css(\"position\")))\n\t\t\tthis.element[0].style.position = 'relative';\n\n\t\t(this.options.addClasses && this.element.addClass(\"ui-draggable\"));\n\t\t(this.options.disabled && this.element.addClass(\"ui-draggable-disabled\"));\n\n\t\tthis._mouseInit();\n\n\t},\n\n\tdestroy: function() {\n\t\tif(!this.element.data('draggable')) return;\n\t\tthis.element\n\t\t\t.removeData(\"draggable\")\n\t\t\t.unbind(\".draggable\")\n\t\t\t.removeClass(\"ui-draggable\"\n\t\t\t\t+ \" ui-draggable-dragging\"\n\t\t\t\t+ \" ui-draggable-disabled\");\n\t\tthis._mouseDestroy();\n\n\t\treturn this;\n\t},\n\n\t_mouseCapture: function(event) {\n\n\t\tvar o = this.options;\n\n\t\t// among others, prevent a drag on a resizable-handle\n\t\tif (this.helper || o.disabled || $(event.target).is('.ui-resizable-handle'))\n\t\t\treturn false;\n\n\t\t//Quit if we're not on a valid handle\n\t\tthis.handle = this._getHandle(event);\n\t\tif (!this.handle)\n\t\t\treturn false;\n\t\t\n\t\tif ( o.iframeFix ) {\n\t\t\t$(o.iframeFix === true ? \"iframe\" : o.iframeFix).each(function() {\n\t\t\t\t$('<div class=\"ui-draggable-iframeFix\" style=\"background: #fff;\"></div>')\n\t\t\t\t.css({\n\t\t\t\t\twidth: this.offsetWidth+\"px\", height: this.offsetHeight+\"px\",\n\t\t\t\t\tposition: \"absolute\", opacity: \"0.001\", zIndex: 1000\n\t\t\t\t})\n\t\t\t\t.css($(this).offset())\n\t\t\t\t.appendTo(\"body\");\n\t\t\t});\n\t\t}\n\n\t\treturn true;\n\n\t},\n\n\t_mouseStart: function(event) {\n\n\t\tvar o = this.options;\n\n\t\t//Create and append the visible helper\n\t\tthis.helper = this._createHelper(event);\n\n\t\tthis.helper.addClass(\"ui-draggable-dragging\");\n\n\t\t//Cache the helper size\n\t\tthis._cacheHelperProportions();\n\n\t\t//If ddmanager is used for droppables, set the global draggable\n\t\tif($.ui.ddmanager)\n\t\t\t$.ui.ddmanager.current = this;\n\n\t\t/*\n\t\t * - Position generation -\n\t\t * This block generates everything position related - it's the core of draggables.\n\t\t */\n\n\t\t//Cache the margins of the original element\n\t\tthis._cacheMargins();\n\n\t\t//Store the helper's css position\n\t\tthis.cssPosition = this.helper.css(\"position\");\n\t\tthis.scrollParent = this.helper.scrollParent();\n\n\t\t//The element's absolute position on the page minus margins\n\t\tthis.offset = this.positionAbs = this.element.offset();\n\t\tthis.offset = {\n\t\t\ttop: this.offset.top - this.margins.top,\n\t\t\tleft: this.offset.left - this.margins.left\n\t\t};\n\n\t\t$.extend(this.offset, {\n\t\t\tclick: { //Where the click happened, relative to the element\n\t\t\t\tleft: event.pageX - this.offset.left,\n\t\t\t\ttop: event.pageY - this.offset.top\n\t\t\t},\n\t\t\tparent: this._getParentOffset(),\n\t\t\trelative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper\n\t\t});\n\n\t\t//Generate the original position\n\t\tthis.originalPosition = this.position = this._generatePosition(event);\n\t\tthis.originalPageX = event.pageX;\n\t\tthis.originalPageY = event.pageY;\n\n\t\t//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied\n\t\t(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));\n\n\t\t//Set a containment if given in the options\n\t\tif(o.containment)\n\t\t\tthis._setContainment();\n\n\t\t//Trigger event + callbacks\n\t\tif(this._trigger(\"start\", event) === false) {\n\t\t\tthis._clear();\n\t\t\treturn false;\n\t\t}\n\n\t\t//Recache the helper size\n\t\tthis._cacheHelperProportions();\n\n\t\t//Prepare the droppable offsets\n\t\tif ($.ui.ddmanager && !o.dropBehaviour)\n\t\t\t$.ui.ddmanager.prepareOffsets(this, event);\n\n\t\t\n\t\tthis._mouseDrag(event, true); //Execute the drag once - this causes the helper not to be visible before getting its correct position\n\t\t\n\t\t//If the ddmanager is used for droppables, inform the manager that dragging has started (see #5003)\n\t\tif ( $.ui.ddmanager ) $.ui.ddmanager.dragStart(this, event);\n\t\t\n\t\treturn true;\n\t},\n\n\t_mouseDrag: function(event, noPropagation) {\n\n\t\t//Compute the helpers position\n\t\tthis.position = this._generatePosition(event);\n\t\tthis.positionAbs = this._convertPositionTo(\"absolute\");\n\n\t\t//Call plugins and callbacks and use the resulting position if something is returned\n\t\tif (!noPropagation) {\n\t\t\tvar ui = this._uiHash();\n\t\t\tif(this._trigger('drag', event, ui) === false) {\n\t\t\t\tthis._mouseUp({});\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tthis.position = ui.position;\n\t\t}\n\n\t\tif(!this.options.axis || this.options.axis != \"y\") this.helper[0].style.left = this.position.left+'px';\n\t\tif(!this.options.axis || this.options.axis != \"x\") this.helper[0].style.top = this.position.top+'px';\n\t\tif($.ui.ddmanager) $.ui.ddmanager.drag(this, event);\n\n\t\treturn false;\n\t},\n\n\t_mouseStop: function(event) {\n\n\t\t//If we are using droppables, inform the manager about the drop\n\t\tvar dropped = false;\n\t\tif ($.ui.ddmanager && !this.options.dropBehaviour)\n\t\t\tdropped = $.ui.ddmanager.drop(this, event);\n\n\t\t//if a drop comes from outside (a sortable)\n\t\tif(this.dropped) {\n\t\t\tdropped = this.dropped;\n\t\t\tthis.dropped = false;\n\t\t}\n\t\t\n\t\t//if the original element is no longer in the DOM don't bother to continue (see #8269)\n\t\tvar element = this.element[0], elementInDom = false;\n\t\twhile ( element && (element = element.parentNode) ) {\n\t\t\tif (element == document ) {\n\t\t\t\telementInDom = true;\n\t\t\t}\n\t\t}\n\t\tif ( !elementInDom && this.options.helper === \"original\" )\n\t\t\treturn false;\n\n\t\tif((this.options.revert == \"invalid\" && !dropped) || (this.options.revert == \"valid\" && dropped) || this.options.revert === true || ($.isFunction(this.options.revert) && this.options.revert.call(this.element, dropped))) {\n\t\t\tvar self = this;\n\t\t\t$(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() {\n\t\t\t\tif(self._trigger(\"stop\", event) !== false) {\n\t\t\t\t\tself._clear();\n\t\t\t\t}\n\t\t\t});\n\t\t} else {\n\t\t\tif(this._trigger(\"stop\", event) !== false) {\n\t\t\t\tthis._clear();\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t},\n\t\n\t_mouseUp: function(event) {\n\t\t//Remove frame helpers\n\t\t$(\"div.ui-draggable-iframeFix\").each(function() { \n\t\t\tthis.parentNode.removeChild(this); \n\t\t});\n\t\t\n\t\t//If the ddmanager is used for droppables, inform the manager that dragging has stopped (see #5003)\n\t\tif( $.ui.ddmanager ) $.ui.ddmanager.dragStop(this, event);\n\t\t\n\t\treturn $.ui.mouse.prototype._mouseUp.call(this, event);\n\t},\n\t\n\tcancel: function() {\n\t\t\n\t\tif(this.helper.is(\".ui-draggable-dragging\")) {\n\t\t\tthis._mouseUp({});\n\t\t} else {\n\t\t\tthis._clear();\n\t\t}\n\t\t\n\t\treturn this;\n\t\t\n\t},\n\n\t_getHandle: function(event) {\n\n\t\tvar handle = !this.options.handle || !$(this.options.handle, this.element).length ? true : false;\n\t\t$(this.options.handle, this.element)\n\t\t\t.find(\"*\")\n\t\t\t.andSelf()\n\t\t\t.each(function() {\n\t\t\t\tif(this == event.target) handle = true;\n\t\t\t});\n\n\t\treturn handle;\n\n\t},\n\n\t_createHelper: function(event) {\n\n\t\tvar o = this.options;\n\t\tvar helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event])) : (o.helper == 'clone' ? this.element.clone().removeAttr('id') : this.element);\n\n\t\tif(!helper.parents('body').length)\n\t\t\thelper.appendTo((o.appendTo == 'parent' ? this.element[0].parentNode : o.appendTo));\n\n\t\tif(helper[0] != this.element[0] && !(/(fixed|absolute)/).test(helper.css(\"position\")))\n\t\t\thelper.css(\"position\", \"absolute\");\n\n\t\treturn helper;\n\n\t},\n\n\t_adjustOffsetFromHelper: function(obj) {\n\t\tif (typeof obj == 'string') {\n\t\t\tobj = obj.split(' ');\n\t\t}\n\t\tif ($.isArray(obj)) {\n\t\t\tobj = {left: +obj[0], top: +obj[1] || 0};\n\t\t}\n\t\tif ('left' in obj) {\n\t\t\tthis.offset.click.left = obj.left + this.margins.left;\n\t\t}\n\t\tif ('right' in obj) {\n\t\t\tthis.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;\n\t\t}\n\t\tif ('top' in obj) {\n\t\t\tthis.offset.click.top = obj.top + this.margins.top;\n\t\t}\n\t\tif ('bottom' in obj) {\n\t\t\tthis.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;\n\t\t}\n\t},\n\n\t_getParentOffset: function() {\n\n\t\t//Get the offsetParent and cache its position\n\t\tthis.offsetParent = this.helper.offsetParent();\n\t\tvar po = this.offsetParent.offset();\n\n\t\t// This is a special case where we need to modify a offset calculated on start, since the following happened:\n\t\t// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent\n\t\t// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that\n\t\t//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag\n\t\tif(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {\n\t\t\tpo.left += this.scrollParent.scrollLeft();\n\t\t\tpo.top += this.scrollParent.scrollTop();\n\t\t}\n\n\t\tif((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information\n\t\t|| (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix\n\t\t\tpo = { top: 0, left: 0 };\n\n\t\treturn {\n\t\t\ttop: po.top + (parseInt(this.offsetParent.css(\"borderTopWidth\"),10) || 0),\n\t\t\tleft: po.left + (parseInt(this.offsetParent.css(\"borderLeftWidth\"),10) || 0)\n\t\t};\n\n\t},\n\n\t_getRelativeOffset: function() {\n\n\t\tif(this.cssPosition == \"relative\") {\n\t\t\tvar p = this.element.position();\n\t\t\treturn {\n\t\t\t\ttop: p.top - (parseInt(this.helper.css(\"top\"),10) || 0) + this.scrollParent.scrollTop(),\n\t\t\t\tleft: p.left - (parseInt(this.helper.css(\"left\"),10) || 0) + this.scrollParent.scrollLeft()\n\t\t\t};\n\t\t} else {\n\t\t\treturn { top: 0, left: 0 };\n\t\t}\n\n\t},\n\n\t_cacheMargins: function() {\n\t\tthis.margins = {\n\t\t\tleft: (parseInt(this.element.css(\"marginLeft\"),10) || 0),\n\t\t\ttop: (parseInt(this.element.css(\"marginTop\"),10) || 0),\n\t\t\tright: (parseInt(this.element.css(\"marginRight\"),10) || 0),\n\t\t\tbottom: (parseInt(this.element.css(\"marginBottom\"),10) || 0)\n\t\t};\n\t},\n\n\t_cacheHelperProportions: function() {\n\t\tthis.helperProportions = {\n\t\t\twidth: this.helper.outerWidth(),\n\t\t\theight: this.helper.outerHeight()\n\t\t};\n\t},\n\n\t_setContainment: function() {\n\n\t\tvar o = this.options;\n\t\tif(o.containment == 'parent') o.containment = this.helper[0].parentNode;\n\t\tif(o.containment == 'document' || o.containment == 'window') this.containment = [\n\t\t\to.containment == 'document' ? 0 : $(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left,\n\t\t\to.containment == 'document' ? 0 : $(window).scrollTop() - this.offset.relative.top - this.offset.parent.top,\n\t\t\t(o.containment == 'document' ? 0 : $(window).scrollLeft()) + $(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,\n\t\t\t(o.containment == 'document' ? 0 : $(window).scrollTop()) + ($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top\n\t\t];\n\n\t\tif(!(/^(document|window|parent)$/).test(o.containment) && o.containment.constructor != Array) {\n\t\t        var c = $(o.containment);\n\t\t\tvar ce = c[0]; if(!ce) return;\n\t\t\tvar co = c.offset();\n\t\t\tvar over = ($(ce).css(\"overflow\") != 'hidden');\n\n\t\t\tthis.containment = [\n\t\t\t\t(parseInt($(ce).css(\"borderLeftWidth\"),10) || 0) + (parseInt($(ce).css(\"paddingLeft\"),10) || 0),\n\t\t\t\t(parseInt($(ce).css(\"borderTopWidth\"),10) || 0) + (parseInt($(ce).css(\"paddingTop\"),10) || 0),\n\t\t\t\t(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css(\"borderLeftWidth\"),10) || 0) - (parseInt($(ce).css(\"paddingRight\"),10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right,\n\t\t\t\t(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css(\"borderTopWidth\"),10) || 0) - (parseInt($(ce).css(\"paddingBottom\"),10) || 0) - this.helperProportions.height - this.margins.top  - this.margins.bottom\n\t\t\t];\n\t\t\tthis.relative_container = c;\n\n\t\t} else if(o.containment.constructor == Array) {\n\t\t\tthis.containment = o.containment;\n\t\t}\n\n\t},\n\n\t_convertPositionTo: function(d, pos) {\n\n\t\tif(!pos) pos = this.position;\n\t\tvar mod = d == \"absolute\" ? 1 : -1;\n\t\tvar o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);\n\n\t\treturn {\n\t\t\ttop: (\n\t\t\t\tpos.top\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// The absolute mouse position\n\t\t\t\t+ this.offset.relative.top * mod\t\t\t\t\t\t\t\t\t\t// Only for relative positioned nodes: Relative offset from element to offset parent\n\t\t\t\t+ this.offset.parent.top * mod\t\t\t\t\t\t\t\t\t\t\t// The offsetParent's offset without borders (offset + border)\n\t\t\t\t- ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)\n\t\t\t),\n\t\t\tleft: (\n\t\t\t\tpos.left\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// The absolute mouse position\n\t\t\t\t+ this.offset.relative.left * mod\t\t\t\t\t\t\t\t\t\t// Only for relative positioned nodes: Relative offset from element to offset parent\n\t\t\t\t+ this.offset.parent.left * mod\t\t\t\t\t\t\t\t\t\t\t// The offsetParent's offset without borders (offset + border)\n\t\t\t\t- ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)\n\t\t\t)\n\t\t};\n\n\t},\n\n\t_generatePosition: function(event) {\n\n\t\tvar o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);\n\t\tvar pageX = event.pageX;\n\t\tvar pageY = event.pageY;\n\n\t\t/*\n\t\t * - Position constraining -\n\t\t * Constrain the position to a mix of grid, containment.\n\t\t */\n\n\t\tif(this.originalPosition) { //If we are not dragging yet, we won't check for options\n\t\t         var containment;\n\t\t         if(this.containment) {\n\t\t\t\t if (this.relative_container){\n\t\t\t\t     var co = this.relative_container.offset();\n\t\t\t\t     containment = [ this.containment[0] + co.left,\n\t\t\t\t\t\t     this.containment[1] + co.top,\n\t\t\t\t\t\t     this.containment[2] + co.left,\n\t\t\t\t\t\t     this.containment[3] + co.top ];\n\t\t\t\t }\n\t\t\t\t else {\n\t\t\t\t     containment = this.containment;\n\t\t\t\t }\n\n\t\t\t\tif(event.pageX - this.offset.click.left < containment[0]) pageX = containment[0] + this.offset.click.left;\n\t\t\t\tif(event.pageY - this.offset.click.top < containment[1]) pageY = containment[1] + this.offset.click.top;\n\t\t\t\tif(event.pageX - this.offset.click.left > containment[2]) pageX = containment[2] + this.offset.click.left;\n\t\t\t\tif(event.pageY - this.offset.click.top > containment[3]) pageY = containment[3] + this.offset.click.top;\n\t\t\t}\n\n\t\t\tif(o.grid) {\n\t\t\t\t//Check for grid elements set to 0 to prevent divide by 0 error causing invalid argument errors in IE (see ticket #6950)\n\t\t\t\tvar top = o.grid[1] ? this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1] : this.originalPageY;\n\t\t\t\tpageY = containment ? (!(top - this.offset.click.top < containment[1] || top - this.offset.click.top > containment[3]) ? top : (!(top - this.offset.click.top < containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;\n\n\t\t\t\tvar left = o.grid[0] ? this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0] : this.originalPageX;\n\t\t\t\tpageX = containment ? (!(left - this.offset.click.left < containment[0] || left - this.offset.click.left > containment[2]) ? left : (!(left - this.offset.click.left < containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;\n\t\t\t}\n\n\t\t}\n\n\t\treturn {\n\t\t\ttop: (\n\t\t\t\tpageY\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// The absolute mouse position\n\t\t\t\t- this.offset.click.top\t\t\t\t\t\t\t\t\t\t\t\t\t// Click offset (relative to the element)\n\t\t\t\t- this.offset.relative.top\t\t\t\t\t\t\t\t\t\t\t\t// Only for relative positioned nodes: Relative offset from element to offset parent\n\t\t\t\t- this.offset.parent.top\t\t\t\t\t\t\t\t\t\t\t\t// The offsetParent's offset without borders (offset + border)\n\t\t\t\t+ ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))\n\t\t\t),\n\t\t\tleft: (\n\t\t\t\tpageX\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// The absolute mouse position\n\t\t\t\t- this.offset.click.left\t\t\t\t\t\t\t\t\t\t\t\t// Click offset (relative to the element)\n\t\t\t\t- this.offset.relative.left\t\t\t\t\t\t\t\t\t\t\t\t// Only for relative positioned nodes: Relative offset from element to offset parent\n\t\t\t\t- this.offset.parent.left\t\t\t\t\t\t\t\t\t\t\t\t// The offsetParent's offset without borders (offset + border)\n\t\t\t\t+ ($.browser.safari && $.browser.version < 526 && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))\n\t\t\t)\n\t\t};\n\n\t},\n\n\t_clear: function() {\n\t\tthis.helper.removeClass(\"ui-draggable-dragging\");\n\t\tif(this.helper[0] != this.element[0] && !this.cancelHelperRemoval) this.helper.remove();\n\t\t//if($.ui.ddmanager) $.ui.ddmanager.current = null;\n\t\tthis.helper = null;\n\t\tthis.cancelHelperRemoval = false;\n\t},\n\n\t// From now on bulk stuff - mainly helpers\n\n\t_trigger: function(type, event, ui) {\n\t\tui = ui || this._uiHash();\n\t\t$.ui.plugin.call(this, type, [event, ui]);\n\t\tif(type == \"drag\") this.positionAbs = this._convertPositionTo(\"absolute\"); //The absolute position has to be recalculated after plugins\n\t\treturn $.Widget.prototype._trigger.call(this, type, event, ui);\n\t},\n\n\tplugins: {},\n\n\t_uiHash: function(event) {\n\t\treturn {\n\t\t\thelper: this.helper,\n\t\t\tposition: this.position,\n\t\t\toriginalPosition: this.originalPosition,\n\t\t\toffset: this.positionAbs\n\t\t};\n\t}\n\n});\n\n$.extend($.ui.draggable, {\n\tversion: \"1.8.24\"\n});\n\n$.ui.plugin.add(\"draggable\", \"connectToSortable\", {\n\tstart: function(event, ui) {\n\n\t\tvar inst = $(this).data(\"draggable\"), o = inst.options,\n\t\t\tuiSortable = $.extend({}, ui, { item: inst.element });\n\t\tinst.sortables = [];\n\t\t$(o.connectToSortable).each(function() {\n\t\t\tvar sortable = $.data(this, 'sortable');\n\t\t\tif (sortable && !sortable.options.disabled) {\n\t\t\t\tinst.sortables.push({\n\t\t\t\t\tinstance: sortable,\n\t\t\t\t\tshouldRevert: sortable.options.revert\n\t\t\t\t});\n\t\t\t\tsortable.refreshPositions();\t// Call the sortable's refreshPositions at drag start to refresh the containerCache since the sortable container cache is used in drag and needs to be up to date (this will ensure it's initialised as well as being kept in step with any changes that might have happened on the page).\n\t\t\t\tsortable._trigger(\"activate\", event, uiSortable);\n\t\t\t}\n\t\t});\n\n\t},\n\tstop: function(event, ui) {\n\n\t\t//If we are still over the sortable, we fake the stop event of the sortable, but also remove helper\n\t\tvar inst = $(this).data(\"draggable\"),\n\t\t\tuiSortable = $.extend({}, ui, { item: inst.element });\n\n\t\t$.each(inst.sortables, function() {\n\t\t\tif(this.instance.isOver) {\n\n\t\t\t\tthis.instance.isOver = 0;\n\n\t\t\t\tinst.cancelHelperRemoval = true; //Don't remove the helper in the draggable instance\n\t\t\t\tthis.instance.cancelHelperRemoval = false; //Remove it in the sortable instance (so sortable plugins like revert still work)\n\n\t\t\t\t//The sortable revert is supported, and we have to set a temporary dropped variable on the draggable to support revert: 'valid/invalid'\n\t\t\t\tif(this.shouldRevert) this.instance.options.revert = true;\n\n\t\t\t\t//Trigger the stop of the sortable\n\t\t\t\tthis.instance._mouseStop(event);\n\n\t\t\t\tthis.instance.options.helper = this.instance.options._helper;\n\n\t\t\t\t//If the helper has been the original item, restore properties in the sortable\n\t\t\t\tif(inst.options.helper == 'original')\n\t\t\t\t\tthis.instance.currentItem.css({ top: 'auto', left: 'auto' });\n\n\t\t\t} else {\n\t\t\t\tthis.instance.cancelHelperRemoval = false; //Remove the helper in the sortable instance\n\t\t\t\tthis.instance._trigger(\"deactivate\", event, uiSortable);\n\t\t\t}\n\n\t\t});\n\n\t},\n\tdrag: function(event, ui) {\n\n\t\tvar inst = $(this).data(\"draggable\"), self = this;\n\n\t\tvar checkPos = function(o) {\n\t\t\tvar dyClick = this.offset.click.top, dxClick = this.offset.click.left;\n\t\t\tvar helperTop = this.positionAbs.top, helperLeft = this.positionAbs.left;\n\t\t\tvar itemHeight = o.height, itemWidth = o.width;\n\t\t\tvar itemTop = o.top, itemLeft = o.left;\n\n\t\t\treturn $.ui.isOver(helperTop + dyClick, helperLeft + dxClick, itemTop, itemLeft, itemHeight, itemWidth);\n\t\t};\n\n\t\t$.each(inst.sortables, function(i) {\n\t\t\t\n\t\t\t//Copy over some variables to allow calling the sortable's native _intersectsWith\n\t\t\tthis.instance.positionAbs = inst.positionAbs;\n\t\t\tthis.instance.helperProportions = inst.helperProportions;\n\t\t\tthis.instance.offset.click = inst.offset.click;\n\t\t\t\n\t\t\tif(this.instance._intersectsWith(this.instance.containerCache)) {\n\n\t\t\t\t//If it intersects, we use a little isOver variable and set it once, so our move-in stuff gets fired only once\n\t\t\t\tif(!this.instance.isOver) {\n\n\t\t\t\t\tthis.instance.isOver = 1;\n\t\t\t\t\t//Now we fake the start of dragging for the sortable instance,\n\t\t\t\t\t//by cloning the list group item, appending it to the sortable and using it as inst.currentItem\n\t\t\t\t\t//We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)\n\t\t\t\t\tthis.instance.currentItem = $(self).clone().removeAttr('id').appendTo(this.instance.element).data(\"sortable-item\", true);\n\t\t\t\t\tthis.instance.options._helper = this.instance.options.helper; //Store helper option to later restore it\n\t\t\t\t\tthis.instance.options.helper = function() { return ui.helper[0]; };\n\n\t\t\t\t\tevent.target = this.instance.currentItem[0];\n\t\t\t\t\tthis.instance._mouseCapture(event, true);\n\t\t\t\t\tthis.instance._mouseStart(event, true, true);\n\n\t\t\t\t\t//Because the browser event is way off the new appended portlet, we modify a couple of variables to reflect the changes\n\t\t\t\t\tthis.instance.offset.click.top = inst.offset.click.top;\n\t\t\t\t\tthis.instance.offset.click.left = inst.offset.click.left;\n\t\t\t\t\tthis.instance.offset.parent.left -= inst.offset.parent.left - this.instance.offset.parent.left;\n\t\t\t\t\tthis.instance.offset.parent.top -= inst.offset.parent.top - this.instance.offset.parent.top;\n\n\t\t\t\t\tinst._trigger(\"toSortable\", event);\n\t\t\t\t\tinst.dropped = this.instance.element; //draggable revert needs that\n\t\t\t\t\t//hack so receive/update callbacks work (mostly)\n\t\t\t\t\tinst.currentItem = inst.element;\n\t\t\t\t\tthis.instance.fromOutside = inst;\n\n\t\t\t\t}\n\n\t\t\t\t//Provided we did all the previous steps, we can fire the drag event of the sortable on every draggable drag, when it intersects with the sortable\n\t\t\t\tif(this.instance.currentItem) this.instance._mouseDrag(event);\n\n\t\t\t} else {\n\n\t\t\t\t//If it doesn't intersect with the sortable, and it intersected before,\n\t\t\t\t//we fake the drag stop of the sortable, but make sure it doesn't remove the helper by using cancelHelperRemoval\n\t\t\t\tif(this.instance.isOver) {\n\n\t\t\t\t\tthis.instance.isOver = 0;\n\t\t\t\t\tthis.instance.cancelHelperRemoval = true;\n\t\t\t\t\t\n\t\t\t\t\t//Prevent reverting on this forced stop\n\t\t\t\t\tthis.instance.options.revert = false;\n\t\t\t\t\t\n\t\t\t\t\t// The out event needs to be triggered independently\n\t\t\t\t\tthis.instance._trigger('out', event, this.instance._uiHash(this.instance));\n\t\t\t\t\t\n\t\t\t\t\tthis.instance._mouseStop(event, true);\n\t\t\t\t\tthis.instance.options.helper = this.instance.options._helper;\n\n\t\t\t\t\t//Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size\n\t\t\t\t\tthis.instance.currentItem.remove();\n\t\t\t\t\tif(this.instance.placeholder) this.instance.placeholder.remove();\n\n\t\t\t\t\tinst._trigger(\"fromSortable\", event);\n\t\t\t\t\tinst.dropped = false; //draggable revert needs that\n\t\t\t\t}\n\n\t\t\t};\n\n\t\t});\n\n\t}\n});\n\n$.ui.plugin.add(\"draggable\", \"cursor\", {\n\tstart: function(event, ui) {\n\t\tvar t = $('body'), o = $(this).data('draggable').options;\n\t\tif (t.css(\"cursor\")) o._cursor = t.css(\"cursor\");\n\t\tt.css(\"cursor\", o.cursor);\n\t},\n\tstop: function(event, ui) {\n\t\tvar o = $(this).data('draggable').options;\n\t\tif (o._cursor) $('body').css(\"cursor\", o._cursor);\n\t}\n});\n\n$.ui.plugin.add(\"draggable\", \"opacity\", {\n\tstart: function(event, ui) {\n\t\tvar t = $(ui.helper), o = $(this).data('draggable').options;\n\t\tif(t.css(\"opacity\")) o._opacity = t.css(\"opacity\");\n\t\tt.css('opacity', o.opacity);\n\t},\n\tstop: function(event, ui) {\n\t\tvar o = $(this).data('draggable').options;\n\t\tif(o._opacity) $(ui.helper).css('opacity', o._opacity);\n\t}\n});\n\n$.ui.plugin.add(\"draggable\", \"scroll\", {\n\tstart: function(event, ui) {\n\t\tvar i = $(this).data(\"draggable\");\n\t\tif(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') i.overflowOffset = i.scrollParent.offset();\n\t},\n\tdrag: function(event, ui) {\n\n\t\tvar i = $(this).data(\"draggable\"), o = i.options, scrolled = false;\n\n\t\tif(i.scrollParent[0] != document && i.scrollParent[0].tagName != 'HTML') {\n\n\t\t\tif(!o.axis || o.axis != 'x') {\n\t\t\t\tif((i.overflowOffset.top + i.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)\n\t\t\t\t\ti.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop + o.scrollSpeed;\n\t\t\t\telse if(event.pageY - i.overflowOffset.top < o.scrollSensitivity)\n\t\t\t\t\ti.scrollParent[0].scrollTop = scrolled = i.scrollParent[0].scrollTop - o.scrollSpeed;\n\t\t\t}\n\n\t\t\tif(!o.axis || o.axis != 'y') {\n\t\t\t\tif((i.overflowOffset.left + i.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)\n\t\t\t\t\ti.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft + o.scrollSpeed;\n\t\t\t\telse if(event.pageX - i.overflowOffset.left < o.scrollSensitivity)\n\t\t\t\t\ti.scrollParent[0].scrollLeft = scrolled = i.scrollParent[0].scrollLeft - o.scrollSpeed;\n\t\t\t}\n\n\t\t} else {\n\n\t\t\tif(!o.axis || o.axis != 'x') {\n\t\t\t\tif(event.pageY - $(document).scrollTop() < o.scrollSensitivity)\n\t\t\t\t\tscrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);\n\t\t\t\telse if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)\n\t\t\t\t\tscrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);\n\t\t\t}\n\n\t\t\tif(!o.axis || o.axis != 'y') {\n\t\t\t\tif(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)\n\t\t\t\t\tscrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);\n\t\t\t\telse if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)\n\t\t\t\t\tscrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);\n\t\t\t}\n\n\t\t}\n\n\t\tif(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)\n\t\t\t$.ui.ddmanager.prepareOffsets(i, event);\n\n\t}\n});\n\n$.ui.plugin.add(\"draggable\", \"snap\", {\n\tstart: function(event, ui) {\n\n\t\tvar i = $(this).data(\"draggable\"), o = i.options;\n\t\ti.snapElements = [];\n\n\t\t$(o.snap.constructor != String ? ( o.snap.items || ':data(draggable)' ) : o.snap).each(function() {\n\t\t\tvar $t = $(this); var $o = $t.offset();\n\t\t\tif(this != i.element[0]) i.snapElements.push({\n\t\t\t\titem: this,\n\t\t\t\twidth: $t.outerWidth(), height: $t.outerHeight(),\n\t\t\t\ttop: $o.top, left: $o.left\n\t\t\t});\n\t\t});\n\n\t},\n\tdrag: function(event, ui) {\n\n\t\tvar inst = $(this).data(\"draggable\"), o = inst.options;\n\t\tvar d = o.snapTolerance;\n\n\t\tvar x1 = ui.offset.left, x2 = x1 + inst.helperProportions.width,\n\t\t\ty1 = ui.offset.top, y2 = y1 + inst.helperProportions.height;\n\n\t\tfor (var i = inst.snapElements.length - 1; i >= 0; i--){\n\n\t\t\tvar l = inst.snapElements[i].left, r = l + inst.snapElements[i].width,\n\t\t\t\tt = inst.snapElements[i].top, b = t + inst.snapElements[i].height;\n\n\t\t\t//Yes, I know, this is insane ;)\n\t\t\tif(!((l-d < x1 && x1 < r+d && t-d < y1 && y1 < b+d) || (l-d < x1 && x1 < r+d && t-d < y2 && y2 < b+d) || (l-d < x2 && x2 < r+d && t-d < y1 && y1 < b+d) || (l-d < x2 && x2 < r+d && t-d < y2 && y2 < b+d))) {\n\t\t\t\tif(inst.snapElements[i].snapping) (inst.options.snap.release && inst.options.snap.release.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));\n\t\t\t\tinst.snapElements[i].snapping = false;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif(o.snapMode != 'inner') {\n\t\t\t\tvar ts = Math.abs(t - y2) <= d;\n\t\t\t\tvar bs = Math.abs(b - y1) <= d;\n\t\t\t\tvar ls = Math.abs(l - x2) <= d;\n\t\t\t\tvar rs = Math.abs(r - x1) <= d;\n\t\t\t\tif(ts) ui.position.top = inst._convertPositionTo(\"relative\", { top: t - inst.helperProportions.height, left: 0 }).top - inst.margins.top;\n\t\t\t\tif(bs) ui.position.top = inst._convertPositionTo(\"relative\", { top: b, left: 0 }).top - inst.margins.top;\n\t\t\t\tif(ls) ui.position.left = inst._convertPositionTo(\"relative\", { top: 0, left: l - inst.helperProportions.width }).left - inst.margins.left;\n\t\t\t\tif(rs) ui.position.left = inst._convertPositionTo(\"relative\", { top: 0, left: r }).left - inst.margins.left;\n\t\t\t}\n\n\t\t\tvar first = (ts || bs || ls || rs);\n\n\t\t\tif(o.snapMode != 'outer') {\n\t\t\t\tvar ts = Math.abs(t - y1) <= d;\n\t\t\t\tvar bs = Math.abs(b - y2) <= d;\n\t\t\t\tvar ls = Math.abs(l - x1) <= d;\n\t\t\t\tvar rs = Math.abs(r - x2) <= d;\n\t\t\t\tif(ts) ui.position.top = inst._convertPositionTo(\"relative\", { top: t, left: 0 }).top - inst.margins.top;\n\t\t\t\tif(bs) ui.position.top = inst._convertPositionTo(\"relative\", { top: b - inst.helperProportions.height, left: 0 }).top - inst.margins.top;\n\t\t\t\tif(ls) ui.position.left = inst._convertPositionTo(\"relative\", { top: 0, left: l }).left - inst.margins.left;\n\t\t\t\tif(rs) ui.position.left = inst._convertPositionTo(\"relative\", { top: 0, left: r - inst.helperProportions.width }).left - inst.margins.left;\n\t\t\t}\n\n\t\t\tif(!inst.snapElements[i].snapping && (ts || bs || ls || rs || first))\n\t\t\t\t(inst.options.snap.snap && inst.options.snap.snap.call(inst.element, event, $.extend(inst._uiHash(), { snapItem: inst.snapElements[i].item })));\n\t\t\tinst.snapElements[i].snapping = (ts || bs || ls || rs || first);\n\n\t\t};\n\n\t}\n});\n\n$.ui.plugin.add(\"draggable\", \"stack\", {\n\tstart: function(event, ui) {\n\n\t\tvar o = $(this).data(\"draggable\").options;\n\n\t\tvar group = $.makeArray($(o.stack)).sort(function(a,b) {\n\t\t\treturn (parseInt($(a).css(\"zIndex\"),10) || 0) - (parseInt($(b).css(\"zIndex\"),10) || 0);\n\t\t});\n\t\tif (!group.length) { return; }\n\t\t\n\t\tvar min = parseInt(group[0].style.zIndex) || 0;\n\t\t$(group).each(function(i) {\n\t\t\tthis.style.zIndex = min + i;\n\t\t});\n\n\t\tthis[0].style.zIndex = min + group.length;\n\n\t}\n});\n\n$.ui.plugin.add(\"draggable\", \"zIndex\", {\n\tstart: function(event, ui) {\n\t\tvar t = $(ui.helper), o = $(this).data(\"draggable\").options;\n\t\tif(t.css(\"zIndex\")) o._zIndex = t.css(\"zIndex\");\n\t\tt.css('zIndex', o.zIndex);\n\t},\n\tstop: function(event, ui) {\n\t\tvar o = $(this).data(\"draggable\").options;\n\t\tif(o._zIndex) $(ui.helper).css('zIndex', o._zIndex);\n\t}\n});\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.widget(\"ui.droppable\", {\n\twidgetEventPrefix: \"drop\",\n\toptions: {\n\t\taccept: '*',\n\t\tactiveClass: false,\n\t\taddClasses: true,\n\t\tgreedy: false,\n\t\thoverClass: false,\n\t\tscope: 'default',\n\t\ttolerance: 'intersect'\n\t},\n\t_create: function() {\n\n\t\tvar o = this.options, accept = o.accept;\n\t\tthis.isover = 0; this.isout = 1;\n\n\t\tthis.accept = $.isFunction(accept) ? accept : function(d) {\n\t\t\treturn d.is(accept);\n\t\t};\n\n\t\t//Store the droppable's proportions\n\t\tthis.proportions = { width: this.element[0].offsetWidth, height: this.element[0].offsetHeight };\n\n\t\t// Add the reference and positions to the manager\n\t\t$.ui.ddmanager.droppables[o.scope] = $.ui.ddmanager.droppables[o.scope] || [];\n\t\t$.ui.ddmanager.droppables[o.scope].push(this);\n\n\t\t(o.addClasses && this.element.addClass(\"ui-droppable\"));\n\n\t},\n\n\tdestroy: function() {\n\t\tvar drop = $.ui.ddmanager.droppables[this.options.scope];\n\t\tfor ( var i = 0; i < drop.length; i++ )\n\t\t\tif ( drop[i] == this )\n\t\t\t\tdrop.splice(i, 1);\n\n\t\tthis.element\n\t\t\t.removeClass(\"ui-droppable ui-droppable-disabled\")\n\t\t\t.removeData(\"droppable\")\n\t\t\t.unbind(\".droppable\");\n\n\t\treturn this;\n\t},\n\n\t_setOption: function(key, value) {\n\n\t\tif(key == 'accept') {\n\t\t\tthis.accept = $.isFunction(value) ? value : function(d) {\n\t\t\t\treturn d.is(value);\n\t\t\t};\n\t\t}\n\t\t$.Widget.prototype._setOption.apply(this, arguments);\n\t},\n\n\t_activate: function(event) {\n\t\tvar draggable = $.ui.ddmanager.current;\n\t\tif(this.options.activeClass) this.element.addClass(this.options.activeClass);\n\t\t(draggable && this._trigger('activate', event, this.ui(draggable)));\n\t},\n\n\t_deactivate: function(event) {\n\t\tvar draggable = $.ui.ddmanager.current;\n\t\tif(this.options.activeClass) this.element.removeClass(this.options.activeClass);\n\t\t(draggable && this._trigger('deactivate', event, this.ui(draggable)));\n\t},\n\n\t_over: function(event) {\n\n\t\tvar draggable = $.ui.ddmanager.current;\n\t\tif (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element\n\n\t\tif (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {\n\t\t\tif(this.options.hoverClass) this.element.addClass(this.options.hoverClass);\n\t\t\tthis._trigger('over', event, this.ui(draggable));\n\t\t}\n\n\t},\n\n\t_out: function(event) {\n\n\t\tvar draggable = $.ui.ddmanager.current;\n\t\tif (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return; // Bail if draggable and droppable are same element\n\n\t\tif (this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {\n\t\t\tif(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);\n\t\t\tthis._trigger('out', event, this.ui(draggable));\n\t\t}\n\n\t},\n\n\t_drop: function(event,custom) {\n\n\t\tvar draggable = custom || $.ui.ddmanager.current;\n\t\tif (!draggable || (draggable.currentItem || draggable.element)[0] == this.element[0]) return false; // Bail if draggable and droppable are same element\n\n\t\tvar childrenIntersection = false;\n\t\tthis.element.find(\":data(droppable)\").not(\".ui-draggable-dragging\").each(function() {\n\t\t\tvar inst = $.data(this, 'droppable');\n\t\t\tif(\n\t\t\t\tinst.options.greedy\n\t\t\t\t&& !inst.options.disabled\n\t\t\t\t&& inst.options.scope == draggable.options.scope\n\t\t\t\t&& inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element))\n\t\t\t\t&& $.ui.intersect(draggable, $.extend(inst, { offset: inst.element.offset() }), inst.options.tolerance)\n\t\t\t) { childrenIntersection = true; return false; }\n\t\t});\n\t\tif(childrenIntersection) return false;\n\n\t\tif(this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {\n\t\t\tif(this.options.activeClass) this.element.removeClass(this.options.activeClass);\n\t\t\tif(this.options.hoverClass) this.element.removeClass(this.options.hoverClass);\n\t\t\tthis._trigger('drop', event, this.ui(draggable));\n\t\t\treturn this.element;\n\t\t}\n\n\t\treturn false;\n\n\t},\n\n\tui: function(c) {\n\t\treturn {\n\t\t\tdraggable: (c.currentItem || c.element),\n\t\t\thelper: c.helper,\n\t\t\tposition: c.position,\n\t\t\toffset: c.positionAbs\n\t\t};\n\t}\n\n});\n\n$.extend($.ui.droppable, {\n\tversion: \"1.8.24\"\n});\n\n$.ui.intersect = function(draggable, droppable, toleranceMode) {\n\n\tif (!droppable.offset) return false;\n\n\tvar x1 = (draggable.positionAbs || draggable.position.absolute).left, x2 = x1 + draggable.helperProportions.width,\n\t\ty1 = (draggable.positionAbs || draggable.position.absolute).top, y2 = y1 + draggable.helperProportions.height;\n\tvar l = droppable.offset.left, r = l + droppable.proportions.width,\n\t\tt = droppable.offset.top, b = t + droppable.proportions.height;\n\n\tswitch (toleranceMode) {\n\t\tcase 'fit':\n\t\t\treturn (l <= x1 && x2 <= r\n\t\t\t\t&& t <= y1 && y2 <= b);\n\t\t\tbreak;\n\t\tcase 'intersect':\n\t\t\treturn (l < x1 + (draggable.helperProportions.width / 2) // Right Half\n\t\t\t\t&& x2 - (draggable.helperProportions.width / 2) < r // Left Half\n\t\t\t\t&& t < y1 + (draggable.helperProportions.height / 2) // Bottom Half\n\t\t\t\t&& y2 - (draggable.helperProportions.height / 2) < b ); // Top Half\n\t\t\tbreak;\n\t\tcase 'pointer':\n\t\t\tvar draggableLeft = ((draggable.positionAbs || draggable.position.absolute).left + (draggable.clickOffset || draggable.offset.click).left),\n\t\t\t\tdraggableTop = ((draggable.positionAbs || draggable.position.absolute).top + (draggable.clickOffset || draggable.offset.click).top),\n\t\t\t\tisOver = $.ui.isOver(draggableTop, draggableLeft, t, l, droppable.proportions.height, droppable.proportions.width);\n\t\t\treturn isOver;\n\t\t\tbreak;\n\t\tcase 'touch':\n\t\t\treturn (\n\t\t\t\t\t(y1 >= t && y1 <= b) ||\t// Top edge touching\n\t\t\t\t\t(y2 >= t && y2 <= b) ||\t// Bottom edge touching\n\t\t\t\t\t(y1 < t && y2 > b)\t\t// Surrounded vertically\n\t\t\t\t) && (\n\t\t\t\t\t(x1 >= l && x1 <= r) ||\t// Left edge touching\n\t\t\t\t\t(x2 >= l && x2 <= r) ||\t// Right edge touching\n\t\t\t\t\t(x1 < l && x2 > r)\t\t// Surrounded horizontally\n\t\t\t\t);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn false;\n\t\t\tbreak;\n\t\t}\n\n};\n\n/*\n\tThis manager tracks offsets of draggables and droppables\n*/\n$.ui.ddmanager = {\n\tcurrent: null,\n\tdroppables: { 'default': [] },\n\tprepareOffsets: function(t, event) {\n\n\t\tvar m = $.ui.ddmanager.droppables[t.options.scope] || [];\n\t\tvar type = event ? event.type : null; // workaround for #2317\n\t\tvar list = (t.currentItem || t.element).find(\":data(droppable)\").andSelf();\n\n\t\tdroppablesLoop: for (var i = 0; i < m.length; i++) {\n\n\t\t\tif(m[i].options.disabled || (t && !m[i].accept.call(m[i].element[0],(t.currentItem || t.element)))) continue;\t//No disabled and non-accepted\n\t\t\tfor (var j=0; j < list.length; j++) { if(list[j] == m[i].element[0]) { m[i].proportions.height = 0; continue droppablesLoop; } }; //Filter out elements in the current dragged item\n\t\t\tm[i].visible = m[i].element.css(\"display\") != \"none\"; if(!m[i].visible) continue; \t\t\t\t\t\t\t\t\t//If the element is not visible, continue\n\n\t\t\tif(type == \"mousedown\") m[i]._activate.call(m[i], event); //Activate the droppable if used directly from draggables\n\n\t\t\tm[i].offset = m[i].element.offset();\n\t\t\tm[i].proportions = { width: m[i].element[0].offsetWidth, height: m[i].element[0].offsetHeight };\n\n\t\t}\n\n\t},\n\tdrop: function(draggable, event) {\n\n\t\tvar dropped = false;\n\t\t$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {\n\n\t\t\tif(!this.options) return;\n\t\t\tif (!this.options.disabled && this.visible && $.ui.intersect(draggable, this, this.options.tolerance))\n\t\t\t\tdropped = this._drop.call(this, event) || dropped;\n\n\t\t\tif (!this.options.disabled && this.visible && this.accept.call(this.element[0],(draggable.currentItem || draggable.element))) {\n\t\t\t\tthis.isout = 1; this.isover = 0;\n\t\t\t\tthis._deactivate.call(this, event);\n\t\t\t}\n\n\t\t});\n\t\treturn dropped;\n\n\t},\n\tdragStart: function( draggable, event ) {\n\t\t//Listen for scrolling so that if the dragging causes scrolling the position of the droppables can be recalculated (see #5003)\n\t\tdraggable.element.parents( \":not(body,html)\" ).bind( \"scroll.droppable\", function() {\n\t\t\tif( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );\n\t\t});\n\t},\n\tdrag: function(draggable, event) {\n\n\t\t//If you have a highly dynamic page, you might try this option. It renders positions every time you move the mouse.\n\t\tif(draggable.options.refreshPositions) $.ui.ddmanager.prepareOffsets(draggable, event);\n\n\t\t//Run through all droppables and check their positions based on specific tolerance options\n\t\t$.each($.ui.ddmanager.droppables[draggable.options.scope] || [], function() {\n\n\t\t\tif(this.options.disabled || this.greedyChild || !this.visible) return;\n\t\t\tvar intersects = $.ui.intersect(draggable, this, this.options.tolerance);\n\n\t\t\tvar c = !intersects && this.isover == 1 ? 'isout' : (intersects && this.isover == 0 ? 'isover' : null);\n\t\t\tif(!c) return;\n\n\t\t\tvar parentInstance;\n\t\t\tif (this.options.greedy) {\n\t\t\t\t// find droppable parents with same scope\n\t\t\t\tvar scope = this.options.scope;\n\t\t\t\tvar parent = this.element.parents(':data(droppable)').filter(function () {\n\t\t\t\t\treturn $.data(this, 'droppable').options.scope === scope;\n\t\t\t\t});\n\n\t\t\t\tif (parent.length) {\n\t\t\t\t\tparentInstance = $.data(parent[0], 'droppable');\n\t\t\t\t\tparentInstance.greedyChild = (c == 'isover' ? 1 : 0);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// we just moved into a greedy child\n\t\t\tif (parentInstance && c == 'isover') {\n\t\t\t\tparentInstance['isover'] = 0;\n\t\t\t\tparentInstance['isout'] = 1;\n\t\t\t\tparentInstance._out.call(parentInstance, event);\n\t\t\t}\n\n\t\t\tthis[c] = 1; this[c == 'isout' ? 'isover' : 'isout'] = 0;\n\t\t\tthis[c == \"isover\" ? \"_over\" : \"_out\"].call(this, event);\n\n\t\t\t// we just moved out of a greedy child\n\t\t\tif (parentInstance && c == 'isout') {\n\t\t\t\tparentInstance['isout'] = 0;\n\t\t\t\tparentInstance['isover'] = 1;\n\t\t\t\tparentInstance._over.call(parentInstance, event);\n\t\t\t}\n\t\t});\n\n\t},\n\tdragStop: function( draggable, event ) {\n\t\tdraggable.element.parents( \":not(body,html)\" ).unbind( \"scroll.droppable\" );\n\t\t//Call prepareOffsets one final time since IE does not fire return scroll events when overflow was caused by drag (see #5003)\n\t\tif( !draggable.options.refreshPositions ) $.ui.ddmanager.prepareOffsets( draggable, event );\n\t}\n};\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.widget(\"ui.resizable\", $.ui.mouse, {\n\twidgetEventPrefix: \"resize\",\n\toptions: {\n\t\talsoResize: false,\n\t\tanimate: false,\n\t\tanimateDuration: \"slow\",\n\t\tanimateEasing: \"swing\",\n\t\taspectRatio: false,\n\t\tautoHide: false,\n\t\tcontainment: false,\n\t\tghost: false,\n\t\tgrid: false,\n\t\thandles: \"e,s,se\",\n\t\thelper: false,\n\t\tmaxHeight: null,\n\t\tmaxWidth: null,\n\t\tminHeight: 10,\n\t\tminWidth: 10,\n\t\tzIndex: 1000\n\t},\n\t_create: function() {\n\n\t\tvar self = this, o = this.options;\n\t\tthis.element.addClass(\"ui-resizable\");\n\n\t\t$.extend(this, {\n\t\t\t_aspectRatio: !!(o.aspectRatio),\n\t\t\taspectRatio: o.aspectRatio,\n\t\t\toriginalElement: this.element,\n\t\t\t_proportionallyResizeElements: [],\n\t\t\t_helper: o.helper || o.ghost || o.animate ? o.helper || 'ui-resizable-helper' : null\n\t\t});\n\n\t\t//Wrap the element if it cannot hold child nodes\n\t\tif(this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)) {\n\n\t\t\t//Create a wrapper element and set the wrapper to the new current internal element\n\t\t\tthis.element.wrap(\n\t\t\t\t$('<div class=\"ui-wrapper\" style=\"overflow: hidden;\"></div>').css({\n\t\t\t\t\tposition: this.element.css('position'),\n\t\t\t\t\twidth: this.element.outerWidth(),\n\t\t\t\t\theight: this.element.outerHeight(),\n\t\t\t\t\ttop: this.element.css('top'),\n\t\t\t\t\tleft: this.element.css('left')\n\t\t\t\t})\n\t\t\t);\n\n\t\t\t//Overwrite the original this.element\n\t\t\tthis.element = this.element.parent().data(\n\t\t\t\t\"resizable\", this.element.data('resizable')\n\t\t\t);\n\n\t\t\tthis.elementIsWrapper = true;\n\n\t\t\t//Move margins to the wrapper\n\t\t\tthis.element.css({ marginLeft: this.originalElement.css(\"marginLeft\"), marginTop: this.originalElement.css(\"marginTop\"), marginRight: this.originalElement.css(\"marginRight\"), marginBottom: this.originalElement.css(\"marginBottom\") });\n\t\t\tthis.originalElement.css({ marginLeft: 0, marginTop: 0, marginRight: 0, marginBottom: 0});\n\n\t\t\t//Prevent Safari textarea resize\n\t\t\tthis.originalResizeStyle = this.originalElement.css('resize');\n\t\t\tthis.originalElement.css('resize', 'none');\n\n\t\t\t//Push the actual element to our proportionallyResize internal array\n\t\t\tthis._proportionallyResizeElements.push(this.originalElement.css({ position: 'static', zoom: 1, display: 'block' }));\n\n\t\t\t// avoid IE jump (hard set the margin)\n\t\t\tthis.originalElement.css({ margin: this.originalElement.css('margin') });\n\n\t\t\t// fix handlers offset\n\t\t\tthis._proportionallyResize();\n\n\t\t}\n\n\t\tthis.handles = o.handles || (!$('.ui-resizable-handle', this.element).length ? \"e,s,se\" : { n: '.ui-resizable-n', e: '.ui-resizable-e', s: '.ui-resizable-s', w: '.ui-resizable-w', se: '.ui-resizable-se', sw: '.ui-resizable-sw', ne: '.ui-resizable-ne', nw: '.ui-resizable-nw' });\n\t\tif(this.handles.constructor == String) {\n\n\t\t\tif(this.handles == 'all') this.handles = 'n,e,s,w,se,sw,ne,nw';\n\t\t\tvar n = this.handles.split(\",\"); this.handles = {};\n\n\t\t\tfor(var i = 0; i < n.length; i++) {\n\n\t\t\t\tvar handle = $.trim(n[i]), hname = 'ui-resizable-'+handle;\n\t\t\t\tvar axis = $('<div class=\"ui-resizable-handle ' + hname + '\"></div>');\n\n\t\t\t\t// Apply zIndex to all handles - see #7960\n\t\t\t\taxis.css({ zIndex: o.zIndex });\n\n\t\t\t\t//TODO : What's going on here?\n\t\t\t\tif ('se' == handle) {\n\t\t\t\t\taxis.addClass('ui-icon ui-icon-gripsmall-diagonal-se');\n\t\t\t\t};\n\n\t\t\t\t//Insert into internal handles object and append to element\n\t\t\t\tthis.handles[handle] = '.ui-resizable-'+handle;\n\t\t\t\tthis.element.append(axis);\n\t\t\t}\n\n\t\t}\n\n\t\tthis._renderAxis = function(target) {\n\n\t\t\ttarget = target || this.element;\n\n\t\t\tfor(var i in this.handles) {\n\n\t\t\t\tif(this.handles[i].constructor == String)\n\t\t\t\t\tthis.handles[i] = $(this.handles[i], this.element).show();\n\n\t\t\t\t//Apply pad to wrapper element, needed to fix axis position (textarea, inputs, scrolls)\n\t\t\t\tif (this.elementIsWrapper && this.originalElement[0].nodeName.match(/textarea|input|select|button/i)) {\n\n\t\t\t\t\tvar axis = $(this.handles[i], this.element), padWrapper = 0;\n\n\t\t\t\t\t//Checking the correct pad and border\n\t\t\t\t\tpadWrapper = /sw|ne|nw|se|n|s/.test(i) ? axis.outerHeight() : axis.outerWidth();\n\n\t\t\t\t\t//The padding type i have to apply...\n\t\t\t\t\tvar padPos = [ 'padding',\n\t\t\t\t\t\t/ne|nw|n/.test(i) ? 'Top' :\n\t\t\t\t\t\t/se|sw|s/.test(i) ? 'Bottom' :\n\t\t\t\t\t\t/^e$/.test(i) ? 'Right' : 'Left' ].join(\"\");\n\n\t\t\t\t\ttarget.css(padPos, padWrapper);\n\n\t\t\t\t\tthis._proportionallyResize();\n\n\t\t\t\t}\n\n\t\t\t\t//TODO: What's that good for? There's not anything to be executed left\n\t\t\t\tif(!$(this.handles[i]).length)\n\t\t\t\t\tcontinue;\n\n\t\t\t}\n\t\t};\n\n\t\t//TODO: make renderAxis a prototype function\n\t\tthis._renderAxis(this.element);\n\n\t\tthis._handles = $('.ui-resizable-handle', this.element)\n\t\t\t.disableSelection();\n\n\t\t//Matching axis name\n\t\tthis._handles.mouseover(function() {\n\t\t\tif (!self.resizing) {\n\t\t\t\tif (this.className)\n\t\t\t\t\tvar axis = this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i);\n\t\t\t\t//Axis, default = se\n\t\t\t\tself.axis = axis && axis[1] ? axis[1] : 'se';\n\t\t\t}\n\t\t});\n\n\t\t//If we want to auto hide the elements\n\t\tif (o.autoHide) {\n\t\t\tthis._handles.hide();\n\t\t\t$(this.element)\n\t\t\t\t.addClass(\"ui-resizable-autohide\")\n\t\t\t\t.hover(function() {\n\t\t\t\t\tif (o.disabled) return;\n\t\t\t\t\t$(this).removeClass(\"ui-resizable-autohide\");\n\t\t\t\t\tself._handles.show();\n\t\t\t\t},\n\t\t\t\tfunction(){\n\t\t\t\t\tif (o.disabled) return;\n\t\t\t\t\tif (!self.resizing) {\n\t\t\t\t\t\t$(this).addClass(\"ui-resizable-autohide\");\n\t\t\t\t\t\tself._handles.hide();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t}\n\n\t\t//Initialize the mouse interaction\n\t\tthis._mouseInit();\n\n\t},\n\n\tdestroy: function() {\n\n\t\tthis._mouseDestroy();\n\n\t\tvar _destroy = function(exp) {\n\t\t\t$(exp).removeClass(\"ui-resizable ui-resizable-disabled ui-resizable-resizing\")\n\t\t\t\t.removeData(\"resizable\").unbind(\".resizable\").find('.ui-resizable-handle').remove();\n\t\t};\n\n\t\t//TODO: Unwrap at same DOM position\n\t\tif (this.elementIsWrapper) {\n\t\t\t_destroy(this.element);\n\t\t\tvar wrapper = this.element;\n\t\t\twrapper.after(\n\t\t\t\tthis.originalElement.css({\n\t\t\t\t\tposition: wrapper.css('position'),\n\t\t\t\t\twidth: wrapper.outerWidth(),\n\t\t\t\t\theight: wrapper.outerHeight(),\n\t\t\t\t\ttop: wrapper.css('top'),\n\t\t\t\t\tleft: wrapper.css('left')\n\t\t\t\t})\n\t\t\t).remove();\n\t\t}\n\n\t\tthis.originalElement.css('resize', this.originalResizeStyle);\n\t\t_destroy(this.originalElement);\n\n\t\treturn this;\n\t},\n\n\t_mouseCapture: function(event) {\n\t\tvar handle = false;\n\t\tfor (var i in this.handles) {\n\t\t\tif ($(this.handles[i])[0] == event.target) {\n\t\t\t\thandle = true;\n\t\t\t}\n\t\t}\n\n\t\treturn !this.options.disabled && handle;\n\t},\n\n\t_mouseStart: function(event) {\n\n\t\tvar o = this.options, iniPos = this.element.position(), el = this.element;\n\n\t\tthis.resizing = true;\n\t\tthis.documentScroll = { top: $(document).scrollTop(), left: $(document).scrollLeft() };\n\n\t\t// bugfix for http://dev.jquery.com/ticket/1749\n\t\tif (el.is('.ui-draggable') || (/absolute/).test(el.css('position'))) {\n\t\t\tel.css({ position: 'absolute', top: iniPos.top, left: iniPos.left });\n\t\t}\n\n\t\tthis._renderProxy();\n\n\t\tvar curleft = num(this.helper.css('left')), curtop = num(this.helper.css('top'));\n\n\t\tif (o.containment) {\n\t\t\tcurleft += $(o.containment).scrollLeft() || 0;\n\t\t\tcurtop += $(o.containment).scrollTop() || 0;\n\t\t}\n\n\t\t//Store needed variables\n\t\tthis.offset = this.helper.offset();\n\t\tthis.position = { left: curleft, top: curtop };\n\t\tthis.size = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };\n\t\tthis.originalSize = this._helper ? { width: el.outerWidth(), height: el.outerHeight() } : { width: el.width(), height: el.height() };\n\t\tthis.originalPosition = { left: curleft, top: curtop };\n\t\tthis.sizeDiff = { width: el.outerWidth() - el.width(), height: el.outerHeight() - el.height() };\n\t\tthis.originalMousePosition = { left: event.pageX, top: event.pageY };\n\n\t\t//Aspect Ratio\n\t\tthis.aspectRatio = (typeof o.aspectRatio == 'number') ? o.aspectRatio : ((this.originalSize.width / this.originalSize.height) || 1);\n\n\t    var cursor = $('.ui-resizable-' + this.axis).css('cursor');\n\t    $('body').css('cursor', cursor == 'auto' ? this.axis + '-resize' : cursor);\n\n\t\tel.addClass(\"ui-resizable-resizing\");\n\t\tthis._propagate(\"start\", event);\n\t\treturn true;\n\t},\n\n\t_mouseDrag: function(event) {\n\n\t\t//Increase performance, avoid regex\n\t\tvar el = this.helper, o = this.options, props = {},\n\t\t\tself = this, smp = this.originalMousePosition, a = this.axis;\n\n\t\tvar dx = (event.pageX-smp.left)||0, dy = (event.pageY-smp.top)||0;\n\t\tvar trigger = this._change[a];\n\t\tif (!trigger) return false;\n\n\t\t// Calculate the attrs that will be change\n\t\tvar data = trigger.apply(this, [event, dx, dy]), ie6 = $.browser.msie && $.browser.version < 7, csdif = this.sizeDiff;\n\n\t\t// Put this in the mouseDrag handler since the user can start pressing shift while resizing\n\t\tthis._updateVirtualBoundaries(event.shiftKey);\n\t\tif (this._aspectRatio || event.shiftKey)\n\t\t\tdata = this._updateRatio(data, event);\n\n\t\tdata = this._respectSize(data, event);\n\n\t\t// plugins callbacks need to be called first\n\t\tthis._propagate(\"resize\", event);\n\n\t\tel.css({\n\t\t\ttop: this.position.top + \"px\", left: this.position.left + \"px\",\n\t\t\twidth: this.size.width + \"px\", height: this.size.height + \"px\"\n\t\t});\n\n\t\tif (!this._helper && this._proportionallyResizeElements.length)\n\t\t\tthis._proportionallyResize();\n\n\t\tthis._updateCache(data);\n\n\t\t// calling the user callback at the end\n\t\tthis._trigger('resize', event, this.ui());\n\n\t\treturn false;\n\t},\n\n\t_mouseStop: function(event) {\n\n\t\tthis.resizing = false;\n\t\tvar o = this.options, self = this;\n\n\t\tif(this._helper) {\n\t\t\tvar pr = this._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),\n\t\t\t\tsoffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,\n\t\t\t\tsoffsetw = ista ? 0 : self.sizeDiff.width;\n\n\t\t\tvar s = { width: (self.helper.width()  - soffsetw), height: (self.helper.height() - soffseth) },\n\t\t\t\tleft = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,\n\t\t\t\ttop = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;\n\n\t\t\tif (!o.animate)\n\t\t\t\tthis.element.css($.extend(s, { top: top, left: left }));\n\n\t\t\tself.helper.height(self.size.height);\n\t\t\tself.helper.width(self.size.width);\n\n\t\t\tif (this._helper && !o.animate) this._proportionallyResize();\n\t\t}\n\n\t\t$('body').css('cursor', 'auto');\n\n\t\tthis.element.removeClass(\"ui-resizable-resizing\");\n\n\t\tthis._propagate(\"stop\", event);\n\n\t\tif (this._helper) this.helper.remove();\n\t\treturn false;\n\n\t},\n\n    _updateVirtualBoundaries: function(forceAspectRatio) {\n        var o = this.options, pMinWidth, pMaxWidth, pMinHeight, pMaxHeight, b;\n\n        b = {\n            minWidth: isNumber(o.minWidth) ? o.minWidth : 0,\n            maxWidth: isNumber(o.maxWidth) ? o.maxWidth : Infinity,\n            minHeight: isNumber(o.minHeight) ? o.minHeight : 0,\n            maxHeight: isNumber(o.maxHeight) ? o.maxHeight : Infinity\n        };\n\n        if(this._aspectRatio || forceAspectRatio) {\n            // We want to create an enclosing box whose aspect ration is the requested one\n            // First, compute the \"projected\" size for each dimension based on the aspect ratio and other dimension\n            pMinWidth = b.minHeight * this.aspectRatio;\n            pMinHeight = b.minWidth / this.aspectRatio;\n            pMaxWidth = b.maxHeight * this.aspectRatio;\n            pMaxHeight = b.maxWidth / this.aspectRatio;\n\n            if(pMinWidth > b.minWidth) b.minWidth = pMinWidth;\n            if(pMinHeight > b.minHeight) b.minHeight = pMinHeight;\n            if(pMaxWidth < b.maxWidth) b.maxWidth = pMaxWidth;\n            if(pMaxHeight < b.maxHeight) b.maxHeight = pMaxHeight;\n        }\n        this._vBoundaries = b;\n    },\n\n\t_updateCache: function(data) {\n\t\tvar o = this.options;\n\t\tthis.offset = this.helper.offset();\n\t\tif (isNumber(data.left)) this.position.left = data.left;\n\t\tif (isNumber(data.top)) this.position.top = data.top;\n\t\tif (isNumber(data.height)) this.size.height = data.height;\n\t\tif (isNumber(data.width)) this.size.width = data.width;\n\t},\n\n\t_updateRatio: function(data, event) {\n\n\t\tvar o = this.options, cpos = this.position, csize = this.size, a = this.axis;\n\n\t\tif (isNumber(data.height)) data.width = (data.height * this.aspectRatio);\n\t\telse if (isNumber(data.width)) data.height = (data.width / this.aspectRatio);\n\n\t\tif (a == 'sw') {\n\t\t\tdata.left = cpos.left + (csize.width - data.width);\n\t\t\tdata.top = null;\n\t\t}\n\t\tif (a == 'nw') {\n\t\t\tdata.top = cpos.top + (csize.height - data.height);\n\t\t\tdata.left = cpos.left + (csize.width - data.width);\n\t\t}\n\n\t\treturn data;\n\t},\n\n\t_respectSize: function(data, event) {\n\n\t\tvar el = this.helper, o = this._vBoundaries, pRatio = this._aspectRatio || event.shiftKey, a = this.axis,\n\t\t\t\tismaxw = isNumber(data.width) && o.maxWidth && (o.maxWidth < data.width), ismaxh = isNumber(data.height) && o.maxHeight && (o.maxHeight < data.height),\n\t\t\t\t\tisminw = isNumber(data.width) && o.minWidth && (o.minWidth > data.width), isminh = isNumber(data.height) && o.minHeight && (o.minHeight > data.height);\n\n\t\tif (isminw) data.width = o.minWidth;\n\t\tif (isminh) data.height = o.minHeight;\n\t\tif (ismaxw) data.width = o.maxWidth;\n\t\tif (ismaxh) data.height = o.maxHeight;\n\n\t\tvar dw = this.originalPosition.left + this.originalSize.width, dh = this.position.top + this.size.height;\n\t\tvar cw = /sw|nw|w/.test(a), ch = /nw|ne|n/.test(a);\n\n\t\tif (isminw && cw) data.left = dw - o.minWidth;\n\t\tif (ismaxw && cw) data.left = dw - o.maxWidth;\n\t\tif (isminh && ch)\tdata.top = dh - o.minHeight;\n\t\tif (ismaxh && ch)\tdata.top = dh - o.maxHeight;\n\n\t\t// fixing jump error on top/left - bug #2330\n\t\tvar isNotwh = !data.width && !data.height;\n\t\tif (isNotwh && !data.left && data.top) data.top = null;\n\t\telse if (isNotwh && !data.top && data.left) data.left = null;\n\n\t\treturn data;\n\t},\n\n\t_proportionallyResize: function() {\n\n\t\tvar o = this.options;\n\t\tif (!this._proportionallyResizeElements.length) return;\n\t\tvar element = this.helper || this.element;\n\n\t\tfor (var i=0; i < this._proportionallyResizeElements.length; i++) {\n\n\t\t\tvar prel = this._proportionallyResizeElements[i];\n\n\t\t\tif (!this.borderDif) {\n\t\t\t\tvar b = [prel.css('borderTopWidth'), prel.css('borderRightWidth'), prel.css('borderBottomWidth'), prel.css('borderLeftWidth')],\n\t\t\t\t\tp = [prel.css('paddingTop'), prel.css('paddingRight'), prel.css('paddingBottom'), prel.css('paddingLeft')];\n\n\t\t\t\tthis.borderDif = $.map(b, function(v, i) {\n\t\t\t\t\tvar border = parseInt(v,10)||0, padding = parseInt(p[i],10)||0;\n\t\t\t\t\treturn border + padding;\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif ($.browser.msie && !(!($(element).is(':hidden') || $(element).parents(':hidden').length)))\n\t\t\t\tcontinue;\n\n\t\t\tprel.css({\n\t\t\t\theight: (element.height() - this.borderDif[0] - this.borderDif[2]) || 0,\n\t\t\t\twidth: (element.width() - this.borderDif[1] - this.borderDif[3]) || 0\n\t\t\t});\n\n\t\t};\n\n\t},\n\n\t_renderProxy: function() {\n\n\t\tvar el = this.element, o = this.options;\n\t\tthis.elementOffset = el.offset();\n\n\t\tif(this._helper) {\n\n\t\t\tthis.helper = this.helper || $('<div style=\"overflow:hidden;\"></div>');\n\n\t\t\t// fix ie6 offset TODO: This seems broken\n\t\t\tvar ie6 = $.browser.msie && $.browser.version < 7, ie6offset = (ie6 ? 1 : 0),\n\t\t\tpxyoffset = ( ie6 ? 2 : -1 );\n\n\t\t\tthis.helper.addClass(this._helper).css({\n\t\t\t\twidth: this.element.outerWidth() + pxyoffset,\n\t\t\t\theight: this.element.outerHeight() + pxyoffset,\n\t\t\t\tposition: 'absolute',\n\t\t\t\tleft: this.elementOffset.left - ie6offset +'px',\n\t\t\t\ttop: this.elementOffset.top - ie6offset +'px',\n\t\t\t\tzIndex: ++o.zIndex //TODO: Don't modify option\n\t\t\t});\n\n\t\t\tthis.helper\n\t\t\t\t.appendTo(\"body\")\n\t\t\t\t.disableSelection();\n\n\t\t} else {\n\t\t\tthis.helper = this.element;\n\t\t}\n\n\t},\n\n\t_change: {\n\t\te: function(event, dx, dy) {\n\t\t\treturn { width: this.originalSize.width + dx };\n\t\t},\n\t\tw: function(event, dx, dy) {\n\t\t\tvar o = this.options, cs = this.originalSize, sp = this.originalPosition;\n\t\t\treturn { left: sp.left + dx, width: cs.width - dx };\n\t\t},\n\t\tn: function(event, dx, dy) {\n\t\t\tvar o = this.options, cs = this.originalSize, sp = this.originalPosition;\n\t\t\treturn { top: sp.top + dy, height: cs.height - dy };\n\t\t},\n\t\ts: function(event, dx, dy) {\n\t\t\treturn { height: this.originalSize.height + dy };\n\t\t},\n\t\tse: function(event, dx, dy) {\n\t\t\treturn $.extend(this._change.s.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));\n\t\t},\n\t\tsw: function(event, dx, dy) {\n\t\t\treturn $.extend(this._change.s.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));\n\t\t},\n\t\tne: function(event, dx, dy) {\n\t\t\treturn $.extend(this._change.n.apply(this, arguments), this._change.e.apply(this, [event, dx, dy]));\n\t\t},\n\t\tnw: function(event, dx, dy) {\n\t\t\treturn $.extend(this._change.n.apply(this, arguments), this._change.w.apply(this, [event, dx, dy]));\n\t\t}\n\t},\n\n\t_propagate: function(n, event) {\n\t\t$.ui.plugin.call(this, n, [event, this.ui()]);\n\t\t(n != \"resize\" && this._trigger(n, event, this.ui()));\n\t},\n\n\tplugins: {},\n\n\tui: function() {\n\t\treturn {\n\t\t\toriginalElement: this.originalElement,\n\t\t\telement: this.element,\n\t\t\thelper: this.helper,\n\t\t\tposition: this.position,\n\t\t\tsize: this.size,\n\t\t\toriginalSize: this.originalSize,\n\t\t\toriginalPosition: this.originalPosition\n\t\t};\n\t}\n\n});\n\n$.extend($.ui.resizable, {\n\tversion: \"1.8.24\"\n});\n\n/*\n * Resizable Extensions\n */\n\n$.ui.plugin.add(\"resizable\", \"alsoResize\", {\n\n\tstart: function (event, ui) {\n\t\tvar self = $(this).data(\"resizable\"), o = self.options;\n\n\t\tvar _store = function (exp) {\n\t\t\t$(exp).each(function() {\n\t\t\t\tvar el = $(this);\n\t\t\t\tel.data(\"resizable-alsoresize\", {\n\t\t\t\t\twidth: parseInt(el.width(), 10), height: parseInt(el.height(), 10),\n\t\t\t\t\tleft: parseInt(el.css('left'), 10), top: parseInt(el.css('top'), 10)\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\n\t\tif (typeof(o.alsoResize) == 'object' && !o.alsoResize.parentNode) {\n\t\t\tif (o.alsoResize.length) { o.alsoResize = o.alsoResize[0]; _store(o.alsoResize); }\n\t\t\telse { $.each(o.alsoResize, function (exp) { _store(exp); }); }\n\t\t}else{\n\t\t\t_store(o.alsoResize);\n\t\t}\n\t},\n\n\tresize: function (event, ui) {\n\t\tvar self = $(this).data(\"resizable\"), o = self.options, os = self.originalSize, op = self.originalPosition;\n\n\t\tvar delta = {\n\t\t\theight: (self.size.height - os.height) || 0, width: (self.size.width - os.width) || 0,\n\t\t\ttop: (self.position.top - op.top) || 0, left: (self.position.left - op.left) || 0\n\t\t},\n\n\t\t_alsoResize = function (exp, c) {\n\t\t\t$(exp).each(function() {\n\t\t\t\tvar el = $(this), start = $(this).data(\"resizable-alsoresize\"), style = {}, \n\t\t\t\t\tcss = c && c.length ? c : el.parents(ui.originalElement[0]).length ? ['width', 'height'] : ['width', 'height', 'top', 'left'];\n\n\t\t\t\t$.each(css, function (i, prop) {\n\t\t\t\t\tvar sum = (start[prop]||0) + (delta[prop]||0);\n\t\t\t\t\tif (sum && sum >= 0)\n\t\t\t\t\t\tstyle[prop] = sum || null;\n\t\t\t\t});\n\n\t\t\t\tel.css(style);\n\t\t\t});\n\t\t};\n\n\t\tif (typeof(o.alsoResize) == 'object' && !o.alsoResize.nodeType) {\n\t\t\t$.each(o.alsoResize, function (exp, c) { _alsoResize(exp, c); });\n\t\t}else{\n\t\t\t_alsoResize(o.alsoResize);\n\t\t}\n\t},\n\n\tstop: function (event, ui) {\n\t\t$(this).removeData(\"resizable-alsoresize\");\n\t}\n});\n\n$.ui.plugin.add(\"resizable\", \"animate\", {\n\n\tstop: function(event, ui) {\n\t\tvar self = $(this).data(\"resizable\"), o = self.options;\n\n\t\tvar pr = self._proportionallyResizeElements, ista = pr.length && (/textarea/i).test(pr[0].nodeName),\n\t\t\t\t\tsoffseth = ista && $.ui.hasScroll(pr[0], 'left') /* TODO - jump height */ ? 0 : self.sizeDiff.height,\n\t\t\t\t\t\tsoffsetw = ista ? 0 : self.sizeDiff.width;\n\n\t\tvar style = { width: (self.size.width - soffsetw), height: (self.size.height - soffseth) },\n\t\t\t\t\tleft = (parseInt(self.element.css('left'), 10) + (self.position.left - self.originalPosition.left)) || null,\n\t\t\t\t\t\ttop = (parseInt(self.element.css('top'), 10) + (self.position.top - self.originalPosition.top)) || null;\n\n\t\tself.element.animate(\n\t\t\t$.extend(style, top && left ? { top: top, left: left } : {}), {\n\t\t\t\tduration: o.animateDuration,\n\t\t\t\teasing: o.animateEasing,\n\t\t\t\tstep: function() {\n\n\t\t\t\t\tvar data = {\n\t\t\t\t\t\twidth: parseInt(self.element.css('width'), 10),\n\t\t\t\t\t\theight: parseInt(self.element.css('height'), 10),\n\t\t\t\t\t\ttop: parseInt(self.element.css('top'), 10),\n\t\t\t\t\t\tleft: parseInt(self.element.css('left'), 10)\n\t\t\t\t\t};\n\n\t\t\t\t\tif (pr && pr.length) $(pr[0]).css({ width: data.width, height: data.height });\n\n\t\t\t\t\t// propagating resize, and updating values for each animation step\n\t\t\t\t\tself._updateCache(data);\n\t\t\t\t\tself._propagate(\"resize\", event);\n\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t}\n\n});\n\n$.ui.plugin.add(\"resizable\", \"containment\", {\n\n\tstart: function(event, ui) {\n\t\tvar self = $(this).data(\"resizable\"), o = self.options, el = self.element;\n\t\tvar oc = o.containment,\tce = (oc instanceof $) ? oc.get(0) : (/parent/.test(oc)) ? el.parent().get(0) : oc;\n\t\tif (!ce) return;\n\n\t\tself.containerElement = $(ce);\n\n\t\tif (/document/.test(oc) || oc == document) {\n\t\t\tself.containerOffset = { left: 0, top: 0 };\n\t\t\tself.containerPosition = { left: 0, top: 0 };\n\n\t\t\tself.parentData = {\n\t\t\t\telement: $(document), left: 0, top: 0,\n\t\t\t\twidth: $(document).width(), height: $(document).height() || document.body.parentNode.scrollHeight\n\t\t\t};\n\t\t}\n\n\t\t// i'm a node, so compute top, left, right, bottom\n\t\telse {\n\t\t\tvar element = $(ce), p = [];\n\t\t\t$([ \"Top\", \"Right\", \"Left\", \"Bottom\" ]).each(function(i, name) { p[i] = num(element.css(\"padding\" + name)); });\n\n\t\t\tself.containerOffset = element.offset();\n\t\t\tself.containerPosition = element.position();\n\t\t\tself.containerSize = { height: (element.innerHeight() - p[3]), width: (element.innerWidth() - p[1]) };\n\n\t\t\tvar co = self.containerOffset, ch = self.containerSize.height,\tcw = self.containerSize.width,\n\t\t\t\t\t\twidth = ($.ui.hasScroll(ce, \"left\") ? ce.scrollWidth : cw ), height = ($.ui.hasScroll(ce) ? ce.scrollHeight : ch);\n\n\t\t\tself.parentData = {\n\t\t\t\telement: ce, left: co.left, top: co.top, width: width, height: height\n\t\t\t};\n\t\t}\n\t},\n\n\tresize: function(event, ui) {\n\t\tvar self = $(this).data(\"resizable\"), o = self.options,\n\t\t\t\tps = self.containerSize, co = self.containerOffset, cs = self.size, cp = self.position,\n\t\t\t\tpRatio = self._aspectRatio || event.shiftKey, cop = { top:0, left:0 }, ce = self.containerElement;\n\n\t\tif (ce[0] != document && (/static/).test(ce.css('position'))) cop = co;\n\n\t\tif (cp.left < (self._helper ? co.left : 0)) {\n\t\t\tself.size.width = self.size.width + (self._helper ? (self.position.left - co.left) : (self.position.left - cop.left));\n\t\t\tif (pRatio) self.size.height = self.size.width / self.aspectRatio;\n\t\t\tself.position.left = o.helper ? co.left : 0;\n\t\t}\n\n\t\tif (cp.top < (self._helper ? co.top : 0)) {\n\t\t\tself.size.height = self.size.height + (self._helper ? (self.position.top - co.top) : self.position.top);\n\t\t\tif (pRatio) self.size.width = self.size.height * self.aspectRatio;\n\t\t\tself.position.top = self._helper ? co.top : 0;\n\t\t}\n\n\t\tself.offset.left = self.parentData.left+self.position.left;\n\t\tself.offset.top = self.parentData.top+self.position.top;\n\n\t\tvar woset = Math.abs( (self._helper ? self.offset.left - cop.left : (self.offset.left - cop.left)) + self.sizeDiff.width ),\n\t\t\t\t\thoset = Math.abs( (self._helper ? self.offset.top - cop.top : (self.offset.top - co.top)) + self.sizeDiff.height );\n\n\t\tvar isParent = self.containerElement.get(0) == self.element.parent().get(0),\n\t\t    isOffsetRelative = /relative|absolute/.test(self.containerElement.css('position'));\n\n\t\tif(isParent && isOffsetRelative) woset -= self.parentData.left;\n\n\t\tif (woset + self.size.width >= self.parentData.width) {\n\t\t\tself.size.width = self.parentData.width - woset;\n\t\t\tif (pRatio) self.size.height = self.size.width / self.aspectRatio;\n\t\t}\n\n\t\tif (hoset + self.size.height >= self.parentData.height) {\n\t\t\tself.size.height = self.parentData.height - hoset;\n\t\t\tif (pRatio) self.size.width = self.size.height * self.aspectRatio;\n\t\t}\n\t},\n\n\tstop: function(event, ui){\n\t\tvar self = $(this).data(\"resizable\"), o = self.options, cp = self.position,\n\t\t\t\tco = self.containerOffset, cop = self.containerPosition, ce = self.containerElement;\n\n\t\tvar helper = $(self.helper), ho = helper.offset(), w = helper.outerWidth() - self.sizeDiff.width, h = helper.outerHeight() - self.sizeDiff.height;\n\n\t\tif (self._helper && !o.animate && (/relative/).test(ce.css('position')))\n\t\t\t$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });\n\n\t\tif (self._helper && !o.animate && (/static/).test(ce.css('position')))\n\t\t\t$(this).css({ left: ho.left - cop.left - co.left, width: w, height: h });\n\n\t}\n});\n\n$.ui.plugin.add(\"resizable\", \"ghost\", {\n\n\tstart: function(event, ui) {\n\n\t\tvar self = $(this).data(\"resizable\"), o = self.options, cs = self.size;\n\n\t\tself.ghost = self.originalElement.clone();\n\t\tself.ghost\n\t\t\t.css({ opacity: .25, display: 'block', position: 'relative', height: cs.height, width: cs.width, margin: 0, left: 0, top: 0 })\n\t\t\t.addClass('ui-resizable-ghost')\n\t\t\t.addClass(typeof o.ghost == 'string' ? o.ghost : '');\n\n\t\tself.ghost.appendTo(self.helper);\n\n\t},\n\n\tresize: function(event, ui){\n\t\tvar self = $(this).data(\"resizable\"), o = self.options;\n\t\tif (self.ghost) self.ghost.css({ position: 'relative', height: self.size.height, width: self.size.width });\n\t},\n\n\tstop: function(event, ui){\n\t\tvar self = $(this).data(\"resizable\"), o = self.options;\n\t\tif (self.ghost && self.helper) self.helper.get(0).removeChild(self.ghost.get(0));\n\t}\n\n});\n\n$.ui.plugin.add(\"resizable\", \"grid\", {\n\n\tresize: function(event, ui) {\n\t\tvar self = $(this).data(\"resizable\"), o = self.options, cs = self.size, os = self.originalSize, op = self.originalPosition, a = self.axis, ratio = o._aspectRatio || event.shiftKey;\n\t\to.grid = typeof o.grid == \"number\" ? [o.grid, o.grid] : o.grid;\n\t\tvar ox = Math.round((cs.width - os.width) / (o.grid[0]||1)) * (o.grid[0]||1), oy = Math.round((cs.height - os.height) / (o.grid[1]||1)) * (o.grid[1]||1);\n\n\t\tif (/^(se|s|e)$/.test(a)) {\n\t\t\tself.size.width = os.width + ox;\n\t\t\tself.size.height = os.height + oy;\n\t\t}\n\t\telse if (/^(ne)$/.test(a)) {\n\t\t\tself.size.width = os.width + ox;\n\t\t\tself.size.height = os.height + oy;\n\t\t\tself.position.top = op.top - oy;\n\t\t}\n\t\telse if (/^(sw)$/.test(a)) {\n\t\t\tself.size.width = os.width + ox;\n\t\t\tself.size.height = os.height + oy;\n\t\t\tself.position.left = op.left - ox;\n\t\t}\n\t\telse {\n\t\t\tself.size.width = os.width + ox;\n\t\t\tself.size.height = os.height + oy;\n\t\t\tself.position.top = op.top - oy;\n\t\t\tself.position.left = op.left - ox;\n\t\t}\n\t}\n\n});\n\nvar num = function(v) {\n\treturn parseInt(v, 10) || 0;\n};\n\nvar isNumber = function(value) {\n\treturn !isNaN(parseInt(value, 10));\n};\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.widget(\"ui.selectable\", $.ui.mouse, {\n\toptions: {\n\t\tappendTo: 'body',\n\t\tautoRefresh: true,\n\t\tdistance: 0,\n\t\tfilter: '*',\n\t\ttolerance: 'touch'\n\t},\n\t_create: function() {\n\t\tvar self = this;\n\n\t\tthis.element.addClass(\"ui-selectable\");\n\n\t\tthis.dragged = false;\n\n\t\t// cache selectee children based on filter\n\t\tvar selectees;\n\t\tthis.refresh = function() {\n\t\t\tselectees = $(self.options.filter, self.element[0]);\n\t\t\tselectees.addClass(\"ui-selectee\");\n\t\t\tselectees.each(function() {\n\t\t\t\tvar $this = $(this);\n\t\t\t\tvar pos = $this.offset();\n\t\t\t\t$.data(this, \"selectable-item\", {\n\t\t\t\t\telement: this,\n\t\t\t\t\t$element: $this,\n\t\t\t\t\tleft: pos.left,\n\t\t\t\t\ttop: pos.top,\n\t\t\t\t\tright: pos.left + $this.outerWidth(),\n\t\t\t\t\tbottom: pos.top + $this.outerHeight(),\n\t\t\t\t\tstartselected: false,\n\t\t\t\t\tselected: $this.hasClass('ui-selected'),\n\t\t\t\t\tselecting: $this.hasClass('ui-selecting'),\n\t\t\t\t\tunselecting: $this.hasClass('ui-unselecting')\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\t\tthis.refresh();\n\n\t\tthis.selectees = selectees.addClass(\"ui-selectee\");\n\n\t\tthis._mouseInit();\n\n\t\tthis.helper = $(\"<div class='ui-selectable-helper'></div>\");\n\t},\n\n\tdestroy: function() {\n\t\tthis.selectees\n\t\t\t.removeClass(\"ui-selectee\")\n\t\t\t.removeData(\"selectable-item\");\n\t\tthis.element\n\t\t\t.removeClass(\"ui-selectable ui-selectable-disabled\")\n\t\t\t.removeData(\"selectable\")\n\t\t\t.unbind(\".selectable\");\n\t\tthis._mouseDestroy();\n\n\t\treturn this;\n\t},\n\n\t_mouseStart: function(event) {\n\t\tvar self = this;\n\n\t\tthis.opos = [event.pageX, event.pageY];\n\n\t\tif (this.options.disabled)\n\t\t\treturn;\n\n\t\tvar options = this.options;\n\n\t\tthis.selectees = $(options.filter, this.element[0]);\n\n\t\tthis._trigger(\"start\", event);\n\n\t\t$(options.appendTo).append(this.helper);\n\t\t// position helper (lasso)\n\t\tthis.helper.css({\n\t\t\t\"left\": event.clientX,\n\t\t\t\"top\": event.clientY,\n\t\t\t\"width\": 0,\n\t\t\t\"height\": 0\n\t\t});\n\n\t\tif (options.autoRefresh) {\n\t\t\tthis.refresh();\n\t\t}\n\n\t\tthis.selectees.filter('.ui-selected').each(function() {\n\t\t\tvar selectee = $.data(this, \"selectable-item\");\n\t\t\tselectee.startselected = true;\n\t\t\tif (!event.metaKey && !event.ctrlKey) {\n\t\t\t\tselectee.$element.removeClass('ui-selected');\n\t\t\t\tselectee.selected = false;\n\t\t\t\tselectee.$element.addClass('ui-unselecting');\n\t\t\t\tselectee.unselecting = true;\n\t\t\t\t// selectable UNSELECTING callback\n\t\t\t\tself._trigger(\"unselecting\", event, {\n\t\t\t\t\tunselecting: selectee.element\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\t$(event.target).parents().andSelf().each(function() {\n\t\t\tvar selectee = $.data(this, \"selectable-item\");\n\t\t\tif (selectee) {\n\t\t\t\tvar doSelect = (!event.metaKey && !event.ctrlKey) || !selectee.$element.hasClass('ui-selected');\n\t\t\t\tselectee.$element\n\t\t\t\t\t.removeClass(doSelect ? \"ui-unselecting\" : \"ui-selected\")\n\t\t\t\t\t.addClass(doSelect ? \"ui-selecting\" : \"ui-unselecting\");\n\t\t\t\tselectee.unselecting = !doSelect;\n\t\t\t\tselectee.selecting = doSelect;\n\t\t\t\tselectee.selected = doSelect;\n\t\t\t\t// selectable (UN)SELECTING callback\n\t\t\t\tif (doSelect) {\n\t\t\t\t\tself._trigger(\"selecting\", event, {\n\t\t\t\t\t\tselecting: selectee.element\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tself._trigger(\"unselecting\", event, {\n\t\t\t\t\t\tunselecting: selectee.element\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\n\t},\n\n\t_mouseDrag: function(event) {\n\t\tvar self = this;\n\t\tthis.dragged = true;\n\n\t\tif (this.options.disabled)\n\t\t\treturn;\n\n\t\tvar options = this.options;\n\n\t\tvar x1 = this.opos[0], y1 = this.opos[1], x2 = event.pageX, y2 = event.pageY;\n\t\tif (x1 > x2) { var tmp = x2; x2 = x1; x1 = tmp; }\n\t\tif (y1 > y2) { var tmp = y2; y2 = y1; y1 = tmp; }\n\t\tthis.helper.css({left: x1, top: y1, width: x2-x1, height: y2-y1});\n\n\t\tthis.selectees.each(function() {\n\t\t\tvar selectee = $.data(this, \"selectable-item\");\n\t\t\t//prevent helper from being selected if appendTo: selectable\n\t\t\tif (!selectee || selectee.element == self.element[0])\n\t\t\t\treturn;\n\t\t\tvar hit = false;\n\t\t\tif (options.tolerance == 'touch') {\n\t\t\t\thit = ( !(selectee.left > x2 || selectee.right < x1 || selectee.top > y2 || selectee.bottom < y1) );\n\t\t\t} else if (options.tolerance == 'fit') {\n\t\t\t\thit = (selectee.left > x1 && selectee.right < x2 && selectee.top > y1 && selectee.bottom < y2);\n\t\t\t}\n\n\t\t\tif (hit) {\n\t\t\t\t// SELECT\n\t\t\t\tif (selectee.selected) {\n\t\t\t\t\tselectee.$element.removeClass('ui-selected');\n\t\t\t\t\tselectee.selected = false;\n\t\t\t\t}\n\t\t\t\tif (selectee.unselecting) {\n\t\t\t\t\tselectee.$element.removeClass('ui-unselecting');\n\t\t\t\t\tselectee.unselecting = false;\n\t\t\t\t}\n\t\t\t\tif (!selectee.selecting) {\n\t\t\t\t\tselectee.$element.addClass('ui-selecting');\n\t\t\t\t\tselectee.selecting = true;\n\t\t\t\t\t// selectable SELECTING callback\n\t\t\t\t\tself._trigger(\"selecting\", event, {\n\t\t\t\t\t\tselecting: selectee.element\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// UNSELECT\n\t\t\t\tif (selectee.selecting) {\n\t\t\t\t\tif ((event.metaKey || event.ctrlKey) && selectee.startselected) {\n\t\t\t\t\t\tselectee.$element.removeClass('ui-selecting');\n\t\t\t\t\t\tselectee.selecting = false;\n\t\t\t\t\t\tselectee.$element.addClass('ui-selected');\n\t\t\t\t\t\tselectee.selected = true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tselectee.$element.removeClass('ui-selecting');\n\t\t\t\t\t\tselectee.selecting = false;\n\t\t\t\t\t\tif (selectee.startselected) {\n\t\t\t\t\t\t\tselectee.$element.addClass('ui-unselecting');\n\t\t\t\t\t\t\tselectee.unselecting = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// selectable UNSELECTING callback\n\t\t\t\t\t\tself._trigger(\"unselecting\", event, {\n\t\t\t\t\t\t\tunselecting: selectee.element\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (selectee.selected) {\n\t\t\t\t\tif (!event.metaKey && !event.ctrlKey && !selectee.startselected) {\n\t\t\t\t\t\tselectee.$element.removeClass('ui-selected');\n\t\t\t\t\t\tselectee.selected = false;\n\n\t\t\t\t\t\tselectee.$element.addClass('ui-unselecting');\n\t\t\t\t\t\tselectee.unselecting = true;\n\t\t\t\t\t\t// selectable UNSELECTING callback\n\t\t\t\t\t\tself._trigger(\"unselecting\", event, {\n\t\t\t\t\t\t\tunselecting: selectee.element\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\treturn false;\n\t},\n\n\t_mouseStop: function(event) {\n\t\tvar self = this;\n\n\t\tthis.dragged = false;\n\n\t\tvar options = this.options;\n\n\t\t$('.ui-unselecting', this.element[0]).each(function() {\n\t\t\tvar selectee = $.data(this, \"selectable-item\");\n\t\t\tselectee.$element.removeClass('ui-unselecting');\n\t\t\tselectee.unselecting = false;\n\t\t\tselectee.startselected = false;\n\t\t\tself._trigger(\"unselected\", event, {\n\t\t\t\tunselected: selectee.element\n\t\t\t});\n\t\t});\n\t\t$('.ui-selecting', this.element[0]).each(function() {\n\t\t\tvar selectee = $.data(this, \"selectable-item\");\n\t\t\tselectee.$element.removeClass('ui-selecting').addClass('ui-selected');\n\t\t\tselectee.selecting = false;\n\t\t\tselectee.selected = true;\n\t\t\tselectee.startselected = true;\n\t\t\tself._trigger(\"selected\", event, {\n\t\t\t\tselected: selectee.element\n\t\t\t});\n\t\t});\n\t\tthis._trigger(\"stop\", event);\n\n\t\tthis.helper.remove();\n\n\t\treturn false;\n\t}\n\n});\n\n$.extend($.ui.selectable, {\n\tversion: \"1.8.24\"\n});\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.widget(\"ui.sortable\", $.ui.mouse, {\n\twidgetEventPrefix: \"sort\",\n\tready: false,\n\toptions: {\n\t\tappendTo: \"parent\",\n\t\taxis: false,\n\t\tconnectWith: false,\n\t\tcontainment: false,\n\t\tcursor: 'auto',\n\t\tcursorAt: false,\n\t\tdropOnEmpty: true,\n\t\tforcePlaceholderSize: false,\n\t\tforceHelperSize: false,\n\t\tgrid: false,\n\t\thandle: false,\n\t\thelper: \"original\",\n\t\titems: '> *',\n\t\topacity: false,\n\t\tplaceholder: false,\n\t\trevert: false,\n\t\tscroll: true,\n\t\tscrollSensitivity: 20,\n\t\tscrollSpeed: 20,\n\t\tscope: \"default\",\n\t\ttolerance: \"intersect\",\n\t\tzIndex: 1000\n\t},\n\t_create: function() {\n\n\t\tvar o = this.options;\n\t\tthis.containerCache = {};\n\t\tthis.element.addClass(\"ui-sortable\");\n\n\t\t//Get the items\n\t\tthis.refresh();\n\n\t\t//Let's determine if the items are being displayed horizontally\n\t\tthis.floating = this.items.length ? o.axis === 'x' || (/left|right/).test(this.items[0].item.css('float')) || (/inline|table-cell/).test(this.items[0].item.css('display')) : false;\n\n\t\t//Let's determine the parent's offset\n\t\tthis.offset = this.element.offset();\n\n\t\t//Initialize mouse events for interaction\n\t\tthis._mouseInit();\n\t\t\n\t\t//We're ready to go\n\t\tthis.ready = true\n\n\t},\n\n\tdestroy: function() {\n\t\t$.Widget.prototype.destroy.call( this );\n\t\tthis.element\n\t\t\t.removeClass(\"ui-sortable ui-sortable-disabled\");\n\t\tthis._mouseDestroy();\n\n\t\tfor ( var i = this.items.length - 1; i >= 0; i-- )\n\t\t\tthis.items[i].item.removeData(this.widgetName + \"-item\");\n\n\t\treturn this;\n\t},\n\n\t_setOption: function(key, value){\n\t\tif ( key === \"disabled\" ) {\n\t\t\tthis.options[ key ] = value;\n\t\n\t\t\tthis.widget()\n\t\t\t\t[ value ? \"addClass\" : \"removeClass\"]( \"ui-sortable-disabled\" );\n\t\t} else {\n\t\t\t// Don't call widget base _setOption for disable as it adds ui-state-disabled class\n\t\t\t$.Widget.prototype._setOption.apply(this, arguments);\n\t\t}\n\t},\n\n\t_mouseCapture: function(event, overrideHandle) {\n\t\tvar that = this;\n\n\t\tif (this.reverting) {\n\t\t\treturn false;\n\t\t}\n\n\t\tif(this.options.disabled || this.options.type == 'static') return false;\n\n\t\t//We have to refresh the items data once first\n\t\tthis._refreshItems(event);\n\n\t\t//Find out if the clicked node (or one of its parents) is a actual item in this.items\n\t\tvar currentItem = null, self = this, nodes = $(event.target).parents().each(function() {\n\t\t\tif($.data(this, that.widgetName + '-item') == self) {\n\t\t\t\tcurrentItem = $(this);\n\t\t\t\treturn false;\n\t\t\t}\n\t\t});\n\t\tif($.data(event.target, that.widgetName + '-item') == self) currentItem = $(event.target);\n\n\t\tif(!currentItem) return false;\n\t\tif(this.options.handle && !overrideHandle) {\n\t\t\tvar validHandle = false;\n\n\t\t\t$(this.options.handle, currentItem).find(\"*\").andSelf().each(function() { if(this == event.target) validHandle = true; });\n\t\t\tif(!validHandle) return false;\n\t\t}\n\n\t\tthis.currentItem = currentItem;\n\t\tthis._removeCurrentsFromItems();\n\t\treturn true;\n\n\t},\n\n\t_mouseStart: function(event, overrideHandle, noActivation) {\n\n\t\tvar o = this.options, self = this;\n\t\tthis.currentContainer = this;\n\n\t\t//We only need to call refreshPositions, because the refreshItems call has been moved to mouseCapture\n\t\tthis.refreshPositions();\n\n\t\t//Create and append the visible helper\n\t\tthis.helper = this._createHelper(event);\n\n\t\t//Cache the helper size\n\t\tthis._cacheHelperProportions();\n\n\t\t/*\n\t\t * - Position generation -\n\t\t * This block generates everything position related - it's the core of draggables.\n\t\t */\n\n\t\t//Cache the margins of the original element\n\t\tthis._cacheMargins();\n\n\t\t//Get the next scrolling parent\n\t\tthis.scrollParent = this.helper.scrollParent();\n\n\t\t//The element's absolute position on the page minus margins\n\t\tthis.offset = this.currentItem.offset();\n\t\tthis.offset = {\n\t\t\ttop: this.offset.top - this.margins.top,\n\t\t\tleft: this.offset.left - this.margins.left\n\t\t};\n\n\t\t$.extend(this.offset, {\n\t\t\tclick: { //Where the click happened, relative to the element\n\t\t\t\tleft: event.pageX - this.offset.left,\n\t\t\t\ttop: event.pageY - this.offset.top\n\t\t\t},\n\t\t\tparent: this._getParentOffset(),\n\t\t\trelative: this._getRelativeOffset() //This is a relative to absolute position minus the actual position calculation - only used for relative positioned helper\n\t\t});\n\n\t\t// Only after we got the offset, we can change the helper's position to absolute\n\t\t// TODO: Still need to figure out a way to make relative sorting possible\n\t\tthis.helper.css(\"position\", \"absolute\");\n\t\tthis.cssPosition = this.helper.css(\"position\");\n\t\t\n\t\t//Generate the original position\n\t\tthis.originalPosition = this._generatePosition(event);\n\t\tthis.originalPageX = event.pageX;\n\t\tthis.originalPageY = event.pageY;\n\n\t\t//Adjust the mouse offset relative to the helper if 'cursorAt' is supplied\n\t\t(o.cursorAt && this._adjustOffsetFromHelper(o.cursorAt));\n\n\t\t//Cache the former DOM position\n\t\tthis.domPosition = { prev: this.currentItem.prev()[0], parent: this.currentItem.parent()[0] };\n\n\t\t//If the helper is not the original, hide the original so it's not playing any role during the drag, won't cause anything bad this way\n\t\tif(this.helper[0] != this.currentItem[0]) {\n\t\t\tthis.currentItem.hide();\n\t\t}\n\n\t\t//Create the placeholder\n\t\tthis._createPlaceholder();\n\n\t\t//Set a containment if given in the options\n\t\tif(o.containment)\n\t\t\tthis._setContainment();\n\n\t\tif(o.cursor) { // cursor option\n\t\t\tif ($('body').css(\"cursor\")) this._storedCursor = $('body').css(\"cursor\");\n\t\t\t$('body').css(\"cursor\", o.cursor);\n\t\t}\n\n\t\tif(o.opacity) { // opacity option\n\t\t\tif (this.helper.css(\"opacity\")) this._storedOpacity = this.helper.css(\"opacity\");\n\t\t\tthis.helper.css(\"opacity\", o.opacity);\n\t\t}\n\n\t\tif(o.zIndex) { // zIndex option\n\t\t\tif (this.helper.css(\"zIndex\")) this._storedZIndex = this.helper.css(\"zIndex\");\n\t\t\tthis.helper.css(\"zIndex\", o.zIndex);\n\t\t}\n\n\t\t//Prepare scrolling\n\t\tif(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML')\n\t\t\tthis.overflowOffset = this.scrollParent.offset();\n\n\t\t//Call callbacks\n\t\tthis._trigger(\"start\", event, this._uiHash());\n\n\t\t//Recache the helper size\n\t\tif(!this._preserveHelperProportions)\n\t\t\tthis._cacheHelperProportions();\n\n\n\t\t//Post 'activate' events to possible containers\n\t\tif(!noActivation) {\n\t\t\t for (var i = this.containers.length - 1; i >= 0; i--) { this.containers[i]._trigger(\"activate\", event, self._uiHash(this)); }\n\t\t}\n\n\t\t//Prepare possible droppables\n\t\tif($.ui.ddmanager)\n\t\t\t$.ui.ddmanager.current = this;\n\n\t\tif ($.ui.ddmanager && !o.dropBehaviour)\n\t\t\t$.ui.ddmanager.prepareOffsets(this, event);\n\n\t\tthis.dragging = true;\n\n\t\tthis.helper.addClass(\"ui-sortable-helper\");\n\t\tthis._mouseDrag(event); //Execute the drag once - this causes the helper not to be visible before getting its correct position\n\t\treturn true;\n\n\t},\n\n\t_mouseDrag: function(event) {\n\n\t\t//Compute the helpers position\n\t\tthis.position = this._generatePosition(event);\n\t\tthis.positionAbs = this._convertPositionTo(\"absolute\");\n\n\t\tif (!this.lastPositionAbs) {\n\t\t\tthis.lastPositionAbs = this.positionAbs;\n\t\t}\n\n\t\t//Do scrolling\n\t\tif(this.options.scroll) {\n\t\t\tvar o = this.options, scrolled = false;\n\t\t\tif(this.scrollParent[0] != document && this.scrollParent[0].tagName != 'HTML') {\n\n\t\t\t\tif((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)\n\t\t\t\t\tthis.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;\n\t\t\t\telse if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)\n\t\t\t\t\tthis.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;\n\n\t\t\t\tif((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)\n\t\t\t\t\tthis.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;\n\t\t\t\telse if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)\n\t\t\t\t\tthis.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;\n\n\t\t\t} else {\n\n\t\t\t\tif(event.pageY - $(document).scrollTop() < o.scrollSensitivity)\n\t\t\t\t\tscrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);\n\t\t\t\telse if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)\n\t\t\t\t\tscrolled = $(document).scrollTop($(document).scrollTop() + o.scrollSpeed);\n\n\t\t\t\tif(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)\n\t\t\t\t\tscrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);\n\t\t\t\telse if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)\n\t\t\t\t\tscrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);\n\n\t\t\t}\n\n\t\t\tif(scrolled !== false && $.ui.ddmanager && !o.dropBehaviour)\n\t\t\t\t$.ui.ddmanager.prepareOffsets(this, event);\n\t\t}\n\n\t\t//Regenerate the absolute position used for position checks\n\t\tthis.positionAbs = this._convertPositionTo(\"absolute\");\n\n\t\t//Set the helper position\n\t\tif(!this.options.axis || this.options.axis != \"y\") this.helper[0].style.left = this.position.left+'px';\n\t\tif(!this.options.axis || this.options.axis != \"x\") this.helper[0].style.top = this.position.top+'px';\n\n\t\t//Rearrange\n\t\tfor (var i = this.items.length - 1; i >= 0; i--) {\n\n\t\t\t//Cache variables and intersection, continue if no intersection\n\t\t\tvar item = this.items[i], itemElement = item.item[0], intersection = this._intersectsWithPointer(item);\n\t\t\tif (!intersection) continue;\n\n\t\t\t// Only put the placeholder inside the current Container, skip all\n\t\t\t// items form other containers. This works because when moving\n\t\t\t// an item from one container to another the\n\t\t\t// currentContainer is switched before the placeholder is moved.\n\t\t\t//\n\t\t\t// Without this moving items in \"sub-sortables\" can cause the placeholder to jitter\n\t\t\t// beetween the outer and inner container.\n\t\t\tif (item.instance !== this.currentContainer) continue;\n\n\t\t\tif (itemElement != this.currentItem[0] //cannot intersect with itself\n\t\t\t\t&&\tthis.placeholder[intersection == 1 ? \"next\" : \"prev\"]()[0] != itemElement //no useless actions that have been done before\n\t\t\t\t&&\t!$.ui.contains(this.placeholder[0], itemElement) //no action if the item moved is the parent of the item checked\n\t\t\t\t&& (this.options.type == 'semi-dynamic' ? !$.ui.contains(this.element[0], itemElement) : true)\n\t\t\t\t//&& itemElement.parentNode == this.placeholder[0].parentNode // only rearrange items within the same container\n\t\t\t) {\n\n\t\t\t\tthis.direction = intersection == 1 ? \"down\" : \"up\";\n\n\t\t\t\tif (this.options.tolerance == \"pointer\" || this._intersectsWithSides(item)) {\n\t\t\t\t\tthis._rearrange(event, item);\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tthis._trigger(\"change\", event, this._uiHash());\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t//Post events to containers\n\t\tthis._contactContainers(event);\n\n\t\t//Interconnect with droppables\n\t\tif($.ui.ddmanager) $.ui.ddmanager.drag(this, event);\n\n\t\t//Call callbacks\n\t\tthis._trigger('sort', event, this._uiHash());\n\n\t\tthis.lastPositionAbs = this.positionAbs;\n\t\treturn false;\n\n\t},\n\n\t_mouseStop: function(event, noPropagation) {\n\n\t\tif(!event) return;\n\n\t\t//If we are using droppables, inform the manager about the drop\n\t\tif ($.ui.ddmanager && !this.options.dropBehaviour)\n\t\t\t$.ui.ddmanager.drop(this, event);\n\n\t\tif(this.options.revert) {\n\t\t\tvar self = this;\n\t\t\tvar cur = self.placeholder.offset();\n\n\t\t\tself.reverting = true;\n\n\t\t\t$(this.helper).animate({\n\t\t\t\tleft: cur.left - this.offset.parent.left - self.margins.left + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollLeft),\n\t\t\t\ttop: cur.top - this.offset.parent.top - self.margins.top + (this.offsetParent[0] == document.body ? 0 : this.offsetParent[0].scrollTop)\n\t\t\t}, parseInt(this.options.revert, 10) || 500, function() {\n\t\t\t\tself._clear(event);\n\t\t\t});\n\t\t} else {\n\t\t\tthis._clear(event, noPropagation);\n\t\t}\n\n\t\treturn false;\n\n\t},\n\n\tcancel: function() {\n\n\t\tvar self = this;\n\n\t\tif(this.dragging) {\n\n\t\t\tthis._mouseUp({ target: null });\n\n\t\t\tif(this.options.helper == \"original\")\n\t\t\t\tthis.currentItem.css(this._storedCSS).removeClass(\"ui-sortable-helper\");\n\t\t\telse\n\t\t\t\tthis.currentItem.show();\n\n\t\t\t//Post deactivating events to containers\n\t\t\tfor (var i = this.containers.length - 1; i >= 0; i--){\n\t\t\t\tthis.containers[i]._trigger(\"deactivate\", null, self._uiHash(this));\n\t\t\t\tif(this.containers[i].containerCache.over) {\n\t\t\t\t\tthis.containers[i]._trigger(\"out\", null, self._uiHash(this));\n\t\t\t\t\tthis.containers[i].containerCache.over = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\tif (this.placeholder) {\n\t\t\t//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!\n\t\t\tif(this.placeholder[0].parentNode) this.placeholder[0].parentNode.removeChild(this.placeholder[0]);\n\t\t\tif(this.options.helper != \"original\" && this.helper && this.helper[0].parentNode) this.helper.remove();\n\n\t\t\t$.extend(this, {\n\t\t\t\thelper: null,\n\t\t\t\tdragging: false,\n\t\t\t\treverting: false,\n\t\t\t\t_noFinalSort: null\n\t\t\t});\n\n\t\t\tif(this.domPosition.prev) {\n\t\t\t\t$(this.domPosition.prev).after(this.currentItem);\n\t\t\t} else {\n\t\t\t\t$(this.domPosition.parent).prepend(this.currentItem);\n\t\t\t}\n\t\t}\n\n\t\treturn this;\n\n\t},\n\n\tserialize: function(o) {\n\n\t\tvar items = this._getItemsAsjQuery(o && o.connected);\n\t\tvar str = []; o = o || {};\n\n\t\t$(items).each(function() {\n\t\t\tvar res = ($(o.item || this).attr(o.attribute || 'id') || '').match(o.expression || (/(.+)[-=_](.+)/));\n\t\t\tif(res) str.push((o.key || res[1]+'[]')+'='+(o.key && o.expression ? res[1] : res[2]));\n\t\t});\n\n\t\tif(!str.length && o.key) {\n\t\t\tstr.push(o.key + '=');\n\t\t}\n\n\t\treturn str.join('&');\n\n\t},\n\n\ttoArray: function(o) {\n\n\t\tvar items = this._getItemsAsjQuery(o && o.connected);\n\t\tvar ret = []; o = o || {};\n\n\t\titems.each(function() { ret.push($(o.item || this).attr(o.attribute || 'id') || ''); });\n\t\treturn ret;\n\n\t},\n\n\t/* Be careful with the following core functions */\n\t_intersectsWith: function(item) {\n\n\t\tvar x1 = this.positionAbs.left,\n\t\t\tx2 = x1 + this.helperProportions.width,\n\t\t\ty1 = this.positionAbs.top,\n\t\t\ty2 = y1 + this.helperProportions.height;\n\n\t\tvar l = item.left,\n\t\t\tr = l + item.width,\n\t\t\tt = item.top,\n\t\t\tb = t + item.height;\n\n\t\tvar dyClick = this.offset.click.top,\n\t\t\tdxClick = this.offset.click.left;\n\n\t\tvar isOverElement = (y1 + dyClick) > t && (y1 + dyClick) < b && (x1 + dxClick) > l && (x1 + dxClick) < r;\n\n\t\tif(\t   this.options.tolerance == \"pointer\"\n\t\t\t|| this.options.forcePointerForContainers\n\t\t\t|| (this.options.tolerance != \"pointer\" && this.helperProportions[this.floating ? 'width' : 'height'] > item[this.floating ? 'width' : 'height'])\n\t\t) {\n\t\t\treturn isOverElement;\n\t\t} else {\n\n\t\t\treturn (l < x1 + (this.helperProportions.width / 2) // Right Half\n\t\t\t\t&& x2 - (this.helperProportions.width / 2) < r // Left Half\n\t\t\t\t&& t < y1 + (this.helperProportions.height / 2) // Bottom Half\n\t\t\t\t&& y2 - (this.helperProportions.height / 2) < b ); // Top Half\n\n\t\t}\n\t},\n\n\t_intersectsWithPointer: function(item) {\n\n\t\tvar isOverElementHeight = (this.options.axis === 'x') || $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top, item.height),\n\t\t\tisOverElementWidth = (this.options.axis === 'y') || $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left, item.width),\n\t\t\tisOverElement = isOverElementHeight && isOverElementWidth,\n\t\t\tverticalDirection = this._getDragVerticalDirection(),\n\t\t\thorizontalDirection = this._getDragHorizontalDirection();\n\n\t\tif (!isOverElement)\n\t\t\treturn false;\n\n\t\treturn this.floating ?\n\t\t\t( ((horizontalDirection && horizontalDirection == \"right\") || verticalDirection == \"down\") ? 2 : 1 )\n\t\t\t: ( verticalDirection && (verticalDirection == \"down\" ? 2 : 1) );\n\n\t},\n\n\t_intersectsWithSides: function(item) {\n\n\t\tvar isOverBottomHalf = $.ui.isOverAxis(this.positionAbs.top + this.offset.click.top, item.top + (item.height/2), item.height),\n\t\t\tisOverRightHalf = $.ui.isOverAxis(this.positionAbs.left + this.offset.click.left, item.left + (item.width/2), item.width),\n\t\t\tverticalDirection = this._getDragVerticalDirection(),\n\t\t\thorizontalDirection = this._getDragHorizontalDirection();\n\n\t\tif (this.floating && horizontalDirection) {\n\t\t\treturn ((horizontalDirection == \"right\" && isOverRightHalf) || (horizontalDirection == \"left\" && !isOverRightHalf));\n\t\t} else {\n\t\t\treturn verticalDirection && ((verticalDirection == \"down\" && isOverBottomHalf) || (verticalDirection == \"up\" && !isOverBottomHalf));\n\t\t}\n\n\t},\n\n\t_getDragVerticalDirection: function() {\n\t\tvar delta = this.positionAbs.top - this.lastPositionAbs.top;\n\t\treturn delta != 0 && (delta > 0 ? \"down\" : \"up\");\n\t},\n\n\t_getDragHorizontalDirection: function() {\n\t\tvar delta = this.positionAbs.left - this.lastPositionAbs.left;\n\t\treturn delta != 0 && (delta > 0 ? \"right\" : \"left\");\n\t},\n\n\trefresh: function(event) {\n\t\tthis._refreshItems(event);\n\t\tthis.refreshPositions();\n\t\treturn this;\n\t},\n\n\t_connectWith: function() {\n\t\tvar options = this.options;\n\t\treturn options.connectWith.constructor == String\n\t\t\t? [options.connectWith]\n\t\t\t: options.connectWith;\n\t},\n\t\n\t_getItemsAsjQuery: function(connected) {\n\n\t\tvar self = this;\n\t\tvar items = [];\n\t\tvar queries = [];\n\t\tvar connectWith = this._connectWith();\n\n\t\tif(connectWith && connected) {\n\t\t\tfor (var i = connectWith.length - 1; i >= 0; i--){\n\t\t\t\tvar cur = $(connectWith[i]);\n\t\t\t\tfor (var j = cur.length - 1; j >= 0; j--){\n\t\t\t\t\tvar inst = $.data(cur[j], this.widgetName);\n\t\t\t\t\tif(inst && inst != this && !inst.options.disabled) {\n\t\t\t\t\t\tqueries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element) : $(inst.options.items, inst.element).not(\".ui-sortable-helper\").not('.ui-sortable-placeholder'), inst]);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\n\t\tqueries.push([$.isFunction(this.options.items) ? this.options.items.call(this.element, null, { options: this.options, item: this.currentItem }) : $(this.options.items, this.element).not(\".ui-sortable-helper\").not('.ui-sortable-placeholder'), this]);\n\n\t\tfor (var i = queries.length - 1; i >= 0; i--){\n\t\t\tqueries[i][0].each(function() {\n\t\t\t\titems.push(this);\n\t\t\t});\n\t\t};\n\n\t\treturn $(items);\n\n\t},\n\n\t_removeCurrentsFromItems: function() {\n\n\t\tvar list = this.currentItem.find(\":data(\" + this.widgetName + \"-item)\");\n\n\t\tfor (var i=0; i < this.items.length; i++) {\n\n\t\t\tfor (var j=0; j < list.length; j++) {\n\t\t\t\tif(list[j] == this.items[i].item[0])\n\t\t\t\t\tthis.items.splice(i,1);\n\t\t\t};\n\n\t\t};\n\n\t},\n\n\t_refreshItems: function(event) {\n\n\t\tthis.items = [];\n\t\tthis.containers = [this];\n\t\tvar items = this.items;\n\t\tvar self = this;\n\t\tvar queries = [[$.isFunction(this.options.items) ? this.options.items.call(this.element[0], event, { item: this.currentItem }) : $(this.options.items, this.element), this]];\n\t\tvar connectWith = this._connectWith();\n\n\t\tif(connectWith && this.ready) { //Shouldn't be run the first time through due to massive slow-down\n\t\t\tfor (var i = connectWith.length - 1; i >= 0; i--){\n\t\t\t\tvar cur = $(connectWith[i]);\n\t\t\t\tfor (var j = cur.length - 1; j >= 0; j--){\n\t\t\t\t\tvar inst = $.data(cur[j], this.widgetName);\n\t\t\t\t\tif(inst && inst != this && !inst.options.disabled) {\n\t\t\t\t\t\tqueries.push([$.isFunction(inst.options.items) ? inst.options.items.call(inst.element[0], event, { item: this.currentItem }) : $(inst.options.items, inst.element), inst]);\n\t\t\t\t\t\tthis.containers.push(inst);\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t};\n\t\t}\n\n\t\tfor (var i = queries.length - 1; i >= 0; i--) {\n\t\t\tvar targetData = queries[i][1];\n\t\t\tvar _queries = queries[i][0];\n\n\t\t\tfor (var j=0, queriesLength = _queries.length; j < queriesLength; j++) {\n\t\t\t\tvar item = $(_queries[j]);\n\n\t\t\t\titem.data(this.widgetName + '-item', targetData); // Data for target checking (mouse manager)\n\n\t\t\t\titems.push({\n\t\t\t\t\titem: item,\n\t\t\t\t\tinstance: targetData,\n\t\t\t\t\twidth: 0, height: 0,\n\t\t\t\t\tleft: 0, top: 0\n\t\t\t\t});\n\t\t\t};\n\t\t};\n\n\t},\n\n\trefreshPositions: function(fast) {\n\n\t\t//This has to be redone because due to the item being moved out/into the offsetParent, the offsetParent's position will change\n\t\tif(this.offsetParent && this.helper) {\n\t\t\tthis.offset.parent = this._getParentOffset();\n\t\t}\n\n\t\tfor (var i = this.items.length - 1; i >= 0; i--){\n\t\t\tvar item = this.items[i];\n\n\t\t\t//We ignore calculating positions of all connected containers when we're not over them\n\t\t\tif(item.instance != this.currentContainer && this.currentContainer && item.item[0] != this.currentItem[0])\n\t\t\t\tcontinue;\n\n\t\t\tvar t = this.options.toleranceElement ? $(this.options.toleranceElement, item.item) : item.item;\n\n\t\t\tif (!fast) {\n\t\t\t\titem.width = t.outerWidth();\n\t\t\t\titem.height = t.outerHeight();\n\t\t\t}\n\n\t\t\tvar p = t.offset();\n\t\t\titem.left = p.left;\n\t\t\titem.top = p.top;\n\t\t};\n\n\t\tif(this.options.custom && this.options.custom.refreshContainers) {\n\t\t\tthis.options.custom.refreshContainers.call(this);\n\t\t} else {\n\t\t\tfor (var i = this.containers.length - 1; i >= 0; i--){\n\t\t\t\tvar p = this.containers[i].element.offset();\n\t\t\t\tthis.containers[i].containerCache.left = p.left;\n\t\t\t\tthis.containers[i].containerCache.top = p.top;\n\t\t\t\tthis.containers[i].containerCache.width\t= this.containers[i].element.outerWidth();\n\t\t\t\tthis.containers[i].containerCache.height = this.containers[i].element.outerHeight();\n\t\t\t};\n\t\t}\n\n\t\treturn this;\n\t},\n\n\t_createPlaceholder: function(that) {\n\n\t\tvar self = that || this, o = self.options;\n\n\t\tif(!o.placeholder || o.placeholder.constructor == String) {\n\t\t\tvar className = o.placeholder;\n\t\t\to.placeholder = {\n\t\t\t\telement: function() {\n\n\t\t\t\t\tvar el = $(document.createElement(self.currentItem[0].nodeName))\n\t\t\t\t\t\t.addClass(className || self.currentItem[0].className+\" ui-sortable-placeholder\")\n\t\t\t\t\t\t.removeClass(\"ui-sortable-helper\")[0];\n\n\t\t\t\t\tif(!className)\n\t\t\t\t\t\tel.style.visibility = \"hidden\";\n\n\t\t\t\t\treturn el;\n\t\t\t\t},\n\t\t\t\tupdate: function(container, p) {\n\n\t\t\t\t\t// 1. If a className is set as 'placeholder option, we don't force sizes - the class is responsible for that\n\t\t\t\t\t// 2. The option 'forcePlaceholderSize can be enabled to force it even if a class name is specified\n\t\t\t\t\tif(className && !o.forcePlaceholderSize) return;\n\n\t\t\t\t\t//If the element doesn't have a actual height by itself (without styles coming from a stylesheet), it receives the inline height from the dragged item\n\t\t\t\t\tif(!p.height()) { p.height(self.currentItem.innerHeight() - parseInt(self.currentItem.css('paddingTop')||0, 10) - parseInt(self.currentItem.css('paddingBottom')||0, 10)); };\n\t\t\t\t\tif(!p.width()) { p.width(self.currentItem.innerWidth() - parseInt(self.currentItem.css('paddingLeft')||0, 10) - parseInt(self.currentItem.css('paddingRight')||0, 10)); };\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\t//Create the placeholder\n\t\tself.placeholder = $(o.placeholder.element.call(self.element, self.currentItem));\n\n\t\t//Append it after the actual current item\n\t\tself.currentItem.after(self.placeholder);\n\n\t\t//Update the size of the placeholder (TODO: Logic to fuzzy, see line 316/317)\n\t\to.placeholder.update(self, self.placeholder);\n\n\t},\n\n\t_contactContainers: function(event) {\n\t\t\n\t\t// get innermost container that intersects with item \n\t\tvar innermostContainer = null, innermostIndex = null;\t\t\n\t\t\n\t\t\n\t\tfor (var i = this.containers.length - 1; i >= 0; i--){\n\n\t\t\t// never consider a container that's located within the item itself \n\t\t\tif($.ui.contains(this.currentItem[0], this.containers[i].element[0]))\n\t\t\t\tcontinue;\n\n\t\t\tif(this._intersectsWith(this.containers[i].containerCache)) {\n\n\t\t\t\t// if we've already found a container and it's more \"inner\" than this, then continue \n\t\t\t\tif(innermostContainer && $.ui.contains(this.containers[i].element[0], innermostContainer.element[0]))\n\t\t\t\t\tcontinue;\n\n\t\t\t\tinnermostContainer = this.containers[i]; \n\t\t\t\tinnermostIndex = i;\n\t\t\t\t\t\n\t\t\t} else {\n\t\t\t\t// container doesn't intersect. trigger \"out\" event if necessary \n\t\t\t\tif(this.containers[i].containerCache.over) {\n\t\t\t\t\tthis.containers[i]._trigger(\"out\", event, this._uiHash(this));\n\t\t\t\t\tthis.containers[i].containerCache.over = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\t\n\t\t// if no intersecting containers found, return \n\t\tif(!innermostContainer) return; \n\n\t\t// move the item into the container if it's not there already\n\t\tif(this.containers.length === 1) {\n\t\t\tthis.containers[innermostIndex]._trigger(\"over\", event, this._uiHash(this));\n\t\t\tthis.containers[innermostIndex].containerCache.over = 1;\n\t\t} else if(this.currentContainer != this.containers[innermostIndex]) {\n\n\t\t\t//When entering a new container, we will find the item with the least distance and append our item near it\n\t\t\tvar dist = 10000; var itemWithLeastDistance = null; var base = this.positionAbs[this.containers[innermostIndex].floating ? 'left' : 'top'];\n\t\t\tfor (var j = this.items.length - 1; j >= 0; j--) {\n\t\t\t\tif(!$.ui.contains(this.containers[innermostIndex].element[0], this.items[j].item[0])) continue;\n\t\t\t\tvar cur = this.containers[innermostIndex].floating ? this.items[j].item.offset().left : this.items[j].item.offset().top;\n\t\t\t\tif(Math.abs(cur - base) < dist) {\n\t\t\t\t\tdist = Math.abs(cur - base); itemWithLeastDistance = this.items[j];\n\t\t\t\t\tthis.direction = (cur - base > 0) ? 'down' : 'up';\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(!itemWithLeastDistance && !this.options.dropOnEmpty) //Check if dropOnEmpty is enabled\n\t\t\t\treturn;\n\n\t\t\tthis.currentContainer = this.containers[innermostIndex];\n\t\t\titemWithLeastDistance ? this._rearrange(event, itemWithLeastDistance, null, true) : this._rearrange(event, null, this.containers[innermostIndex].element, true);\n\t\t\tthis._trigger(\"change\", event, this._uiHash());\n\t\t\tthis.containers[innermostIndex]._trigger(\"change\", event, this._uiHash(this));\n\n\t\t\t//Update the placeholder\n\t\t\tthis.options.placeholder.update(this.currentContainer, this.placeholder);\n\n\t\t\tthis.containers[innermostIndex]._trigger(\"over\", event, this._uiHash(this));\n\t\t\tthis.containers[innermostIndex].containerCache.over = 1;\n\t\t} \n\t\n\t\t\n\t},\n\n\t_createHelper: function(event) {\n\n\t\tvar o = this.options;\n\t\tvar helper = $.isFunction(o.helper) ? $(o.helper.apply(this.element[0], [event, this.currentItem])) : (o.helper == 'clone' ? this.currentItem.clone() : this.currentItem);\n\n\t\tif(!helper.parents('body').length) //Add the helper to the DOM if that didn't happen already\n\t\t\t$(o.appendTo != 'parent' ? o.appendTo : this.currentItem[0].parentNode)[0].appendChild(helper[0]);\n\n\t\tif(helper[0] == this.currentItem[0])\n\t\t\tthis._storedCSS = { width: this.currentItem[0].style.width, height: this.currentItem[0].style.height, position: this.currentItem.css(\"position\"), top: this.currentItem.css(\"top\"), left: this.currentItem.css(\"left\") };\n\n\t\tif(helper[0].style.width == '' || o.forceHelperSize) helper.width(this.currentItem.width());\n\t\tif(helper[0].style.height == '' || o.forceHelperSize) helper.height(this.currentItem.height());\n\n\t\treturn helper;\n\n\t},\n\n\t_adjustOffsetFromHelper: function(obj) {\n\t\tif (typeof obj == 'string') {\n\t\t\tobj = obj.split(' ');\n\t\t}\n\t\tif ($.isArray(obj)) {\n\t\t\tobj = {left: +obj[0], top: +obj[1] || 0};\n\t\t}\n\t\tif ('left' in obj) {\n\t\t\tthis.offset.click.left = obj.left + this.margins.left;\n\t\t}\n\t\tif ('right' in obj) {\n\t\t\tthis.offset.click.left = this.helperProportions.width - obj.right + this.margins.left;\n\t\t}\n\t\tif ('top' in obj) {\n\t\t\tthis.offset.click.top = obj.top + this.margins.top;\n\t\t}\n\t\tif ('bottom' in obj) {\n\t\t\tthis.offset.click.top = this.helperProportions.height - obj.bottom + this.margins.top;\n\t\t}\n\t},\n\n\t_getParentOffset: function() {\n\n\n\t\t//Get the offsetParent and cache its position\n\t\tthis.offsetParent = this.helper.offsetParent();\n\t\tvar po = this.offsetParent.offset();\n\n\t\t// This is a special case where we need to modify a offset calculated on start, since the following happened:\n\t\t// 1. The position of the helper is absolute, so it's position is calculated based on the next positioned parent\n\t\t// 2. The actual offset parent is a child of the scroll parent, and the scroll parent isn't the document, which means that\n\t\t//    the scroll is included in the initial calculation of the offset of the parent, and never recalculated upon drag\n\t\tif(this.cssPosition == 'absolute' && this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) {\n\t\t\tpo.left += this.scrollParent.scrollLeft();\n\t\t\tpo.top += this.scrollParent.scrollTop();\n\t\t}\n\n\t\tif((this.offsetParent[0] == document.body) //This needs to be actually done for all browsers, since pageX/pageY includes this information\n\t\t|| (this.offsetParent[0].tagName && this.offsetParent[0].tagName.toLowerCase() == 'html' && $.browser.msie)) //Ugly IE fix\n\t\t\tpo = { top: 0, left: 0 };\n\n\t\treturn {\n\t\t\ttop: po.top + (parseInt(this.offsetParent.css(\"borderTopWidth\"),10) || 0),\n\t\t\tleft: po.left + (parseInt(this.offsetParent.css(\"borderLeftWidth\"),10) || 0)\n\t\t};\n\n\t},\n\n\t_getRelativeOffset: function() {\n\n\t\tif(this.cssPosition == \"relative\") {\n\t\t\tvar p = this.currentItem.position();\n\t\t\treturn {\n\t\t\t\ttop: p.top - (parseInt(this.helper.css(\"top\"),10) || 0) + this.scrollParent.scrollTop(),\n\t\t\t\tleft: p.left - (parseInt(this.helper.css(\"left\"),10) || 0) + this.scrollParent.scrollLeft()\n\t\t\t};\n\t\t} else {\n\t\t\treturn { top: 0, left: 0 };\n\t\t}\n\n\t},\n\n\t_cacheMargins: function() {\n\t\tthis.margins = {\n\t\t\tleft: (parseInt(this.currentItem.css(\"marginLeft\"),10) || 0),\n\t\t\ttop: (parseInt(this.currentItem.css(\"marginTop\"),10) || 0)\n\t\t};\n\t},\n\n\t_cacheHelperProportions: function() {\n\t\tthis.helperProportions = {\n\t\t\twidth: this.helper.outerWidth(),\n\t\t\theight: this.helper.outerHeight()\n\t\t};\n\t},\n\n\t_setContainment: function() {\n\n\t\tvar o = this.options;\n\t\tif(o.containment == 'parent') o.containment = this.helper[0].parentNode;\n\t\tif(o.containment == 'document' || o.containment == 'window') this.containment = [\n\t\t\t0 - this.offset.relative.left - this.offset.parent.left,\n\t\t\t0 - this.offset.relative.top - this.offset.parent.top,\n\t\t\t$(o.containment == 'document' ? document : window).width() - this.helperProportions.width - this.margins.left,\n\t\t\t($(o.containment == 'document' ? document : window).height() || document.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top\n\t\t];\n\n\t\tif(!(/^(document|window|parent)$/).test(o.containment)) {\n\t\t\tvar ce = $(o.containment)[0];\n\t\t\tvar co = $(o.containment).offset();\n\t\t\tvar over = ($(ce).css(\"overflow\") != 'hidden');\n\n\t\t\tthis.containment = [\n\t\t\t\tco.left + (parseInt($(ce).css(\"borderLeftWidth\"),10) || 0) + (parseInt($(ce).css(\"paddingLeft\"),10) || 0) - this.margins.left,\n\t\t\t\tco.top + (parseInt($(ce).css(\"borderTopWidth\"),10) || 0) + (parseInt($(ce).css(\"paddingTop\"),10) || 0) - this.margins.top,\n\t\t\t\tco.left+(over ? Math.max(ce.scrollWidth,ce.offsetWidth) : ce.offsetWidth) - (parseInt($(ce).css(\"borderLeftWidth\"),10) || 0) - (parseInt($(ce).css(\"paddingRight\"),10) || 0) - this.helperProportions.width - this.margins.left,\n\t\t\t\tco.top+(over ? Math.max(ce.scrollHeight,ce.offsetHeight) : ce.offsetHeight) - (parseInt($(ce).css(\"borderTopWidth\"),10) || 0) - (parseInt($(ce).css(\"paddingBottom\"),10) || 0) - this.helperProportions.height - this.margins.top\n\t\t\t];\n\t\t}\n\n\t},\n\n\t_convertPositionTo: function(d, pos) {\n\n\t\tif(!pos) pos = this.position;\n\t\tvar mod = d == \"absolute\" ? 1 : -1;\n\t\tvar o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);\n\n\t\treturn {\n\t\t\ttop: (\n\t\t\t\tpos.top\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// The absolute mouse position\n\t\t\t\t+ this.offset.relative.top * mod\t\t\t\t\t\t\t\t\t\t// Only for relative positioned nodes: Relative offset from element to offset parent\n\t\t\t\t+ this.offset.parent.top * mod\t\t\t\t\t\t\t\t\t\t\t// The offsetParent's offset without borders (offset + border)\n\t\t\t\t- ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ) * mod)\n\t\t\t),\n\t\t\tleft: (\n\t\t\t\tpos.left\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// The absolute mouse position\n\t\t\t\t+ this.offset.relative.left * mod\t\t\t\t\t\t\t\t\t\t// Only for relative positioned nodes: Relative offset from element to offset parent\n\t\t\t\t+ this.offset.parent.left * mod\t\t\t\t\t\t\t\t\t\t\t// The offsetParent's offset without borders (offset + border)\n\t\t\t\t- ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ) * mod)\n\t\t\t)\n\t\t};\n\n\t},\n\n\t_generatePosition: function(event) {\n\n\t\tvar o = this.options, scroll = this.cssPosition == 'absolute' && !(this.scrollParent[0] != document && $.ui.contains(this.scrollParent[0], this.offsetParent[0])) ? this.offsetParent : this.scrollParent, scrollIsRootNode = (/(html|body)/i).test(scroll[0].tagName);\n\n\t\t// This is another very weird special case that only happens for relative elements:\n\t\t// 1. If the css position is relative\n\t\t// 2. and the scroll parent is the document or similar to the offset parent\n\t\t// we have to refresh the relative offset during the scroll so there are no jumps\n\t\tif(this.cssPosition == 'relative' && !(this.scrollParent[0] != document && this.scrollParent[0] != this.offsetParent[0])) {\n\t\t\tthis.offset.relative = this._getRelativeOffset();\n\t\t}\n\n\t\tvar pageX = event.pageX;\n\t\tvar pageY = event.pageY;\n\n\t\t/*\n\t\t * - Position constraining -\n\t\t * Constrain the position to a mix of grid, containment.\n\t\t */\n\n\t\tif(this.originalPosition) { //If we are not dragging yet, we won't check for options\n\n\t\t\tif(this.containment) {\n\t\t\t\tif(event.pageX - this.offset.click.left < this.containment[0]) pageX = this.containment[0] + this.offset.click.left;\n\t\t\t\tif(event.pageY - this.offset.click.top < this.containment[1]) pageY = this.containment[1] + this.offset.click.top;\n\t\t\t\tif(event.pageX - this.offset.click.left > this.containment[2]) pageX = this.containment[2] + this.offset.click.left;\n\t\t\t\tif(event.pageY - this.offset.click.top > this.containment[3]) pageY = this.containment[3] + this.offset.click.top;\n\t\t\t}\n\n\t\t\tif(o.grid) {\n\t\t\t\tvar top = this.originalPageY + Math.round((pageY - this.originalPageY) / o.grid[1]) * o.grid[1];\n\t\t\t\tpageY = this.containment ? (!(top - this.offset.click.top < this.containment[1] || top - this.offset.click.top > this.containment[3]) ? top : (!(top - this.offset.click.top < this.containment[1]) ? top - o.grid[1] : top + o.grid[1])) : top;\n\n\t\t\t\tvar left = this.originalPageX + Math.round((pageX - this.originalPageX) / o.grid[0]) * o.grid[0];\n\t\t\t\tpageX = this.containment ? (!(left - this.offset.click.left < this.containment[0] || left - this.offset.click.left > this.containment[2]) ? left : (!(left - this.offset.click.left < this.containment[0]) ? left - o.grid[0] : left + o.grid[0])) : left;\n\t\t\t}\n\n\t\t}\n\n\t\treturn {\n\t\t\ttop: (\n\t\t\t\tpageY\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// The absolute mouse position\n\t\t\t\t- this.offset.click.top\t\t\t\t\t\t\t\t\t\t\t\t\t// Click offset (relative to the element)\n\t\t\t\t- this.offset.relative.top\t\t\t\t\t\t\t\t\t\t\t\t// Only for relative positioned nodes: Relative offset from element to offset parent\n\t\t\t\t- this.offset.parent.top\t\t\t\t\t\t\t\t\t\t\t\t// The offsetParent's offset without borders (offset + border)\n\t\t\t\t+ ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollTop() : ( scrollIsRootNode ? 0 : scroll.scrollTop() ) ))\n\t\t\t),\n\t\t\tleft: (\n\t\t\t\tpageX\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// The absolute mouse position\n\t\t\t\t- this.offset.click.left\t\t\t\t\t\t\t\t\t\t\t\t// Click offset (relative to the element)\n\t\t\t\t- this.offset.relative.left\t\t\t\t\t\t\t\t\t\t\t\t// Only for relative positioned nodes: Relative offset from element to offset parent\n\t\t\t\t- this.offset.parent.left\t\t\t\t\t\t\t\t\t\t\t\t// The offsetParent's offset without borders (offset + border)\n\t\t\t\t+ ($.browser.safari && this.cssPosition == 'fixed' ? 0 : ( this.cssPosition == 'fixed' ? -this.scrollParent.scrollLeft() : scrollIsRootNode ? 0 : scroll.scrollLeft() ))\n\t\t\t)\n\t\t};\n\n\t},\n\n\t_rearrange: function(event, i, a, hardRefresh) {\n\n\t\ta ? a[0].appendChild(this.placeholder[0]) : i.item[0].parentNode.insertBefore(this.placeholder[0], (this.direction == 'down' ? i.item[0] : i.item[0].nextSibling));\n\n\t\t//Various things done here to improve the performance:\n\t\t// 1. we create a setTimeout, that calls refreshPositions\n\t\t// 2. on the instance, we have a counter variable, that get's higher after every append\n\t\t// 3. on the local scope, we copy the counter variable, and check in the timeout, if it's still the same\n\t\t// 4. this lets only the last addition to the timeout stack through\n\t\tthis.counter = this.counter ? ++this.counter : 1;\n\t\tvar self = this, counter = this.counter;\n\n\t\twindow.setTimeout(function() {\n\t\t\tif(counter == self.counter) self.refreshPositions(!hardRefresh); //Precompute after each DOM insertion, NOT on mousemove\n\t\t},0);\n\n\t},\n\n\t_clear: function(event, noPropagation) {\n\n\t\tthis.reverting = false;\n\t\t// We delay all events that have to be triggered to after the point where the placeholder has been removed and\n\t\t// everything else normalized again\n\t\tvar delayedTriggers = [], self = this;\n\n\t\t// We first have to update the dom position of the actual currentItem\n\t\t// Note: don't do it if the current item is already removed (by a user), or it gets reappended (see #4088)\n\t\tif(!this._noFinalSort && this.currentItem.parent().length) this.placeholder.before(this.currentItem);\n\t\tthis._noFinalSort = null;\n\n\t\tif(this.helper[0] == this.currentItem[0]) {\n\t\t\tfor(var i in this._storedCSS) {\n\t\t\t\tif(this._storedCSS[i] == 'auto' || this._storedCSS[i] == 'static') this._storedCSS[i] = '';\n\t\t\t}\n\t\t\tthis.currentItem.css(this._storedCSS).removeClass(\"ui-sortable-helper\");\n\t\t} else {\n\t\t\tthis.currentItem.show();\n\t\t}\n\n\t\tif(this.fromOutside && !noPropagation) delayedTriggers.push(function(event) { this._trigger(\"receive\", event, this._uiHash(this.fromOutside)); });\n\t\tif((this.fromOutside || this.domPosition.prev != this.currentItem.prev().not(\".ui-sortable-helper\")[0] || this.domPosition.parent != this.currentItem.parent()[0]) && !noPropagation) delayedTriggers.push(function(event) { this._trigger(\"update\", event, this._uiHash()); }); //Trigger update callback if the DOM position has changed\n\n\t\t// Check if the items Container has Changed and trigger appropriate\n\t\t// events.\n\t\tif (this !== this.currentContainer) {\n\t\t\tif(!noPropagation) {\n\t\t\t\tdelayedTriggers.push(function(event) { this._trigger(\"remove\", event, this._uiHash()); });\n\t\t\t\tdelayedTriggers.push((function(c) { return function(event) { c._trigger(\"receive\", event, this._uiHash(this)); };  }).call(this, this.currentContainer));\n\t\t\t\tdelayedTriggers.push((function(c) { return function(event) { c._trigger(\"update\", event, this._uiHash(this));  }; }).call(this, this.currentContainer));\n\t\t\t}\n\t\t}\n\n\t\t//Post events to containers\n\t\tfor (var i = this.containers.length - 1; i >= 0; i--){\n\t\t\tif(!noPropagation) delayedTriggers.push((function(c) { return function(event) { c._trigger(\"deactivate\", event, this._uiHash(this)); };  }).call(this, this.containers[i]));\n\t\t\tif(this.containers[i].containerCache.over) {\n\t\t\t\tdelayedTriggers.push((function(c) { return function(event) { c._trigger(\"out\", event, this._uiHash(this)); };  }).call(this, this.containers[i]));\n\t\t\t\tthis.containers[i].containerCache.over = 0;\n\t\t\t}\n\t\t}\n\n\t\t//Do what was originally in plugins\n\t\tif(this._storedCursor) $('body').css(\"cursor\", this._storedCursor); //Reset cursor\n\t\tif(this._storedOpacity) this.helper.css(\"opacity\", this._storedOpacity); //Reset opacity\n\t\tif(this._storedZIndex) this.helper.css(\"zIndex\", this._storedZIndex == 'auto' ? '' : this._storedZIndex); //Reset z-index\n\n\t\tthis.dragging = false;\n\t\tif(this.cancelHelperRemoval) {\n\t\t\tif(!noPropagation) {\n\t\t\t\tthis._trigger(\"beforeStop\", event, this._uiHash());\n\t\t\t\tfor (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events\n\t\t\t\tthis._trigger(\"stop\", event, this._uiHash());\n\t\t\t}\n\n\t\t\tthis.fromOutside = false;\n\t\t\treturn false;\n\t\t}\n\n\t\tif(!noPropagation) this._trigger(\"beforeStop\", event, this._uiHash());\n\n\t\t//$(this.placeholder[0]).remove(); would have been the jQuery way - unfortunately, it unbinds ALL events from the original node!\n\t\tthis.placeholder[0].parentNode.removeChild(this.placeholder[0]);\n\n\t\tif(this.helper[0] != this.currentItem[0]) this.helper.remove(); this.helper = null;\n\n\t\tif(!noPropagation) {\n\t\t\tfor (var i=0; i < delayedTriggers.length; i++) { delayedTriggers[i].call(this, event); }; //Trigger all delayed events\n\t\t\tthis._trigger(\"stop\", event, this._uiHash());\n\t\t}\n\n\t\tthis.fromOutside = false;\n\t\treturn true;\n\n\t},\n\n\t_trigger: function() {\n\t\tif ($.Widget.prototype._trigger.apply(this, arguments) === false) {\n\t\t\tthis.cancel();\n\t\t}\n\t},\n\n\t_uiHash: function(inst) {\n\t\tvar self = inst || this;\n\t\treturn {\n\t\t\thelper: self.helper,\n\t\t\tplaceholder: self.placeholder || $([]),\n\t\t\tposition: self.position,\n\t\t\toriginalPosition: self.originalPosition,\n\t\t\toffset: self.positionAbs,\n\t\t\titem: self.currentItem,\n\t\t\tsender: inst ? inst.element : null\n\t\t};\n\t}\n\n});\n\n$.extend($.ui.sortable, {\n\tversion: \"1.8.24\"\n});\n\n})(jQuery);\n\n;jQuery.effects || (function($, undefined) {\n\n$.effects = {};\n\n\n\n/******************************************************************************/\n/****************************** COLOR ANIMATIONS ******************************/\n/******************************************************************************/\n\n// override the animation for color styles\n$.each(['backgroundColor', 'borderBottomColor', 'borderLeftColor',\n\t'borderRightColor', 'borderTopColor', 'borderColor', 'color', 'outlineColor'],\nfunction(i, attr) {\n\t$.fx.step[attr] = function(fx) {\n\t\tif (!fx.colorInit) {\n\t\t\tfx.start = getColor(fx.elem, attr);\n\t\t\tfx.end = getRGB(fx.end);\n\t\t\tfx.colorInit = true;\n\t\t}\n\n\t\tfx.elem.style[attr] = 'rgb(' +\n\t\t\tMath.max(Math.min(parseInt((fx.pos * (fx.end[0] - fx.start[0])) + fx.start[0], 10), 255), 0) + ',' +\n\t\t\tMath.max(Math.min(parseInt((fx.pos * (fx.end[1] - fx.start[1])) + fx.start[1], 10), 255), 0) + ',' +\n\t\t\tMath.max(Math.min(parseInt((fx.pos * (fx.end[2] - fx.start[2])) + fx.start[2], 10), 255), 0) + ')';\n\t};\n});\n\n// Color Conversion functions from highlightFade\n// By Blair Mitchelmore\n// http://jquery.offput.ca/highlightFade/\n\n// Parse strings looking for color tuples [255,255,255]\nfunction getRGB(color) {\n\t\tvar result;\n\n\t\t// Check if we're already dealing with an array of colors\n\t\tif ( color && color.constructor == Array && color.length == 3 )\n\t\t\t\treturn color;\n\n\t\t// Look for rgb(num,num,num)\n\t\tif (result = /rgb\\(\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*,\\s*([0-9]{1,3})\\s*\\)/.exec(color))\n\t\t\t\treturn [parseInt(result[1],10), parseInt(result[2],10), parseInt(result[3],10)];\n\n\t\t// Look for rgb(num%,num%,num%)\n\t\tif (result = /rgb\\(\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*,\\s*([0-9]+(?:\\.[0-9]+)?)\\%\\s*\\)/.exec(color))\n\t\t\t\treturn [parseFloat(result[1])*2.55, parseFloat(result[2])*2.55, parseFloat(result[3])*2.55];\n\n\t\t// Look for #a0b1c2\n\t\tif (result = /#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})/.exec(color))\n\t\t\t\treturn [parseInt(result[1],16), parseInt(result[2],16), parseInt(result[3],16)];\n\n\t\t// Look for #fff\n\t\tif (result = /#([a-fA-F0-9])([a-fA-F0-9])([a-fA-F0-9])/.exec(color))\n\t\t\t\treturn [parseInt(result[1]+result[1],16), parseInt(result[2]+result[2],16), parseInt(result[3]+result[3],16)];\n\n\t\t// Look for rgba(0, 0, 0, 0) == transparent in Safari 3\n\t\tif (result = /rgba\\(0, 0, 0, 0\\)/.exec(color))\n\t\t\t\treturn colors['transparent'];\n\n\t\t// Otherwise, we're most likely dealing with a named color\n\t\treturn colors[$.trim(color).toLowerCase()];\n}\n\nfunction getColor(elem, attr) {\n\t\tvar color;\n\n\t\tdo {\n\t\t\t\t// jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css\n\t\t\t\tcolor = ($.curCSS || $.css)(elem, attr);\n\n\t\t\t\t// Keep going until we find an element that has color, or we hit the body\n\t\t\t\tif ( color != '' && color != 'transparent' || $.nodeName(elem, \"body\") )\n\t\t\t\t\t\tbreak;\n\n\t\t\t\tattr = \"backgroundColor\";\n\t\t} while ( elem = elem.parentNode );\n\n\t\treturn getRGB(color);\n};\n\n// Some named colors to work with\n// From Interface by Stefan Petre\n// http://interface.eyecon.ro/\n\nvar colors = {\n\taqua:[0,255,255],\n\tazure:[240,255,255],\n\tbeige:[245,245,220],\n\tblack:[0,0,0],\n\tblue:[0,0,255],\n\tbrown:[165,42,42],\n\tcyan:[0,255,255],\n\tdarkblue:[0,0,139],\n\tdarkcyan:[0,139,139],\n\tdarkgrey:[169,169,169],\n\tdarkgreen:[0,100,0],\n\tdarkkhaki:[189,183,107],\n\tdarkmagenta:[139,0,139],\n\tdarkolivegreen:[85,107,47],\n\tdarkorange:[255,140,0],\n\tdarkorchid:[153,50,204],\n\tdarkred:[139,0,0],\n\tdarksalmon:[233,150,122],\n\tdarkviolet:[148,0,211],\n\tfuchsia:[255,0,255],\n\tgold:[255,215,0],\n\tgreen:[0,128,0],\n\tindigo:[75,0,130],\n\tkhaki:[240,230,140],\n\tlightblue:[173,216,230],\n\tlightcyan:[224,255,255],\n\tlightgreen:[144,238,144],\n\tlightgrey:[211,211,211],\n\tlightpink:[255,182,193],\n\tlightyellow:[255,255,224],\n\tlime:[0,255,0],\n\tmagenta:[255,0,255],\n\tmaroon:[128,0,0],\n\tnavy:[0,0,128],\n\tolive:[128,128,0],\n\torange:[255,165,0],\n\tpink:[255,192,203],\n\tpurple:[128,0,128],\n\tviolet:[128,0,128],\n\tred:[255,0,0],\n\tsilver:[192,192,192],\n\twhite:[255,255,255],\n\tyellow:[255,255,0],\n\ttransparent: [255,255,255]\n};\n\n\n\n/******************************************************************************/\n/****************************** CLASS ANIMATIONS ******************************/\n/******************************************************************************/\n\nvar classAnimationActions = ['add', 'remove', 'toggle'],\n\tshorthandStyles = {\n\t\tborder: 1,\n\t\tborderBottom: 1,\n\t\tborderColor: 1,\n\t\tborderLeft: 1,\n\t\tborderRight: 1,\n\t\tborderTop: 1,\n\t\tborderWidth: 1,\n\t\tmargin: 1,\n\t\tpadding: 1\n\t};\n\nfunction getElementStyles() {\n\tvar style = document.defaultView\n\t\t\t? document.defaultView.getComputedStyle(this, null)\n\t\t\t: this.currentStyle,\n\t\tnewStyle = {},\n\t\tkey,\n\t\tcamelCase;\n\n\t// webkit enumerates style porperties\n\tif (style && style.length && style[0] && style[style[0]]) {\n\t\tvar len = style.length;\n\t\twhile (len--) {\n\t\t\tkey = style[len];\n\t\t\tif (typeof style[key] == 'string') {\n\t\t\t\tcamelCase = key.replace(/\\-(\\w)/g, function(all, letter){\n\t\t\t\t\treturn letter.toUpperCase();\n\t\t\t\t});\n\t\t\t\tnewStyle[camelCase] = style[key];\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor (key in style) {\n\t\t\tif (typeof style[key] === 'string') {\n\t\t\t\tnewStyle[key] = style[key];\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn newStyle;\n}\n\nfunction filterStyles(styles) {\n\tvar name, value;\n\tfor (name in styles) {\n\t\tvalue = styles[name];\n\t\tif (\n\t\t\t// ignore null and undefined values\n\t\t\tvalue == null ||\n\t\t\t// ignore functions (when does this occur?)\n\t\t\t$.isFunction(value) ||\n\t\t\t// shorthand styles that need to be expanded\n\t\t\tname in shorthandStyles ||\n\t\t\t// ignore scrollbars (break in IE)\n\t\t\t(/scrollbar/).test(name) ||\n\n\t\t\t// only colors or values that can be converted to numbers\n\t\t\t(!(/color/i).test(name) && isNaN(parseFloat(value)))\n\t\t) {\n\t\t\tdelete styles[name];\n\t\t}\n\t}\n\t\n\treturn styles;\n}\n\nfunction styleDifference(oldStyle, newStyle) {\n\tvar diff = { _: 0 }, // http://dev.jquery.com/ticket/5459\n\t\tname;\n\n\tfor (name in newStyle) {\n\t\tif (oldStyle[name] != newStyle[name]) {\n\t\t\tdiff[name] = newStyle[name];\n\t\t}\n\t}\n\n\treturn diff;\n}\n\n$.effects.animateClass = function(value, duration, easing, callback) {\n\tif ($.isFunction(easing)) {\n\t\tcallback = easing;\n\t\teasing = null;\n\t}\n\n\treturn this.queue(function() {\n\t\tvar that = $(this),\n\t\t\toriginalStyleAttr = that.attr('style') || ' ',\n\t\t\toriginalStyle = filterStyles(getElementStyles.call(this)),\n\t\t\tnewStyle,\n\t\t\tclassName = that.attr('class') || \"\";\n\n\t\t$.each(classAnimationActions, function(i, action) {\n\t\t\tif (value[action]) {\n\t\t\t\tthat[action + 'Class'](value[action]);\n\t\t\t}\n\t\t});\n\t\tnewStyle = filterStyles(getElementStyles.call(this));\n\t\tthat.attr('class', className);\n\n\t\tthat.animate(styleDifference(originalStyle, newStyle), {\n\t\t\tqueue: false,\n\t\t\tduration: duration,\n\t\t\teasing: easing,\n\t\t\tcomplete: function() {\n\t\t\t\t$.each(classAnimationActions, function(i, action) {\n\t\t\t\t\tif (value[action]) { that[action + 'Class'](value[action]); }\n\t\t\t\t});\n\t\t\t\t// work around bug in IE by clearing the cssText before setting it\n\t\t\t\tif (typeof that.attr('style') == 'object') {\n\t\t\t\t\tthat.attr('style').cssText = '';\n\t\t\t\t\tthat.attr('style').cssText = originalStyleAttr;\n\t\t\t\t} else {\n\t\t\t\t\tthat.attr('style', originalStyleAttr);\n\t\t\t\t}\n\t\t\t\tif (callback) { callback.apply(this, arguments); }\n\t\t\t\t$.dequeue( this );\n\t\t\t}\n\t\t});\n\t});\n};\n\n$.fn.extend({\n\t_addClass: $.fn.addClass,\n\taddClass: function(classNames, speed, easing, callback) {\n\t\treturn speed ? $.effects.animateClass.apply(this, [{ add: classNames },speed,easing,callback]) : this._addClass(classNames);\n\t},\n\n\t_removeClass: $.fn.removeClass,\n\tremoveClass: function(classNames,speed,easing,callback) {\n\t\treturn speed ? $.effects.animateClass.apply(this, [{ remove: classNames },speed,easing,callback]) : this._removeClass(classNames);\n\t},\n\n\t_toggleClass: $.fn.toggleClass,\n\ttoggleClass: function(classNames, force, speed, easing, callback) {\n\t\tif ( typeof force == \"boolean\" || force === undefined ) {\n\t\t\tif ( !speed ) {\n\t\t\t\t// without speed parameter;\n\t\t\t\treturn this._toggleClass(classNames, force);\n\t\t\t} else {\n\t\t\t\treturn $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]);\n\t\t\t}\n\t\t} else {\n\t\t\t// without switch parameter;\n\t\t\treturn $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]);\n\t\t}\n\t},\n\n\tswitchClass: function(remove,add,speed,easing,callback) {\n\t\treturn $.effects.animateClass.apply(this, [{ add: add, remove: remove },speed,easing,callback]);\n\t}\n});\n\n\n\n/******************************************************************************/\n/*********************************** EFFECTS **********************************/\n/******************************************************************************/\n\n$.extend($.effects, {\n\tversion: \"1.8.24\",\n\n\t// Saves a set of properties in a data storage\n\tsave: function(element, set) {\n\t\tfor(var i=0; i < set.length; i++) {\n\t\t\tif(set[i] !== null) element.data(\"ec.storage.\"+set[i], element[0].style[set[i]]);\n\t\t}\n\t},\n\n\t// Restores a set of previously saved properties from a data storage\n\trestore: function(element, set) {\n\t\tfor(var i=0; i < set.length; i++) {\n\t\t\tif(set[i] !== null) element.css(set[i], element.data(\"ec.storage.\"+set[i]));\n\t\t}\n\t},\n\n\tsetMode: function(el, mode) {\n\t\tif (mode == 'toggle') mode = el.is(':hidden') ? 'show' : 'hide'; // Set for toggle\n\t\treturn mode;\n\t},\n\n\tgetBaseline: function(origin, original) { // Translates a [top,left] array into a baseline value\n\t\t// this should be a little more flexible in the future to handle a string & hash\n\t\tvar y, x;\n\t\tswitch (origin[0]) {\n\t\t\tcase 'top': y = 0; break;\n\t\t\tcase 'middle': y = 0.5; break;\n\t\t\tcase 'bottom': y = 1; break;\n\t\t\tdefault: y = origin[0] / original.height;\n\t\t};\n\t\tswitch (origin[1]) {\n\t\t\tcase 'left': x = 0; break;\n\t\t\tcase 'center': x = 0.5; break;\n\t\t\tcase 'right': x = 1; break;\n\t\t\tdefault: x = origin[1] / original.width;\n\t\t};\n\t\treturn {x: x, y: y};\n\t},\n\n\t// Wraps the element around a wrapper that copies position properties\n\tcreateWrapper: function(element) {\n\n\t\t// if the element is already wrapped, return it\n\t\tif (element.parent().is('.ui-effects-wrapper')) {\n\t\t\treturn element.parent();\n\t\t}\n\n\t\t// wrap the element\n\t\tvar props = {\n\t\t\t\twidth: element.outerWidth(true),\n\t\t\t\theight: element.outerHeight(true),\n\t\t\t\t'float': element.css('float')\n\t\t\t},\n\t\t\twrapper = $('<div></div>')\n\t\t\t\t.addClass('ui-effects-wrapper')\n\t\t\t\t.css({\n\t\t\t\t\tfontSize: '100%',\n\t\t\t\t\tbackground: 'transparent',\n\t\t\t\t\tborder: 'none',\n\t\t\t\t\tmargin: 0,\n\t\t\t\t\tpadding: 0\n\t\t\t\t}),\n\t\t\tactive = document.activeElement;\n\n\t\t// support: Firefox\n\t\t// Firefox incorrectly exposes anonymous content\n\t\t// https://bugzilla.mozilla.org/show_bug.cgi?id=561664\n\t\ttry {\n\t\t\tactive.id;\n\t\t} catch( e ) {\n\t\t\tactive = document.body;\n\t\t}\n\n\t\telement.wrap( wrapper );\n\n\t\t// Fixes #7595 - Elements lose focus when wrapped.\n\t\tif ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {\n\t\t\t$( active ).focus();\n\t\t}\n\t\t\n\t\twrapper = element.parent(); //Hotfix for jQuery 1.4 since some change in wrap() seems to actually loose the reference to the wrapped element\n\n\t\t// transfer positioning properties to the wrapper\n\t\tif (element.css('position') == 'static') {\n\t\t\twrapper.css({ position: 'relative' });\n\t\t\telement.css({ position: 'relative' });\n\t\t} else {\n\t\t\t$.extend(props, {\n\t\t\t\tposition: element.css('position'),\n\t\t\t\tzIndex: element.css('z-index')\n\t\t\t});\n\t\t\t$.each(['top', 'left', 'bottom', 'right'], function(i, pos) {\n\t\t\t\tprops[pos] = element.css(pos);\n\t\t\t\tif (isNaN(parseInt(props[pos], 10))) {\n\t\t\t\t\tprops[pos] = 'auto';\n\t\t\t\t}\n\t\t\t});\n\t\t\telement.css({position: 'relative', top: 0, left: 0, right: 'auto', bottom: 'auto' });\n\t\t}\n\n\t\treturn wrapper.css(props).show();\n\t},\n\n\tremoveWrapper: function(element) {\n\t\tvar parent,\n\t\t\tactive = document.activeElement;\n\t\t\n\t\tif (element.parent().is('.ui-effects-wrapper')) {\n\t\t\tparent = element.parent().replaceWith(element);\n\t\t\t// Fixes #7595 - Elements lose focus when wrapped.\n\t\t\tif ( element[ 0 ] === active || $.contains( element[ 0 ], active ) ) {\n\t\t\t\t$( active ).focus();\n\t\t\t}\n\t\t\treturn parent;\n\t\t}\n\t\t\t\n\t\treturn element;\n\t},\n\n\tsetTransition: function(element, list, factor, value) {\n\t\tvalue = value || {};\n\t\t$.each(list, function(i, x){\n\t\t\tvar unit = element.cssUnit(x);\n\t\t\tif (unit[0] > 0) value[x] = unit[0] * factor + unit[1];\n\t\t});\n\t\treturn value;\n\t}\n});\n\n\nfunction _normalizeArguments(effect, options, speed, callback) {\n\t// shift params for method overloading\n\tif (typeof effect == 'object') {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = effect;\n\t\teffect = options.effect;\n\t}\n\tif ($.isFunction(options)) {\n\t\tcallback = options;\n\t\tspeed = null;\n\t\toptions = {};\n\t}\n        if (typeof options == 'number' || $.fx.speeds[options]) {\n\t\tcallback = speed;\n\t\tspeed = options;\n\t\toptions = {};\n\t}\n\tif ($.isFunction(speed)) {\n\t\tcallback = speed;\n\t\tspeed = null;\n\t}\n\n\toptions = options || {};\n\n\tspeed = speed || options.duration;\n\tspeed = $.fx.off ? 0 : typeof speed == 'number'\n\t\t? speed : speed in $.fx.speeds ? $.fx.speeds[speed] : $.fx.speeds._default;\n\n\tcallback = callback || options.complete;\n\n\treturn [effect, options, speed, callback];\n}\n\nfunction standardSpeed( speed ) {\n\t// valid standard speeds\n\tif ( !speed || typeof speed === \"number\" || $.fx.speeds[ speed ] ) {\n\t\treturn true;\n\t}\n\t\n\t// invalid strings - treat as \"normal\" speed\n\tif ( typeof speed === \"string\" && !$.effects[ speed ] ) {\n\t\treturn true;\n\t}\n\t\n\treturn false;\n}\n\n$.fn.extend({\n\teffect: function(effect, options, speed, callback) {\n\t\tvar args = _normalizeArguments.apply(this, arguments),\n\t\t\t// TODO: make effects take actual parameters instead of a hash\n\t\t\targs2 = {\n\t\t\t\toptions: args[1],\n\t\t\t\tduration: args[2],\n\t\t\t\tcallback: args[3]\n\t\t\t},\n\t\t\tmode = args2.options.mode,\n\t\t\teffectMethod = $.effects[effect];\n\t\t\n\t\tif ( $.fx.off || !effectMethod ) {\n\t\t\t// delegate to the original method (e.g., .show()) if possible\n\t\t\tif ( mode ) {\n\t\t\t\treturn this[ mode ]( args2.duration, args2.callback );\n\t\t\t} else {\n\t\t\t\treturn this.each(function() {\n\t\t\t\t\tif ( args2.callback ) {\n\t\t\t\t\t\targs2.callback.call( this );\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn effectMethod.call(this, args2);\n\t},\n\n\t_show: $.fn.show,\n\tshow: function(speed) {\n\t\tif ( standardSpeed( speed ) ) {\n\t\t\treturn this._show.apply(this, arguments);\n\t\t} else {\n\t\t\tvar args = _normalizeArguments.apply(this, arguments);\n\t\t\targs[1].mode = 'show';\n\t\t\treturn this.effect.apply(this, args);\n\t\t}\n\t},\n\n\t_hide: $.fn.hide,\n\thide: function(speed) {\n\t\tif ( standardSpeed( speed ) ) {\n\t\t\treturn this._hide.apply(this, arguments);\n\t\t} else {\n\t\t\tvar args = _normalizeArguments.apply(this, arguments);\n\t\t\targs[1].mode = 'hide';\n\t\t\treturn this.effect.apply(this, args);\n\t\t}\n\t},\n\n\t// jQuery core overloads toggle and creates _toggle\n\t__toggle: $.fn.toggle,\n\ttoggle: function(speed) {\n\t\tif ( standardSpeed( speed ) || typeof speed === \"boolean\" || $.isFunction( speed ) ) {\n\t\t\treturn this.__toggle.apply(this, arguments);\n\t\t} else {\n\t\t\tvar args = _normalizeArguments.apply(this, arguments);\n\t\t\targs[1].mode = 'toggle';\n\t\t\treturn this.effect.apply(this, args);\n\t\t}\n\t},\n\n\t// helper functions\n\tcssUnit: function(key) {\n\t\tvar style = this.css(key), val = [];\n\t\t$.each( ['em','px','%','pt'], function(i, unit){\n\t\t\tif(style.indexOf(unit) > 0)\n\t\t\t\tval = [parseFloat(style), unit];\n\t\t});\n\t\treturn val;\n\t}\n});\n\n\n\n/******************************************************************************/\n/*********************************** EASING ***********************************/\n/******************************************************************************/\n\n// based on easing equations from Robert Penner (http://www.robertpenner.com/easing)\n\nvar baseEasings = {};\n\n$.each( [ \"Quad\", \"Cubic\", \"Quart\", \"Quint\", \"Expo\" ], function( i, name ) {\n\tbaseEasings[ name ] = function( p ) {\n\t\treturn Math.pow( p, i + 2 );\n\t};\n});\n\n$.extend( baseEasings, {\n\tSine: function ( p ) {\n\t\treturn 1 - Math.cos( p * Math.PI / 2 );\n\t},\n\tCirc: function ( p ) {\n\t\treturn 1 - Math.sqrt( 1 - p * p );\n\t},\n\tElastic: function( p ) {\n\t\treturn p === 0 || p === 1 ? p :\n\t\t\t-Math.pow( 2, 8 * (p - 1) ) * Math.sin( ( (p - 1) * 80 - 7.5 ) * Math.PI / 15 );\n\t},\n\tBack: function( p ) {\n\t\treturn p * p * ( 3 * p - 2 );\n\t},\n\tBounce: function ( p ) {\n\t\tvar pow2,\n\t\t\tbounce = 4;\n\n\t\twhile ( p < ( ( pow2 = Math.pow( 2, --bounce ) ) - 1 ) / 11 ) {}\n\t\treturn 1 / Math.pow( 4, 3 - bounce ) - 7.5625 * Math.pow( ( pow2 * 3 - 2 ) / 22 - p, 2 );\n\t}\n});\n\n$.each( baseEasings, function( name, easeIn ) {\n\t$.easing[ \"easeIn\" + name ] = easeIn;\n\t$.easing[ \"easeOut\" + name ] = function( p ) {\n\t\treturn 1 - easeIn( 1 - p );\n\t};\n\t$.easing[ \"easeInOut\" + name ] = function( p ) {\n\t\treturn p < .5 ?\n\t\t\teaseIn( p * 2 ) / 2 :\n\t\t\teaseIn( p * -2 + 2 ) / -2 + 1;\n\t};\n});\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.effects.blind = function(o) {\n\n\treturn this.queue(function() {\n\n\t\t// Create element\n\t\tvar el = $(this), props = ['position','top','bottom','left','right'];\n\n\t\t// Set options\n\t\tvar mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode\n\t\tvar direction = o.options.direction || 'vertical'; // Default direction\n\n\t\t// Adjust\n\t\t$.effects.save(el, props); el.show(); // Save & Show\n\t\tvar wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper\n\t\tvar ref = (direction == 'vertical') ? 'height' : 'width';\n\t\tvar distance = (direction == 'vertical') ? wrapper.height() : wrapper.width();\n\t\tif(mode == 'show') wrapper.css(ref, 0); // Shift\n\n\t\t// Animation\n\t\tvar animation = {};\n\t\tanimation[ref] = mode == 'show' ? distance : 0;\n\n\t\t// Animate\n\t\twrapper.animate(animation, o.duration, o.options.easing, function() {\n\t\t\tif(mode == 'hide') el.hide(); // Hide\n\t\t\t$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore\n\t\t\tif(o.callback) o.callback.apply(el[0], arguments); // Callback\n\t\t\tel.dequeue();\n\t\t});\n\n\t});\n\n};\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.effects.bounce = function(o) {\n\n\treturn this.queue(function() {\n\n\t\t// Create element\n\t\tvar el = $(this), props = ['position','top','bottom','left','right'];\n\n\t\t// Set options\n\t\tvar mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode\n\t\tvar direction = o.options.direction || 'up'; // Default direction\n\t\tvar distance = o.options.distance || 20; // Default distance\n\t\tvar times = o.options.times || 5; // Default # of times\n\t\tvar speed = o.duration || 250; // Default speed per bounce\n\t\tif (/show|hide/.test(mode)) props.push('opacity'); // Avoid touching opacity to prevent clearType and PNG issues in IE\n\n\t\t// Adjust\n\t\t$.effects.save(el, props); el.show(); // Save & Show\n\t\t$.effects.createWrapper(el); // Create Wrapper\n\t\tvar ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';\n\t\tvar motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';\n\t\tvar distance = o.options.distance || (ref == 'top' ? el.outerHeight(true) / 3 : el.outerWidth(true) / 3);\n\t\tif (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift\n\t\tif (mode == 'hide') distance = distance / (times * 2);\n\t\tif (mode != 'hide') times--;\n\n\t\t// Animate\n\t\tif (mode == 'show') { // Show Bounce\n\t\t\tvar animation = {opacity: 1};\n\t\t\tanimation[ref] = (motion == 'pos' ? '+=' : '-=') + distance;\n\t\t\tel.animate(animation, speed / 2, o.options.easing);\n\t\t\tdistance = distance / 2;\n\t\t\ttimes--;\n\t\t};\n\t\tfor (var i = 0; i < times; i++) { // Bounces\n\t\t\tvar animation1 = {}, animation2 = {};\n\t\t\tanimation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;\n\t\t\tanimation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;\n\t\t\tel.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing);\n\t\t\tdistance = (mode == 'hide') ? distance * 2 : distance / 2;\n\t\t};\n\t\tif (mode == 'hide') { // Last Bounce\n\t\t\tvar animation = {opacity: 0};\n\t\t\tanimation[ref] = (motion == 'pos' ? '-=' : '+=')  + distance;\n\t\t\tel.animate(animation, speed / 2, o.options.easing, function(){\n\t\t\t\tel.hide(); // Hide\n\t\t\t\t$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore\n\t\t\t\tif(o.callback) o.callback.apply(this, arguments); // Callback\n\t\t\t});\n\t\t} else {\n\t\t\tvar animation1 = {}, animation2 = {};\n\t\t\tanimation1[ref] = (motion == 'pos' ? '-=' : '+=') + distance;\n\t\t\tanimation2[ref] = (motion == 'pos' ? '+=' : '-=') + distance;\n\t\t\tel.animate(animation1, speed / 2, o.options.easing).animate(animation2, speed / 2, o.options.easing, function(){\n\t\t\t\t$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore\n\t\t\t\tif(o.callback) o.callback.apply(this, arguments); // Callback\n\t\t\t});\n\t\t};\n\t\tel.queue('fx', function() { el.dequeue(); });\n\t\tel.dequeue();\n\t});\n\n};\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.effects.clip = function(o) {\n\n\treturn this.queue(function() {\n\n\t\t// Create element\n\t\tvar el = $(this), props = ['position','top','bottom','left','right','height','width'];\n\n\t\t// Set options\n\t\tvar mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode\n\t\tvar direction = o.options.direction || 'vertical'; // Default direction\n\n\t\t// Adjust\n\t\t$.effects.save(el, props); el.show(); // Save & Show\n\t\tvar wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper\n\t\tvar animate = el[0].tagName == 'IMG' ? wrapper : el;\n\t\tvar ref = {\n\t\t\tsize: (direction == 'vertical') ? 'height' : 'width',\n\t\t\tposition: (direction == 'vertical') ? 'top' : 'left'\n\t\t};\n\t\tvar distance = (direction == 'vertical') ? animate.height() : animate.width();\n\t\tif(mode == 'show') { animate.css(ref.size, 0); animate.css(ref.position, distance / 2); } // Shift\n\n\t\t// Animation\n\t\tvar animation = {};\n\t\tanimation[ref.size] = mode == 'show' ? distance : 0;\n\t\tanimation[ref.position] = mode == 'show' ? 0 : distance / 2;\n\n\t\t// Animate\n\t\tanimate.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {\n\t\t\tif(mode == 'hide') el.hide(); // Hide\n\t\t\t$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore\n\t\t\tif(o.callback) o.callback.apply(el[0], arguments); // Callback\n\t\t\tel.dequeue();\n\t\t}});\n\n\t});\n\n};\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.effects.drop = function(o) {\n\n\treturn this.queue(function() {\n\n\t\t// Create element\n\t\tvar el = $(this), props = ['position','top','bottom','left','right','opacity'];\n\n\t\t// Set options\n\t\tvar mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode\n\t\tvar direction = o.options.direction || 'left'; // Default Direction\n\n\t\t// Adjust\n\t\t$.effects.save(el, props); el.show(); // Save & Show\n\t\t$.effects.createWrapper(el); // Create Wrapper\n\t\tvar ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';\n\t\tvar motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';\n\t\tvar distance = o.options.distance || (ref == 'top' ? el.outerHeight( true ) / 2 : el.outerWidth( true ) / 2);\n\t\tif (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift\n\n\t\t// Animation\n\t\tvar animation = {opacity: mode == 'show' ? 1 : 0};\n\t\tanimation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;\n\n\t\t// Animate\n\t\tel.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {\n\t\t\tif(mode == 'hide') el.hide(); // Hide\n\t\t\t$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore\n\t\t\tif(o.callback) o.callback.apply(this, arguments); // Callback\n\t\t\tel.dequeue();\n\t\t}});\n\n\t});\n\n};\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.effects.explode = function(o) {\n\n\treturn this.queue(function() {\n\n\tvar rows = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;\n\tvar cells = o.options.pieces ? Math.round(Math.sqrt(o.options.pieces)) : 3;\n\n\to.options.mode = o.options.mode == 'toggle' ? ($(this).is(':visible') ? 'hide' : 'show') : o.options.mode;\n\tvar el = $(this).show().css('visibility', 'hidden');\n\tvar offset = el.offset();\n\n\t//Substract the margins - not fixing the problem yet.\n\toffset.top -= parseInt(el.css(\"marginTop\"),10) || 0;\n\toffset.left -= parseInt(el.css(\"marginLeft\"),10) || 0;\n\n\tvar width = el.outerWidth(true);\n\tvar height = el.outerHeight(true);\n\n\tfor(var i=0;i<rows;i++) { // =\n\t\tfor(var j=0;j<cells;j++) { // ||\n\t\t\tel\n\t\t\t\t.clone()\n\t\t\t\t.appendTo('body')\n\t\t\t\t.wrap('<div></div>')\n\t\t\t\t.css({\n\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\tvisibility: 'visible',\n\t\t\t\t\tleft: -j*(width/cells),\n\t\t\t\t\ttop: -i*(height/rows)\n\t\t\t\t})\n\t\t\t\t.parent()\n\t\t\t\t.addClass('ui-effects-explode')\n\t\t\t\t.css({\n\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\toverflow: 'hidden',\n\t\t\t\t\twidth: width/cells,\n\t\t\t\t\theight: height/rows,\n\t\t\t\t\tleft: offset.left + j*(width/cells) + (o.options.mode == 'show' ? (j-Math.floor(cells/2))*(width/cells) : 0),\n\t\t\t\t\ttop: offset.top + i*(height/rows) + (o.options.mode == 'show' ? (i-Math.floor(rows/2))*(height/rows) : 0),\n\t\t\t\t\topacity: o.options.mode == 'show' ? 0 : 1\n\t\t\t\t}).animate({\n\t\t\t\t\tleft: offset.left + j*(width/cells) + (o.options.mode == 'show' ? 0 : (j-Math.floor(cells/2))*(width/cells)),\n\t\t\t\t\ttop: offset.top + i*(height/rows) + (o.options.mode == 'show' ? 0 : (i-Math.floor(rows/2))*(height/rows)),\n\t\t\t\t\topacity: o.options.mode == 'show' ? 1 : 0\n\t\t\t\t}, o.duration || 500);\n\t\t}\n\t}\n\n\t// Set a timeout, to call the callback approx. when the other animations have finished\n\tsetTimeout(function() {\n\n\t\to.options.mode == 'show' ? el.css({ visibility: 'visible' }) : el.css({ visibility: 'visible' }).hide();\n\t\t\t\tif(o.callback) o.callback.apply(el[0]); // Callback\n\t\t\t\tel.dequeue();\n\n\t\t\t\t$('div.ui-effects-explode').remove();\n\n\t}, o.duration || 500);\n\n\n\t});\n\n};\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.effects.fade = function(o) {\n\treturn this.queue(function() {\n\t\tvar elem = $(this),\n\t\t\tmode = $.effects.setMode(elem, o.options.mode || 'hide');\n\n\t\telem.animate({ opacity: mode }, {\n\t\t\tqueue: false,\n\t\t\tduration: o.duration,\n\t\t\teasing: o.options.easing,\n\t\t\tcomplete: function() {\n\t\t\t\t(o.callback && o.callback.apply(this, arguments));\n\t\t\t\telem.dequeue();\n\t\t\t}\n\t\t});\n\t});\n};\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.effects.fold = function(o) {\n\n\treturn this.queue(function() {\n\n\t\t// Create element\n\t\tvar el = $(this), props = ['position','top','bottom','left','right'];\n\n\t\t// Set options\n\t\tvar mode = $.effects.setMode(el, o.options.mode || 'hide'); // Set Mode\n\t\tvar size = o.options.size || 15; // Default fold size\n\t\tvar horizFirst = !(!o.options.horizFirst); // Ensure a boolean value\n\t\tvar duration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2;\n\n\t\t// Adjust\n\t\t$.effects.save(el, props); el.show(); // Save & Show\n\t\tvar wrapper = $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper\n\t\tvar widthFirst = ((mode == 'show') != horizFirst);\n\t\tvar ref = widthFirst ? ['width', 'height'] : ['height', 'width'];\n\t\tvar distance = widthFirst ? [wrapper.width(), wrapper.height()] : [wrapper.height(), wrapper.width()];\n\t\tvar percent = /([0-9]+)%/.exec(size);\n\t\tif(percent) size = parseInt(percent[1],10) / 100 * distance[mode == 'hide' ? 0 : 1];\n\t\tif(mode == 'show') wrapper.css(horizFirst ? {height: 0, width: size} : {height: size, width: 0}); // Shift\n\n\t\t// Animation\n\t\tvar animation1 = {}, animation2 = {};\n\t\tanimation1[ref[0]] = mode == 'show' ? distance[0] : size;\n\t\tanimation2[ref[1]] = mode == 'show' ? distance[1] : 0;\n\n\t\t// Animate\n\t\twrapper.animate(animation1, duration, o.options.easing)\n\t\t.animate(animation2, duration, o.options.easing, function() {\n\t\t\tif(mode == 'hide') el.hide(); // Hide\n\t\t\t$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore\n\t\t\tif(o.callback) o.callback.apply(el[0], arguments); // Callback\n\t\t\tel.dequeue();\n\t\t});\n\n\t});\n\n};\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.effects.highlight = function(o) {\n\treturn this.queue(function() {\n\t\tvar elem = $(this),\n\t\t\tprops = ['backgroundImage', 'backgroundColor', 'opacity'],\n\t\t\tmode = $.effects.setMode(elem, o.options.mode || 'show'),\n\t\t\tanimation = {\n\t\t\t\tbackgroundColor: elem.css('backgroundColor')\n\t\t\t};\n\n\t\tif (mode == 'hide') {\n\t\t\tanimation.opacity = 0;\n\t\t}\n\n\t\t$.effects.save(elem, props);\n\t\telem\n\t\t\t.show()\n\t\t\t.css({\n\t\t\t\tbackgroundImage: 'none',\n\t\t\t\tbackgroundColor: o.options.color || '#ffff99'\n\t\t\t})\n\t\t\t.animate(animation, {\n\t\t\t\tqueue: false,\n\t\t\t\tduration: o.duration,\n\t\t\t\teasing: o.options.easing,\n\t\t\t\tcomplete: function() {\n\t\t\t\t\t(mode == 'hide' && elem.hide());\n\t\t\t\t\t$.effects.restore(elem, props);\n\t\t\t\t\t(mode == 'show' && !$.support.opacity && this.style.removeAttribute('filter'));\n\t\t\t\t\t(o.callback && o.callback.apply(this, arguments));\n\t\t\t\t\telem.dequeue();\n\t\t\t\t}\n\t\t\t});\n\t});\n};\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.effects.pulsate = function(o) {\n\treturn this.queue(function() {\n\t\tvar elem = $(this),\n\t\t\tmode = $.effects.setMode(elem, o.options.mode || 'show'),\n\t\t\ttimes = ((o.options.times || 5) * 2) - 1,\n\t\t\tduration = o.duration ? o.duration / 2 : $.fx.speeds._default / 2,\n\t\t\tisVisible = elem.is(':visible'),\n\t\t\tanimateTo = 0;\n\n\t\tif (!isVisible) {\n\t\t\telem.css('opacity', 0).show();\n\t\t\tanimateTo = 1;\n\t\t}\n\n\t\tif ((mode == 'hide' && isVisible) || (mode == 'show' && !isVisible)) {\n\t\t\ttimes--;\n\t\t}\n\n\t\tfor (var i = 0; i < times; i++) {\n\t\t\telem.animate({ opacity: animateTo }, duration, o.options.easing);\n\t\t\tanimateTo = (animateTo + 1) % 2;\n\t\t}\n\n\t\telem.animate({ opacity: animateTo }, duration, o.options.easing, function() {\n\t\t\tif (animateTo == 0) {\n\t\t\t\telem.hide();\n\t\t\t}\n\t\t\t(o.callback && o.callback.apply(this, arguments));\n\t\t});\n\n\t\telem\n\t\t\t.queue('fx', function() { elem.dequeue(); })\n\t\t\t.dequeue();\n\t});\n};\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.effects.puff = function(o) {\n\treturn this.queue(function() {\n\t\tvar elem = $(this),\n\t\t\tmode = $.effects.setMode(elem, o.options.mode || 'hide'),\n\t\t\tpercent = parseInt(o.options.percent, 10) || 150,\n\t\t\tfactor = percent / 100,\n\t\t\toriginal = { height: elem.height(), width: elem.width() };\n\n\t\t$.extend(o.options, {\n\t\t\tfade: true,\n\t\t\tmode: mode,\n\t\t\tpercent: mode == 'hide' ? percent : 100,\n\t\t\tfrom: mode == 'hide'\n\t\t\t\t? original\n\t\t\t\t: {\n\t\t\t\t\theight: original.height * factor,\n\t\t\t\t\twidth: original.width * factor\n\t\t\t\t}\n\t\t});\n\n\t\telem.effect('scale', o.options, o.duration, o.callback);\n\t\telem.dequeue();\n\t});\n};\n\n$.effects.scale = function(o) {\n\n\treturn this.queue(function() {\n\n\t\t// Create element\n\t\tvar el = $(this);\n\n\t\t// Set options\n\t\tvar options = $.extend(true, {}, o.options);\n\t\tvar mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode\n\t\tvar percent = parseInt(o.options.percent,10) || (parseInt(o.options.percent,10) == 0 ? 0 : (mode == 'hide' ? 0 : 100)); // Set default scaling percent\n\t\tvar direction = o.options.direction || 'both'; // Set default axis\n\t\tvar origin = o.options.origin; // The origin of the scaling\n\t\tif (mode != 'effect') { // Set default origin and restore for show/hide\n\t\t\toptions.origin = origin || ['middle','center'];\n\t\t\toptions.restore = true;\n\t\t}\n\t\tvar original = {height: el.height(), width: el.width()}; // Save original\n\t\tel.from = o.options.from || (mode == 'show' ? {height: 0, width: 0} : original); // Default from state\n\n\t\t// Adjust\n\t\tvar factor = { // Set scaling factor\n\t\t\ty: direction != 'horizontal' ? (percent / 100) : 1,\n\t\t\tx: direction != 'vertical' ? (percent / 100) : 1\n\t\t};\n\t\tel.to = {height: original.height * factor.y, width: original.width * factor.x}; // Set to state\n\n\t\tif (o.options.fade) { // Fade option to support puff\n\t\t\tif (mode == 'show') {el.from.opacity = 0; el.to.opacity = 1;};\n\t\t\tif (mode == 'hide') {el.from.opacity = 1; el.to.opacity = 0;};\n\t\t};\n\n\t\t// Animation\n\t\toptions.from = el.from; options.to = el.to; options.mode = mode;\n\n\t\t// Animate\n\t\tel.effect('size', options, o.duration, o.callback);\n\t\tel.dequeue();\n\t});\n\n};\n\n$.effects.size = function(o) {\n\n\treturn this.queue(function() {\n\n\t\t// Create element\n\t\tvar el = $(this), props = ['position','top','bottom','left','right','width','height','overflow','opacity'];\n\t\tvar props1 = ['position','top','bottom','left','right','overflow','opacity']; // Always restore\n\t\tvar props2 = ['width','height','overflow']; // Copy for children\n\t\tvar cProps = ['fontSize'];\n\t\tvar vProps = ['borderTopWidth', 'borderBottomWidth', 'paddingTop', 'paddingBottom'];\n\t\tvar hProps = ['borderLeftWidth', 'borderRightWidth', 'paddingLeft', 'paddingRight'];\n\n\t\t// Set options\n\t\tvar mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode\n\t\tvar restore = o.options.restore || false; // Default restore\n\t\tvar scale = o.options.scale || 'both'; // Default scale mode\n\t\tvar origin = o.options.origin; // The origin of the sizing\n\t\tvar original = {height: el.height(), width: el.width()}; // Save original\n\t\tel.from = o.options.from || original; // Default from state\n\t\tel.to = o.options.to || original; // Default to state\n\t\t// Adjust\n\t\tif (origin) { // Calculate baseline shifts\n\t\t\tvar baseline = $.effects.getBaseline(origin, original);\n\t\t\tel.from.top = (original.height - el.from.height) * baseline.y;\n\t\t\tel.from.left = (original.width - el.from.width) * baseline.x;\n\t\t\tel.to.top = (original.height - el.to.height) * baseline.y;\n\t\t\tel.to.left = (original.width - el.to.width) * baseline.x;\n\t\t};\n\t\tvar factor = { // Set scaling factor\n\t\t\tfrom: {y: el.from.height / original.height, x: el.from.width / original.width},\n\t\t\tto: {y: el.to.height / original.height, x: el.to.width / original.width}\n\t\t};\n\t\tif (scale == 'box' || scale == 'both') { // Scale the css box\n\t\t\tif (factor.from.y != factor.to.y) { // Vertical props scaling\n\t\t\t\tprops = props.concat(vProps);\n\t\t\t\tel.from = $.effects.setTransition(el, vProps, factor.from.y, el.from);\n\t\t\t\tel.to = $.effects.setTransition(el, vProps, factor.to.y, el.to);\n\t\t\t};\n\t\t\tif (factor.from.x != factor.to.x) { // Horizontal props scaling\n\t\t\t\tprops = props.concat(hProps);\n\t\t\t\tel.from = $.effects.setTransition(el, hProps, factor.from.x, el.from);\n\t\t\t\tel.to = $.effects.setTransition(el, hProps, factor.to.x, el.to);\n\t\t\t};\n\t\t};\n\t\tif (scale == 'content' || scale == 'both') { // Scale the content\n\t\t\tif (factor.from.y != factor.to.y) { // Vertical props scaling\n\t\t\t\tprops = props.concat(cProps);\n\t\t\t\tel.from = $.effects.setTransition(el, cProps, factor.from.y, el.from);\n\t\t\t\tel.to = $.effects.setTransition(el, cProps, factor.to.y, el.to);\n\t\t\t};\n\t\t};\n\t\t$.effects.save(el, restore ? props : props1); el.show(); // Save & Show\n\t\t$.effects.createWrapper(el); // Create Wrapper\n\t\tel.css('overflow','hidden').css(el.from); // Shift\n\n\t\t// Animate\n\t\tif (scale == 'content' || scale == 'both') { // Scale the children\n\t\t\tvProps = vProps.concat(['marginTop','marginBottom']).concat(cProps); // Add margins/font-size\n\t\t\thProps = hProps.concat(['marginLeft','marginRight']); // Add margins\n\t\t\tprops2 = props.concat(vProps).concat(hProps); // Concat\n\t\t\tel.find(\"*[width]\").each(function(){\n\t\t\t\tvar child = $(this);\n\t\t\t\tif (restore) $.effects.save(child, props2);\n\t\t\t\tvar c_original = {height: child.height(), width: child.width()}; // Save original\n\t\t\t\tchild.from = {height: c_original.height * factor.from.y, width: c_original.width * factor.from.x};\n\t\t\t\tchild.to = {height: c_original.height * factor.to.y, width: c_original.width * factor.to.x};\n\t\t\t\tif (factor.from.y != factor.to.y) { // Vertical props scaling\n\t\t\t\t\tchild.from = $.effects.setTransition(child, vProps, factor.from.y, child.from);\n\t\t\t\t\tchild.to = $.effects.setTransition(child, vProps, factor.to.y, child.to);\n\t\t\t\t};\n\t\t\t\tif (factor.from.x != factor.to.x) { // Horizontal props scaling\n\t\t\t\t\tchild.from = $.effects.setTransition(child, hProps, factor.from.x, child.from);\n\t\t\t\t\tchild.to = $.effects.setTransition(child, hProps, factor.to.x, child.to);\n\t\t\t\t};\n\t\t\t\tchild.css(child.from); // Shift children\n\t\t\t\tchild.animate(child.to, o.duration, o.options.easing, function(){\n\t\t\t\t\tif (restore) $.effects.restore(child, props2); // Restore children\n\t\t\t\t}); // Animate children\n\t\t\t});\n\t\t};\n\n\t\t// Animate\n\t\tel.animate(el.to, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {\n\t\t\tif (el.to.opacity === 0) {\n\t\t\t\tel.css('opacity', el.from.opacity);\n\t\t\t}\n\t\t\tif(mode == 'hide') el.hide(); // Hide\n\t\t\t$.effects.restore(el, restore ? props : props1); $.effects.removeWrapper(el); // Restore\n\t\t\tif(o.callback) o.callback.apply(this, arguments); // Callback\n\t\t\tel.dequeue();\n\t\t}});\n\n\t});\n\n};\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.effects.shake = function(o) {\n\n\treturn this.queue(function() {\n\n\t\t// Create element\n\t\tvar el = $(this), props = ['position','top','bottom','left','right'];\n\n\t\t// Set options\n\t\tvar mode = $.effects.setMode(el, o.options.mode || 'effect'); // Set Mode\n\t\tvar direction = o.options.direction || 'left'; // Default direction\n\t\tvar distance = o.options.distance || 20; // Default distance\n\t\tvar times = o.options.times || 3; // Default # of times\n\t\tvar speed = o.duration || o.options.duration || 140; // Default speed per shake\n\n\t\t// Adjust\n\t\t$.effects.save(el, props); el.show(); // Save & Show\n\t\t$.effects.createWrapper(el); // Create Wrapper\n\t\tvar ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';\n\t\tvar motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';\n\n\t\t// Animation\n\t\tvar animation = {}, animation1 = {}, animation2 = {};\n\t\tanimation[ref] = (motion == 'pos' ? '-=' : '+=')  + distance;\n\t\tanimation1[ref] = (motion == 'pos' ? '+=' : '-=')  + distance * 2;\n\t\tanimation2[ref] = (motion == 'pos' ? '-=' : '+=')  + distance * 2;\n\n\t\t// Animate\n\t\tel.animate(animation, speed, o.options.easing);\n\t\tfor (var i = 1; i < times; i++) { // Shakes\n\t\t\tel.animate(animation1, speed, o.options.easing).animate(animation2, speed, o.options.easing);\n\t\t};\n\t\tel.animate(animation1, speed, o.options.easing).\n\t\tanimate(animation, speed / 2, o.options.easing, function(){ // Last shake\n\t\t\t$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore\n\t\t\tif(o.callback) o.callback.apply(this, arguments); // Callback\n\t\t});\n\t\tel.queue('fx', function() { el.dequeue(); });\n\t\tel.dequeue();\n\t});\n\n};\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.effects.slide = function(o) {\n\n\treturn this.queue(function() {\n\n\t\t// Create element\n\t\tvar el = $(this), props = ['position','top','bottom','left','right'];\n\n\t\t// Set options\n\t\tvar mode = $.effects.setMode(el, o.options.mode || 'show'); // Set Mode\n\t\tvar direction = o.options.direction || 'left'; // Default Direction\n\n\t\t// Adjust\n\t\t$.effects.save(el, props); el.show(); // Save & Show\n\t\t$.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper\n\t\tvar ref = (direction == 'up' || direction == 'down') ? 'top' : 'left';\n\t\tvar motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg';\n\t\tvar distance = o.options.distance || (ref == 'top' ? el.outerHeight( true ) : el.outerWidth( true ));\n\t\tif (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? \"-\" + distance : -distance) : distance); // Shift\n\n\t\t// Animation\n\t\tvar animation = {};\n\t\tanimation[ref] = (mode == 'show' ? (motion == 'pos' ? '+=' : '-=') : (motion == 'pos' ? '-=' : '+=')) + distance;\n\n\t\t// Animate\n\t\tel.animate(animation, { queue: false, duration: o.duration, easing: o.options.easing, complete: function() {\n\t\t\tif(mode == 'hide') el.hide(); // Hide\n\t\t\t$.effects.restore(el, props); $.effects.removeWrapper(el); // Restore\n\t\t\tif(o.callback) o.callback.apply(this, arguments); // Callback\n\t\t\tel.dequeue();\n\t\t}});\n\n\t});\n\n};\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.effects.transfer = function(o) {\n\treturn this.queue(function() {\n\t\tvar elem = $(this),\n\t\t\ttarget = $(o.options.to),\n\t\t\tendPosition = target.offset(),\n\t\t\tanimation = {\n\t\t\t\ttop: endPosition.top,\n\t\t\t\tleft: endPosition.left,\n\t\t\t\theight: target.innerHeight(),\n\t\t\t\twidth: target.innerWidth()\n\t\t\t},\n\t\t\tstartPosition = elem.offset(),\n\t\t\ttransfer = $('<div class=\"ui-effects-transfer\"></div>')\n\t\t\t\t.appendTo(document.body)\n\t\t\t\t.addClass(o.options.className)\n\t\t\t\t.css({\n\t\t\t\t\ttop: startPosition.top,\n\t\t\t\t\tleft: startPosition.left,\n\t\t\t\t\theight: elem.innerHeight(),\n\t\t\t\t\twidth: elem.innerWidth(),\n\t\t\t\t\tposition: 'absolute'\n\t\t\t\t})\n\t\t\t\t.animate(animation, o.duration, o.options.easing, function() {\n\t\t\t\t\ttransfer.remove();\n\t\t\t\t\t(o.callback && o.callback.apply(elem[0], arguments));\n\t\t\t\t\telem.dequeue();\n\t\t\t\t});\n\t});\n};\n\n})(jQuery);\n\n(function( $, undefined ) {\n\n$.widget( \"ui.accordion\", {\n\toptions: {\n\t\tactive: 0,\n\t\tanimated: \"slide\",\n\t\tautoHeight: true,\n\t\tclearStyle: false,\n\t\tcollapsible: false,\n\t\tevent: \"click\",\n\t\tfillSpace: false,\n\t\theader: \"> li > :first-child,> :not(li):even\",\n\t\ticons: {\n\t\t\theader: \"ui-icon-triangle-1-e\",\n\t\t\theaderSelected: \"ui-icon-triangle-1-s\"\n\t\t},\n\t\tnavigation: false,\n\t\tnavigationFilter: function() {\n\t\t\treturn this.href.toLowerCase() === location.href.toLowerCase();\n\t\t}\n\t},\n\n\t_create: function() {\n\t\tvar self = this,\n\t\t\toptions = self.options;\n\n\t\tself.running = 0;\n\n\t\tself.element\n\t\t\t.addClass( \"ui-accordion ui-widget ui-helper-reset\" )\n\t\t\t// in lack of child-selectors in CSS\n\t\t\t// we need to mark top-LIs in a UL-accordion for some IE-fix\n\t\t\t.children( \"li\" )\n\t\t\t\t.addClass( \"ui-accordion-li-fix\" );\n\n\t\tself.headers = self.element.find( options.header )\n\t\t\t.addClass( \"ui-accordion-header ui-helper-reset ui-state-default ui-corner-all\" )\n\t\t\t.bind( \"mouseenter.accordion\", function() {\n\t\t\t\tif ( options.disabled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t$( this ).addClass( \"ui-state-hover\" );\n\t\t\t})\n\t\t\t.bind( \"mouseleave.accordion\", function() {\n\t\t\t\tif ( options.disabled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t$( this ).removeClass( \"ui-state-hover\" );\n\t\t\t})\n\t\t\t.bind( \"focus.accordion\", function() {\n\t\t\t\tif ( options.disabled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t$( this ).addClass( \"ui-state-focus\" );\n\t\t\t})\n\t\t\t.bind( \"blur.accordion\", function() {\n\t\t\t\tif ( options.disabled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t$( this ).removeClass( \"ui-state-focus\" );\n\t\t\t});\n\n\t\tself.headers.next()\n\t\t\t.addClass( \"ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom\" );\n\n\t\tif ( options.navigation ) {\n\t\t\tvar current = self.element.find( \"a\" ).filter( options.navigationFilter ).eq( 0 );\n\t\t\tif ( current.length ) {\n\t\t\t\tvar header = current.closest( \".ui-accordion-header\" );\n\t\t\t\tif ( header.length ) {\n\t\t\t\t\t// anchor within header\n\t\t\t\t\tself.active = header;\n\t\t\t\t} else {\n\t\t\t\t\t// anchor within content\n\t\t\t\t\tself.active = current.closest( \".ui-accordion-content\" ).prev();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tself.active = self._findActive( self.active || options.active )\n\t\t\t.addClass( \"ui-state-default ui-state-active\" )\n\t\t\t.toggleClass( \"ui-corner-all\" )\n\t\t\t.toggleClass( \"ui-corner-top\" );\n\t\tself.active.next().addClass( \"ui-accordion-content-active\" );\n\n\t\tself._createIcons();\n\t\tself.resize();\n\t\t\n\t\t// ARIA\n\t\tself.element.attr( \"role\", \"tablist\" );\n\n\t\tself.headers\n\t\t\t.attr( \"role\", \"tab\" )\n\t\t\t.bind( \"keydown.accordion\", function( event ) {\n\t\t\t\treturn self._keydown( event );\n\t\t\t})\n\t\t\t.next()\n\t\t\t\t.attr( \"role\", \"tabpanel\" );\n\n\t\tself.headers\n\t\t\t.not( self.active || \"\" )\n\t\t\t.attr({\n\t\t\t\t\"aria-expanded\": \"false\",\n\t\t\t\t\"aria-selected\": \"false\",\n\t\t\t\ttabIndex: -1\n\t\t\t})\n\t\t\t.next()\n\t\t\t\t.hide();\n\n\t\t// make sure at least one header is in the tab order\n\t\tif ( !self.active.length ) {\n\t\t\tself.headers.eq( 0 ).attr( \"tabIndex\", 0 );\n\t\t} else {\n\t\t\tself.active\n\t\t\t\t.attr({\n\t\t\t\t\t\"aria-expanded\": \"true\",\n\t\t\t\t\t\"aria-selected\": \"true\",\n\t\t\t\t\ttabIndex: 0\n\t\t\t\t});\n\t\t}\n\n\t\t// only need links in tab order for Safari\n\t\tif ( !$.browser.safari ) {\n\t\t\tself.headers.find( \"a\" ).attr( \"tabIndex\", -1 );\n\t\t}\n\n\t\tif ( options.event ) {\n\t\t\tself.headers.bind( options.event.split(\" \").join(\".accordion \") + \".accordion\", function(event) {\n\t\t\t\tself._clickHandler.call( self, event, this );\n\t\t\t\tevent.preventDefault();\n\t\t\t});\n\t\t}\n\t},\n\n\t_createIcons: function() {\n\t\tvar options = this.options;\n\t\tif ( options.icons ) {\n\t\t\t$( \"<span></span>\" )\n\t\t\t\t.addClass( \"ui-icon \" + options.icons.header )\n\t\t\t\t.prependTo( this.headers );\n\t\t\tthis.active.children( \".ui-icon\" )\n\t\t\t\t.toggleClass(options.icons.header)\n\t\t\t\t.toggleClass(options.icons.headerSelected);\n\t\t\tthis.element.addClass( \"ui-accordion-icons\" );\n\t\t}\n\t},\n\n\t_destroyIcons: function() {\n\t\tthis.headers.children( \".ui-icon\" ).remove();\n\t\tthis.element.removeClass( \"ui-accordion-icons\" );\n\t},\n\n\tdestroy: function() {\n\t\tvar options = this.options;\n\n\t\tthis.element\n\t\t\t.removeClass( \"ui-accordion ui-widget ui-helper-reset\" )\n\t\t\t.removeAttr( \"role\" );\n\n\t\tthis.headers\n\t\t\t.unbind( \".accordion\" )\n\t\t\t.removeClass( \"ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top\" )\n\t\t\t.removeAttr( \"role\" )\n\t\t\t.removeAttr( \"aria-expanded\" )\n\t\t\t.removeAttr( \"aria-selected\" )\n\t\t\t.removeAttr( \"tabIndex\" );\n\n\t\tthis.headers.find( \"a\" ).removeAttr( \"tabIndex\" );\n\t\tthis._destroyIcons();\n\t\tvar contents = this.headers.next()\n\t\t\t.css( \"display\", \"\" )\n\t\t\t.removeAttr( \"role\" )\n\t\t\t.removeClass( \"ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled\" );\n\t\tif ( options.autoHeight || options.fillHeight ) {\n\t\t\tcontents.css( \"height\", \"\" );\n\t\t}\n\n\t\treturn $.Widget.prototype.destroy.call( this );\n\t},\n\n\t_setOption: function( key, value ) {\n\t\t$.Widget.prototype._setOption.apply( this, arguments );\n\t\t\t\n\t\tif ( key == \"active\" ) {\n\t\t\tthis.activate( value );\n\t\t}\n\t\tif ( key == \"icons\" ) {\n\t\t\tthis._destroyIcons();\n\t\t\tif ( value ) {\n\t\t\t\tthis._createIcons();\n\t\t\t}\n\t\t}\n\t\t// #5332 - opacity doesn't cascade to positioned elements in IE\n\t\t// so we need to add the disabled class to the headers and panels\n\t\tif ( key == \"disabled\" ) {\n\t\t\tthis.headers.add(this.headers.next())\n\t\t\t\t[ value ? \"addClass\" : \"removeClass\" ](\n\t\t\t\t\t\"ui-accordion-disabled ui-state-disabled\" );\n\t\t}\n\t},\n\n\t_keydown: function( event ) {\n\t\tif ( this.options.disabled || event.altKey || event.ctrlKey ) {\n\t\t\treturn;\n\t\t}\n\n\t\tvar keyCode = $.ui.keyCode,\n\t\t\tlength = this.headers.length,\n\t\t\tcurrentIndex = this.headers.index( event.target ),\n\t\t\ttoFocus = false;\n\n\t\tswitch ( event.keyCode ) {\n\t\t\tcase keyCode.RIGHT:\n\t\t\tcase keyCode.DOWN:\n\t\t\t\ttoFocus = this.headers[ ( currentIndex + 1 ) % length ];\n\t\t\t\tbreak;\n\t\t\tcase keyCode.LEFT:\n\t\t\tcase keyCode.UP:\n\t\t\t\ttoFocus = this.headers[ ( currentIndex - 1 + length ) % length ];\n\t\t\t\tbreak;\n\t\t\tcase keyCode.SPACE:\n\t\t\tcase keyCode.ENTER:\n\t\t\t\tthis._clickHandler( { target: event.target }, event.target );\n\t\t\t\tevent.preventDefault();\n\t\t}\n\n\t\tif ( toFocus ) {\n\t\t\t$( event.target ).attr( \"tabIndex\", -1 );\n\t\t\t$( toFocus ).attr( \"tabIndex\", 0 );\n\t\t\ttoFocus.focus();\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t},\n\n\tresize: function() {\n\t\tvar options = this.options,\n\t\t\tmaxHeight;\n\n\t\tif ( options.fillSpace ) {\n\t\t\tif ( $.browser.msie ) {\n\t\t\t\tvar defOverflow = this.element.parent().css( \"overflow\" );\n\t\t\t\tthis.element.parent().css( \"overflow\", \"hidden\");\n\t\t\t}\n\t\t\tmaxHeight = this.element.parent().height();\n\t\t\tif ($.browser.msie) {\n\t\t\t\tthis.element.parent().css( \"overflow\", defOverflow );\n\t\t\t}\n\n\t\t\tthis.headers.each(function() {\n\t\t\t\tmaxHeight -= $( this ).outerHeight( true );\n\t\t\t});\n\n\t\t\tthis.headers.next()\n\t\t\t\t.each(function() {\n\t\t\t\t\t$( this ).height( Math.max( 0, maxHeight -\n\t\t\t\t\t\t$( this ).innerHeight() + $( this ).height() ) );\n\t\t\t\t})\n\t\t\t\t.css( \"overflow\", \"auto\" );\n\t\t} else if ( options.autoHeight ) {\n\t\t\tmaxHeight = 0;\n\t\t\tthis.headers.next()\n\t\t\t\t.each(function() {\n\t\t\t\t\tmaxHeight = Math.max( maxHeight, $( this ).height( \"\" ).height() );\n\t\t\t\t})\n\t\t\t\t.height( maxHeight );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tactivate: function( index ) {\n\t\t// TODO this gets called on init, changing the option without an explicit call for that\n\t\tthis.options.active = index;\n\t\t// call clickHandler with custom event\n\t\tvar active = this._findActive( index )[ 0 ];\n\t\tthis._clickHandler( { target: active }, active );\n\n\t\treturn this;\n\t},\n\n\t_findActive: function( selector ) {\n\t\treturn selector\n\t\t\t? typeof selector === \"number\"\n\t\t\t\t? this.headers.filter( \":eq(\" + selector + \")\" )\n\t\t\t\t: this.headers.not( this.headers.not( selector ) )\n\t\t\t: selector === false\n\t\t\t\t? $( [] )\n\t\t\t\t: this.headers.filter( \":eq(0)\" );\n\t},\n\n\t// TODO isn't event.target enough? why the separate target argument?\n\t_clickHandler: function( event, target ) {\n\t\tvar options = this.options;\n\t\tif ( options.disabled ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// called only when using activate(false) to close all parts programmatically\n\t\tif ( !event.target ) {\n\t\t\tif ( !options.collapsible ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.active\n\t\t\t\t.removeClass( \"ui-state-active ui-corner-top\" )\n\t\t\t\t.addClass( \"ui-state-default ui-corner-all\" )\n\t\t\t\t.children( \".ui-icon\" )\n\t\t\t\t\t.removeClass( options.icons.headerSelected )\n\t\t\t\t\t.addClass( options.icons.header );\n\t\t\tthis.active.next().addClass( \"ui-accordion-content-active\" );\n\t\t\tvar toHide = this.active.next(),\n\t\t\t\tdata = {\n\t\t\t\t\toptions: options,\n\t\t\t\t\tnewHeader: $( [] ),\n\t\t\t\t\toldHeader: options.active,\n\t\t\t\t\tnewContent: $( [] ),\n\t\t\t\t\toldContent: toHide\n\t\t\t\t},\n\t\t\t\ttoShow = ( this.active = $( [] ) );\n\t\t\tthis._toggle( toShow, toHide, data );\n\t\t\treturn;\n\t\t}\n\n\t\t// get the click target\n\t\tvar clicked = $( event.currentTarget || target ),\n\t\t\tclickedIsActive = clicked[0] === this.active[0];\n\n\t\t// TODO the option is changed, is that correct?\n\t\t// TODO if it is correct, shouldn't that happen after determining that the click is valid?\n\t\toptions.active = options.collapsible && clickedIsActive ?\n\t\t\tfalse :\n\t\t\tthis.headers.index( clicked );\n\n\t\t// if animations are still active, or the active header is the target, ignore click\n\t\tif ( this.running || ( !options.collapsible && clickedIsActive ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// find elements to show and hide\n\t\tvar active = this.active,\n\t\t\ttoShow = clicked.next(),\n\t\t\ttoHide = this.active.next(),\n\t\t\tdata = {\n\t\t\t\toptions: options,\n\t\t\t\tnewHeader: clickedIsActive && options.collapsible ? $([]) : clicked,\n\t\t\t\toldHeader: this.active,\n\t\t\t\tnewContent: clickedIsActive && options.collapsible ? $([]) : toShow,\n\t\t\t\toldContent: toHide\n\t\t\t},\n\t\t\tdown = this.headers.index( this.active[0] ) > this.headers.index( clicked[0] );\n\n\t\t// when the call to ._toggle() comes after the class changes\n\t\t// it causes a very odd bug in IE 8 (see #6720)\n\t\tthis.active = clickedIsActive ? $([]) : clicked;\n\t\tthis._toggle( toShow, toHide, data, clickedIsActive, down );\n\n\t\t// switch classes\n\t\tactive\n\t\t\t.removeClass( \"ui-state-active ui-corner-top\" )\n\t\t\t.addClass( \"ui-state-default ui-corner-all\" )\n\t\t\t.children( \".ui-icon\" )\n\t\t\t\t.removeClass( options.icons.headerSelected )\n\t\t\t\t.addClass( options.icons.header );\n\t\tif ( !clickedIsActive ) {\n\t\t\tclicked\n\t\t\t\t.removeClass( \"ui-state-default ui-corner-all\" )\n\t\t\t\t.addClass( \"ui-state-active ui-corner-top\" )\n\t\t\t\t.children( \".ui-icon\" )\n\t\t\t\t\t.removeClass( options.icons.header )\n\t\t\t\t\t.addClass( options.icons.headerSelected );\n\t\t\tclicked\n\t\t\t\t.next()\n\t\t\t\t.addClass( \"ui-accordion-content-active\" );\n\t\t}\n\n\t\treturn;\n\t},\n\n\t_toggle: function( toShow, toHide, data, clickedIsActive, down ) {\n\t\tvar self = this,\n\t\t\toptions = self.options;\n\n\t\tself.toShow = toShow;\n\t\tself.toHide = toHide;\n\t\tself.data = data;\n\n\t\tvar complete = function() {\n\t\t\tif ( !self ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn self._completed.apply( self, arguments );\n\t\t};\n\n\t\t// trigger changestart event\n\t\tself._trigger( \"changestart\", null, self.data );\n\n\t\t// count elements to animate\n\t\tself.running = toHide.size() === 0 ? toShow.size() : toHide.size();\n\n\t\tif ( options.animated ) {\n\t\t\tvar animOptions = {};\n\n\t\t\tif ( options.collapsible && clickedIsActive ) {\n\t\t\t\tanimOptions = {\n\t\t\t\t\ttoShow: $( [] ),\n\t\t\t\t\ttoHide: toHide,\n\t\t\t\t\tcomplete: complete,\n\t\t\t\t\tdown: down,\n\t\t\t\t\tautoHeight: options.autoHeight || options.fillSpace\n\t\t\t\t};\n\t\t\t} else {\n\t\t\t\tanimOptions = {\n\t\t\t\t\ttoShow: toShow,\n\t\t\t\t\ttoHide: toHide,\n\t\t\t\t\tcomplete: complete,\n\t\t\t\t\tdown: down,\n\t\t\t\t\tautoHeight: options.autoHeight || options.fillSpace\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tif ( !options.proxied ) {\n\t\t\t\toptions.proxied = options.animated;\n\t\t\t}\n\n\t\t\tif ( !options.proxiedDuration ) {\n\t\t\t\toptions.proxiedDuration = options.duration;\n\t\t\t}\n\n\t\t\toptions.animated = $.isFunction( options.proxied ) ?\n\t\t\t\toptions.proxied( animOptions ) :\n\t\t\t\toptions.proxied;\n\n\t\t\toptions.duration = $.isFunction( options.proxiedDuration ) ?\n\t\t\t\toptions.proxiedDuration( animOptions ) :\n\t\t\t\toptions.proxiedDuration;\n\n\t\t\tvar animations = $.ui.accordion.animations,\n\t\t\t\tduration = options.duration,\n\t\t\t\teasing = options.animated;\n\n\t\t\tif ( easing && !animations[ easing ] && !$.easing[ easing ] ) {\n\t\t\t\teasing = \"slide\";\n\t\t\t}\n\t\t\tif ( !animations[ easing ] ) {\n\t\t\t\tanimations[ easing ] = function( options ) {\n\t\t\t\t\tthis.slide( options, {\n\t\t\t\t\t\teasing: easing,\n\t\t\t\t\t\tduration: duration || 700\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tanimations[ easing ]( animOptions );\n\t\t} else {\n\t\t\tif ( options.collapsible && clickedIsActive ) {\n\t\t\t\ttoShow.toggle();\n\t\t\t} else {\n\t\t\t\ttoHide.hide();\n\t\t\t\ttoShow.show();\n\t\t\t}\n\n\t\t\tcomplete( true );\n\t\t}\n\n\t\t// TODO assert that the blur and focus triggers are really necessary, remove otherwise\n\t\ttoHide.prev()\n\t\t\t.attr({\n\t\t\t\t\"aria-expanded\": \"false\",\n\t\t\t\t\"aria-selected\": \"false\",\n\t\t\t\ttabIndex: -1\n\t\t\t})\n\t\t\t.blur();\n\t\ttoShow.prev()\n\t\t\t.attr({\n\t\t\t\t\"aria-expanded\": \"true\",\n\t\t\t\t\"aria-selected\": \"true\",\n\t\t\t\ttabIndex: 0\n\t\t\t})\n\t\t\t.focus();\n\t},\n\n\t_completed: function( cancel ) {\n\t\tthis.running = cancel ? 0 : --this.running;\n\t\tif ( this.running ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( this.options.clearStyle ) {\n\t\t\tthis.toShow.add( this.toHide ).css({\n\t\t\t\theight: \"\",\n\t\t\t\toverflow: \"\"\n\t\t\t});\n\t\t}\n\n\t\t// other classes are removed before the animation; this one needs to stay until completed\n\t\tthis.toHide.removeClass( \"ui-accordion-content-active\" );\n\t\t// Work around for rendering bug in IE (#5421)\n\t\tif ( this.toHide.length ) {\n\t\t\tthis.toHide.parent()[0].className = this.toHide.parent()[0].className;\n\t\t}\n\n\t\tthis._trigger( \"change\", null, this.data );\n\t}\n});\n\n$.extend( $.ui.accordion, {\n\tversion: \"1.8.24\",\n\tanimations: {\n\t\tslide: function( options, additions ) {\n\t\t\toptions = $.extend({\n\t\t\t\teasing: \"swing\",\n\t\t\t\tduration: 300\n\t\t\t}, options, additions );\n\t\t\tif ( !options.toHide.size() ) {\n\t\t\t\toptions.toShow.animate({\n\t\t\t\t\theight: \"show\",\n\t\t\t\t\tpaddingTop: \"show\",\n\t\t\t\t\tpaddingBottom: \"show\"\n\t\t\t\t}, options );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( !options.toShow.size() ) {\n\t\t\t\toptions.toHide.animate({\n\t\t\t\t\theight: \"hide\",\n\t\t\t\t\tpaddingTop: \"hide\",\n\t\t\t\t\tpaddingBottom: \"hide\"\n\t\t\t\t}, options );\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar overflow = options.toShow.css( \"overflow\" ),\n\t\t\t\tpercentDone = 0,\n\t\t\t\tshowProps = {},\n\t\t\t\thideProps = {},\n\t\t\t\tfxAttrs = [ \"height\", \"paddingTop\", \"paddingBottom\" ],\n\t\t\t\toriginalWidth;\n\t\t\t// fix width before calculating height of hidden element\n\t\t\tvar s = options.toShow;\n\t\t\toriginalWidth = s[0].style.width;\n\t\t\ts.width( s.parent().width()\n\t\t\t\t- parseFloat( s.css( \"paddingLeft\" ) )\n\t\t\t\t- parseFloat( s.css( \"paddingRight\" ) )\n\t\t\t\t- ( parseFloat( s.css( \"borderLeftWidth\" ) ) || 0 )\n\t\t\t\t- ( parseFloat( s.css( \"borderRightWidth\" ) ) || 0 ) );\n\n\t\t\t$.each( fxAttrs, function( i, prop ) {\n\t\t\t\thideProps[ prop ] = \"hide\";\n\n\t\t\t\tvar parts = ( \"\" + $.css( options.toShow[0], prop ) ).match( /^([\\d+-.]+)(.*)$/ );\n\t\t\t\tshowProps[ prop ] = {\n\t\t\t\t\tvalue: parts[ 1 ],\n\t\t\t\t\tunit: parts[ 2 ] || \"px\"\n\t\t\t\t};\n\t\t\t});\n\t\t\toptions.toShow.css({ height: 0, overflow: \"hidden\" }).show();\n\t\t\toptions.toHide\n\t\t\t\t.filter( \":hidden\" )\n\t\t\t\t\t.each( options.complete )\n\t\t\t\t.end()\n\t\t\t\t.filter( \":visible\" )\n\t\t\t\t.animate( hideProps, {\n\t\t\t\tstep: function( now, settings ) {\n\t\t\t\t\t// only calculate the percent when animating height\n\t\t\t\t\t// IE gets very inconsistent results when animating elements\n\t\t\t\t\t// with small values, which is common for padding\n\t\t\t\t\tif ( settings.prop == \"height\" ) {\n\t\t\t\t\t\tpercentDone = ( settings.end - settings.start === 0 ) ? 0 :\n\t\t\t\t\t\t\t( settings.now - settings.start ) / ( settings.end - settings.start );\n\t\t\t\t\t}\n\n\t\t\t\t\toptions.toShow[ 0 ].style[ settings.prop ] =\n\t\t\t\t\t\t( percentDone * showProps[ settings.prop ].value )\n\t\t\t\t\t\t+ showProps[ settings.prop ].unit;\n\t\t\t\t},\n\t\t\t\tduration: options.duration,\n\t\t\t\teasing: options.easing,\n\t\t\t\tcomplete: function() {\n\t\t\t\t\tif ( !options.autoHeight ) {\n\t\t\t\t\t\toptions.toShow.css( \"height\", \"\" );\n\t\t\t\t\t}\n\t\t\t\t\toptions.toShow.css({\n\t\t\t\t\t\twidth: originalWidth,\n\t\t\t\t\t\toverflow: overflow\n\t\t\t\t\t});\n\t\t\t\t\toptions.complete();\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\t\tbounceslide: function( options ) {\n\t\t\tthis.slide( options, {\n\t\t\t\teasing: options.down ? \"easeOutBounce\" : \"swing\",\n\t\t\t\tduration: options.down ? 1000 : 200\n\t\t\t});\n\t\t}\n\t}\n});\n\n})( jQuery );\n\n(function( $, undefined ) {\n\n// used to prevent race conditions with remote data sources\nvar requestIndex = 0;\n\n$.widget( \"ui.autocomplete\", {\n\toptions: {\n\t\tappendTo: \"body\",\n\t\tautoFocus: false,\n\t\tdelay: 300,\n\t\tminLength: 1,\n\t\tposition: {\n\t\t\tmy: \"left top\",\n\t\t\tat: \"left bottom\",\n\t\t\tcollision: \"none\"\n\t\t},\n\t\tsource: null\n\t},\n\n\tpending: 0,\n\n\t_create: function() {\n\t\tvar self = this,\n\t\t\tdoc = this.element[ 0 ].ownerDocument,\n\t\t\tsuppressKeyPress;\n\t\tthis.isMultiLine = this.element.is( \"textarea\" );\n\n\t\tthis.element\n\t\t\t.addClass( \"ui-autocomplete-input\" )\n\t\t\t.attr( \"autocomplete\", \"off\" )\n\t\t\t// TODO verify these actually work as intended\n\t\t\t.attr({\n\t\t\t\trole: \"textbox\",\n\t\t\t\t\"aria-autocomplete\": \"list\",\n\t\t\t\t\"aria-haspopup\": \"true\"\n\t\t\t})\n\t\t\t.bind( \"keydown.autocomplete\", function( event ) {\n\t\t\t\tif ( self.options.disabled || self.element.propAttr( \"readOnly\" ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tsuppressKeyPress = false;\n\t\t\t\tvar keyCode = $.ui.keyCode;\n\t\t\t\tswitch( event.keyCode ) {\n\t\t\t\tcase keyCode.PAGE_UP:\n\t\t\t\t\tself._move( \"previousPage\", event );\n\t\t\t\t\tbreak;\n\t\t\t\tcase keyCode.PAGE_DOWN:\n\t\t\t\t\tself._move( \"nextPage\", event );\n\t\t\t\t\tbreak;\n\t\t\t\tcase keyCode.UP:\n\t\t\t\t\tself._keyEvent( \"previous\", event );\n\t\t\t\t\tbreak;\n\t\t\t\tcase keyCode.DOWN:\n\t\t\t\t\tself._keyEvent( \"next\", event );\n\t\t\t\t\tbreak;\n\t\t\t\tcase keyCode.ENTER:\n\t\t\t\tcase keyCode.NUMPAD_ENTER:\n\t\t\t\t\t// when menu is open and has focus\n\t\t\t\t\tif ( self.menu.active ) {\n\t\t\t\t\t\t// #6055 - Opera still allows the keypress to occur\n\t\t\t\t\t\t// which causes forms to submit\n\t\t\t\t\t\tsuppressKeyPress = true;\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t\t//passthrough - ENTER and TAB both select the current element\n\t\t\t\tcase keyCode.TAB:\n\t\t\t\t\tif ( !self.menu.active ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tself.menu.select( event );\n\t\t\t\t\tbreak;\n\t\t\t\tcase keyCode.ESCAPE:\n\t\t\t\t\tself.element.val( self.term );\n\t\t\t\t\tself.close( event );\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t// keypress is triggered before the input value is changed\n\t\t\t\t\tclearTimeout( self.searching );\n\t\t\t\t\tself.searching = setTimeout(function() {\n\t\t\t\t\t\t// only search if the value has changed\n\t\t\t\t\t\tif ( self.term != self.element.val() ) {\n\t\t\t\t\t\t\tself.selectedItem = null;\n\t\t\t\t\t\t\tself.search( null, event );\n\t\t\t\t\t\t}\n\t\t\t\t\t}, self.options.delay );\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t})\n\t\t\t.bind( \"keypress.autocomplete\", function( event ) {\n\t\t\t\tif ( suppressKeyPress ) {\n\t\t\t\t\tsuppressKeyPress = false;\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t})\n\t\t\t.bind( \"focus.autocomplete\", function() {\n\t\t\t\tif ( self.options.disabled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tself.selectedItem = null;\n\t\t\t\tself.previous = self.element.val();\n\t\t\t})\n\t\t\t.bind( \"blur.autocomplete\", function( event ) {\n\t\t\t\tif ( self.options.disabled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tclearTimeout( self.searching );\n\t\t\t\t// clicks on the menu (or a button to trigger a search) will cause a blur event\n\t\t\t\tself.closing = setTimeout(function() {\n\t\t\t\t\tself.close( event );\n\t\t\t\t\tself._change( event );\n\t\t\t\t}, 150 );\n\t\t\t});\n\t\tthis._initSource();\n\t\tthis.menu = $( \"<ul></ul>\" )\n\t\t\t.addClass( \"ui-autocomplete\" )\n\t\t\t.appendTo( $( this.options.appendTo || \"body\", doc )[0] )\n\t\t\t// prevent the close-on-blur in case of a \"slow\" click on the menu (long mousedown)\n\t\t\t.mousedown(function( event ) {\n\t\t\t\t// clicking on the scrollbar causes focus to shift to the body\n\t\t\t\t// but we can't detect a mouseup or a click immediately afterward\n\t\t\t\t// so we have to track the next mousedown and close the menu if\n\t\t\t\t// the user clicks somewhere outside of the autocomplete\n\t\t\t\tvar menuElement = self.menu.element[ 0 ];\n\t\t\t\tif ( !$( event.target ).closest( \".ui-menu-item\" ).length ) {\n\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t$( document ).one( 'mousedown', function( event ) {\n\t\t\t\t\t\t\tif ( event.target !== self.element[ 0 ] &&\n\t\t\t\t\t\t\t\tevent.target !== menuElement &&\n\t\t\t\t\t\t\t\t!$.ui.contains( menuElement, event.target ) ) {\n\t\t\t\t\t\t\t\tself.close();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}, 1 );\n\t\t\t\t}\n\n\t\t\t\t// use another timeout to make sure the blur-event-handler on the input was already triggered\n\t\t\t\tsetTimeout(function() {\n\t\t\t\t\tclearTimeout( self.closing );\n\t\t\t\t}, 13);\n\t\t\t})\n\t\t\t.menu({\n\t\t\t\tfocus: function( event, ui ) {\n\t\t\t\t\tvar item = ui.item.data( \"item.autocomplete\" );\n\t\t\t\t\tif ( false !== self._trigger( \"focus\", event, { item: item } ) ) {\n\t\t\t\t\t\t// use value to match what will end up in the input, if it was a key event\n\t\t\t\t\t\tif ( /^key/.test(event.originalEvent.type) ) {\n\t\t\t\t\t\t\tself.element.val( item.value );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tselected: function( event, ui ) {\n\t\t\t\t\tvar item = ui.item.data( \"item.autocomplete\" ),\n\t\t\t\t\t\tprevious = self.previous;\n\n\t\t\t\t\t// only trigger when focus was lost (click on menu)\n\t\t\t\t\tif ( self.element[0] !== doc.activeElement ) {\n\t\t\t\t\t\tself.element.focus();\n\t\t\t\t\t\tself.previous = previous;\n\t\t\t\t\t\t// #6109 - IE triggers two focus events and the second\n\t\t\t\t\t\t// is asynchronous, so we need to reset the previous\n\t\t\t\t\t\t// term synchronously and asynchronously :-(\n\t\t\t\t\t\tsetTimeout(function() {\n\t\t\t\t\t\t\tself.previous = previous;\n\t\t\t\t\t\t\tself.selectedItem = item;\n\t\t\t\t\t\t}, 1);\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( false !== self._trigger( \"select\", event, { item: item } ) ) {\n\t\t\t\t\t\tself.element.val( item.value );\n\t\t\t\t\t}\n\t\t\t\t\t// reset the term after the select event\n\t\t\t\t\t// this allows custom select handling to work properly\n\t\t\t\t\tself.term = self.element.val();\n\n\t\t\t\t\tself.close( event );\n\t\t\t\t\tself.selectedItem = item;\n\t\t\t\t},\n\t\t\t\tblur: function( event, ui ) {\n\t\t\t\t\t// don't set the value of the text field if it's already correct\n\t\t\t\t\t// this prevents moving the cursor unnecessarily\n\t\t\t\t\tif ( self.menu.element.is(\":visible\") &&\n\t\t\t\t\t\t( self.element.val() !== self.term ) ) {\n\t\t\t\t\t\tself.element.val( self.term );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t})\n\t\t\t.zIndex( this.element.zIndex() + 1 )\n\t\t\t// workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781\n\t\t\t.css({ top: 0, left: 0 })\n\t\t\t.hide()\n\t\t\t.data( \"menu\" );\n\t\tif ( $.fn.bgiframe ) {\n\t\t\t this.menu.element.bgiframe();\n\t\t}\n\t\t// turning off autocomplete prevents the browser from remembering the\n\t\t// value when navigating through history, so we re-enable autocomplete\n\t\t// if the page is unloaded before the widget is destroyed. #7790\n\t\tself.beforeunloadHandler = function() {\n\t\t\tself.element.removeAttr( \"autocomplete\" );\n\t\t};\n\t\t$( window ).bind( \"beforeunload\", self.beforeunloadHandler );\n\t},\n\n\tdestroy: function() {\n\t\tthis.element\n\t\t\t.removeClass( \"ui-autocomplete-input\" )\n\t\t\t.removeAttr( \"autocomplete\" )\n\t\t\t.removeAttr( \"role\" )\n\t\t\t.removeAttr( \"aria-autocomplete\" )\n\t\t\t.removeAttr( \"aria-haspopup\" );\n\t\tthis.menu.element.remove();\n\t\t$( window ).unbind( \"beforeunload\", this.beforeunloadHandler );\n\t\t$.Widget.prototype.destroy.call( this );\n\t},\n\n\t_setOption: function( key, value ) {\n\t\t$.Widget.prototype._setOption.apply( this, arguments );\n\t\tif ( key === \"source\" ) {\n\t\t\tthis._initSource();\n\t\t}\n\t\tif ( key === \"appendTo\" ) {\n\t\t\tthis.menu.element.appendTo( $( value || \"body\", this.element[0].ownerDocument )[0] )\n\t\t}\n\t\tif ( key === \"disabled\" && value && this.xhr ) {\n\t\t\tthis.xhr.abort();\n\t\t}\n\t},\n\n\t_initSource: function() {\n\t\tvar self = this,\n\t\t\tarray,\n\t\t\turl;\n\t\tif ( $.isArray(this.options.source) ) {\n\t\t\tarray = this.options.source;\n\t\t\tthis.source = function( request, response ) {\n\t\t\t\tresponse( $.ui.autocomplete.filter(array, request.term) );\n\t\t\t};\n\t\t} else if ( typeof this.options.source === \"string\" ) {\n\t\t\turl = this.options.source;\n\t\t\tthis.source = function( request, response ) {\n\t\t\t\tif ( self.xhr ) {\n\t\t\t\t\tself.xhr.abort();\n\t\t\t\t}\n\t\t\t\tself.xhr = $.ajax({\n\t\t\t\t\turl: url,\n\t\t\t\t\tdata: request,\n\t\t\t\t\tdataType: \"json\",\n\t\t\t\t\tsuccess: function( data, status ) {\n\t\t\t\t\t\tresponse( data );\n\t\t\t\t\t},\n\t\t\t\t\terror: function() {\n\t\t\t\t\t\tresponse( [] );\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t};\n\t\t} else {\n\t\t\tthis.source = this.options.source;\n\t\t}\n\t},\n\n\tsearch: function( value, event ) {\n\t\tvalue = value != null ? value : this.element.val();\n\n\t\t// always save the actual value, not the one passed as an argument\n\t\tthis.term = this.element.val();\n\n\t\tif ( value.length < this.options.minLength ) {\n\t\t\treturn this.close( event );\n\t\t}\n\n\t\tclearTimeout( this.closing );\n\t\tif ( this._trigger( \"search\", event ) === false ) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn this._search( value );\n\t},\n\n\t_search: function( value ) {\n\t\tthis.pending++;\n\t\tthis.element.addClass( \"ui-autocomplete-loading\" );\n\n\t\tthis.source( { term: value }, this._response() );\n\t},\n\n\t_response: function() {\n\t\tvar that = this,\n\t\t\tindex = ++requestIndex;\n\n\t\treturn function( content ) {\n\t\t\tif ( index === requestIndex ) {\n\t\t\t\tthat.__response( content );\n\t\t\t}\n\n\t\t\tthat.pending--;\n\t\t\tif ( !that.pending ) {\n\t\t\t\tthat.element.removeClass( \"ui-autocomplete-loading\" );\n\t\t\t}\n\t\t};\n\t},\n\n\t__response: function( content ) {\n\t\tif ( !this.options.disabled && content && content.length ) {\n\t\t\tcontent = this._normalize( content );\n\t\t\tthis._suggest( content );\n\t\t\tthis._trigger( \"open\" );\n\t\t} else {\n\t\t\tthis.close();\n\t\t}\n\t},\n\n\tclose: function( event ) {\n\t\tclearTimeout( this.closing );\n\t\tif ( this.menu.element.is(\":visible\") ) {\n\t\t\tthis.menu.element.hide();\n\t\t\tthis.menu.deactivate();\n\t\t\tthis._trigger( \"close\", event );\n\t\t}\n\t},\n\t\n\t_change: function( event ) {\n\t\tif ( this.previous !== this.element.val() ) {\n\t\t\tthis._trigger( \"change\", event, { item: this.selectedItem } );\n\t\t}\n\t},\n\n\t_normalize: function( items ) {\n\t\t// assume all items have the right format when the first item is complete\n\t\tif ( items.length && items[0].label && items[0].value ) {\n\t\t\treturn items;\n\t\t}\n\t\treturn $.map( items, function(item) {\n\t\t\tif ( typeof item === \"string\" ) {\n\t\t\t\treturn {\n\t\t\t\t\tlabel: item,\n\t\t\t\t\tvalue: item\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn $.extend({\n\t\t\t\tlabel: item.label || item.value,\n\t\t\t\tvalue: item.value || item.label\n\t\t\t}, item );\n\t\t});\n\t},\n\n\t_suggest: function( items ) {\n\t\tvar ul = this.menu.element\n\t\t\t.empty()\n\t\t\t.zIndex( this.element.zIndex() + 1 );\n\t\tthis._renderMenu( ul, items );\n\t\t// TODO refresh should check if the active item is still in the dom, removing the need for a manual deactivate\n\t\tthis.menu.deactivate();\n\t\tthis.menu.refresh();\n\n\t\t// size and position menu\n\t\tul.show();\n\t\tthis._resizeMenu();\n\t\tul.position( $.extend({\n\t\t\tof: this.element\n\t\t}, this.options.position ));\n\n\t\tif ( this.options.autoFocus ) {\n\t\t\tthis.menu.next( new $.Event(\"mouseover\") );\n\t\t}\n\t},\n\n\t_resizeMenu: function() {\n\t\tvar ul = this.menu.element;\n\t\tul.outerWidth( Math.max(\n\t\t\t// Firefox wraps long text (possibly a rounding bug)\n\t\t\t// so we add 1px to avoid the wrapping (#7513)\n\t\t\tul.width( \"\" ).outerWidth() + 1,\n\t\t\tthis.element.outerWidth()\n\t\t) );\n\t},\n\n\t_renderMenu: function( ul, items ) {\n\t\tvar self = this;\n\t\t$.each( items, function( index, item ) {\n\t\t\tself._renderItem( ul, item );\n\t\t});\n\t},\n\n\t_renderItem: function( ul, item) {\n\t\treturn $( \"<li></li>\" )\n\t\t\t.data( \"item.autocomplete\", item )\n\t\t\t.append( $( \"<a></a>\" ).text( item.label ) )\n\t\t\t.appendTo( ul );\n\t},\n\n\t_move: function( direction, event ) {\n\t\tif ( !this.menu.element.is(\":visible\") ) {\n\t\t\tthis.search( null, event );\n\t\t\treturn;\n\t\t}\n\t\tif ( this.menu.first() && /^previous/.test(direction) ||\n\t\t\t\tthis.menu.last() && /^next/.test(direction) ) {\n\t\t\tthis.element.val( this.term );\n\t\t\tthis.menu.deactivate();\n\t\t\treturn;\n\t\t}\n\t\tthis.menu[ direction ]( event );\n\t},\n\n\twidget: function() {\n\t\treturn this.menu.element;\n\t},\n\t_keyEvent: function( keyEvent, event ) {\n\t\tif ( !this.isMultiLine || this.menu.element.is( \":visible\" ) ) {\n\t\t\tthis._move( keyEvent, event );\n\n\t\t\t// prevents moving cursor to beginning/end of the text field in some browsers\n\t\t\tevent.preventDefault();\n\t\t}\n\t}\n});\n\n$.extend( $.ui.autocomplete, {\n\tescapeRegex: function( value ) {\n\t\treturn value.replace(/[-[\\]{}()*+?.,\\\\^$|#\\s]/g, \"\\\\$&\");\n\t},\n\tfilter: function(array, term) {\n\t\tvar matcher = new RegExp( $.ui.autocomplete.escapeRegex(term), \"i\" );\n\t\treturn $.grep( array, function(value) {\n\t\t\treturn matcher.test( value.label || value.value || value );\n\t\t});\n\t}\n});\n\n}( jQuery ));\n\n/*\n * jQuery UI Menu (not officially released)\n * \n * This widget isn't yet finished and the API is subject to change. We plan to finish\n * it for the next release. You're welcome to give it a try anyway and give us feedback,\n * as long as you're okay with migrating your code later on. We can help with that, too.\n *\n * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about)\n * Licensed under the MIT license.\n * http://jquery.org/license\n *\n * http://docs.jquery.com/UI/Menu\n *\n * Depends:\n *\tjquery.ui.core.js\n *  jquery.ui.widget.js\n */\n(function($) {\n\n$.widget(\"ui.menu\", {\n\t_create: function() {\n\t\tvar self = this;\n\t\tthis.element\n\t\t\t.addClass(\"ui-menu ui-widget ui-widget-content ui-corner-all\")\n\t\t\t.attr({\n\t\t\t\trole: \"listbox\",\n\t\t\t\t\"aria-activedescendant\": \"ui-active-menuitem\"\n\t\t\t})\n\t\t\t.click(function( event ) {\n\t\t\t\tif ( !$( event.target ).closest( \".ui-menu-item a\" ).length ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// temporary\n\t\t\t\tevent.preventDefault();\n\t\t\t\tself.select( event );\n\t\t\t});\n\t\tthis.refresh();\n\t},\n\t\n\trefresh: function() {\n\t\tvar self = this;\n\n\t\t// don't refresh list items that are already adapted\n\t\tvar items = this.element.children(\"li:not(.ui-menu-item):has(a)\")\n\t\t\t.addClass(\"ui-menu-item\")\n\t\t\t.attr(\"role\", \"menuitem\");\n\t\t\n\t\titems.children(\"a\")\n\t\t\t.addClass(\"ui-corner-all\")\n\t\t\t.attr(\"tabindex\", -1)\n\t\t\t// mouseenter doesn't work with event delegation\n\t\t\t.mouseenter(function( event ) {\n\t\t\t\tself.activate( event, $(this).parent() );\n\t\t\t})\n\t\t\t.mouseleave(function() {\n\t\t\t\tself.deactivate();\n\t\t\t});\n\t},\n\n\tactivate: function( event, item ) {\n\t\tthis.deactivate();\n\t\tif (this.hasScroll()) {\n\t\t\tvar offset = item.offset().top - this.element.offset().top,\n\t\t\t\tscroll = this.element.scrollTop(),\n\t\t\t\telementHeight = this.element.height();\n\t\t\tif (offset < 0) {\n\t\t\t\tthis.element.scrollTop( scroll + offset);\n\t\t\t} else if (offset >= elementHeight) {\n\t\t\t\tthis.element.scrollTop( scroll + offset - elementHeight + item.height());\n\t\t\t}\n\t\t}\n\t\tthis.active = item.eq(0)\n\t\t\t.children(\"a\")\n\t\t\t\t.addClass(\"ui-state-hover\")\n\t\t\t\t.attr(\"id\", \"ui-active-menuitem\")\n\t\t\t.end();\n\t\tthis._trigger(\"focus\", event, { item: item });\n\t},\n\n\tdeactivate: function() {\n\t\tif (!this.active) { return; }\n\n\t\tthis.active.children(\"a\")\n\t\t\t.removeClass(\"ui-state-hover\")\n\t\t\t.removeAttr(\"id\");\n\t\tthis._trigger(\"blur\");\n\t\tthis.active = null;\n\t},\n\n\tnext: function(event) {\n\t\tthis.move(\"next\", \".ui-menu-item:first\", event);\n\t},\n\n\tprevious: function(event) {\n\t\tthis.move(\"prev\", \".ui-menu-item:last\", event);\n\t},\n\n\tfirst: function() {\n\t\treturn this.active && !this.active.prevAll(\".ui-menu-item\").length;\n\t},\n\n\tlast: function() {\n\t\treturn this.active && !this.active.nextAll(\".ui-menu-item\").length;\n\t},\n\n\tmove: function(direction, edge, event) {\n\t\tif (!this.active) {\n\t\t\tthis.activate(event, this.element.children(edge));\n\t\t\treturn;\n\t\t}\n\t\tvar next = this.active[direction + \"All\"](\".ui-menu-item\").eq(0);\n\t\tif (next.length) {\n\t\t\tthis.activate(event, next);\n\t\t} else {\n\t\t\tthis.activate(event, this.element.children(edge));\n\t\t}\n\t},\n\n\t// TODO merge with previousPage\n\tnextPage: function(event) {\n\t\tif (this.hasScroll()) {\n\t\t\t// TODO merge with no-scroll-else\n\t\t\tif (!this.active || this.last()) {\n\t\t\t\tthis.activate(event, this.element.children(\".ui-menu-item:first\"));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar base = this.active.offset().top,\n\t\t\t\theight = this.element.height(),\n\t\t\t\tresult = this.element.children(\".ui-menu-item\").filter(function() {\n\t\t\t\t\tvar close = $(this).offset().top - base - height + $(this).height();\n\t\t\t\t\t// TODO improve approximation\n\t\t\t\t\treturn close < 10 && close > -10;\n\t\t\t\t});\n\n\t\t\t// TODO try to catch this earlier when scrollTop indicates the last page anyway\n\t\t\tif (!result.length) {\n\t\t\t\tresult = this.element.children(\".ui-menu-item:last\");\n\t\t\t}\n\t\t\tthis.activate(event, result);\n\t\t} else {\n\t\t\tthis.activate(event, this.element.children(\".ui-menu-item\")\n\t\t\t\t.filter(!this.active || this.last() ? \":first\" : \":last\"));\n\t\t}\n\t},\n\n\t// TODO merge with nextPage\n\tpreviousPage: function(event) {\n\t\tif (this.hasScroll()) {\n\t\t\t// TODO merge with no-scroll-else\n\t\t\tif (!this.active || this.first()) {\n\t\t\t\tthis.activate(event, this.element.children(\".ui-menu-item:last\"));\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar base = this.active.offset().top,\n\t\t\t\theight = this.element.height(),\n\t\t\t\tresult = this.element.children(\".ui-menu-item\").filter(function() {\n\t\t\t\t\tvar close = $(this).offset().top - base + height - $(this).height();\n\t\t\t\t\t// TODO improve approximation\n\t\t\t\t\treturn close < 10 && close > -10;\n\t\t\t\t});\n\n\t\t\t// TODO try to catch this earlier when scrollTop indicates the last page anyway\n\t\t\tif (!result.length) {\n\t\t\t\tresult = this.element.children(\".ui-menu-item:first\");\n\t\t\t}\n\t\t\tthis.activate(event, result);\n\t\t} else {\n\t\t\tthis.activate(event, this.element.children(\".ui-menu-item\")\n\t\t\t\t.filter(!this.active || this.first() ? \":last\" : \":first\"));\n\t\t}\n\t},\n\n\thasScroll: function() {\n\t\treturn this.element.height() < this.element[ $.fn.prop ? \"prop\" : \"attr\" ](\"scrollHeight\");\n\t},\n\n\tselect: function( event ) {\n\t\tthis._trigger(\"selected\", event, { item: this.active });\n\t}\n});\n\n}(jQuery));\n\n(function( $, undefined ) {\n\nvar lastActive, startXPos, startYPos, clickDragged,\n\tbaseClasses = \"ui-button ui-widget ui-state-default ui-corner-all\",\n\tstateClasses = \"ui-state-hover ui-state-active \",\n\ttypeClasses = \"ui-button-icons-only ui-button-icon-only ui-button-text-icons ui-button-text-icon-primary ui-button-text-icon-secondary ui-button-text-only\",\n\tformResetHandler = function() {\n\t\tvar buttons = $( this ).find( \":ui-button\" );\n\t\tsetTimeout(function() {\n\t\t\tbuttons.button( \"refresh\" );\n\t\t}, 1 );\n\t},\n\tradioGroup = function( radio ) {\n\t\tvar name = radio.name,\n\t\t\tform = radio.form,\n\t\t\tradios = $( [] );\n\t\tif ( name ) {\n\t\t\tif ( form ) {\n\t\t\t\tradios = $( form ).find( \"[name='\" + name + \"']\" );\n\t\t\t} else {\n\t\t\t\tradios = $( \"[name='\" + name + \"']\", radio.ownerDocument )\n\t\t\t\t\t.filter(function() {\n\t\t\t\t\t\treturn !this.form;\n\t\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn radios;\n\t};\n\n$.widget( \"ui.button\", {\n\toptions: {\n\t\tdisabled: null,\n\t\ttext: true,\n\t\tlabel: null,\n\t\ticons: {\n\t\t\tprimary: null,\n\t\t\tsecondary: null\n\t\t}\n\t},\n\t_create: function() {\n\t\tthis.element.closest( \"form\" )\n\t\t\t.unbind( \"reset.button\" )\n\t\t\t.bind( \"reset.button\", formResetHandler );\n\n\t\tif ( typeof this.options.disabled !== \"boolean\" ) {\n\t\t\tthis.options.disabled = !!this.element.propAttr( \"disabled\" );\n\t\t} else {\n\t\t\tthis.element.propAttr( \"disabled\", this.options.disabled );\n\t\t}\n\n\t\tthis._determineButtonType();\n\t\tthis.hasTitle = !!this.buttonElement.attr( \"title\" );\n\n\t\tvar self = this,\n\t\t\toptions = this.options,\n\t\t\ttoggleButton = this.type === \"checkbox\" || this.type === \"radio\",\n\t\t\thoverClass = \"ui-state-hover\" + ( !toggleButton ? \" ui-state-active\" : \"\" ),\n\t\t\tfocusClass = \"ui-state-focus\";\n\n\t\tif ( options.label === null ) {\n\t\t\toptions.label = this.buttonElement.html();\n\t\t}\n\n\t\tthis.buttonElement\n\t\t\t.addClass( baseClasses )\n\t\t\t.attr( \"role\", \"button\" )\n\t\t\t.bind( \"mouseenter.button\", function() {\n\t\t\t\tif ( options.disabled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t$( this ).addClass( \"ui-state-hover\" );\n\t\t\t\tif ( this === lastActive ) {\n\t\t\t\t\t$( this ).addClass( \"ui-state-active\" );\n\t\t\t\t}\n\t\t\t})\n\t\t\t.bind( \"mouseleave.button\", function() {\n\t\t\t\tif ( options.disabled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t$( this ).removeClass( hoverClass );\n\t\t\t})\n\t\t\t.bind( \"click.button\", function( event ) {\n\t\t\t\tif ( options.disabled ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tevent.stopImmediatePropagation();\n\t\t\t\t}\n\t\t\t});\n\n\t\tthis.element\n\t\t\t.bind( \"focus.button\", function() {\n\t\t\t\t// no need to check disabled, focus won't be triggered anyway\n\t\t\t\tself.buttonElement.addClass( focusClass );\n\t\t\t})\n\t\t\t.bind( \"blur.button\", function() {\n\t\t\t\tself.buttonElement.removeClass( focusClass );\n\t\t\t});\n\n\t\tif ( toggleButton ) {\n\t\t\tthis.element.bind( \"change.button\", function() {\n\t\t\t\tif ( clickDragged ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tself.refresh();\n\t\t\t});\n\t\t\t// if mouse moves between mousedown and mouseup (drag) set clickDragged flag\n\t\t\t// prevents issue where button state changes but checkbox/radio checked state\n\t\t\t// does not in Firefox (see ticket #6970)\n\t\t\tthis.buttonElement\n\t\t\t\t.bind( \"mousedown.button\", function( event ) {\n\t\t\t\t\tif ( options.disabled ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tclickDragged = false;\n\t\t\t\t\tstartXPos = event.pageX;\n\t\t\t\t\tstartYPos = event.pageY;\n\t\t\t\t})\n\t\t\t\t.bind( \"mouseup.button\", function( event ) {\n\t\t\t\t\tif ( options.disabled ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif ( startXPos !== event.pageX || startYPos !== event.pageY ) {\n\t\t\t\t\t\tclickDragged = true;\n\t\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tif ( this.type === \"checkbox\" ) {\n\t\t\tthis.buttonElement.bind( \"click.button\", function() {\n\t\t\t\tif ( options.disabled || clickDragged ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t$( this ).toggleClass( \"ui-state-active\" );\n\t\t\t\tself.buttonElement.attr( \"aria-pressed\", self.element[0].checked );\n\t\t\t});\n\t\t} else if ( this.type === \"radio\" ) {\n\t\t\tthis.buttonElement.bind( \"click.button\", function() {\n\t\t\t\tif ( options.disabled || clickDragged ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t$( this ).addClass( \"ui-state-active\" );\n\t\t\t\tself.buttonElement.attr( \"aria-pressed\", \"true\" );\n\n\t\t\t\tvar radio = self.element[ 0 ];\n\t\t\t\tradioGroup( radio )\n\t\t\t\t\t.not( radio )\n\t\t\t\t\t.map(function() {\n\t\t\t\t\t\treturn $( this ).button( \"widget\" )[ 0 ];\n\t\t\t\t\t})\n\t\t\t\t\t.removeClass( \"ui-state-active\" )\n\t\t\t\t\t.attr( \"aria-pressed\", \"false\" );\n\t\t\t});\n\t\t} else {\n\t\t\tthis.buttonElement\n\t\t\t\t.bind( \"mousedown.button\", function() {\n\t\t\t\t\tif ( options.disabled ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\t$( this ).addClass( \"ui-state-active\" );\n\t\t\t\t\tlastActive = this;\n\t\t\t\t\t$( document ).one( \"mouseup\", function() {\n\t\t\t\t\t\tlastActive = null;\n\t\t\t\t\t});\n\t\t\t\t})\n\t\t\t\t.bind( \"mouseup.button\", function() {\n\t\t\t\t\tif ( options.disabled ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\t$( this ).removeClass( \"ui-state-active\" );\n\t\t\t\t})\n\t\t\t\t.bind( \"keydown.button\", function(event) {\n\t\t\t\t\tif ( options.disabled ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif ( event.keyCode == $.ui.keyCode.SPACE || event.keyCode == $.ui.keyCode.ENTER ) {\n\t\t\t\t\t\t$( this ).addClass( \"ui-state-active\" );\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.bind( \"keyup.button\", function() {\n\t\t\t\t\t$( this ).removeClass( \"ui-state-active\" );\n\t\t\t\t});\n\n\t\t\tif ( this.buttonElement.is(\"a\") ) {\n\t\t\t\tthis.buttonElement.keyup(function(event) {\n\t\t\t\t\tif ( event.keyCode === $.ui.keyCode.SPACE ) {\n\t\t\t\t\t\t// TODO pass through original event correctly (just as 2nd argument doesn't work)\n\t\t\t\t\t\t$( this ).click();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\t// TODO: pull out $.Widget's handling for the disabled option into\n\t\t// $.Widget.prototype._setOptionDisabled so it's easy to proxy and can\n\t\t// be overridden by individual plugins\n\t\tthis._setOption( \"disabled\", options.disabled );\n\t\tthis._resetButton();\n\t},\n\n\t_determineButtonType: function() {\n\n\t\tif ( this.element.is(\":checkbox\") ) {\n\t\t\tthis.type = \"checkbox\";\n\t\t} else if ( this.element.is(\":radio\") ) {\n\t\t\tthis.type = \"radio\";\n\t\t} else if ( this.element.is(\"input\") ) {\n\t\t\tthis.type = \"input\";\n\t\t} else {\n\t\t\tthis.type = \"button\";\n\t\t}\n\n\t\tif ( this.type === \"checkbox\" || this.type === \"radio\" ) {\n\t\t\t// we don't search against the document in case the element\n\t\t\t// is disconnected from the DOM\n\t\t\tvar ancestor = this.element.parents().filter(\":last\"),\n\t\t\t\tlabelSelector = \"label[for='\" + this.element.attr(\"id\") + \"']\";\n\t\t\tthis.buttonElement = ancestor.find( labelSelector );\n\t\t\tif ( !this.buttonElement.length ) {\n\t\t\t\tancestor = ancestor.length ? ancestor.siblings() : this.element.siblings();\n\t\t\t\tthis.buttonElement = ancestor.filter( labelSelector );\n\t\t\t\tif ( !this.buttonElement.length ) {\n\t\t\t\t\tthis.buttonElement = ancestor.find( labelSelector );\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.element.addClass( \"ui-helper-hidden-accessible\" );\n\n\t\t\tvar checked = this.element.is( \":checked\" );\n\t\t\tif ( checked ) {\n\t\t\t\tthis.buttonElement.addClass( \"ui-state-active\" );\n\t\t\t}\n\t\t\tthis.buttonElement.attr( \"aria-pressed\", checked );\n\t\t} else {\n\t\t\tthis.buttonElement = this.element;\n\t\t}\n\t},\n\n\twidget: function() {\n\t\treturn this.buttonElement;\n\t},\n\n\tdestroy: function() {\n\t\tthis.element\n\t\t\t.removeClass( \"ui-helper-hidden-accessible\" );\n\t\tthis.buttonElement\n\t\t\t.removeClass( baseClasses + \" \" + stateClasses + \" \" + typeClasses )\n\t\t\t.removeAttr( \"role\" )\n\t\t\t.removeAttr( \"aria-pressed\" )\n\t\t\t.html( this.buttonElement.find(\".ui-button-text\").html() );\n\n\t\tif ( !this.hasTitle ) {\n\t\t\tthis.buttonElement.removeAttr( \"title\" );\n\t\t}\n\n\t\t$.Widget.prototype.destroy.call( this );\n\t},\n\n\t_setOption: function( key, value ) {\n\t\t$.Widget.prototype._setOption.apply( this, arguments );\n\t\tif ( key === \"disabled\" ) {\n\t\t\tif ( value ) {\n\t\t\t\tthis.element.propAttr( \"disabled\", true );\n\t\t\t} else {\n\t\t\t\tthis.element.propAttr( \"disabled\", false );\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tthis._resetButton();\n\t},\n\n\trefresh: function() {\n\t\tvar isDisabled = this.element.is( \":disabled\" );\n\t\tif ( isDisabled !== this.options.disabled ) {\n\t\t\tthis._setOption( \"disabled\", isDisabled );\n\t\t}\n\t\tif ( this.type === \"radio\" ) {\n\t\t\tradioGroup( this.element[0] ).each(function() {\n\t\t\t\tif ( $( this ).is( \":checked\" ) ) {\n\t\t\t\t\t$( this ).button( \"widget\" )\n\t\t\t\t\t\t.addClass( \"ui-state-active\" )\n\t\t\t\t\t\t.attr( \"aria-pressed\", \"true\" );\n\t\t\t\t} else {\n\t\t\t\t\t$( this ).button( \"widget\" )\n\t\t\t\t\t\t.removeClass( \"ui-state-active\" )\n\t\t\t\t\t\t.attr( \"aria-pressed\", \"false\" );\n\t\t\t\t}\n\t\t\t});\n\t\t} else if ( this.type === \"checkbox\" ) {\n\t\t\tif ( this.element.is( \":checked\" ) ) {\n\t\t\t\tthis.buttonElement\n\t\t\t\t\t.addClass( \"ui-state-active\" )\n\t\t\t\t\t.attr( \"aria-pressed\", \"true\" );\n\t\t\t} else {\n\t\t\t\tthis.buttonElement\n\t\t\t\t\t.removeClass( \"ui-state-active\" )\n\t\t\t\t\t.attr( \"aria-pressed\", \"false\" );\n\t\t\t}\n\t\t}\n\t},\n\n\t_resetButton: function() {\n\t\tif ( this.type === \"input\" ) {\n\t\t\tif ( this.options.label ) {\n\t\t\t\tthis.element.val( this.options.label );\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tvar buttonElement = this.buttonElement.removeClass( typeClasses ),\n\t\t\tbuttonText = $( \"<span></span>\", this.element[0].ownerDocument )\n\t\t\t\t.addClass( \"ui-button-text\" )\n\t\t\t\t.html( this.options.label )\n\t\t\t\t.appendTo( buttonElement.empty() )\n\t\t\t\t.text(),\n\t\t\ticons = this.options.icons,\n\t\t\tmultipleIcons = icons.primary && icons.secondary,\n\t\t\tbuttonClasses = [];  \n\n\t\tif ( icons.primary || icons.secondary ) {\n\t\t\tif ( this.options.text ) {\n\t\t\t\tbuttonClasses.push( \"ui-button-text-icon\" + ( multipleIcons ? \"s\" : ( icons.primary ? \"-primary\" : \"-secondary\" ) ) );\n\t\t\t}\n\n\t\t\tif ( icons.primary ) {\n\t\t\t\tbuttonElement.prepend( \"<span class='ui-button-icon-primary ui-icon \" + icons.primary + \"'></span>\" );\n\t\t\t}\n\n\t\t\tif ( icons.secondary ) {\n\t\t\t\tbuttonElement.append( \"<span class='ui-button-icon-secondary ui-icon \" + icons.secondary + \"'></span>\" );\n\t\t\t}\n\n\t\t\tif ( !this.options.text ) {\n\t\t\t\tbuttonClasses.push( multipleIcons ? \"ui-button-icons-only\" : \"ui-button-icon-only\" );\n\n\t\t\t\tif ( !this.hasTitle ) {\n\t\t\t\t\tbuttonElement.attr( \"title\", buttonText );\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tbuttonClasses.push( \"ui-button-text-only\" );\n\t\t}\n\t\tbuttonElement.addClass( buttonClasses.join( \" \" ) );\n\t}\n});\n\n$.widget( \"ui.buttonset\", {\n\toptions: {\n\t\titems: \":button, :submit, :reset, :checkbox, :radio, a, :data(button)\"\n\t},\n\n\t_create: function() {\n\t\tthis.element.addClass( \"ui-buttonset\" );\n\t},\n\t\n\t_init: function() {\n\t\tthis.refresh();\n\t},\n\n\t_setOption: function( key, value ) {\n\t\tif ( key === \"disabled\" ) {\n\t\t\tthis.buttons.button( \"option\", key, value );\n\t\t}\n\n\t\t$.Widget.prototype._setOption.apply( this, arguments );\n\t},\n\t\n\trefresh: function() {\n\t\tvar rtl = this.element.css( \"direction\" ) === \"rtl\";\n\t\t\n\t\tthis.buttons = this.element.find( this.options.items )\n\t\t\t.filter( \":ui-button\" )\n\t\t\t\t.button( \"refresh\" )\n\t\t\t.end()\n\t\t\t.not( \":ui-button\" )\n\t\t\t\t.button()\n\t\t\t.end()\n\t\t\t.map(function() {\n\t\t\t\treturn $( this ).button( \"widget\" )[ 0 ];\n\t\t\t})\n\t\t\t\t.removeClass( \"ui-corner-all ui-corner-left ui-corner-right\" )\n\t\t\t\t.filter( \":first\" )\n\t\t\t\t\t.addClass( rtl ? \"ui-corner-right\" : \"ui-corner-left\" )\n\t\t\t\t.end()\n\t\t\t\t.filter( \":last\" )\n\t\t\t\t\t.addClass( rtl ? \"ui-corner-left\" : \"ui-corner-right\" )\n\t\t\t\t.end()\n\t\t\t.end();\n\t},\n\n\tdestroy: function() {\n\t\tthis.element.removeClass( \"ui-buttonset\" );\n\t\tthis.buttons\n\t\t\t.map(function() {\n\t\t\t\treturn $( this ).button( \"widget\" )[ 0 ];\n\t\t\t})\n\t\t\t\t.removeClass( \"ui-corner-left ui-corner-right\" )\n\t\t\t.end()\n\t\t\t.button( \"destroy\" );\n\n\t\t$.Widget.prototype.destroy.call( this );\n\t}\n});\n\n}( jQuery ) );\n\n(function( $, undefined ) {\n\n$.extend($.ui, { datepicker: { version: \"1.8.24\" } });\n\nvar PROP_NAME = 'datepicker';\nvar dpuuid = new Date().getTime();\nvar instActive;\n\n/* Date picker manager.\n   Use the singleton instance of this class, $.datepicker, to interact with the date picker.\n   Settings for (groups of) date pickers are maintained in an instance object,\n   allowing multiple different settings on the same page. */\n\nfunction Datepicker() {\n\tthis.debug = false; // Change this to true to start debugging\n\tthis._curInst = null; // The current instance in use\n\tthis._keyEvent = false; // If the last event was a key event\n\tthis._disabledInputs = []; // List of date picker inputs that have been disabled\n\tthis._datepickerShowing = false; // True if the popup picker is showing , false if not\n\tthis._inDialog = false; // True if showing within a \"dialog\", false if not\n\tthis._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division\n\tthis._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class\n\tthis._appendClass = 'ui-datepicker-append'; // The name of the append marker class\n\tthis._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class\n\tthis._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class\n\tthis._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class\n\tthis._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class\n\tthis._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class\n\tthis._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class\n\tthis.regional = []; // Available regional settings, indexed by language code\n\tthis.regional[''] = { // Default regional settings\n\t\tcloseText: 'Done', // Display text for close link\n\t\tprevText: 'Prev', // Display text for previous month link\n\t\tnextText: 'Next', // Display text for next month link\n\t\tcurrentText: 'Today', // Display text for current month link\n\t\tmonthNames: ['January','February','March','April','May','June',\n\t\t\t'July','August','September','October','November','December'], // Names of months for drop-down and formatting\n\t\tmonthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting\n\t\tdayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting\n\t\tdayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting\n\t\tdayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday\n\t\tweekHeader: 'Wk', // Column header for week of the year\n\t\tdateFormat: 'mm/dd/yy', // See format options on parseDate\n\t\tfirstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...\n\t\tisRTL: false, // True if right-to-left language, false if left-to-right\n\t\tshowMonthAfterYear: false, // True if the year select precedes month, false for month then year\n\t\tyearSuffix: '' // Additional text to append to the year in the month headers\n\t};\n\tthis._defaults = { // Global defaults for all the date picker instances\n\t\tshowOn: 'focus', // 'focus' for popup on focus,\n\t\t\t// 'button' for trigger button, or 'both' for either\n\t\tshowAnim: 'fadeIn', // Name of jQuery animation for popup\n\t\tshowOptions: {}, // Options for enhanced animations\n\t\tdefaultDate: null, // Used when field is blank: actual date,\n\t\t\t// +/-number for offset from today, null for today\n\t\tappendText: '', // Display text following the input box, e.g. showing the format\n\t\tbuttonText: '...', // Text for trigger button\n\t\tbuttonImage: '', // URL for trigger button image\n\t\tbuttonImageOnly: false, // True if the image appears alone, false if it appears on a button\n\t\thideIfNoPrevNext: false, // True to hide next/previous month links\n\t\t\t// if not applicable, false to just disable them\n\t\tnavigationAsDateFormat: false, // True if date formatting applied to prev/today/next links\n\t\tgotoCurrent: false, // True if today link goes back to current selection instead\n\t\tchangeMonth: false, // True if month can be selected directly, false if only prev/next\n\t\tchangeYear: false, // True if year can be selected directly, false if only prev/next\n\t\tyearRange: 'c-10:c+10', // Range of years to display in drop-down,\n\t\t\t// either relative to today's year (-nn:+nn), relative to currently displayed year\n\t\t\t// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)\n\t\tshowOtherMonths: false, // True to show dates in other months, false to leave blank\n\t\tselectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable\n\t\tshowWeek: false, // True to show week of the year, false to not show it\n\t\tcalculateWeek: this.iso8601Week, // How to calculate the week of the year,\n\t\t\t// takes a Date and returns the number of the week for it\n\t\tshortYearCutoff: '+10', // Short year values < this are in the current century,\n\t\t\t// > this are in the previous century,\n\t\t\t// string value starting with '+' for current year + value\n\t\tminDate: null, // The earliest selectable date, or null for no limit\n\t\tmaxDate: null, // The latest selectable date, or null for no limit\n\t\tduration: 'fast', // Duration of display/closure\n\t\tbeforeShowDay: null, // Function that takes a date and returns an array with\n\t\t\t// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',\n\t\t\t// [2] = cell title (optional), e.g. $.datepicker.noWeekends\n\t\tbeforeShow: null, // Function that takes an input field and\n\t\t\t// returns a set of custom settings for the date picker\n\t\tonSelect: null, // Define a callback function when a date is selected\n\t\tonChangeMonthYear: null, // Define a callback function when the month or year is changed\n\t\tonClose: null, // Define a callback function when the datepicker is closed\n\t\tnumberOfMonths: 1, // Number of months to show at a time\n\t\tshowCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)\n\t\tstepMonths: 1, // Number of months to step back/forward\n\t\tstepBigMonths: 12, // Number of months to step back/forward for the big links\n\t\taltField: '', // Selector for an alternate field to store selected dates into\n\t\taltFormat: '', // The date format to use for the alternate field\n\t\tconstrainInput: true, // The input is constrained by the current date format\n\t\tshowButtonPanel: false, // True to show button panel, false to not show it\n\t\tautoSize: false, // True to size the input for the date format, false to leave as is\n\t\tdisabled: false // The initial disabled state\n\t};\n\t$.extend(this._defaults, this.regional['']);\n\tthis.dpDiv = bindHover($('<div id=\"' + this._mainDivId + '\" class=\"ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>'));\n}\n\n$.extend(Datepicker.prototype, {\n\t/* Class name added to elements to indicate already configured with a date picker. */\n\tmarkerClassName: 'hasDatepicker',\n\t\n\t//Keep track of the maximum number of rows displayed (see #7043)\n\tmaxRows: 4,\n\n\t/* Debug logging (if enabled). */\n\tlog: function () {\n\t\tif (this.debug)\n\t\t\tconsole.log.apply('', arguments);\n\t},\n\t\n\t// TODO rename to \"widget\" when switching to widget factory\n\t_widgetDatepicker: function() {\n\t\treturn this.dpDiv;\n\t},\n\n\t/* Override the default settings for all instances of the date picker.\n\t   @param  settings  object - the new settings to use as defaults (anonymous object)\n\t   @return the manager object */\n\tsetDefaults: function(settings) {\n\t\textendRemove(this._defaults, settings || {});\n\t\treturn this;\n\t},\n\n\t/* Attach the date picker to a jQuery selection.\n\t   @param  target    element - the target input field or division or span\n\t   @param  settings  object - the new settings to use for this date picker instance (anonymous) */\n\t_attachDatepicker: function(target, settings) {\n\t\t// check for settings on the control itself - in namespace 'date:'\n\t\tvar inlineSettings = null;\n\t\tfor (var attrName in this._defaults) {\n\t\t\tvar attrValue = target.getAttribute('date:' + attrName);\n\t\t\tif (attrValue) {\n\t\t\t\tinlineSettings = inlineSettings || {};\n\t\t\t\ttry {\n\t\t\t\t\tinlineSettings[attrName] = eval(attrValue);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tinlineSettings[attrName] = attrValue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvar nodeName = target.nodeName.toLowerCase();\n\t\tvar inline = (nodeName == 'div' || nodeName == 'span');\n\t\tif (!target.id) {\n\t\t\tthis.uuid += 1;\n\t\t\ttarget.id = 'dp' + this.uuid;\n\t\t}\n\t\tvar inst = this._newInst($(target), inline);\n\t\tinst.settings = $.extend({}, settings || {}, inlineSettings || {});\n\t\tif (nodeName == 'input') {\n\t\t\tthis._connectDatepicker(target, inst);\n\t\t} else if (inline) {\n\t\t\tthis._inlineDatepicker(target, inst);\n\t\t}\n\t},\n\n\t/* Create a new instance object. */\n\t_newInst: function(target, inline) {\n\t\tvar id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\\\\\$1'); // escape jQuery meta chars\n\t\treturn {id: id, input: target, // associated target\n\t\t\tselectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection\n\t\t\tdrawMonth: 0, drawYear: 0, // month being drawn\n\t\t\tinline: inline, // is datepicker inline or not\n\t\t\tdpDiv: (!inline ? this.dpDiv : // presentation div\n\t\t\tbindHover($('<div class=\"' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all\"></div>')))};\n\t},\n\n\t/* Attach the date picker to an input field. */\n\t_connectDatepicker: function(target, inst) {\n\t\tvar input = $(target);\n\t\tinst.append = $([]);\n\t\tinst.trigger = $([]);\n\t\tif (input.hasClass(this.markerClassName))\n\t\t\treturn;\n\t\tthis._attachments(input, inst);\n\t\tinput.addClass(this.markerClassName).keydown(this._doKeyDown).\n\t\t\tkeypress(this._doKeyPress).keyup(this._doKeyUp).\n\t\t\tbind(\"setData.datepicker\", function(event, key, value) {\n\t\t\t\tinst.settings[key] = value;\n\t\t\t}).bind(\"getData.datepicker\", function(event, key) {\n\t\t\t\treturn this._get(inst, key);\n\t\t\t});\n\t\tthis._autoSize(inst);\n\t\t$.data(target, PROP_NAME, inst);\n\t\t//If disabled option is true, disable the datepicker once it has been attached to the input (see ticket #5665)\n\t\tif( inst.settings.disabled ) {\n\t\t\tthis._disableDatepicker( target );\n\t\t}\n\t},\n\n\t/* Make attachments based on settings. */\n\t_attachments: function(input, inst) {\n\t\tvar appendText = this._get(inst, 'appendText');\n\t\tvar isRTL = this._get(inst, 'isRTL');\n\t\tif (inst.append)\n\t\t\tinst.append.remove();\n\t\tif (appendText) {\n\t\t\tinst.append = $('<span class=\"' + this._appendClass + '\">' + appendText + '</span>');\n\t\t\tinput[isRTL ? 'before' : 'after'](inst.append);\n\t\t}\n\t\tinput.unbind('focus', this._showDatepicker);\n\t\tif (inst.trigger)\n\t\t\tinst.trigger.remove();\n\t\tvar showOn = this._get(inst, 'showOn');\n\t\tif (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field\n\t\t\tinput.focus(this._showDatepicker);\n\t\tif (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked\n\t\t\tvar buttonText = this._get(inst, 'buttonText');\n\t\t\tvar buttonImage = this._get(inst, 'buttonImage');\n\t\t\tinst.trigger = $(this._get(inst, 'buttonImageOnly') ?\n\t\t\t\t$('<img/>').addClass(this._triggerClass).\n\t\t\t\t\tattr({ src: buttonImage, alt: buttonText, title: buttonText }) :\n\t\t\t\t$('<button type=\"button\"></button>').addClass(this._triggerClass).\n\t\t\t\t\thtml(buttonImage == '' ? buttonText : $('<img/>').attr(\n\t\t\t\t\t{ src:buttonImage, alt:buttonText, title:buttonText })));\n\t\t\tinput[isRTL ? 'before' : 'after'](inst.trigger);\n\t\t\tinst.trigger.click(function() {\n\t\t\t\tif ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])\n\t\t\t\t\t$.datepicker._hideDatepicker();\n\t\t\t\telse if ($.datepicker._datepickerShowing && $.datepicker._lastInput != input[0]) {\n\t\t\t\t\t$.datepicker._hideDatepicker(); \n\t\t\t\t\t$.datepicker._showDatepicker(input[0]);\n\t\t\t\t} else\n\t\t\t\t\t$.datepicker._showDatepicker(input[0]);\n\t\t\t\treturn false;\n\t\t\t});\n\t\t}\n\t},\n\n\t/* Apply the maximum length for the date format. */\n\t_autoSize: function(inst) {\n\t\tif (this._get(inst, 'autoSize') && !inst.inline) {\n\t\t\tvar date = new Date(2009, 12 - 1, 20); // Ensure double digits\n\t\t\tvar dateFormat = this._get(inst, 'dateFormat');\n\t\t\tif (dateFormat.match(/[DM]/)) {\n\t\t\t\tvar findMax = function(names) {\n\t\t\t\t\tvar max = 0;\n\t\t\t\t\tvar maxI = 0;\n\t\t\t\t\tfor (var i = 0; i < names.length; i++) {\n\t\t\t\t\t\tif (names[i].length > max) {\n\t\t\t\t\t\t\tmax = names[i].length;\n\t\t\t\t\t\t\tmaxI = i;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn maxI;\n\t\t\t\t};\n\t\t\t\tdate.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?\n\t\t\t\t\t'monthNames' : 'monthNamesShort'))));\n\t\t\t\tdate.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?\n\t\t\t\t\t'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());\n\t\t\t}\n\t\t\tinst.input.attr('size', this._formatDate(inst, date).length);\n\t\t}\n\t},\n\n\t/* Attach an inline date picker to a div. */\n\t_inlineDatepicker: function(target, inst) {\n\t\tvar divSpan = $(target);\n\t\tif (divSpan.hasClass(this.markerClassName))\n\t\t\treturn;\n\t\tdivSpan.addClass(this.markerClassName).append(inst.dpDiv).\n\t\t\tbind(\"setData.datepicker\", function(event, key, value){\n\t\t\t\tinst.settings[key] = value;\n\t\t\t}).bind(\"getData.datepicker\", function(event, key){\n\t\t\t\treturn this._get(inst, key);\n\t\t\t});\n\t\t$.data(target, PROP_NAME, inst);\n\t\tthis._setDate(inst, this._getDefaultDate(inst), true);\n\t\tthis._updateDatepicker(inst);\n\t\tthis._updateAlternate(inst);\n\t\t//If disabled option is true, disable the datepicker before showing it (see ticket #5665)\n\t\tif( inst.settings.disabled ) {\n\t\t\tthis._disableDatepicker( target );\n\t\t}\n\t\t// Set display:block in place of inst.dpDiv.show() which won't work on disconnected elements\n\t\t// http://bugs.jqueryui.com/ticket/7552 - A Datepicker created on a detached div has zero height\n\t\tinst.dpDiv.css( \"display\", \"block\" );\n\t},\n\n\t/* Pop-up the date picker in a \"dialog\" box.\n\t   @param  input     element - ignored\n\t   @param  date      string or Date - the initial date to display\n\t   @param  onSelect  function - the function to call when a date is selected\n\t   @param  settings  object - update the dialog date picker instance's settings (anonymous object)\n\t   @param  pos       int[2] - coordinates for the dialog's position within the screen or\n\t                     event - with x/y coordinates or\n\t                     leave empty for default (screen centre)\n\t   @return the manager object */\n\t_dialogDatepicker: function(input, date, onSelect, settings, pos) {\n\t\tvar inst = this._dialogInst; // internal instance\n\t\tif (!inst) {\n\t\t\tthis.uuid += 1;\n\t\t\tvar id = 'dp' + this.uuid;\n\t\t\tthis._dialogInput = $('<input type=\"text\" id=\"' + id +\n\t\t\t\t'\" style=\"position: absolute; top: -100px; width: 0px;\"/>');\n\t\t\tthis._dialogInput.keydown(this._doKeyDown);\n\t\t\t$('body').append(this._dialogInput);\n\t\t\tinst = this._dialogInst = this._newInst(this._dialogInput, false);\n\t\t\tinst.settings = {};\n\t\t\t$.data(this._dialogInput[0], PROP_NAME, inst);\n\t\t}\n\t\textendRemove(inst.settings, settings || {});\n\t\tdate = (date && date.constructor == Date ? this._formatDate(inst, date) : date);\n\t\tthis._dialogInput.val(date);\n\n\t\tthis._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);\n\t\tif (!this._pos) {\n\t\t\tvar browserWidth = document.documentElement.clientWidth;\n\t\t\tvar browserHeight = document.documentElement.clientHeight;\n\t\t\tvar scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;\n\t\t\tvar scrollY = document.documentElement.scrollTop || document.body.scrollTop;\n\t\t\tthis._pos = // should use actual width/height below\n\t\t\t\t[(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];\n\t\t}\n\n\t\t// move input on screen for focus, but hidden behind dialog\n\t\tthis._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');\n\t\tinst.settings.onSelect = onSelect;\n\t\tthis._inDialog = true;\n\t\tthis.dpDiv.addClass(this._dialogClass);\n\t\tthis._showDatepicker(this._dialogInput[0]);\n\t\tif ($.blockUI)\n\t\t\t$.blockUI(this.dpDiv);\n\t\t$.data(this._dialogInput[0], PROP_NAME, inst);\n\t\treturn this;\n\t},\n\n\t/* Detach a datepicker from its control.\n\t   @param  target    element - the target input field or division or span */\n\t_destroyDatepicker: function(target) {\n\t\tvar $target = $(target);\n\t\tvar inst = $.data(target, PROP_NAME);\n\t\tif (!$target.hasClass(this.markerClassName)) {\n\t\t\treturn;\n\t\t}\n\t\tvar nodeName = target.nodeName.toLowerCase();\n\t\t$.removeData(target, PROP_NAME);\n\t\tif (nodeName == 'input') {\n\t\t\tinst.append.remove();\n\t\t\tinst.trigger.remove();\n\t\t\t$target.removeClass(this.markerClassName).\n\t\t\t\tunbind('focus', this._showDatepicker).\n\t\t\t\tunbind('keydown', this._doKeyDown).\n\t\t\t\tunbind('keypress', this._doKeyPress).\n\t\t\t\tunbind('keyup', this._doKeyUp);\n\t\t} else if (nodeName == 'div' || nodeName == 'span')\n\t\t\t$target.removeClass(this.markerClassName).empty();\n\t},\n\n\t/* Enable the date picker to a jQuery selection.\n\t   @param  target    element - the target input field or division or span */\n\t_enableDatepicker: function(target) {\n\t\tvar $target = $(target);\n\t\tvar inst = $.data(target, PROP_NAME);\n\t\tif (!$target.hasClass(this.markerClassName)) {\n\t\t\treturn;\n\t\t}\n\t\tvar nodeName = target.nodeName.toLowerCase();\n\t\tif (nodeName == 'input') {\n\t\t\ttarget.disabled = false;\n\t\t\tinst.trigger.filter('button').\n\t\t\t\teach(function() { this.disabled = false; }).end().\n\t\t\t\tfilter('img').css({opacity: '1.0', cursor: ''});\n\t\t}\n\t\telse if (nodeName == 'div' || nodeName == 'span') {\n\t\t\tvar inline = $target.children('.' + this._inlineClass);\n\t\t\tinline.children().removeClass('ui-state-disabled');\n\t\t\tinline.find(\"select.ui-datepicker-month, select.ui-datepicker-year\").\n\t\t\t\tremoveAttr(\"disabled\");\n\t\t}\n\t\tthis._disabledInputs = $.map(this._disabledInputs,\n\t\t\tfunction(value) { return (value == target ? null : value); }); // delete entry\n\t},\n\n\t/* Disable the date picker to a jQuery selection.\n\t   @param  target    element - the target input field or division or span */\n\t_disableDatepicker: function(target) {\n\t\tvar $target = $(target);\n\t\tvar inst = $.data(target, PROP_NAME);\n\t\tif (!$target.hasClass(this.markerClassName)) {\n\t\t\treturn;\n\t\t}\n\t\tvar nodeName = target.nodeName.toLowerCase();\n\t\tif (nodeName == 'input') {\n\t\t\ttarget.disabled = true;\n\t\t\tinst.trigger.filter('button').\n\t\t\t\teach(function() { this.disabled = true; }).end().\n\t\t\t\tfilter('img').css({opacity: '0.5', cursor: 'default'});\n\t\t}\n\t\telse if (nodeName == 'div' || nodeName == 'span') {\n\t\t\tvar inline = $target.children('.' + this._inlineClass);\n\t\t\tinline.children().addClass('ui-state-disabled');\n\t\t\tinline.find(\"select.ui-datepicker-month, select.ui-datepicker-year\").\n\t\t\t\tattr(\"disabled\", \"disabled\");\n\t\t}\n\t\tthis._disabledInputs = $.map(this._disabledInputs,\n\t\t\tfunction(value) { return (value == target ? null : value); }); // delete entry\n\t\tthis._disabledInputs[this._disabledInputs.length] = target;\n\t},\n\n\t/* Is the first field in a jQuery collection disabled as a datepicker?\n\t   @param  target    element - the target input field or division or span\n\t   @return boolean - true if disabled, false if enabled */\n\t_isDisabledDatepicker: function(target) {\n\t\tif (!target) {\n\t\t\treturn false;\n\t\t}\n\t\tfor (var i = 0; i < this._disabledInputs.length; i++) {\n\t\t\tif (this._disabledInputs[i] == target)\n\t\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t},\n\n\t/* Retrieve the instance data for the target control.\n\t   @param  target  element - the target input field or division or span\n\t   @return  object - the associated instance data\n\t   @throws  error if a jQuery problem getting data */\n\t_getInst: function(target) {\n\t\ttry {\n\t\t\treturn $.data(target, PROP_NAME);\n\t\t}\n\t\tcatch (err) {\n\t\t\tthrow 'Missing instance data for this datepicker';\n\t\t}\n\t},\n\n\t/* Update or retrieve the settings for a date picker attached to an input field or division.\n\t   @param  target  element - the target input field or division or span\n\t   @param  name    object - the new settings to update or\n\t                   string - the name of the setting to change or retrieve,\n\t                   when retrieving also 'all' for all instance settings or\n\t                   'defaults' for all global defaults\n\t   @param  value   any - the new value for the setting\n\t                   (omit if above is an object or to retrieve a value) */\n\t_optionDatepicker: function(target, name, value) {\n\t\tvar inst = this._getInst(target);\n\t\tif (arguments.length == 2 && typeof name == 'string') {\n\t\t\treturn (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :\n\t\t\t\t(inst ? (name == 'all' ? $.extend({}, inst.settings) :\n\t\t\t\tthis._get(inst, name)) : null));\n\t\t}\n\t\tvar settings = name || {};\n\t\tif (typeof name == 'string') {\n\t\t\tsettings = {};\n\t\t\tsettings[name] = value;\n\t\t}\n\t\tif (inst) {\n\t\t\tif (this._curInst == inst) {\n\t\t\t\tthis._hideDatepicker();\n\t\t\t}\n\t\t\tvar date = this._getDateDatepicker(target, true);\n\t\t\tvar minDate = this._getMinMaxDate(inst, 'min');\n\t\t\tvar maxDate = this._getMinMaxDate(inst, 'max');\n\t\t\textendRemove(inst.settings, settings);\n\t\t\t// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided\n\t\t\tif (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined)\n\t\t\t\tinst.settings.minDate = this._formatDate(inst, minDate);\n\t\t\tif (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined)\n\t\t\t\tinst.settings.maxDate = this._formatDate(inst, maxDate);\n\t\t\tthis._attachments($(target), inst);\n\t\t\tthis._autoSize(inst);\n\t\t\tthis._setDate(inst, date);\n\t\t\tthis._updateAlternate(inst);\n\t\t\tthis._updateDatepicker(inst);\n\t\t}\n\t},\n\n\t// change method deprecated\n\t_changeDatepicker: function(target, name, value) {\n\t\tthis._optionDatepicker(target, name, value);\n\t},\n\n\t/* Redraw the date picker attached to an input field or division.\n\t   @param  target  element - the target input field or division or span */\n\t_refreshDatepicker: function(target) {\n\t\tvar inst = this._getInst(target);\n\t\tif (inst) {\n\t\t\tthis._updateDatepicker(inst);\n\t\t}\n\t},\n\n\t/* Set the dates for a jQuery selection.\n\t   @param  target   element - the target input field or division or span\n\t   @param  date     Date - the new date */\n\t_setDateDatepicker: function(target, date) {\n\t\tvar inst = this._getInst(target);\n\t\tif (inst) {\n\t\t\tthis._setDate(inst, date);\n\t\t\tthis._updateDatepicker(inst);\n\t\t\tthis._updateAlternate(inst);\n\t\t}\n\t},\n\n\t/* Get the date(s) for the first entry in a jQuery selection.\n\t   @param  target     element - the target input field or division or span\n\t   @param  noDefault  boolean - true if no default date is to be used\n\t   @return Date - the current date */\n\t_getDateDatepicker: function(target, noDefault) {\n\t\tvar inst = this._getInst(target);\n\t\tif (inst && !inst.inline)\n\t\t\tthis._setDateFromField(inst, noDefault);\n\t\treturn (inst ? this._getDate(inst) : null);\n\t},\n\n\t/* Handle keystrokes. */\n\t_doKeyDown: function(event) {\n\t\tvar inst = $.datepicker._getInst(event.target);\n\t\tvar handled = true;\n\t\tvar isRTL = inst.dpDiv.is('.ui-datepicker-rtl');\n\t\tinst._keyEvent = true;\n\t\tif ($.datepicker._datepickerShowing)\n\t\t\tswitch (event.keyCode) {\n\t\t\t\tcase 9: $.datepicker._hideDatepicker();\n\t\t\t\t\t\thandled = false;\n\t\t\t\t\t\tbreak; // hide on tab out\n\t\t\t\tcase 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' + \n\t\t\t\t\t\t\t\t\t$.datepicker._currentClass + ')', inst.dpDiv);\n\t\t\t\t\t\tif (sel[0])\n\t\t\t\t\t\t\t$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);\n\t\t\t\t\t\t\tvar onSelect = $.datepicker._get(inst, 'onSelect');\n\t\t\t\t\t\t\tif (onSelect) {\n\t\t\t\t\t\t\t\tvar dateStr = $.datepicker._formatDate(inst);\n\n\t\t\t\t\t\t\t\t// trigger custom callback\n\t\t\t\t\t\t\t\tonSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t$.datepicker._hideDatepicker();\n\t\t\t\t\t\treturn false; // don't submit the form\n\t\t\t\t\t\tbreak; // select the value on enter\n\t\t\t\tcase 27: $.datepicker._hideDatepicker();\n\t\t\t\t\t\tbreak; // hide on escape\n\t\t\t\tcase 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?\n\t\t\t\t\t\t\t-$.datepicker._get(inst, 'stepBigMonths') :\n\t\t\t\t\t\t\t-$.datepicker._get(inst, 'stepMonths')), 'M');\n\t\t\t\t\t\tbreak; // previous month/year on page up/+ ctrl\n\t\t\t\tcase 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?\n\t\t\t\t\t\t\t+$.datepicker._get(inst, 'stepBigMonths') :\n\t\t\t\t\t\t\t+$.datepicker._get(inst, 'stepMonths')), 'M');\n\t\t\t\t\t\tbreak; // next month/year on page down/+ ctrl\n\t\t\t\tcase 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);\n\t\t\t\t\t\thandled = event.ctrlKey || event.metaKey;\n\t\t\t\t\t\tbreak; // clear on ctrl or command +end\n\t\t\t\tcase 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);\n\t\t\t\t\t\thandled = event.ctrlKey || event.metaKey;\n\t\t\t\t\t\tbreak; // current on ctrl or command +home\n\t\t\t\tcase 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');\n\t\t\t\t\t\thandled = event.ctrlKey || event.metaKey;\n\t\t\t\t\t\t// -1 day on ctrl or command +left\n\t\t\t\t\t\tif (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?\n\t\t\t\t\t\t\t\t\t-$.datepicker._get(inst, 'stepBigMonths') :\n\t\t\t\t\t\t\t\t\t-$.datepicker._get(inst, 'stepMonths')), 'M');\n\t\t\t\t\t\t// next month/year on alt +left on Mac\n\t\t\t\t\t\tbreak;\n\t\t\t\tcase 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');\n\t\t\t\t\t\thandled = event.ctrlKey || event.metaKey;\n\t\t\t\t\t\tbreak; // -1 week on ctrl or command +up\n\t\t\t\tcase 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');\n\t\t\t\t\t\thandled = event.ctrlKey || event.metaKey;\n\t\t\t\t\t\t// +1 day on ctrl or command +right\n\t\t\t\t\t\tif (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?\n\t\t\t\t\t\t\t\t\t+$.datepicker._get(inst, 'stepBigMonths') :\n\t\t\t\t\t\t\t\t\t+$.datepicker._get(inst, 'stepMonths')), 'M');\n\t\t\t\t\t\t// next month/year on alt +right\n\t\t\t\t\t\tbreak;\n\t\t\t\tcase 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');\n\t\t\t\t\t\thandled = event.ctrlKey || event.metaKey;\n\t\t\t\t\t\tbreak; // +1 week on ctrl or command +down\n\t\t\t\tdefault: handled = false;\n\t\t\t}\n\t\telse if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home\n\t\t\t$.datepicker._showDatepicker(this);\n\t\telse {\n\t\t\thandled = false;\n\t\t}\n\t\tif (handled) {\n\t\t\tevent.preventDefault();\n\t\t\tevent.stopPropagation();\n\t\t}\n\t},\n\n\t/* Filter entered characters - based on date format. */\n\t_doKeyPress: function(event) {\n\t\tvar inst = $.datepicker._getInst(event.target);\n\t\tif ($.datepicker._get(inst, 'constrainInput')) {\n\t\t\tvar chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));\n\t\t\tvar chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);\n\t\t\treturn event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);\n\t\t}\n\t},\n\n\t/* Synchronise manual entry and field/alternate field. */\n\t_doKeyUp: function(event) {\n\t\tvar inst = $.datepicker._getInst(event.target);\n\t\tif (inst.input.val() != inst.lastVal) {\n\t\t\ttry {\n\t\t\t\tvar date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),\n\t\t\t\t\t(inst.input ? inst.input.val() : null),\n\t\t\t\t\t$.datepicker._getFormatConfig(inst));\n\t\t\t\tif (date) { // only if valid\n\t\t\t\t\t$.datepicker._setDateFromField(inst);\n\t\t\t\t\t$.datepicker._updateAlternate(inst);\n\t\t\t\t\t$.datepicker._updateDatepicker(inst);\n\t\t\t\t}\n\t\t\t}\n\t\t\tcatch (err) {\n\t\t\t\t$.datepicker.log(err);\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t},\n\n\t/* Pop-up the date picker for a given input field.\n       If false returned from beforeShow event handler do not show. \n\t   @param  input  element - the input field attached to the date picker or\n\t                  event - if triggered by focus */\n\t_showDatepicker: function(input) {\n\t\tinput = input.target || input;\n\t\tif (input.nodeName.toLowerCase() != 'input') // find from button/image trigger\n\t\t\tinput = $('input', input.parentNode)[0];\n\t\tif ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here\n\t\t\treturn;\n\t\tvar inst = $.datepicker._getInst(input);\n\t\tif ($.datepicker._curInst && $.datepicker._curInst != inst) {\n\t\t\t$.datepicker._curInst.dpDiv.stop(true, true);\n\t\t\tif ( inst && $.datepicker._datepickerShowing ) {\n\t\t\t\t$.datepicker._hideDatepicker( $.datepicker._curInst.input[0] );\n\t\t\t}\n\t\t}\n\t\tvar beforeShow = $.datepicker._get(inst, 'beforeShow');\n\t\tvar beforeShowSettings = beforeShow ? beforeShow.apply(input, [input, inst]) : {};\n\t\tif(beforeShowSettings === false){\n            //false\n\t\t\treturn;\n\t\t}\n\t\textendRemove(inst.settings, beforeShowSettings);\n\t\tinst.lastVal = null;\n\t\t$.datepicker._lastInput = input;\n\t\t$.datepicker._setDateFromField(inst);\n\t\tif ($.datepicker._inDialog) // hide cursor\n\t\t\tinput.value = '';\n\t\tif (!$.datepicker._pos) { // position below input\n\t\t\t$.datepicker._pos = $.datepicker._findPos(input);\n\t\t\t$.datepicker._pos[1] += input.offsetHeight; // add the height\n\t\t}\n\t\tvar isFixed = false;\n\t\t$(input).parents().each(function() {\n\t\t\tisFixed |= $(this).css('position') == 'fixed';\n\t\t\treturn !isFixed;\n\t\t});\n\t\tif (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled\n\t\t\t$.datepicker._pos[0] -= document.documentElement.scrollLeft;\n\t\t\t$.datepicker._pos[1] -= document.documentElement.scrollTop;\n\t\t}\n\t\tvar offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};\n\t\t$.datepicker._pos = null;\n\t\t//to avoid flashes on Firefox\n\t\tinst.dpDiv.empty();\n\t\t// determine sizing offscreen\n\t\tinst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});\n\t\t$.datepicker._updateDatepicker(inst);\n\t\t// fix width for dynamic number of date pickers\n\t\t// and adjust position before showing\n\t\toffset = $.datepicker._checkOffset(inst, offset, isFixed);\n\t\tinst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?\n\t\t\t'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',\n\t\t\tleft: offset.left + 'px', top: offset.top + 'px'});\n\t\tif (!inst.inline) {\n\t\t\tvar showAnim = $.datepicker._get(inst, 'showAnim');\n\t\t\tvar duration = $.datepicker._get(inst, 'duration');\n\t\t\tvar postProcess = function() {\n\t\t\t\tvar cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only\n\t\t\t\tif( !! cover.length ){\n\t\t\t\t\tvar borders = $.datepicker._getBorders(inst.dpDiv);\n\t\t\t\t\tcover.css({left: -borders[0], top: -borders[1],\n\t\t\t\t\t\twidth: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});\n\t\t\t\t}\n\t\t\t};\n\t\t\tinst.dpDiv.zIndex($(input).zIndex()+1);\n\t\t\t$.datepicker._datepickerShowing = true;\n\t\t\tif ($.effects && $.effects[showAnim])\n\t\t\t\tinst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);\n\t\t\telse\n\t\t\t\tinst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);\n\t\t\tif (!showAnim || !duration)\n\t\t\t\tpostProcess();\n\t\t\tif (inst.input.is(':visible') && !inst.input.is(':disabled'))\n\t\t\t\tinst.input.focus();\n\t\t\t$.datepicker._curInst = inst;\n\t\t}\n\t},\n\n\t/* Generate the date picker content. */\n\t_updateDatepicker: function(inst) {\n\t\tvar self = this;\n\t\tself.maxRows = 4; //Reset the max number of rows being displayed (see #7043)\n\t\tvar borders = $.datepicker._getBorders(inst.dpDiv);\n\t\tinstActive = inst; // for delegate hover events\n\t\tinst.dpDiv.empty().append(this._generateHTML(inst));\n\t\tthis._attachHandlers(inst);\n\t\tvar cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only\n\t\tif( !!cover.length ){ //avoid call to outerXXXX() when not in IE6\n\t\t\tcover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})\n\t\t}\n\t\tinst.dpDiv.find('.' + this._dayOverClass + ' a').mouseover();\n\t\tvar numMonths = this._getNumberOfMonths(inst);\n\t\tvar cols = numMonths[1];\n\t\tvar width = 17;\n\t\tinst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');\n\t\tif (cols > 1)\n\t\t\tinst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');\n\t\tinst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +\n\t\t\t'Class']('ui-datepicker-multi');\n\t\tinst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +\n\t\t\t'Class']('ui-datepicker-rtl');\n\t\tif (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&\n\t\t\t\t// #6694 - don't focus the input if it's already focused\n\t\t\t\t// this breaks the change event in IE\n\t\t\t\tinst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)\n\t\t\tinst.input.focus();\n\t\t// deffered render of the years select (to avoid flashes on Firefox) \n\t\tif( inst.yearshtml ){\n\t\t\tvar origyearshtml = inst.yearshtml;\n\t\t\tsetTimeout(function(){\n\t\t\t\t//assure that inst.yearshtml didn't change.\n\t\t\t\tif( origyearshtml === inst.yearshtml && inst.yearshtml ){\n\t\t\t\t\tinst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml);\n\t\t\t\t}\n\t\t\t\torigyearshtml = inst.yearshtml = null;\n\t\t\t}, 0);\n\t\t}\n\t},\n\n\t/* Retrieve the size of left and top borders for an element.\n\t   @param  elem  (jQuery object) the element of interest\n\t   @return  (number[2]) the left and top borders */\n\t_getBorders: function(elem) {\n\t\tvar convert = function(value) {\n\t\t\treturn {thin: 1, medium: 2, thick: 3}[value] || value;\n\t\t};\n\t\treturn [parseFloat(convert(elem.css('border-left-width'))),\n\t\t\tparseFloat(convert(elem.css('border-top-width')))];\n\t},\n\n\t/* Check positioning to remain on screen. */\n\t_checkOffset: function(inst, offset, isFixed) {\n\t\tvar dpWidth = inst.dpDiv.outerWidth();\n\t\tvar dpHeight = inst.dpDiv.outerHeight();\n\t\tvar inputWidth = inst.input ? inst.input.outerWidth() : 0;\n\t\tvar inputHeight = inst.input ? inst.input.outerHeight() : 0;\n\t\tvar viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft());\n\t\tvar viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop());\n\n\t\toffset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);\n\t\toffset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;\n\t\toffset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;\n\n\t\t// now check if datepicker is showing outside window viewport - move to a better place if so.\n\t\toffset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?\n\t\t\tMath.abs(offset.left + dpWidth - viewWidth) : 0);\n\t\toffset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?\n\t\t\tMath.abs(dpHeight + inputHeight) : 0);\n\n\t\treturn offset;\n\t},\n\n\t/* Find an object's position on the screen. */\n\t_findPos: function(obj) {\n\t\tvar inst = this._getInst(obj);\n\t\tvar isRTL = this._get(inst, 'isRTL');\n        while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) {\n            obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];\n        }\n        var position = $(obj).offset();\n\t    return [position.left, position.top];\n\t},\n\n\t/* Hide the date picker from view.\n\t   @param  input  element - the input field attached to the date picker */\n\t_hideDatepicker: function(input) {\n\t\tvar inst = this._curInst;\n\t\tif (!inst || (input && inst != $.data(input, PROP_NAME)))\n\t\t\treturn;\n\t\tif (this._datepickerShowing) {\n\t\t\tvar showAnim = this._get(inst, 'showAnim');\n\t\t\tvar duration = this._get(inst, 'duration');\n\t\t\tvar postProcess = function() {\n\t\t\t\t$.datepicker._tidyDialog(inst);\n\t\t\t};\n\t\t\tif ($.effects && $.effects[showAnim])\n\t\t\t\tinst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);\n\t\t\telse\n\t\t\t\tinst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :\n\t\t\t\t\t(showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);\n\t\t\tif (!showAnim)\n\t\t\t\tpostProcess();\n\t\t\tthis._datepickerShowing = false;\n\t\t\tvar onClose = this._get(inst, 'onClose');\n\t\t\tif (onClose)\n\t\t\t\tonClose.apply((inst.input ? inst.input[0] : null),\n\t\t\t\t\t[(inst.input ? inst.input.val() : ''), inst]);\n\t\t\tthis._lastInput = null;\n\t\t\tif (this._inDialog) {\n\t\t\t\tthis._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });\n\t\t\t\tif ($.blockUI) {\n\t\t\t\t\t$.unblockUI();\n\t\t\t\t\t$('body').append(this.dpDiv);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._inDialog = false;\n\t\t}\n\t},\n\n\t/* Tidy up after a dialog display. */\n\t_tidyDialog: function(inst) {\n\t\tinst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');\n\t},\n\n\t/* Close date picker if clicked elsewhere. */\n\t_checkExternalClick: function(event) {\n\t\tif (!$.datepicker._curInst)\n\t\t\treturn;\n\n\t\tvar $target = $(event.target),\n\t\t\tinst = $.datepicker._getInst($target[0]);\n\n\t\tif ( ( ( $target[0].id != $.datepicker._mainDivId &&\n\t\t\t\t$target.parents('#' + $.datepicker._mainDivId).length == 0 &&\n\t\t\t\t!$target.hasClass($.datepicker.markerClassName) &&\n\t\t\t\t!$target.closest(\".\" + $.datepicker._triggerClass).length &&\n\t\t\t\t$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||\n\t\t\t( $target.hasClass($.datepicker.markerClassName) && $.datepicker._curInst != inst ) )\n\t\t\t$.datepicker._hideDatepicker();\n\t},\n\n\t/* Adjust one of the date sub-fields. */\n\t_adjustDate: function(id, offset, period) {\n\t\tvar target = $(id);\n\t\tvar inst = this._getInst(target[0]);\n\t\tif (this._isDisabledDatepicker(target[0])) {\n\t\t\treturn;\n\t\t}\n\t\tthis._adjustInstDate(inst, offset +\n\t\t\t(period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning\n\t\t\tperiod);\n\t\tthis._updateDatepicker(inst);\n\t},\n\n\t/* Action for current link. */\n\t_gotoToday: function(id) {\n\t\tvar target = $(id);\n\t\tvar inst = this._getInst(target[0]);\n\t\tif (this._get(inst, 'gotoCurrent') && inst.currentDay) {\n\t\t\tinst.selectedDay = inst.currentDay;\n\t\t\tinst.drawMonth = inst.selectedMonth = inst.currentMonth;\n\t\t\tinst.drawYear = inst.selectedYear = inst.currentYear;\n\t\t}\n\t\telse {\n\t\t\tvar date = new Date();\n\t\t\tinst.selectedDay = date.getDate();\n\t\t\tinst.drawMonth = inst.selectedMonth = date.getMonth();\n\t\t\tinst.drawYear = inst.selectedYear = date.getFullYear();\n\t\t}\n\t\tthis._notifyChange(inst);\n\t\tthis._adjustDate(target);\n\t},\n\n\t/* Action for selecting a new month/year. */\n\t_selectMonthYear: function(id, select, period) {\n\t\tvar target = $(id);\n\t\tvar inst = this._getInst(target[0]);\n\t\tinst['selected' + (period == 'M' ? 'Month' : 'Year')] =\n\t\tinst['draw' + (period == 'M' ? 'Month' : 'Year')] =\n\t\t\tparseInt(select.options[select.selectedIndex].value,10);\n\t\tthis._notifyChange(inst);\n\t\tthis._adjustDate(target);\n\t},\n\n\t/* Action for selecting a day. */\n\t_selectDay: function(id, month, year, td) {\n\t\tvar target = $(id);\n\t\tif ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {\n\t\t\treturn;\n\t\t}\n\t\tvar inst = this._getInst(target[0]);\n\t\tinst.selectedDay = inst.currentDay = $('a', td).html();\n\t\tinst.selectedMonth = inst.currentMonth = month;\n\t\tinst.selectedYear = inst.currentYear = year;\n\t\tthis._selectDate(id, this._formatDate(inst,\n\t\t\tinst.currentDay, inst.currentMonth, inst.currentYear));\n\t},\n\n\t/* Erase the input field and hide the date picker. */\n\t_clearDate: function(id) {\n\t\tvar target = $(id);\n\t\tvar inst = this._getInst(target[0]);\n\t\tthis._selectDate(target, '');\n\t},\n\n\t/* Update the input field with the selected date. */\n\t_selectDate: function(id, dateStr) {\n\t\tvar target = $(id);\n\t\tvar inst = this._getInst(target[0]);\n\t\tdateStr = (dateStr != null ? dateStr : this._formatDate(inst));\n\t\tif (inst.input)\n\t\t\tinst.input.val(dateStr);\n\t\tthis._updateAlternate(inst);\n\t\tvar onSelect = this._get(inst, 'onSelect');\n\t\tif (onSelect)\n\t\t\tonSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]);  // trigger custom callback\n\t\telse if (inst.input)\n\t\t\tinst.input.trigger('change'); // fire the change event\n\t\tif (inst.inline)\n\t\t\tthis._updateDatepicker(inst);\n\t\telse {\n\t\t\tthis._hideDatepicker();\n\t\t\tthis._lastInput = inst.input[0];\n\t\t\tif (typeof(inst.input[0]) != 'object')\n\t\t\t\tinst.input.focus(); // restore focus\n\t\t\tthis._lastInput = null;\n\t\t}\n\t},\n\n\t/* Update any alternate field to synchronise with the main field. */\n\t_updateAlternate: function(inst) {\n\t\tvar altField = this._get(inst, 'altField');\n\t\tif (altField) { // update alternate field too\n\t\t\tvar altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');\n\t\t\tvar date = this._getDate(inst);\n\t\t\tvar dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));\n\t\t\t$(altField).each(function() { $(this).val(dateStr); });\n\t\t}\n\t},\n\n\t/* Set as beforeShowDay function to prevent selection of weekends.\n\t   @param  date  Date - the date to customise\n\t   @return [boolean, string] - is this date selectable?, what is its CSS class? */\n\tnoWeekends: function(date) {\n\t\tvar day = date.getDay();\n\t\treturn [(day > 0 && day < 6), ''];\n\t},\n\n\t/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.\n\t   @param  date  Date - the date to get the week for\n\t   @return  number - the number of the week within the year that contains this date */\n\tiso8601Week: function(date) {\n\t\tvar checkDate = new Date(date.getTime());\n\t\t// Find Thursday of this week starting on Monday\n\t\tcheckDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));\n\t\tvar time = checkDate.getTime();\n\t\tcheckDate.setMonth(0); // Compare with Jan 1\n\t\tcheckDate.setDate(1);\n\t\treturn Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;\n\t},\n\n\t/* Parse a string value into a date object.\n\t   See formatDate below for the possible formats.\n\n\t   @param  format    string - the expected format of the date\n\t   @param  value     string - the date in the above format\n\t   @param  settings  Object - attributes include:\n\t                     shortYearCutoff  number - the cutoff year for determining the century (optional)\n\t                     dayNamesShort    string[7] - abbreviated names of the days from Sunday (optional)\n\t                     dayNames         string[7] - names of the days from Sunday (optional)\n\t                     monthNamesShort  string[12] - abbreviated names of the months (optional)\n\t                     monthNames       string[12] - names of the months (optional)\n\t   @return  Date - the extracted date value or null if value is blank */\n\tparseDate: function (format, value, settings) {\n\t\tif (format == null || value == null)\n\t\t\tthrow 'Invalid arguments';\n\t\tvalue = (typeof value == 'object' ? value.toString() : value + '');\n\t\tif (value == '')\n\t\t\treturn null;\n\t\tvar shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;\n\t\tshortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :\n\t\t\t\tnew Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));\n\t\tvar dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;\n\t\tvar dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;\n\t\tvar monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;\n\t\tvar monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;\n\t\tvar year = -1;\n\t\tvar month = -1;\n\t\tvar day = -1;\n\t\tvar doy = -1;\n\t\tvar literal = false;\n\t\t// Check whether a format character is doubled\n\t\tvar lookAhead = function(match) {\n\t\t\tvar matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);\n\t\t\tif (matches)\n\t\t\t\tiFormat++;\n\t\t\treturn matches;\n\t\t};\n\t\t// Extract a number from the string value\n\t\tvar getNumber = function(match) {\n\t\t\tvar isDoubled = lookAhead(match);\n\t\t\tvar size = (match == '@' ? 14 : (match == '!' ? 20 :\n\t\t\t\t(match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2))));\n\t\t\tvar digits = new RegExp('^\\\\d{1,' + size + '}');\n\t\t\tvar num = value.substring(iValue).match(digits);\n\t\t\tif (!num)\n\t\t\t\tthrow 'Missing number at position ' + iValue;\n\t\t\tiValue += num[0].length;\n\t\t\treturn parseInt(num[0], 10);\n\t\t};\n\t\t// Extract a name from the string value and convert to an index\n\t\tvar getName = function(match, shortNames, longNames) {\n\t\t\tvar names = $.map(lookAhead(match) ? longNames : shortNames, function (v, k) {\n\t\t\t\treturn [ [k, v] ];\n\t\t\t}).sort(function (a, b) {\n\t\t\t\treturn -(a[1].length - b[1].length);\n\t\t\t});\n\t\t\tvar index = -1;\n\t\t\t$.each(names, function (i, pair) {\n\t\t\t\tvar name = pair[1];\n\t\t\t\tif (value.substr(iValue, name.length).toLowerCase() == name.toLowerCase()) {\n\t\t\t\t\tindex = pair[0];\n\t\t\t\t\tiValue += name.length;\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\t\t\tif (index != -1)\n\t\t\t\treturn index + 1;\n\t\t\telse\n\t\t\t\tthrow 'Unknown name at position ' + iValue;\n\t\t};\n\t\t// Confirm that a literal character matches the string value\n\t\tvar checkLiteral = function() {\n\t\t\tif (value.charAt(iValue) != format.charAt(iFormat))\n\t\t\t\tthrow 'Unexpected literal at position ' + iValue;\n\t\t\tiValue++;\n\t\t};\n\t\tvar iValue = 0;\n\t\tfor (var iFormat = 0; iFormat < format.length; iFormat++) {\n\t\t\tif (literal)\n\t\t\t\tif (format.charAt(iFormat) == \"'\" && !lookAhead(\"'\"))\n\t\t\t\t\tliteral = false;\n\t\t\t\telse\n\t\t\t\t\tcheckLiteral();\n\t\t\telse\n\t\t\t\tswitch (format.charAt(iFormat)) {\n\t\t\t\t\tcase 'd':\n\t\t\t\t\t\tday = getNumber('d');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'D':\n\t\t\t\t\t\tgetName('D', dayNamesShort, dayNames);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'o':\n\t\t\t\t\t\tdoy = getNumber('o');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'm':\n\t\t\t\t\t\tmonth = getNumber('m');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'M':\n\t\t\t\t\t\tmonth = getName('M', monthNamesShort, monthNames);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'y':\n\t\t\t\t\t\tyear = getNumber('y');\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '@':\n\t\t\t\t\t\tvar date = new Date(getNumber('@'));\n\t\t\t\t\t\tyear = date.getFullYear();\n\t\t\t\t\t\tmonth = date.getMonth() + 1;\n\t\t\t\t\t\tday = date.getDate();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase '!':\n\t\t\t\t\t\tvar date = new Date((getNumber('!') - this._ticksTo1970) / 10000);\n\t\t\t\t\t\tyear = date.getFullYear();\n\t\t\t\t\t\tmonth = date.getMonth() + 1;\n\t\t\t\t\t\tday = date.getDate();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"'\":\n\t\t\t\t\t\tif (lookAhead(\"'\"))\n\t\t\t\t\t\t\tcheckLiteral();\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tliteral = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tcheckLiteral();\n\t\t\t\t}\n\t\t}\n\t\tif (iValue < value.length){\n\t\t\tthrow \"Extra/unparsed characters found in date: \" + value.substring(iValue);\n\t\t}\n\t\tif (year == -1)\n\t\t\tyear = new Date().getFullYear();\n\t\telse if (year < 100)\n\t\t\tyear += new Date().getFullYear() - new Date().getFullYear() % 100 +\n\t\t\t\t(year <= shortYearCutoff ? 0 : -100);\n\t\tif (doy > -1) {\n\t\t\tmonth = 1;\n\t\t\tday = doy;\n\t\t\tdo {\n\t\t\t\tvar dim = this._getDaysInMonth(year, month - 1);\n\t\t\t\tif (day <= dim)\n\t\t\t\t\tbreak;\n\t\t\t\tmonth++;\n\t\t\t\tday -= dim;\n\t\t\t} while (true);\n\t\t}\n\t\tvar date = this._daylightSavingAdjust(new Date(year, month - 1, day));\n\t\tif (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)\n\t\t\tthrow 'Invalid date'; // E.g. 31/02/00\n\t\treturn date;\n\t},\n\n\t/* Standard date formats. */\n\tATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)\n\tCOOKIE: 'D, dd M yy',\n\tISO_8601: 'yy-mm-dd',\n\tRFC_822: 'D, d M y',\n\tRFC_850: 'DD, dd-M-y',\n\tRFC_1036: 'D, d M y',\n\tRFC_1123: 'D, d M yy',\n\tRFC_2822: 'D, d M yy',\n\tRSS: 'D, d M y', // RFC 822\n\tTICKS: '!',\n\tTIMESTAMP: '@',\n\tW3C: 'yy-mm-dd', // ISO 8601\n\n\t_ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +\n\t\tMath.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),\n\n\t/* Format a date object into a string value.\n\t   The format can be combinations of the following:\n\t   d  - day of month (no leading zero)\n\t   dd - day of month (two digit)\n\t   o  - day of year (no leading zeros)\n\t   oo - day of year (three digit)\n\t   D  - day name short\n\t   DD - day name long\n\t   m  - month of year (no leading zero)\n\t   mm - month of year (two digit)\n\t   M  - month name short\n\t   MM - month name long\n\t   y  - year (two digit)\n\t   yy - year (four digit)\n\t   @ - Unix timestamp (ms since 01/01/1970)\n\t   ! - Windows ticks (100ns since 01/01/0001)\n\t   '...' - literal text\n\t   '' - single quote\n\n\t   @param  format    string - the desired format of the date\n\t   @param  date      Date - the date value to format\n\t   @param  settings  Object - attributes include:\n\t                     dayNamesShort    string[7] - abbreviated names of the days from Sunday (optional)\n\t                     dayNames         string[7] - names of the days from Sunday (optional)\n\t                     monthNamesShort  string[12] - abbreviated names of the months (optional)\n\t                     monthNames       string[12] - names of the months (optional)\n\t   @return  string - the date in the above format */\n\tformatDate: function (format, date, settings) {\n\t\tif (!date)\n\t\t\treturn '';\n\t\tvar dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;\n\t\tvar dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;\n\t\tvar monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;\n\t\tvar monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;\n\t\t// Check whether a format character is doubled\n\t\tvar lookAhead = function(match) {\n\t\t\tvar matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);\n\t\t\tif (matches)\n\t\t\t\tiFormat++;\n\t\t\treturn matches;\n\t\t};\n\t\t// Format a number, with leading zero if necessary\n\t\tvar formatNumber = function(match, value, len) {\n\t\t\tvar num = '' + value;\n\t\t\tif (lookAhead(match))\n\t\t\t\twhile (num.length < len)\n\t\t\t\t\tnum = '0' + num;\n\t\t\treturn num;\n\t\t};\n\t\t// Format a name, short or long as requested\n\t\tvar formatName = function(match, value, shortNames, longNames) {\n\t\t\treturn (lookAhead(match) ? longNames[value] : shortNames[value]);\n\t\t};\n\t\tvar output = '';\n\t\tvar literal = false;\n\t\tif (date)\n\t\t\tfor (var iFormat = 0; iFormat < format.length; iFormat++) {\n\t\t\t\tif (literal)\n\t\t\t\t\tif (format.charAt(iFormat) == \"'\" && !lookAhead(\"'\"))\n\t\t\t\t\t\tliteral = false;\n\t\t\t\t\telse\n\t\t\t\t\t\toutput += format.charAt(iFormat);\n\t\t\t\telse\n\t\t\t\t\tswitch (format.charAt(iFormat)) {\n\t\t\t\t\t\tcase 'd':\n\t\t\t\t\t\t\toutput += formatNumber('d', date.getDate(), 2);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'D':\n\t\t\t\t\t\t\toutput += formatName('D', date.getDay(), dayNamesShort, dayNames);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'o':\n\t\t\t\t\t\t\toutput += formatNumber('o',\n\t\t\t\t\t\t\t\tMath.round((new Date(date.getFullYear(), date.getMonth(), date.getDate()).getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000), 3);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'm':\n\t\t\t\t\t\t\toutput += formatNumber('m', date.getMonth() + 1, 2);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'M':\n\t\t\t\t\t\t\toutput += formatName('M', date.getMonth(), monthNamesShort, monthNames);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase 'y':\n\t\t\t\t\t\t\toutput += (lookAhead('y') ? date.getFullYear() :\n\t\t\t\t\t\t\t\t(date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase '@':\n\t\t\t\t\t\t\toutput += date.getTime();\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase '!':\n\t\t\t\t\t\t\toutput += date.getTime() * 10000 + this._ticksTo1970;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase \"'\":\n\t\t\t\t\t\t\tif (lookAhead(\"'\"))\n\t\t\t\t\t\t\t\toutput += \"'\";\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tliteral = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\toutput += format.charAt(iFormat);\n\t\t\t\t\t}\n\t\t\t}\n\t\treturn output;\n\t},\n\n\t/* Extract all possible characters from the date format. */\n\t_possibleChars: function (format) {\n\t\tvar chars = '';\n\t\tvar literal = false;\n\t\t// Check whether a format character is doubled\n\t\tvar lookAhead = function(match) {\n\t\t\tvar matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);\n\t\t\tif (matches)\n\t\t\t\tiFormat++;\n\t\t\treturn matches;\n\t\t};\n\t\tfor (var iFormat = 0; iFormat < format.length; iFormat++)\n\t\t\tif (literal)\n\t\t\t\tif (format.charAt(iFormat) == \"'\" && !lookAhead(\"'\"))\n\t\t\t\t\tliteral = false;\n\t\t\t\telse\n\t\t\t\t\tchars += format.charAt(iFormat);\n\t\t\telse\n\t\t\t\tswitch (format.charAt(iFormat)) {\n\t\t\t\t\tcase 'd': case 'm': case 'y': case '@':\n\t\t\t\t\t\tchars += '0123456789';\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'D': case 'M':\n\t\t\t\t\t\treturn null; // Accept anything\n\t\t\t\t\tcase \"'\":\n\t\t\t\t\t\tif (lookAhead(\"'\"))\n\t\t\t\t\t\t\tchars += \"'\";\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tliteral = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tchars += format.charAt(iFormat);\n\t\t\t\t}\n\t\treturn chars;\n\t},\n\n\t/* Get a setting value, defaulting if necessary. */\n\t_get: function(inst, name) {\n\t\treturn inst.settings[name] !== undefined ?\n\t\t\tinst.settings[name] : this._defaults[name];\n\t},\n\n\t/* Parse existing date and initialise date picker. */\n\t_setDateFromField: function(inst, noDefault) {\n\t\tif (inst.input.val() == inst.lastVal) {\n\t\t\treturn;\n\t\t}\n\t\tvar dateFormat = this._get(inst, 'dateFormat');\n\t\tvar dates = inst.lastVal = inst.input ? inst.input.val() : null;\n\t\tvar date, defaultDate;\n\t\tdate = defaultDate = this._getDefaultDate(inst);\n\t\tvar settings = this._getFormatConfig(inst);\n\t\ttry {\n\t\t\tdate = this.parseDate(dateFormat, dates, settings) || defaultDate;\n\t\t} catch (event) {\n\t\t\tthis.log(event);\n\t\t\tdates = (noDefault ? '' : dates);\n\t\t}\n\t\tinst.selectedDay = date.getDate();\n\t\tinst.drawMonth = inst.selectedMonth = date.getMonth();\n\t\tinst.drawYear = inst.selectedYear = date.getFullYear();\n\t\tinst.currentDay = (dates ? date.getDate() : 0);\n\t\tinst.currentMonth = (dates ? date.getMonth() : 0);\n\t\tinst.currentYear = (dates ? date.getFullYear() : 0);\n\t\tthis._adjustInstDate(inst);\n\t},\n\n\t/* Retrieve the default date shown on opening. */\n\t_getDefaultDate: function(inst) {\n\t\treturn this._restrictMinMax(inst,\n\t\t\tthis._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));\n\t},\n\n\t/* A date may be specified as an exact value or a relative one. */\n\t_determineDate: function(inst, date, defaultDate) {\n\t\tvar offsetNumeric = function(offset) {\n\t\t\tvar date = new Date();\n\t\t\tdate.setDate(date.getDate() + offset);\n\t\t\treturn date;\n\t\t};\n\t\tvar offsetString = function(offset) {\n\t\t\ttry {\n\t\t\t\treturn $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),\n\t\t\t\t\toffset, $.datepicker._getFormatConfig(inst));\n\t\t\t}\n\t\t\tcatch (e) {\n\t\t\t\t// Ignore\n\t\t\t}\n\t\t\tvar date = (offset.toLowerCase().match(/^c/) ?\n\t\t\t\t$.datepicker._getDate(inst) : null) || new Date();\n\t\t\tvar year = date.getFullYear();\n\t\t\tvar month = date.getMonth();\n\t\t\tvar day = date.getDate();\n\t\t\tvar pattern = /([+-]?[0-9]+)\\s*(d|D|w|W|m|M|y|Y)?/g;\n\t\t\tvar matches = pattern.exec(offset);\n\t\t\twhile (matches) {\n\t\t\t\tswitch (matches[2] || 'd') {\n\t\t\t\t\tcase 'd' : case 'D' :\n\t\t\t\t\t\tday += parseInt(matches[1],10); break;\n\t\t\t\t\tcase 'w' : case 'W' :\n\t\t\t\t\t\tday += parseInt(matches[1],10) * 7; break;\n\t\t\t\t\tcase 'm' : case 'M' :\n\t\t\t\t\t\tmonth += parseInt(matches[1],10);\n\t\t\t\t\t\tday = Math.min(day, $.datepicker._getDaysInMonth(year, month));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'y': case 'Y' :\n\t\t\t\t\t\tyear += parseInt(matches[1],10);\n\t\t\t\t\t\tday = Math.min(day, $.datepicker._getDaysInMonth(year, month));\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tmatches = pattern.exec(offset);\n\t\t\t}\n\t\t\treturn new Date(year, month, day);\n\t\t};\n\t\tvar newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) :\n\t\t\t(typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));\n\t\tnewDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate);\n\t\tif (newDate) {\n\t\t\tnewDate.setHours(0);\n\t\t\tnewDate.setMinutes(0);\n\t\t\tnewDate.setSeconds(0);\n\t\t\tnewDate.setMilliseconds(0);\n\t\t}\n\t\treturn this._daylightSavingAdjust(newDate);\n\t},\n\n\t/* Handle switch to/from daylight saving.\n\t   Hours may be non-zero on daylight saving cut-over:\n\t   > 12 when midnight changeover, but then cannot generate\n\t   midnight datetime, so jump to 1AM, otherwise reset.\n\t   @param  date  (Date) the date to check\n\t   @return  (Date) the corrected date */\n\t_daylightSavingAdjust: function(date) {\n\t\tif (!date) return null;\n\t\tdate.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);\n\t\treturn date;\n\t},\n\n\t/* Set the date(s) directly. */\n\t_setDate: function(inst, date, noChange) {\n\t\tvar clear = !date;\n\t\tvar origMonth = inst.selectedMonth;\n\t\tvar origYear = inst.selectedYear;\n\t\tvar newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));\n\t\tinst.selectedDay = inst.currentDay = newDate.getDate();\n\t\tinst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();\n\t\tinst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();\n\t\tif ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)\n\t\t\tthis._notifyChange(inst);\n\t\tthis._adjustInstDate(inst);\n\t\tif (inst.input) {\n\t\t\tinst.input.val(clear ? '' : this._formatDate(inst));\n\t\t}\n\t},\n\n\t/* Retrieve the date(s) directly. */\n\t_getDate: function(inst) {\n\t\tvar startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :\n\t\t\tthis._daylightSavingAdjust(new Date(\n\t\t\tinst.currentYear, inst.currentMonth, inst.currentDay)));\n\t\t\treturn startDate;\n\t},\n\n\t/* Attach the onxxx handlers.  These are declared statically so\n\t * they work with static code transformers like Caja.\n\t */\n\t_attachHandlers: function(inst) {\n\t\tvar stepMonths = this._get(inst, 'stepMonths');\n\t\tvar id = '#' + inst.id.replace( /\\\\\\\\/g, \"\\\\\" );\n\t\tinst.dpDiv.find('[data-handler]').map(function () {\n\t\t\tvar handler = {\n\t\t\t\tprev: function () {\n\t\t\t\t\twindow['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, -stepMonths, 'M');\n\t\t\t\t},\n\t\t\t\tnext: function () {\n\t\t\t\t\twindow['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, +stepMonths, 'M');\n\t\t\t\t},\n\t\t\t\thide: function () {\n\t\t\t\t\twindow['DP_jQuery_' + dpuuid].datepicker._hideDatepicker();\n\t\t\t\t},\n\t\t\t\ttoday: function () {\n\t\t\t\t\twindow['DP_jQuery_' + dpuuid].datepicker._gotoToday(id);\n\t\t\t\t},\n\t\t\t\tselectDay: function () {\n\t\t\t\t\twindow['DP_jQuery_' + dpuuid].datepicker._selectDay(id, +this.getAttribute('data-month'), +this.getAttribute('data-year'), this);\n\t\t\t\t\treturn false;\n\t\t\t\t},\n\t\t\t\tselectMonth: function () {\n\t\t\t\t\twindow['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'M');\n\t\t\t\t\treturn false;\n\t\t\t\t},\n\t\t\t\tselectYear: function () {\n\t\t\t\t\twindow['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'Y');\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t};\n\t\t\t$(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]);\n\t\t});\n\t},\n\t\n\t/* Generate the HTML for the current state of the date picker. */\n\t_generateHTML: function(inst) {\n\t\tvar today = new Date();\n\t\ttoday = this._daylightSavingAdjust(\n\t\t\tnew Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time\n\t\tvar isRTL = this._get(inst, 'isRTL');\n\t\tvar showButtonPanel = this._get(inst, 'showButtonPanel');\n\t\tvar hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');\n\t\tvar navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');\n\t\tvar numMonths = this._getNumberOfMonths(inst);\n\t\tvar showCurrentAtPos = this._get(inst, 'showCurrentAtPos');\n\t\tvar stepMonths = this._get(inst, 'stepMonths');\n\t\tvar isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);\n\t\tvar currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :\n\t\t\tnew Date(inst.currentYear, inst.currentMonth, inst.currentDay)));\n\t\tvar minDate = this._getMinMaxDate(inst, 'min');\n\t\tvar maxDate = this._getMinMaxDate(inst, 'max');\n\t\tvar drawMonth = inst.drawMonth - showCurrentAtPos;\n\t\tvar drawYear = inst.drawYear;\n\t\tif (drawMonth < 0) {\n\t\t\tdrawMonth += 12;\n\t\t\tdrawYear--;\n\t\t}\n\t\tif (maxDate) {\n\t\t\tvar maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),\n\t\t\t\tmaxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));\n\t\t\tmaxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);\n\t\t\twhile (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {\n\t\t\t\tdrawMonth--;\n\t\t\t\tif (drawMonth < 0) {\n\t\t\t\t\tdrawMonth = 11;\n\t\t\t\t\tdrawYear--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tinst.drawMonth = drawMonth;\n\t\tinst.drawYear = drawYear;\n\t\tvar prevText = this._get(inst, 'prevText');\n\t\tprevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,\n\t\t\tthis._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),\n\t\t\tthis._getFormatConfig(inst)));\n\t\tvar prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?\n\t\t\t'<a class=\"ui-datepicker-prev ui-corner-all\" data-handler=\"prev\" data-event=\"click\"' +\n\t\t\t' title=\"' + prevText + '\"><span class=\"ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '\">' + prevText + '</span></a>' :\n\t\t\t(hideIfNoPrevNext ? '' : '<a class=\"ui-datepicker-prev ui-corner-all ui-state-disabled\" title=\"'+ prevText +'\"><span class=\"ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '\">' + prevText + '</span></a>'));\n\t\tvar nextText = this._get(inst, 'nextText');\n\t\tnextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,\n\t\t\tthis._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),\n\t\t\tthis._getFormatConfig(inst)));\n\t\tvar next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?\n\t\t\t'<a class=\"ui-datepicker-next ui-corner-all\" data-handler=\"next\" data-event=\"click\"' +\n\t\t\t' title=\"' + nextText + '\"><span class=\"ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '\">' + nextText + '</span></a>' :\n\t\t\t(hideIfNoPrevNext ? '' : '<a class=\"ui-datepicker-next ui-corner-all ui-state-disabled\" title=\"'+ nextText + '\"><span class=\"ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '\">' + nextText + '</span></a>'));\n\t\tvar currentText = this._get(inst, 'currentText');\n\t\tvar gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);\n\t\tcurrentText = (!navigationAsDateFormat ? currentText :\n\t\t\tthis.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));\n\t\tvar controls = (!inst.inline ? '<button type=\"button\" class=\"ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all\" data-handler=\"hide\" data-event=\"click\">' +\n\t\t\tthis._get(inst, 'closeText') + '</button>' : '');\n\t\tvar buttonPanel = (showButtonPanel) ? '<div class=\"ui-datepicker-buttonpane ui-widget-content\">' + (isRTL ? controls : '') +\n\t\t\t(this._isInRange(inst, gotoDate) ? '<button type=\"button\" class=\"ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all\" data-handler=\"today\" data-event=\"click\"' +\n\t\t\t'>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';\n\t\tvar firstDay = parseInt(this._get(inst, 'firstDay'),10);\n\t\tfirstDay = (isNaN(firstDay) ? 0 : firstDay);\n\t\tvar showWeek = this._get(inst, 'showWeek');\n\t\tvar dayNames = this._get(inst, 'dayNames');\n\t\tvar dayNamesShort = this._get(inst, 'dayNamesShort');\n\t\tvar dayNamesMin = this._get(inst, 'dayNamesMin');\n\t\tvar monthNames = this._get(inst, 'monthNames');\n\t\tvar monthNamesShort = this._get(inst, 'monthNamesShort');\n\t\tvar beforeShowDay = this._get(inst, 'beforeShowDay');\n\t\tvar showOtherMonths = this._get(inst, 'showOtherMonths');\n\t\tvar selectOtherMonths = this._get(inst, 'selectOtherMonths');\n\t\tvar calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;\n\t\tvar defaultDate = this._getDefaultDate(inst);\n\t\tvar html = '';\n\t\tfor (var row = 0; row < numMonths[0]; row++) {\n\t\t\tvar group = '';\n\t\t\tthis.maxRows = 4;\n\t\t\tfor (var col = 0; col < numMonths[1]; col++) {\n\t\t\t\tvar selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));\n\t\t\t\tvar cornerClass = ' ui-corner-all';\n\t\t\t\tvar calender = '';\n\t\t\t\tif (isMultiMonth) {\n\t\t\t\t\tcalender += '<div class=\"ui-datepicker-group';\n\t\t\t\t\tif (numMonths[1] > 1)\n\t\t\t\t\t\tswitch (col) {\n\t\t\t\t\t\t\tcase 0: calender += ' ui-datepicker-group-first';\n\t\t\t\t\t\t\t\tcornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;\n\t\t\t\t\t\t\tcase numMonths[1]-1: calender += ' ui-datepicker-group-last';\n\t\t\t\t\t\t\t\tcornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;\n\t\t\t\t\t\t\tdefault: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;\n\t\t\t\t\t\t}\n\t\t\t\t\tcalender += '\">';\n\t\t\t\t}\n\t\t\t\tcalender += '<div class=\"ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '\">' +\n\t\t\t\t\t(/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +\n\t\t\t\t\t(/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +\n\t\t\t\t\tthis._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,\n\t\t\t\t\trow > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers\n\t\t\t\t\t'</div><table class=\"ui-datepicker-calendar\"><thead>' +\n\t\t\t\t\t'<tr>';\n\t\t\t\tvar thead = (showWeek ? '<th class=\"ui-datepicker-week-col\">' + this._get(inst, 'weekHeader') + '</th>' : '');\n\t\t\t\tfor (var dow = 0; dow < 7; dow++) { // days of the week\n\t\t\t\t\tvar day = (dow + firstDay) % 7;\n\t\t\t\t\tthead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class=\"ui-datepicker-week-end\"' : '') + '>' +\n\t\t\t\t\t\t'<span title=\"' + dayNames[day] + '\">' + dayNamesMin[day] + '</span></th>';\n\t\t\t\t}\n\t\t\t\tcalender += thead + '</tr></thead><tbody>';\n\t\t\t\tvar daysInMonth = this._getDaysInMonth(drawYear, drawMonth);\n\t\t\t\tif (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)\n\t\t\t\t\tinst.selectedDay = Math.min(inst.selectedDay, daysInMonth);\n\t\t\t\tvar leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;\n\t\t\t\tvar curRows = Math.ceil((leadDays + daysInMonth) / 7); // calculate the number of rows to generate\n\t\t\t\tvar numRows = (isMultiMonth ? this.maxRows > curRows ? this.maxRows : curRows : curRows); //If multiple months, use the higher number of rows (see #7043)\n\t\t\t\tthis.maxRows = numRows;\n\t\t\t\tvar printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));\n\t\t\t\tfor (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows\n\t\t\t\t\tcalender += '<tr>';\n\t\t\t\t\tvar tbody = (!showWeek ? '' : '<td class=\"ui-datepicker-week-col\">' +\n\t\t\t\t\t\tthis._get(inst, 'calculateWeek')(printDate) + '</td>');\n\t\t\t\t\tfor (var dow = 0; dow < 7; dow++) { // create date picker days\n\t\t\t\t\t\tvar daySettings = (beforeShowDay ?\n\t\t\t\t\t\t\tbeforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);\n\t\t\t\t\t\tvar otherMonth = (printDate.getMonth() != drawMonth);\n\t\t\t\t\t\tvar unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||\n\t\t\t\t\t\t\t(minDate && printDate < minDate) || (maxDate && printDate > maxDate);\n\t\t\t\t\t\ttbody += '<td class=\"' +\n\t\t\t\t\t\t\t((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends\n\t\t\t\t\t\t\t(otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months\n\t\t\t\t\t\t\t((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key\n\t\t\t\t\t\t\t(defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?\n\t\t\t\t\t\t\t// or defaultDate is current printedDate and defaultDate is selectedDate\n\t\t\t\t\t\t\t' ' + this._dayOverClass : '') + // highlight selected day\n\t\t\t\t\t\t\t(unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') +  // highlight unselectable days\n\t\t\t\t\t\t\t(otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates\n\t\t\t\t\t\t\t(printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day\n\t\t\t\t\t\t\t(printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '\"' + // highlight today (if different)\n\t\t\t\t\t\t\t((!otherMonth || showOtherMonths) && daySettings[2] ? ' title=\"' + daySettings[2] + '\"' : '') + // cell title\n\t\t\t\t\t\t\t(unselectable ? '' : ' data-handler=\"selectDay\" data-event=\"click\" data-month=\"' + printDate.getMonth() + '\" data-year=\"' + printDate.getFullYear() + '\"') + '>' + // actions\n\t\t\t\t\t\t\t(otherMonth && !showOtherMonths ? '&#xa0;' : // display for other months\n\t\t\t\t\t\t\t(unselectable ? '<span class=\"ui-state-default\">' + printDate.getDate() + '</span>' : '<a class=\"ui-state-default' +\n\t\t\t\t\t\t\t(printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +\n\t\t\t\t\t\t\t(printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day\n\t\t\t\t\t\t\t(otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months\n\t\t\t\t\t\t\t'\" href=\"#\">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date\n\t\t\t\t\t\tprintDate.setDate(printDate.getDate() + 1);\n\t\t\t\t\t\tprintDate = this._daylightSavingAdjust(printDate);\n\t\t\t\t\t}\n\t\t\t\t\tcalender += tbody + '</tr>';\n\t\t\t\t}\n\t\t\t\tdrawMonth++;\n\t\t\t\tif (drawMonth > 11) {\n\t\t\t\t\tdrawMonth = 0;\n\t\t\t\t\tdrawYear++;\n\t\t\t\t}\n\t\t\t\tcalender += '</tbody></table>' + (isMultiMonth ? '</div>' + \n\t\t\t\t\t\t\t((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class=\"ui-datepicker-row-break\"></div>' : '') : '');\n\t\t\t\tgroup += calender;\n\t\t\t}\n\t\t\thtml += group;\n\t\t}\n\t\thtml += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?\n\t\t\t'<iframe src=\"javascript:false;\" class=\"ui-datepicker-cover\" frameborder=\"0\"></iframe>' : '');\n\t\tinst._keyEvent = false;\n\t\treturn html;\n\t},\n\n\t/* Generate the month and year header. */\n\t_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,\n\t\t\tsecondary, monthNames, monthNamesShort) {\n\t\tvar changeMonth = this._get(inst, 'changeMonth');\n\t\tvar changeYear = this._get(inst, 'changeYear');\n\t\tvar showMonthAfterYear = this._get(inst, 'showMonthAfterYear');\n\t\tvar html = '<div class=\"ui-datepicker-title\">';\n\t\tvar monthHtml = '';\n\t\t// month selection\n\t\tif (secondary || !changeMonth)\n\t\t\tmonthHtml += '<span class=\"ui-datepicker-month\">' + monthNames[drawMonth] + '</span>';\n\t\telse {\n\t\t\tvar inMinYear = (minDate && minDate.getFullYear() == drawYear);\n\t\t\tvar inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);\n\t\t\tmonthHtml += '<select class=\"ui-datepicker-month\" data-handler=\"selectMonth\" data-event=\"change\">';\n\t\t\tfor (var month = 0; month < 12; month++) {\n\t\t\t\tif ((!inMinYear || month >= minDate.getMonth()) &&\n\t\t\t\t\t\t(!inMaxYear || month <= maxDate.getMonth()))\n\t\t\t\t\tmonthHtml += '<option value=\"' + month + '\"' +\n\t\t\t\t\t\t(month == drawMonth ? ' selected=\"selected\"' : '') +\n\t\t\t\t\t\t'>' + monthNamesShort[month] + '</option>';\n\t\t\t}\n\t\t\tmonthHtml += '</select>';\n\t\t}\n\t\tif (!showMonthAfterYear)\n\t\t\thtml += monthHtml + (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '');\n\t\t// year selection\n\t\tif ( !inst.yearshtml ) {\n\t\t\tinst.yearshtml = '';\n\t\t\tif (secondary || !changeYear)\n\t\t\t\thtml += '<span class=\"ui-datepicker-year\">' + drawYear + '</span>';\n\t\t\telse {\n\t\t\t\t// determine range of years to display\n\t\t\t\tvar years = this._get(inst, 'yearRange').split(':');\n\t\t\t\tvar thisYear = new Date().getFullYear();\n\t\t\t\tvar determineYear = function(value) {\n\t\t\t\t\tvar year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :\n\t\t\t\t\t\t(value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :\n\t\t\t\t\t\tparseInt(value, 10)));\n\t\t\t\t\treturn (isNaN(year) ? thisYear : year);\n\t\t\t\t};\n\t\t\t\tvar year = determineYear(years[0]);\n\t\t\t\tvar endYear = Math.max(year, determineYear(years[1] || ''));\n\t\t\t\tyear = (minDate ? Math.max(year, minDate.getFullYear()) : year);\n\t\t\t\tendYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);\n\t\t\t\tinst.yearshtml += '<select class=\"ui-datepicker-year\" data-handler=\"selectYear\" data-event=\"change\">';\n\t\t\t\tfor (; year <= endYear; year++) {\n\t\t\t\t\tinst.yearshtml += '<option value=\"' + year + '\"' +\n\t\t\t\t\t\t(year == drawYear ? ' selected=\"selected\"' : '') +\n\t\t\t\t\t\t'>' + year + '</option>';\n\t\t\t\t}\n\t\t\t\tinst.yearshtml += '</select>';\n\t\t\t\t\n\t\t\t\thtml += inst.yearshtml;\n\t\t\t\tinst.yearshtml = null;\n\t\t\t}\n\t\t}\n\t\thtml += this._get(inst, 'yearSuffix');\n\t\tif (showMonthAfterYear)\n\t\t\thtml += (secondary || !(changeMonth && changeYear) ? '&#xa0;' : '') + monthHtml;\n\t\thtml += '</div>'; // Close datepicker_header\n\t\treturn html;\n\t},\n\n\t/* Adjust one of the date sub-fields. */\n\t_adjustInstDate: function(inst, offset, period) {\n\t\tvar year = inst.drawYear + (period == 'Y' ? offset : 0);\n\t\tvar month = inst.drawMonth + (period == 'M' ? offset : 0);\n\t\tvar day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +\n\t\t\t(period == 'D' ? offset : 0);\n\t\tvar date = this._restrictMinMax(inst,\n\t\t\tthis._daylightSavingAdjust(new Date(year, month, day)));\n\t\tinst.selectedDay = date.getDate();\n\t\tinst.drawMonth = inst.selectedMonth = date.getMonth();\n\t\tinst.drawYear = inst.selectedYear = date.getFullYear();\n\t\tif (period == 'M' || period == 'Y')\n\t\t\tthis._notifyChange(inst);\n\t},\n\n\t/* Ensure a date is within any min/max bounds. */\n\t_restrictMinMax: function(inst, date) {\n\t\tvar minDate = this._getMinMaxDate(inst, 'min');\n\t\tvar maxDate = this._getMinMaxDate(inst, 'max');\n\t\tvar newDate = (minDate && date < minDate ? minDate : date);\n\t\tnewDate = (maxDate && newDate > maxDate ? maxDate : newDate);\n\t\treturn newDate;\n\t},\n\n\t/* Notify change of month/year. */\n\t_notifyChange: function(inst) {\n\t\tvar onChange = this._get(inst, 'onChangeMonthYear');\n\t\tif (onChange)\n\t\t\tonChange.apply((inst.input ? inst.input[0] : null),\n\t\t\t\t[inst.selectedYear, inst.selectedMonth + 1, inst]);\n\t},\n\n\t/* Determine the number of months to show. */\n\t_getNumberOfMonths: function(inst) {\n\t\tvar numMonths = this._get(inst, 'numberOfMonths');\n\t\treturn (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));\n\t},\n\n\t/* Determine the current maximum date - ensure no time components are set. */\n\t_getMinMaxDate: function(inst, minMax) {\n\t\treturn this._determineDate(inst, this._get(inst, minMax + 'Date'), null);\n\t},\n\n\t/* Find the number of days in a given month. */\n\t_getDaysInMonth: function(year, month) {\n\t\treturn 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();\n\t},\n\n\t/* Find the day of the week of the first of a month. */\n\t_getFirstDayOfMonth: function(year, month) {\n\t\treturn new Date(year, month, 1).getDay();\n\t},\n\n\t/* Determines if we should allow a \"next/prev\" month display change. */\n\t_canAdjustMonth: function(inst, offset, curYear, curMonth) {\n\t\tvar numMonths = this._getNumberOfMonths(inst);\n\t\tvar date = this._daylightSavingAdjust(new Date(curYear,\n\t\t\tcurMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));\n\t\tif (offset < 0)\n\t\t\tdate.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));\n\t\treturn this._isInRange(inst, date);\n\t},\n\n\t/* Is the given date in the accepted range? */\n\t_isInRange: function(inst, date) {\n\t\tvar minDate = this._getMinMaxDate(inst, 'min');\n\t\tvar maxDate = this._getMinMaxDate(inst, 'max');\n\t\treturn ((!minDate || date.getTime() >= minDate.getTime()) &&\n\t\t\t(!maxDate || date.getTime() <= maxDate.getTime()));\n\t},\n\n\t/* Provide the configuration settings for formatting/parsing. */\n\t_getFormatConfig: function(inst) {\n\t\tvar shortYearCutoff = this._get(inst, 'shortYearCutoff');\n\t\tshortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :\n\t\t\tnew Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));\n\t\treturn {shortYearCutoff: shortYearCutoff,\n\t\t\tdayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),\n\t\t\tmonthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};\n\t},\n\n\t/* Format the given date for display. */\n\t_formatDate: function(inst, day, month, year) {\n\t\tif (!day) {\n\t\t\tinst.currentDay = inst.selectedDay;\n\t\t\tinst.currentMonth = inst.selectedMonth;\n\t\t\tinst.currentYear = inst.selectedYear;\n\t\t}\n\t\tvar date = (day ? (typeof day == 'object' ? day :\n\t\t\tthis._daylightSavingAdjust(new Date(year, month, day))) :\n\t\t\tthis._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));\n\t\treturn this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));\n\t}\n});\n\n/*\n * Bind hover events for datepicker elements.\n * Done via delegate so the binding only occurs once in the lifetime of the parent div.\n * Global instActive, set by _updateDatepicker allows the handlers to find their way back to the active picker.\n */ \nfunction bindHover(dpDiv) {\n\tvar selector = 'button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a';\n\treturn dpDiv.bind('mouseout', function(event) {\n\t\t\tvar elem = $( event.target ).closest( selector );\n\t\t\tif ( !elem.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telem.removeClass( \"ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover\" );\n\t\t})\n\t\t.bind('mouseover', function(event) {\n\t\t\tvar elem = $( event.target ).closest( selector );\n\t\t\tif ($.datepicker._isDisabledDatepicker( instActive.inline ? dpDiv.parent()[0] : instActive.input[0]) ||\n\t\t\t\t\t!elem.length ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telem.parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');\n\t\t\telem.addClass('ui-state-hover');\n\t\t\tif (elem.hasClass('ui-datepicker-prev')) elem.addClass('ui-datepicker-prev-hover');\n\t\t\tif (elem.hasClass('ui-datepicker-next')) elem.addClass('ui-datepicker-next-hover');\n\t\t});\n}\n\n/* jQuery extend now ignores nulls! */\nfunction extendRemove(target, props) {\n\t$.extend(target, props);\n\tfor (var name in props)\n\t\tif (props[name] == null || props[name] == undefined)\n\t\t\ttarget[name] = props[name];\n\treturn target;\n};\n\n/* Determine whether an object is an array. */\nfunction isArray(a) {\n\treturn (a && (($.browser.safari && typeof a == 'object' && a.length) ||\n\t\t(a.constructor && a.constructor.toString().match(/\\Array\\(\\)/))));\n};\n\n/* Invoke the datepicker functionality.\n   @param  options  string - a command, optionally followed by additional parameters or\n                    Object - settings for attaching new datepicker functionality\n   @return  jQuery object */\n$.fn.datepicker = function(options){\n\t\n\t/* Verify an empty collection wasn't passed - Fixes #6976 */\n\tif ( !this.length ) {\n\t\treturn this;\n\t}\n\t\n\t/* Initialise the date picker. */\n\tif (!$.datepicker.initialized) {\n\t\t$(document).mousedown($.datepicker._checkExternalClick).\n\t\t\tfind('body').append($.datepicker.dpDiv);\n\t\t$.datepicker.initialized = true;\n\t}\n\n\tvar otherArgs = Array.prototype.slice.call(arguments, 1);\n\tif (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))\n\t\treturn $.datepicker['_' + options + 'Datepicker'].\n\t\t\tapply($.datepicker, [this[0]].concat(otherArgs));\n\tif (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')\n\t\treturn $.datepicker['_' + options + 'Datepicker'].\n\t\t\tapply($.datepicker, [this[0]].concat(otherArgs));\n\treturn this.each(function() {\n\t\ttypeof options == 'string' ?\n\t\t\t$.datepicker['_' + options + 'Datepicker'].\n\t\t\t\tapply($.datepicker, [this].concat(otherArgs)) :\n\t\t\t$.datepicker._attachDatepicker(this, options);\n\t});\n};\n\n$.datepicker = new Datepicker(); // singleton instance\n$.datepicker.initialized = false;\n$.datepicker.uuid = new Date().getTime();\n$.datepicker.version = \"1.8.24\";\n\n// Workaround for #4055\n// Add another global to avoid noConflict issues with inline event handlers\nwindow['DP_jQuery_' + dpuuid] = $;\n\n})(jQuery);\n\n(function( $, undefined ) {\n\nvar uiDialogClasses =\n\t\t'ui-dialog ' +\n\t\t'ui-widget ' +\n\t\t'ui-widget-content ' +\n\t\t'ui-corner-all ',\n\tsizeRelatedOptions = {\n\t\tbuttons: true,\n\t\theight: true,\n\t\tmaxHeight: true,\n\t\tmaxWidth: true,\n\t\tminHeight: true,\n\t\tminWidth: true,\n\t\twidth: true\n\t},\n\tresizableRelatedOptions = {\n\t\tmaxHeight: true,\n\t\tmaxWidth: true,\n\t\tminHeight: true,\n\t\tminWidth: true\n\t};\n\n$.widget(\"ui.dialog\", {\n\toptions: {\n\t\tautoOpen: true,\n\t\tbuttons: {},\n\t\tcloseOnEscape: true,\n\t\tcloseText: 'close',\n\t\tdialogClass: '',\n\t\tdraggable: true,\n\t\thide: null,\n\t\theight: 'auto',\n\t\tmaxHeight: false,\n\t\tmaxWidth: false,\n\t\tminHeight: 150,\n\t\tminWidth: 150,\n\t\tmodal: false,\n\t\tposition: {\n\t\t\tmy: 'center',\n\t\t\tat: 'center',\n\t\t\tcollision: 'fit',\n\t\t\t// ensure that the titlebar is never outside the document\n\t\t\tusing: function(pos) {\n\t\t\t\tvar topOffset = $(this).css(pos).offset().top;\n\t\t\t\tif (topOffset < 0) {\n\t\t\t\t\t$(this).css('top', pos.top - topOffset);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\tresizable: true,\n\t\tshow: null,\n\t\tstack: true,\n\t\ttitle: '',\n\t\twidth: 300,\n\t\tzIndex: 1000\n\t},\n\n\t_create: function() {\n\t\tthis.originalTitle = this.element.attr('title');\n\t\t// #5742 - .attr() might return a DOMElement\n\t\tif ( typeof this.originalTitle !== \"string\" ) {\n\t\t\tthis.originalTitle = \"\";\n\t\t}\n\n\t\tthis.options.title = this.options.title || this.originalTitle;\n\t\tvar self = this,\n\t\t\toptions = self.options,\n\n\t\t\ttitle = options.title || '&#160;',\n\t\t\ttitleId = $.ui.dialog.getTitleId(self.element),\n\n\t\t\tuiDialog = (self.uiDialog = $('<div></div>'))\n\t\t\t\t.appendTo(document.body)\n\t\t\t\t.hide()\n\t\t\t\t.addClass(uiDialogClasses + options.dialogClass)\n\t\t\t\t.css({\n\t\t\t\t\tzIndex: options.zIndex\n\t\t\t\t})\n\t\t\t\t// setting tabIndex makes the div focusable\n\t\t\t\t// setting outline to 0 prevents a border on focus in Mozilla\n\t\t\t\t.attr('tabIndex', -1).css('outline', 0).keydown(function(event) {\n\t\t\t\t\tif (options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&\n\t\t\t\t\t\tevent.keyCode === $.ui.keyCode.ESCAPE) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tself.close(event);\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t\t.attr({\n\t\t\t\t\trole: 'dialog',\n\t\t\t\t\t'aria-labelledby': titleId\n\t\t\t\t})\n\t\t\t\t.mousedown(function(event) {\n\t\t\t\t\tself.moveToTop(false, event);\n\t\t\t\t}),\n\n\t\t\tuiDialogContent = self.element\n\t\t\t\t.show()\n\t\t\t\t.removeAttr('title')\n\t\t\t\t.addClass(\n\t\t\t\t\t'ui-dialog-content ' +\n\t\t\t\t\t'ui-widget-content')\n\t\t\t\t.appendTo(uiDialog),\n\n\t\t\tuiDialogTitlebar = (self.uiDialogTitlebar = $('<div></div>'))\n\t\t\t\t.addClass(\n\t\t\t\t\t'ui-dialog-titlebar ' +\n\t\t\t\t\t'ui-widget-header ' +\n\t\t\t\t\t'ui-corner-all ' +\n\t\t\t\t\t'ui-helper-clearfix'\n\t\t\t\t)\n\t\t\t\t.prependTo(uiDialog),\n\n\t\t\tuiDialogTitlebarClose = $('<a href=\"#\"></a>')\n\t\t\t\t.addClass(\n\t\t\t\t\t'ui-dialog-titlebar-close ' +\n\t\t\t\t\t'ui-corner-all'\n\t\t\t\t)\n\t\t\t\t.attr('role', 'button')\n\t\t\t\t.hover(\n\t\t\t\t\tfunction() {\n\t\t\t\t\t\tuiDialogTitlebarClose.addClass('ui-state-hover');\n\t\t\t\t\t},\n\t\t\t\t\tfunction() {\n\t\t\t\t\t\tuiDialogTitlebarClose.removeClass('ui-state-hover');\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t\t.focus(function() {\n\t\t\t\t\tuiDialogTitlebarClose.addClass('ui-state-focus');\n\t\t\t\t})\n\t\t\t\t.blur(function() {\n\t\t\t\t\tuiDialogTitlebarClose.removeClass('ui-state-focus');\n\t\t\t\t})\n\t\t\t\t.click(function(event) {\n\t\t\t\t\tself.close(event);\n\t\t\t\t\treturn false;\n\t\t\t\t})\n\t\t\t\t.appendTo(uiDialogTitlebar),\n\n\t\t\tuiDialogTitlebarCloseText = (self.uiDialogTitlebarCloseText = $('<span></span>'))\n\t\t\t\t.addClass(\n\t\t\t\t\t'ui-icon ' +\n\t\t\t\t\t'ui-icon-closethick'\n\t\t\t\t)\n\t\t\t\t.text(options.closeText)\n\t\t\t\t.appendTo(uiDialogTitlebarClose),\n\n\t\t\tuiDialogTitle = $('<span></span>')\n\t\t\t\t.addClass('ui-dialog-title')\n\t\t\t\t.attr('id', titleId)\n\t\t\t\t.html(title)\n\t\t\t\t.prependTo(uiDialogTitlebar);\n\n\t\t//handling of deprecated beforeclose (vs beforeClose) option\n\t\t//Ticket #4669 http://dev.jqueryui.com/ticket/4669\n\t\t//TODO: remove in 1.9pre\n\t\tif ($.isFunction(options.beforeclose) && !$.isFunction(options.beforeClose)) {\n\t\t\toptions.beforeClose = options.beforeclose;\n\t\t}\n\n\t\tuiDialogTitlebar.find(\"*\").add(uiDialogTitlebar).disableSelection();\n\n\t\tif (options.draggable && $.fn.draggable) {\n\t\t\tself._makeDraggable();\n\t\t}\n\t\tif (options.resizable && $.fn.resizable) {\n\t\t\tself._makeResizable();\n\t\t}\n\n\t\tself._createButtons(options.buttons);\n\t\tself._isOpen = false;\n\n\t\tif ($.fn.bgiframe) {\n\t\t\tuiDialog.bgiframe();\n\t\t}\n\t},\n\n\t_init: function() {\n\t\tif ( this.options.autoOpen ) {\n\t\t\tthis.open();\n\t\t}\n\t},\n\n\tdestroy: function() {\n\t\tvar self = this;\n\t\t\n\t\tif (self.overlay) {\n\t\t\tself.overlay.destroy();\n\t\t}\n\t\tself.uiDialog.hide();\n\t\tself.element\n\t\t\t.unbind('.dialog')\n\t\t\t.removeData('dialog')\n\t\t\t.removeClass('ui-dialog-content ui-widget-content')\n\t\t\t.hide().appendTo('body');\n\t\tself.uiDialog.remove();\n\n\t\tif (self.originalTitle) {\n\t\t\tself.element.attr('title', self.originalTitle);\n\t\t}\n\n\t\treturn self;\n\t},\n\n\twidget: function() {\n\t\treturn this.uiDialog;\n\t},\n\n\tclose: function(event) {\n\t\tvar self = this,\n\t\t\tmaxZ, thisZ;\n\t\t\n\t\tif (false === self._trigger('beforeClose', event)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (self.overlay) {\n\t\t\tself.overlay.destroy();\n\t\t}\n\t\tself.uiDialog.unbind('keypress.ui-dialog');\n\n\t\tself._isOpen = false;\n\n\t\tif (self.options.hide) {\n\t\t\tself.uiDialog.hide(self.options.hide, function() {\n\t\t\t\tself._trigger('close', event);\n\t\t\t});\n\t\t} else {\n\t\t\tself.uiDialog.hide();\n\t\t\tself._trigger('close', event);\n\t\t}\n\n\t\t$.ui.dialog.overlay.resize();\n\n\t\t// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)\n\t\tif (self.options.modal) {\n\t\t\tmaxZ = 0;\n\t\t\t$('.ui-dialog').each(function() {\n\t\t\t\tif (this !== self.uiDialog[0]) {\n\t\t\t\t\tthisZ = $(this).css('z-index');\n\t\t\t\t\tif(!isNaN(thisZ)) {\n\t\t\t\t\t\tmaxZ = Math.max(maxZ, thisZ);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t\t$.ui.dialog.maxZ = maxZ;\n\t\t}\n\n\t\treturn self;\n\t},\n\n\tisOpen: function() {\n\t\treturn this._isOpen;\n\t},\n\n\t// the force parameter allows us to move modal dialogs to their correct\n\t// position on open\n\tmoveToTop: function(force, event) {\n\t\tvar self = this,\n\t\t\toptions = self.options,\n\t\t\tsaveScroll;\n\n\t\tif ((options.modal && !force) ||\n\t\t\t(!options.stack && !options.modal)) {\n\t\t\treturn self._trigger('focus', event);\n\t\t}\n\n\t\tif (options.zIndex > $.ui.dialog.maxZ) {\n\t\t\t$.ui.dialog.maxZ = options.zIndex;\n\t\t}\n\t\tif (self.overlay) {\n\t\t\t$.ui.dialog.maxZ += 1;\n\t\t\tself.overlay.$el.css('z-index', $.ui.dialog.overlay.maxZ = $.ui.dialog.maxZ);\n\t\t}\n\n\t\t//Save and then restore scroll since Opera 9.5+ resets when parent z-Index is changed.\n\t\t//  http://ui.jquery.com/bugs/ticket/3193\n\t\tsaveScroll = { scrollTop: self.element.scrollTop(), scrollLeft: self.element.scrollLeft() };\n\t\t$.ui.dialog.maxZ += 1;\n\t\tself.uiDialog.css('z-index', $.ui.dialog.maxZ);\n\t\tself.element.attr(saveScroll);\n\t\tself._trigger('focus', event);\n\n\t\treturn self;\n\t},\n\n\topen: function() {\n\t\tif (this._isOpen) { return; }\n\n\t\tvar self = this,\n\t\t\toptions = self.options,\n\t\t\tuiDialog = self.uiDialog;\n\n\t\tself.overlay = options.modal ? new $.ui.dialog.overlay(self) : null;\n\t\tself._size();\n\t\tself._position(options.position);\n\t\tuiDialog.show(options.show);\n\t\tself.moveToTop(true);\n\n\t\t// prevent tabbing out of modal dialogs\n\t\tif ( options.modal ) {\n\t\t\tuiDialog.bind( \"keydown.ui-dialog\", function( event ) {\n\t\t\t\tif ( event.keyCode !== $.ui.keyCode.TAB ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar tabbables = $(':tabbable', this),\n\t\t\t\t\tfirst = tabbables.filter(':first'),\n\t\t\t\t\tlast  = tabbables.filter(':last');\n\n\t\t\t\tif (event.target === last[0] && !event.shiftKey) {\n\t\t\t\t\tfirst.focus(1);\n\t\t\t\t\treturn false;\n\t\t\t\t} else if (event.target === first[0] && event.shiftKey) {\n\t\t\t\t\tlast.focus(1);\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\t// set focus to the first tabbable element in the content area or the first button\n\t\t// if there are no tabbable elements, set focus on the dialog itself\n\t\t$(self.element.find(':tabbable').get().concat(\n\t\t\tuiDialog.find('.ui-dialog-buttonpane :tabbable').get().concat(\n\t\t\t\tuiDialog.get()))).eq(0).focus();\n\n\t\tself._isOpen = true;\n\t\tself._trigger('open');\n\n\t\treturn self;\n\t},\n\n\t_createButtons: function(buttons) {\n\t\tvar self = this,\n\t\t\thasButtons = false,\n\t\t\tuiDialogButtonPane = $('<div></div>')\n\t\t\t\t.addClass(\n\t\t\t\t\t'ui-dialog-buttonpane ' +\n\t\t\t\t\t'ui-widget-content ' +\n\t\t\t\t\t'ui-helper-clearfix'\n\t\t\t\t),\n\t\t\tuiButtonSet = $( \"<div></div>\" )\n\t\t\t\t.addClass( \"ui-dialog-buttonset\" )\n\t\t\t\t.appendTo( uiDialogButtonPane );\n\n\t\t// if we already have a button pane, remove it\n\t\tself.uiDialog.find('.ui-dialog-buttonpane').remove();\n\n\t\tif (typeof buttons === 'object' && buttons !== null) {\n\t\t\t$.each(buttons, function() {\n\t\t\t\treturn !(hasButtons = true);\n\t\t\t});\n\t\t}\n\t\tif (hasButtons) {\n\t\t\t$.each(buttons, function(name, props) {\n\t\t\t\tprops = $.isFunction( props ) ?\n\t\t\t\t\t{ click: props, text: name } :\n\t\t\t\t\tprops;\n\t\t\t\tvar button = $('<button type=\"button\"></button>')\n\t\t\t\t\t.click(function() {\n\t\t\t\t\t\tprops.click.apply(self.element[0], arguments);\n\t\t\t\t\t})\n\t\t\t\t\t.appendTo(uiButtonSet);\n\t\t\t\t// can't use .attr( props, true ) with jQuery 1.3.2.\n\t\t\t\t$.each( props, function( key, value ) {\n\t\t\t\t\tif ( key === \"click\" ) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif ( key in button ) {\n\t\t\t\t\t\tbutton[ key ]( value );\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbutton.attr( key, value );\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tif ($.fn.button) {\n\t\t\t\t\tbutton.button();\n\t\t\t\t}\n\t\t\t});\n\t\t\tuiDialogButtonPane.appendTo(self.uiDialog);\n\t\t}\n\t},\n\n\t_makeDraggable: function() {\n\t\tvar self = this,\n\t\t\toptions = self.options,\n\t\t\tdoc = $(document),\n\t\t\theightBeforeDrag;\n\n\t\tfunction filteredUi(ui) {\n\t\t\treturn {\n\t\t\t\tposition: ui.position,\n\t\t\t\toffset: ui.offset\n\t\t\t};\n\t\t}\n\n\t\tself.uiDialog.draggable({\n\t\t\tcancel: '.ui-dialog-content, .ui-dialog-titlebar-close',\n\t\t\thandle: '.ui-dialog-titlebar',\n\t\t\tcontainment: 'document',\n\t\t\tstart: function(event, ui) {\n\t\t\t\theightBeforeDrag = options.height === \"auto\" ? \"auto\" : $(this).height();\n\t\t\t\t$(this).height($(this).height()).addClass(\"ui-dialog-dragging\");\n\t\t\t\tself._trigger('dragStart', event, filteredUi(ui));\n\t\t\t},\n\t\t\tdrag: function(event, ui) {\n\t\t\t\tself._trigger('drag', event, filteredUi(ui));\n\t\t\t},\n\t\t\tstop: function(event, ui) {\n\t\t\t\toptions.position = [ui.position.left - doc.scrollLeft(),\n\t\t\t\t\tui.position.top - doc.scrollTop()];\n\t\t\t\t$(this).removeClass(\"ui-dialog-dragging\").height(heightBeforeDrag);\n\t\t\t\tself._trigger('dragStop', event, filteredUi(ui));\n\t\t\t\t$.ui.dialog.overlay.resize();\n\t\t\t}\n\t\t});\n\t},\n\n\t_makeResizable: function(handles) {\n\t\thandles = (handles === undefined ? this.options.resizable : handles);\n\t\tvar self = this,\n\t\t\toptions = self.options,\n\t\t\t// .ui-resizable has position: relative defined in the stylesheet\n\t\t\t// but dialogs have to use absolute or fixed positioning\n\t\t\tposition = self.uiDialog.css('position'),\n\t\t\tresizeHandles = (typeof handles === 'string' ?\n\t\t\t\thandles\t:\n\t\t\t\t'n,e,s,w,se,sw,ne,nw'\n\t\t\t);\n\n\t\tfunction filteredUi(ui) {\n\t\t\treturn {\n\t\t\t\toriginalPosition: ui.originalPosition,\n\t\t\t\toriginalSize: ui.originalSize,\n\t\t\t\tposition: ui.position,\n\t\t\t\tsize: ui.size\n\t\t\t};\n\t\t}\n\n\t\tself.uiDialog.resizable({\n\t\t\tcancel: '.ui-dialog-content',\n\t\t\tcontainment: 'document',\n\t\t\talsoResize: self.element,\n\t\t\tmaxWidth: options.maxWidth,\n\t\t\tmaxHeight: options.maxHeight,\n\t\t\tminWidth: options.minWidth,\n\t\t\tminHeight: self._minHeight(),\n\t\t\thandles: resizeHandles,\n\t\t\tstart: function(event, ui) {\n\t\t\t\t$(this).addClass(\"ui-dialog-resizing\");\n\t\t\t\tself._trigger('resizeStart', event, filteredUi(ui));\n\t\t\t},\n\t\t\tresize: function(event, ui) {\n\t\t\t\tself._trigger('resize', event, filteredUi(ui));\n\t\t\t},\n\t\t\tstop: function(event, ui) {\n\t\t\t\t$(this).removeClass(\"ui-dialog-resizing\");\n\t\t\t\toptions.height = $(this).height();\n\t\t\t\toptions.width = $(this).width();\n\t\t\t\tself._trigger('resizeStop', event, filteredUi(ui));\n\t\t\t\t$.ui.dialog.overlay.resize();\n\t\t\t}\n\t\t})\n\t\t.css('position', position)\n\t\t.find('.ui-resizable-se').addClass('ui-icon ui-icon-grip-diagonal-se');\n\t},\n\n\t_minHeight: function() {\n\t\tvar options = this.options;\n\n\t\tif (options.height === 'auto') {\n\t\t\treturn options.minHeight;\n\t\t} else {\n\t\t\treturn Math.min(options.minHeight, options.height);\n\t\t}\n\t},\n\n\t_position: function(position) {\n\t\tvar myAt = [],\n\t\t\toffset = [0, 0],\n\t\t\tisVisible;\n\n\t\tif (position) {\n\t\t\t// deep extending converts arrays to objects in jQuery <= 1.3.2 :-(\n\t//\t\tif (typeof position == 'string' || $.isArray(position)) {\n\t//\t\t\tmyAt = $.isArray(position) ? position : position.split(' ');\n\n\t\t\tif (typeof position === 'string' || (typeof position === 'object' && '0' in position)) {\n\t\t\t\tmyAt = position.split ? position.split(' ') : [position[0], position[1]];\n\t\t\t\tif (myAt.length === 1) {\n\t\t\t\t\tmyAt[1] = myAt[0];\n\t\t\t\t}\n\n\t\t\t\t$.each(['left', 'top'], function(i, offsetPosition) {\n\t\t\t\t\tif (+myAt[i] === myAt[i]) {\n\t\t\t\t\t\toffset[i] = myAt[i];\n\t\t\t\t\t\tmyAt[i] = offsetPosition;\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tposition = {\n\t\t\t\t\tmy: myAt.join(\" \"),\n\t\t\t\t\tat: myAt.join(\" \"),\n\t\t\t\t\toffset: offset.join(\" \")\n\t\t\t\t};\n\t\t\t} \n\n\t\t\tposition = $.extend({}, $.ui.dialog.prototype.options.position, position);\n\t\t} else {\n\t\t\tposition = $.ui.dialog.prototype.options.position;\n\t\t}\n\n\t\t// need to show the dialog to get the actual offset in the position plugin\n\t\tisVisible = this.uiDialog.is(':visible');\n\t\tif (!isVisible) {\n\t\t\tthis.uiDialog.show();\n\t\t}\n\t\tthis.uiDialog\n\t\t\t// workaround for jQuery bug #5781 http://dev.jquery.com/ticket/5781\n\t\t\t.css({ top: 0, left: 0 })\n\t\t\t.position($.extend({ of: window }, position));\n\t\tif (!isVisible) {\n\t\t\tthis.uiDialog.hide();\n\t\t}\n\t},\n\n\t_setOptions: function( options ) {\n\t\tvar self = this,\n\t\t\tresizableOptions = {},\n\t\t\tresize = false;\n\n\t\t$.each( options, function( key, value ) {\n\t\t\tself._setOption( key, value );\n\t\t\t\n\t\t\tif ( key in sizeRelatedOptions ) {\n\t\t\t\tresize = true;\n\t\t\t}\n\t\t\tif ( key in resizableRelatedOptions ) {\n\t\t\t\tresizableOptions[ key ] = value;\n\t\t\t}\n\t\t});\n\n\t\tif ( resize ) {\n\t\t\tthis._size();\n\t\t}\n\t\tif ( this.uiDialog.is( \":data(resizable)\" ) ) {\n\t\t\tthis.uiDialog.resizable( \"option\", resizableOptions );\n\t\t}\n\t},\n\n\t_setOption: function(key, value){\n\t\tvar self = this,\n\t\t\tuiDialog = self.uiDialog;\n\n\t\tswitch (key) {\n\t\t\t//handling of deprecated beforeclose (vs beforeClose) option\n\t\t\t//Ticket #4669 http://dev.jqueryui.com/ticket/4669\n\t\t\t//TODO: remove in 1.9pre\n\t\t\tcase \"beforeclose\":\n\t\t\t\tkey = \"beforeClose\";\n\t\t\t\tbreak;\n\t\t\tcase \"buttons\":\n\t\t\t\tself._createButtons(value);\n\t\t\t\tbreak;\n\t\t\tcase \"closeText\":\n\t\t\t\t// ensure that we always pass a string\n\t\t\t\tself.uiDialogTitlebarCloseText.text(\"\" + value);\n\t\t\t\tbreak;\n\t\t\tcase \"dialogClass\":\n\t\t\t\tuiDialog\n\t\t\t\t\t.removeClass(self.options.dialogClass)\n\t\t\t\t\t.addClass(uiDialogClasses + value);\n\t\t\t\tbreak;\n\t\t\tcase \"disabled\":\n\t\t\t\tif (value) {\n\t\t\t\t\tuiDialog.addClass('ui-dialog-disabled');\n\t\t\t\t} else {\n\t\t\t\t\tuiDialog.removeClass('ui-dialog-disabled');\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"draggable\":\n\t\t\t\tvar isDraggable = uiDialog.is( \":data(draggable)\" );\n\t\t\t\tif ( isDraggable && !value ) {\n\t\t\t\t\tuiDialog.draggable( \"destroy\" );\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif ( !isDraggable && value ) {\n\t\t\t\t\tself._makeDraggable();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"position\":\n\t\t\t\tself._position(value);\n\t\t\t\tbreak;\n\t\t\tcase \"resizable\":\n\t\t\t\t// currently resizable, becoming non-resizable\n\t\t\t\tvar isResizable = uiDialog.is( \":data(resizable)\" );\n\t\t\t\tif (isResizable && !value) {\n\t\t\t\t\tuiDialog.resizable('destroy');\n\t\t\t\t}\n\n\t\t\t\t// currently resizable, changing handles\n\t\t\t\tif (isResizable && typeof value === 'string') {\n\t\t\t\t\tuiDialog.resizable('option', 'handles', value);\n\t\t\t\t}\n\n\t\t\t\t// currently non-resizable, becoming resizable\n\t\t\t\tif (!isResizable && value !== false) {\n\t\t\t\t\tself._makeResizable(value);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"title\":\n\t\t\t\t// convert whatever was passed in o a string, for html() to not throw up\n\t\t\t\t$(\".ui-dialog-title\", self.uiDialogTitlebar).html(\"\" + (value || '&#160;'));\n\t\t\t\tbreak;\n\t\t}\n\n\t\t$.Widget.prototype._setOption.apply(self, arguments);\n\t},\n\n\t_size: function() {\n\t\t/* If the user has resized the dialog, the .ui-dialog and .ui-dialog-content\n\t\t * divs will both have width and height set, so we need to reset them\n\t\t */\n\t\tvar options = this.options,\n\t\t\tnonContentHeight,\n\t\t\tminContentHeight,\n\t\t\tisVisible = this.uiDialog.is( \":visible\" );\n\n\t\t// reset content sizing\n\t\tthis.element.show().css({\n\t\t\twidth: 'auto',\n\t\t\tminHeight: 0,\n\t\t\theight: 0\n\t\t});\n\n\t\tif (options.minWidth > options.width) {\n\t\t\toptions.width = options.minWidth;\n\t\t}\n\n\t\t// reset wrapper sizing\n\t\t// determine the height of all the non-content elements\n\t\tnonContentHeight = this.uiDialog.css({\n\t\t\t\theight: 'auto',\n\t\t\t\twidth: options.width\n\t\t\t})\n\t\t\t.height();\n\t\tminContentHeight = Math.max( 0, options.minHeight - nonContentHeight );\n\t\t\n\t\tif ( options.height === \"auto\" ) {\n\t\t\t// only needed for IE6 support\n\t\t\tif ( $.support.minHeight ) {\n\t\t\t\tthis.element.css({\n\t\t\t\t\tminHeight: minContentHeight,\n\t\t\t\t\theight: \"auto\"\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tthis.uiDialog.show();\n\t\t\t\tvar autoHeight = this.element.css( \"height\", \"auto\" ).height();\n\t\t\t\tif ( !isVisible ) {\n\t\t\t\t\tthis.uiDialog.hide();\n\t\t\t\t}\n\t\t\t\tthis.element.height( Math.max( autoHeight, minContentHeight ) );\n\t\t\t}\n\t\t} else {\n\t\t\tthis.element.height( Math.max( options.height - nonContentHeight, 0 ) );\n\t\t}\n\n\t\tif (this.uiDialog.is(':data(resizable)')) {\n\t\t\tthis.uiDialog.resizable('option', 'minHeight', this._minHeight());\n\t\t}\n\t}\n});\n\n$.extend($.ui.dialog, {\n\tversion: \"1.8.24\",\n\n\tuuid: 0,\n\tmaxZ: 0,\n\n\tgetTitleId: function($el) {\n\t\tvar id = $el.attr('id');\n\t\tif (!id) {\n\t\t\tthis.uuid += 1;\n\t\t\tid = this.uuid;\n\t\t}\n\t\treturn 'ui-dialog-title-' + id;\n\t},\n\n\toverlay: function(dialog) {\n\t\tthis.$el = $.ui.dialog.overlay.create(dialog);\n\t}\n});\n\n$.extend($.ui.dialog.overlay, {\n\tinstances: [],\n\t// reuse old instances due to IE memory leak with alpha transparency (see #5185)\n\toldInstances: [],\n\tmaxZ: 0,\n\tevents: $.map('focus,mousedown,mouseup,keydown,keypress,click'.split(','),\n\t\tfunction(event) { return event + '.dialog-overlay'; }).join(' '),\n\tcreate: function(dialog) {\n\t\tif (this.instances.length === 0) {\n\t\t\t// prevent use of anchors and inputs\n\t\t\t// we use a setTimeout in case the overlay is created from an\n\t\t\t// event that we're going to be cancelling (see #2804)\n\t\t\tsetTimeout(function() {\n\t\t\t\t// handle $(el).dialog().dialog('close') (see #4065)\n\t\t\t\tif ($.ui.dialog.overlay.instances.length) {\n\t\t\t\t\t$(document).bind($.ui.dialog.overlay.events, function(event) {\n\t\t\t\t\t\t// stop events if the z-index of the target is < the z-index of the overlay\n\t\t\t\t\t\t// we cannot return true when we don't want to cancel the event (#3523)\n\t\t\t\t\t\tif ($(event.target).zIndex() < $.ui.dialog.overlay.maxZ) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}, 1);\n\n\t\t\t// allow closing by pressing the escape key\n\t\t\t$(document).bind('keydown.dialog-overlay', function(event) {\n\t\t\t\tif (dialog.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&\n\t\t\t\t\tevent.keyCode === $.ui.keyCode.ESCAPE) {\n\t\t\t\t\t\n\t\t\t\t\tdialog.close(event);\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// handle window resize\n\t\t\t$(window).bind('resize.dialog-overlay', $.ui.dialog.overlay.resize);\n\t\t}\n\n\t\tvar $el = (this.oldInstances.pop() || $('<div></div>').addClass('ui-widget-overlay'))\n\t\t\t.appendTo(document.body)\n\t\t\t.css({\n\t\t\t\twidth: this.width(),\n\t\t\t\theight: this.height()\n\t\t\t});\n\n\t\tif ($.fn.bgiframe) {\n\t\t\t$el.bgiframe();\n\t\t}\n\n\t\tthis.instances.push($el);\n\t\treturn $el;\n\t},\n\n\tdestroy: function($el) {\n\t\tvar indexOf = $.inArray($el, this.instances);\n\t\tif (indexOf != -1){\n\t\t\tthis.oldInstances.push(this.instances.splice(indexOf, 1)[0]);\n\t\t}\n\n\t\tif (this.instances.length === 0) {\n\t\t\t$([document, window]).unbind('.dialog-overlay');\n\t\t}\n\n\t\t$el.remove();\n\t\t\n\t\t// adjust the maxZ to allow other modal dialogs to continue to work (see #4309)\n\t\tvar maxZ = 0;\n\t\t$.each(this.instances, function() {\n\t\t\tmaxZ = Math.max(maxZ, this.css('z-index'));\n\t\t});\n\t\tthis.maxZ = maxZ;\n\t},\n\n\theight: function() {\n\t\tvar scrollHeight,\n\t\t\toffsetHeight;\n\t\t// handle IE 6\n\t\tif ($.browser.msie && $.browser.version < 7) {\n\t\t\tscrollHeight = Math.max(\n\t\t\t\tdocument.documentElement.scrollHeight,\n\t\t\t\tdocument.body.scrollHeight\n\t\t\t);\n\t\t\toffsetHeight = Math.max(\n\t\t\t\tdocument.documentElement.offsetHeight,\n\t\t\t\tdocument.body.offsetHeight\n\t\t\t);\n\n\t\t\tif (scrollHeight < offsetHeight) {\n\t\t\t\treturn $(window).height() + 'px';\n\t\t\t} else {\n\t\t\t\treturn scrollHeight + 'px';\n\t\t\t}\n\t\t// handle \"good\" browsers\n\t\t} else {\n\t\t\treturn $(document).height() + 'px';\n\t\t}\n\t},\n\n\twidth: function() {\n\t\tvar scrollWidth,\n\t\t\toffsetWidth;\n\t\t// handle IE\n\t\tif ( $.browser.msie ) {\n\t\t\tscrollWidth = Math.max(\n\t\t\t\tdocument.documentElement.scrollWidth,\n\t\t\t\tdocument.body.scrollWidth\n\t\t\t);\n\t\t\toffsetWidth = Math.max(\n\t\t\t\tdocument.documentElement.offsetWidth,\n\t\t\t\tdocument.body.offsetWidth\n\t\t\t);\n\n\t\t\tif (scrollWidth < offsetWidth) {\n\t\t\t\treturn $(window).width() + 'px';\n\t\t\t} else {\n\t\t\t\treturn scrollWidth + 'px';\n\t\t\t}\n\t\t// handle \"good\" browsers\n\t\t} else {\n\t\t\treturn $(document).width() + 'px';\n\t\t}\n\t},\n\n\tresize: function() {\n\t\t/* If the dialog is draggable and the user drags it past the\n\t\t * right edge of the window, the document becomes wider so we\n\t\t * need to stretch the overlay. If the user then drags the\n\t\t * dialog back to the left, the document will become narrower,\n\t\t * so we need to shrink the overlay to the appropriate size.\n\t\t * This is handled by shrinking the overlay before setting it\n\t\t * to the full document size.\n\t\t */\n\t\tvar $overlays = $([]);\n\t\t$.each($.ui.dialog.overlay.instances, function() {\n\t\t\t$overlays = $overlays.add(this);\n\t\t});\n\n\t\t$overlays.css({\n\t\t\twidth: 0,\n\t\t\theight: 0\n\t\t}).css({\n\t\t\twidth: $.ui.dialog.overlay.width(),\n\t\t\theight: $.ui.dialog.overlay.height()\n\t\t});\n\t}\n});\n\n$.extend($.ui.dialog.overlay.prototype, {\n\tdestroy: function() {\n\t\t$.ui.dialog.overlay.destroy(this.$el);\n\t}\n});\n\n}(jQuery));\n\n(function( $, undefined ) {\n\n$.ui = $.ui || {};\n\nvar horizontalPositions = /left|center|right/,\n\tverticalPositions = /top|center|bottom/,\n\tcenter = \"center\",\n\tsupport = {},\n\t_position = $.fn.position,\n\t_offset = $.fn.offset;\n\n$.fn.position = function( options ) {\n\tif ( !options || !options.of ) {\n\t\treturn _position.apply( this, arguments );\n\t}\n\n\t// make a copy, we don't want to modify arguments\n\toptions = $.extend( {}, options );\n\n\tvar target = $( options.of ),\n\t\ttargetElem = target[0],\n\t\tcollision = ( options.collision || \"flip\" ).split( \" \" ),\n\t\toffset = options.offset ? options.offset.split( \" \" ) : [ 0, 0 ],\n\t\ttargetWidth,\n\t\ttargetHeight,\n\t\tbasePosition;\n\n\tif ( targetElem.nodeType === 9 ) {\n\t\ttargetWidth = target.width();\n\t\ttargetHeight = target.height();\n\t\tbasePosition = { top: 0, left: 0 };\n\t// TODO: use $.isWindow() in 1.9\n\t} else if ( targetElem.setTimeout ) {\n\t\ttargetWidth = target.width();\n\t\ttargetHeight = target.height();\n\t\tbasePosition = { top: target.scrollTop(), left: target.scrollLeft() };\n\t} else if ( targetElem.preventDefault ) {\n\t\t// force left top to allow flipping\n\t\toptions.at = \"left top\";\n\t\ttargetWidth = targetHeight = 0;\n\t\tbasePosition = { top: options.of.pageY, left: options.of.pageX };\n\t} else {\n\t\ttargetWidth = target.outerWidth();\n\t\ttargetHeight = target.outerHeight();\n\t\tbasePosition = target.offset();\n\t}\n\n\t// force my and at to have valid horizontal and veritcal positions\n\t// if a value is missing or invalid, it will be converted to center \n\t$.each( [ \"my\", \"at\" ], function() {\n\t\tvar pos = ( options[this] || \"\" ).split( \" \" );\n\t\tif ( pos.length === 1) {\n\t\t\tpos = horizontalPositions.test( pos[0] ) ?\n\t\t\t\tpos.concat( [center] ) :\n\t\t\t\tverticalPositions.test( pos[0] ) ?\n\t\t\t\t\t[ center ].concat( pos ) :\n\t\t\t\t\t[ center, center ];\n\t\t}\n\t\tpos[ 0 ] = horizontalPositions.test( pos[0] ) ? pos[ 0 ] : center;\n\t\tpos[ 1 ] = verticalPositions.test( pos[1] ) ? pos[ 1 ] : center;\n\t\toptions[ this ] = pos;\n\t});\n\n\t// normalize collision option\n\tif ( collision.length === 1 ) {\n\t\tcollision[ 1 ] = collision[ 0 ];\n\t}\n\n\t// normalize offset option\n\toffset[ 0 ] = parseInt( offset[0], 10 ) || 0;\n\tif ( offset.length === 1 ) {\n\t\toffset[ 1 ] = offset[ 0 ];\n\t}\n\toffset[ 1 ] = parseInt( offset[1], 10 ) || 0;\n\n\tif ( options.at[0] === \"right\" ) {\n\t\tbasePosition.left += targetWidth;\n\t} else if ( options.at[0] === center ) {\n\t\tbasePosition.left += targetWidth / 2;\n\t}\n\n\tif ( options.at[1] === \"bottom\" ) {\n\t\tbasePosition.top += targetHeight;\n\t} else if ( options.at[1] === center ) {\n\t\tbasePosition.top += targetHeight / 2;\n\t}\n\n\tbasePosition.left += offset[ 0 ];\n\tbasePosition.top += offset[ 1 ];\n\n\treturn this.each(function() {\n\t\tvar elem = $( this ),\n\t\t\telemWidth = elem.outerWidth(),\n\t\t\telemHeight = elem.outerHeight(),\n\t\t\tmarginLeft = parseInt( $.curCSS( this, \"marginLeft\", true ) ) || 0,\n\t\t\tmarginTop = parseInt( $.curCSS( this, \"marginTop\", true ) ) || 0,\n\t\t\tcollisionWidth = elemWidth + marginLeft +\n\t\t\t\t( parseInt( $.curCSS( this, \"marginRight\", true ) ) || 0 ),\n\t\t\tcollisionHeight = elemHeight + marginTop +\n\t\t\t\t( parseInt( $.curCSS( this, \"marginBottom\", true ) ) || 0 ),\n\t\t\tposition = $.extend( {}, basePosition ),\n\t\t\tcollisionPosition;\n\n\t\tif ( options.my[0] === \"right\" ) {\n\t\t\tposition.left -= elemWidth;\n\t\t} else if ( options.my[0] === center ) {\n\t\t\tposition.left -= elemWidth / 2;\n\t\t}\n\n\t\tif ( options.my[1] === \"bottom\" ) {\n\t\t\tposition.top -= elemHeight;\n\t\t} else if ( options.my[1] === center ) {\n\t\t\tposition.top -= elemHeight / 2;\n\t\t}\n\n\t\t// prevent fractions if jQuery version doesn't support them (see #5280)\n\t\tif ( !support.fractions ) {\n\t\t\tposition.left = Math.round( position.left );\n\t\t\tposition.top = Math.round( position.top );\n\t\t}\n\n\t\tcollisionPosition = {\n\t\t\tleft: position.left - marginLeft,\n\t\t\ttop: position.top - marginTop\n\t\t};\n\n\t\t$.each( [ \"left\", \"top\" ], function( i, dir ) {\n\t\t\tif ( $.ui.position[ collision[i] ] ) {\n\t\t\t\t$.ui.position[ collision[i] ][ dir ]( position, {\n\t\t\t\t\ttargetWidth: targetWidth,\n\t\t\t\t\ttargetHeight: targetHeight,\n\t\t\t\t\telemWidth: elemWidth,\n\t\t\t\t\telemHeight: elemHeight,\n\t\t\t\t\tcollisionPosition: collisionPosition,\n\t\t\t\t\tcollisionWidth: collisionWidth,\n\t\t\t\t\tcollisionHeight: collisionHeight,\n\t\t\t\t\toffset: offset,\n\t\t\t\t\tmy: options.my,\n\t\t\t\t\tat: options.at\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\n\t\tif ( $.fn.bgiframe ) {\n\t\t\telem.bgiframe();\n\t\t}\n\t\telem.offset( $.extend( position, { using: options.using } ) );\n\t});\n};\n\n$.ui.position = {\n\tfit: {\n\t\tleft: function( position, data ) {\n\t\t\tvar win = $( window ),\n\t\t\t\tover = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft();\n\t\t\tposition.left = over > 0 ? position.left - over : Math.max( position.left - data.collisionPosition.left, position.left );\n\t\t},\n\t\ttop: function( position, data ) {\n\t\t\tvar win = $( window ),\n\t\t\t\tover = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop();\n\t\t\tposition.top = over > 0 ? position.top - over : Math.max( position.top - data.collisionPosition.top, position.top );\n\t\t}\n\t},\n\n\tflip: {\n\t\tleft: function( position, data ) {\n\t\t\tif ( data.at[0] === center ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar win = $( window ),\n\t\t\t\tover = data.collisionPosition.left + data.collisionWidth - win.width() - win.scrollLeft(),\n\t\t\t\tmyOffset = data.my[ 0 ] === \"left\" ?\n\t\t\t\t\t-data.elemWidth :\n\t\t\t\t\tdata.my[ 0 ] === \"right\" ?\n\t\t\t\t\t\tdata.elemWidth :\n\t\t\t\t\t\t0,\n\t\t\t\tatOffset = data.at[ 0 ] === \"left\" ?\n\t\t\t\t\tdata.targetWidth :\n\t\t\t\t\t-data.targetWidth,\n\t\t\t\toffset = -2 * data.offset[ 0 ];\n\t\t\tposition.left += data.collisionPosition.left < 0 ?\n\t\t\t\tmyOffset + atOffset + offset :\n\t\t\t\tover > 0 ?\n\t\t\t\t\tmyOffset + atOffset + offset :\n\t\t\t\t\t0;\n\t\t},\n\t\ttop: function( position, data ) {\n\t\t\tif ( data.at[1] === center ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar win = $( window ),\n\t\t\t\tover = data.collisionPosition.top + data.collisionHeight - win.height() - win.scrollTop(),\n\t\t\t\tmyOffset = data.my[ 1 ] === \"top\" ?\n\t\t\t\t\t-data.elemHeight :\n\t\t\t\t\tdata.my[ 1 ] === \"bottom\" ?\n\t\t\t\t\t\tdata.elemHeight :\n\t\t\t\t\t\t0,\n\t\t\t\tatOffset = data.at[ 1 ] === \"top\" ?\n\t\t\t\t\tdata.targetHeight :\n\t\t\t\t\t-data.targetHeight,\n\t\t\t\toffset = -2 * data.offset[ 1 ];\n\t\t\tposition.top += data.collisionPosition.top < 0 ?\n\t\t\t\tmyOffset + atOffset + offset :\n\t\t\t\tover > 0 ?\n\t\t\t\t\tmyOffset + atOffset + offset :\n\t\t\t\t\t0;\n\t\t}\n\t}\n};\n\n// offset setter from jQuery 1.4\nif ( !$.offset.setOffset ) {\n\t$.offset.setOffset = function( elem, options ) {\n\t\t// set position first, in-case top/left are set even on static elem\n\t\tif ( /static/.test( $.curCSS( elem, \"position\" ) ) ) {\n\t\t\telem.style.position = \"relative\";\n\t\t}\n\t\tvar curElem   = $( elem ),\n\t\t\tcurOffset = curElem.offset(),\n\t\t\tcurTop    = parseInt( $.curCSS( elem, \"top\",  true ), 10 ) || 0,\n\t\t\tcurLeft   = parseInt( $.curCSS( elem, \"left\", true ), 10)  || 0,\n\t\t\tprops     = {\n\t\t\t\ttop:  (options.top  - curOffset.top)  + curTop,\n\t\t\t\tleft: (options.left - curOffset.left) + curLeft\n\t\t\t};\n\t\t\n\t\tif ( 'using' in options ) {\n\t\t\toptions.using.call( elem, props );\n\t\t} else {\n\t\t\tcurElem.css( props );\n\t\t}\n\t};\n\n\t$.fn.offset = function( options ) {\n\t\tvar elem = this[ 0 ];\n\t\tif ( !elem || !elem.ownerDocument ) { return null; }\n\t\tif ( options ) {\n\t\t\tif ( $.isFunction( options ) ) {\n\t\t\t\treturn this.each(function( i ) {\n\t\t\t\t\t$( this ).offset( options.call( this, i, $( this ).offset() ) );\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn this.each(function() {\n\t\t\t\t$.offset.setOffset( this, options );\n\t\t\t});\n\t\t}\n\t\treturn _offset.call( this );\n\t};\n}\n\n// jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css\nif ( !$.curCSS ) {\n\t$.curCSS = $.css;\n}\n\n// fraction support test (older versions of jQuery don't support fractions)\n(function () {\n\tvar body = document.getElementsByTagName( \"body\" )[ 0 ], \n\t\tdiv = document.createElement( \"div\" ),\n\t\ttestElement, testElementParent, testElementStyle, offset, offsetTotal;\n\n\t//Create a \"fake body\" for testing based on method used in jQuery.support\n\ttestElement = document.createElement( body ? \"div\" : \"body\" );\n\ttestElementStyle = {\n\t\tvisibility: \"hidden\",\n\t\twidth: 0,\n\t\theight: 0,\n\t\tborder: 0,\n\t\tmargin: 0,\n\t\tbackground: \"none\"\n\t};\n\tif ( body ) {\n\t\t$.extend( testElementStyle, {\n\t\t\tposition: \"absolute\",\n\t\t\tleft: \"-1000px\",\n\t\t\ttop: \"-1000px\"\n\t\t});\n\t}\n\tfor ( var i in testElementStyle ) {\n\t\ttestElement.style[ i ] = testElementStyle[ i ];\n\t}\n\ttestElement.appendChild( div );\n\ttestElementParent = body || document.documentElement;\n\ttestElementParent.insertBefore( testElement, testElementParent.firstChild );\n\n\tdiv.style.cssText = \"position: absolute; left: 10.7432222px; top: 10.432325px; height: 30px; width: 201px;\";\n\n\toffset = $( div ).offset( function( _, offset ) {\n\t\treturn offset;\n\t}).offset();\n\n\ttestElement.innerHTML = \"\";\n\ttestElementParent.removeChild( testElement );\n\n\toffsetTotal = offset.top + offset.left + ( body ? 2000 : 0 );\n\tsupport.fractions = offsetTotal > 21 && offsetTotal < 22;\n})();\n\n}( jQuery ));\n\n(function( $, undefined ) {\n\n$.widget( \"ui.progressbar\", {\n\toptions: {\n\t\tvalue: 0,\n\t\tmax: 100\n\t},\n\n\tmin: 0,\n\n\t_create: function() {\n\t\tthis.element\n\t\t\t.addClass( \"ui-progressbar ui-widget ui-widget-content ui-corner-all\" )\n\t\t\t.attr({\n\t\t\t\trole: \"progressbar\",\n\t\t\t\t\"aria-valuemin\": this.min,\n\t\t\t\t\"aria-valuemax\": this.options.max,\n\t\t\t\t\"aria-valuenow\": this._value()\n\t\t\t});\n\n\t\tthis.valueDiv = $( \"<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>\" )\n\t\t\t.appendTo( this.element );\n\n\t\tthis.oldValue = this._value();\n\t\tthis._refreshValue();\n\t},\n\n\tdestroy: function() {\n\t\tthis.element\n\t\t\t.removeClass( \"ui-progressbar ui-widget ui-widget-content ui-corner-all\" )\n\t\t\t.removeAttr( \"role\" )\n\t\t\t.removeAttr( \"aria-valuemin\" )\n\t\t\t.removeAttr( \"aria-valuemax\" )\n\t\t\t.removeAttr( \"aria-valuenow\" );\n\n\t\tthis.valueDiv.remove();\n\n\t\t$.Widget.prototype.destroy.apply( this, arguments );\n\t},\n\n\tvalue: function( newValue ) {\n\t\tif ( newValue === undefined ) {\n\t\t\treturn this._value();\n\t\t}\n\n\t\tthis._setOption( \"value\", newValue );\n\t\treturn this;\n\t},\n\n\t_setOption: function( key, value ) {\n\t\tif ( key === \"value\" ) {\n\t\t\tthis.options.value = value;\n\t\t\tthis._refreshValue();\n\t\t\tif ( this._value() === this.options.max ) {\n\t\t\t\tthis._trigger( \"complete\" );\n\t\t\t}\n\t\t}\n\n\t\t$.Widget.prototype._setOption.apply( this, arguments );\n\t},\n\n\t_value: function() {\n\t\tvar val = this.options.value;\n\t\t// normalize invalid value\n\t\tif ( typeof val !== \"number\" ) {\n\t\t\tval = 0;\n\t\t}\n\t\treturn Math.min( this.options.max, Math.max( this.min, val ) );\n\t},\n\n\t_percentage: function() {\n\t\treturn 100 * this._value() / this.options.max;\n\t},\n\n\t_refreshValue: function() {\n\t\tvar value = this.value();\n\t\tvar percentage = this._percentage();\n\n\t\tif ( this.oldValue !== value ) {\n\t\t\tthis.oldValue = value;\n\t\t\tthis._trigger( \"change\" );\n\t\t}\n\n\t\tthis.valueDiv\n\t\t\t.toggle( value > this.min )\n\t\t\t.toggleClass( \"ui-corner-right\", value === this.options.max )\n\t\t\t.width( percentage.toFixed(0) + \"%\" );\n\t\tthis.element.attr( \"aria-valuenow\", value );\n\t}\n});\n\n$.extend( $.ui.progressbar, {\n\tversion: \"1.8.24\"\n});\n\n})( jQuery );\n\n(function( $, undefined ) {\n\n// number of pages in a slider\n// (how many times can you page up/down to go through the whole range)\nvar numPages = 5;\n\n$.widget( \"ui.slider\", $.ui.mouse, {\n\n\twidgetEventPrefix: \"slide\",\n\n\toptions: {\n\t\tanimate: false,\n\t\tdistance: 0,\n\t\tmax: 100,\n\t\tmin: 0,\n\t\torientation: \"horizontal\",\n\t\trange: false,\n\t\tstep: 1,\n\t\tvalue: 0,\n\t\tvalues: null\n\t},\n\n\t_create: function() {\n\t\tvar self = this,\n\t\t\to = this.options,\n\t\t\texistingHandles = this.element.find( \".ui-slider-handle\" ).addClass( \"ui-state-default ui-corner-all\" ),\n\t\t\thandle = \"<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>\",\n\t\t\thandleCount = ( o.values && o.values.length ) || 1,\n\t\t\thandles = [];\n\n\t\tthis._keySliding = false;\n\t\tthis._mouseSliding = false;\n\t\tthis._animateOff = true;\n\t\tthis._handleIndex = null;\n\t\tthis._detectOrientation();\n\t\tthis._mouseInit();\n\n\t\tthis.element\n\t\t\t.addClass( \"ui-slider\" +\n\t\t\t\t\" ui-slider-\" + this.orientation +\n\t\t\t\t\" ui-widget\" +\n\t\t\t\t\" ui-widget-content\" +\n\t\t\t\t\" ui-corner-all\" +\n\t\t\t\t( o.disabled ? \" ui-slider-disabled ui-disabled\" : \"\" ) );\n\n\t\tthis.range = $([]);\n\n\t\tif ( o.range ) {\n\t\t\tif ( o.range === true ) {\n\t\t\t\tif ( !o.values ) {\n\t\t\t\t\to.values = [ this._valueMin(), this._valueMin() ];\n\t\t\t\t}\n\t\t\t\tif ( o.values.length && o.values.length !== 2 ) {\n\t\t\t\t\to.values = [ o.values[0], o.values[0] ];\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tthis.range = $( \"<div></div>\" )\n\t\t\t\t.appendTo( this.element )\n\t\t\t\t.addClass( \"ui-slider-range\" +\n\t\t\t\t// note: this isn't the most fittingly semantic framework class for this element,\n\t\t\t\t// but worked best visually with a variety of themes\n\t\t\t\t\" ui-widget-header\" + \n\t\t\t\t( ( o.range === \"min\" || o.range === \"max\" ) ? \" ui-slider-range-\" + o.range : \"\" ) );\n\t\t}\n\n\t\tfor ( var i = existingHandles.length; i < handleCount; i += 1 ) {\n\t\t\thandles.push( handle );\n\t\t}\n\n\t\tthis.handles = existingHandles.add( $( handles.join( \"\" ) ).appendTo( self.element ) );\n\n\t\tthis.handle = this.handles.eq( 0 );\n\n\t\tthis.handles.add( this.range ).filter( \"a\" )\n\t\t\t.click(function( event ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t})\n\t\t\t.hover(function() {\n\t\t\t\tif ( !o.disabled ) {\n\t\t\t\t\t$( this ).addClass( \"ui-state-hover\" );\n\t\t\t\t}\n\t\t\t}, function() {\n\t\t\t\t$( this ).removeClass( \"ui-state-hover\" );\n\t\t\t})\n\t\t\t.focus(function() {\n\t\t\t\tif ( !o.disabled ) {\n\t\t\t\t\t$( \".ui-slider .ui-state-focus\" ).removeClass( \"ui-state-focus\" );\n\t\t\t\t\t$( this ).addClass( \"ui-state-focus\" );\n\t\t\t\t} else {\n\t\t\t\t\t$( this ).blur();\n\t\t\t\t}\n\t\t\t})\n\t\t\t.blur(function() {\n\t\t\t\t$( this ).removeClass( \"ui-state-focus\" );\n\t\t\t});\n\n\t\tthis.handles.each(function( i ) {\n\t\t\t$( this ).data( \"index.ui-slider-handle\", i );\n\t\t});\n\n\t\tthis.handles\n\t\t\t.keydown(function( event ) {\n\t\t\t\tvar index = $( this ).data( \"index.ui-slider-handle\" ),\n\t\t\t\t\tallowed,\n\t\t\t\t\tcurVal,\n\t\t\t\t\tnewVal,\n\t\t\t\t\tstep;\n\t\n\t\t\t\tif ( self.options.disabled ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\n\t\t\t\tswitch ( event.keyCode ) {\n\t\t\t\t\tcase $.ui.keyCode.HOME:\n\t\t\t\t\tcase $.ui.keyCode.END:\n\t\t\t\t\tcase $.ui.keyCode.PAGE_UP:\n\t\t\t\t\tcase $.ui.keyCode.PAGE_DOWN:\n\t\t\t\t\tcase $.ui.keyCode.UP:\n\t\t\t\t\tcase $.ui.keyCode.RIGHT:\n\t\t\t\t\tcase $.ui.keyCode.DOWN:\n\t\t\t\t\tcase $.ui.keyCode.LEFT:\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tif ( !self._keySliding ) {\n\t\t\t\t\t\t\tself._keySliding = true;\n\t\t\t\t\t\t\t$( this ).addClass( \"ui-state-active\" );\n\t\t\t\t\t\t\tallowed = self._start( event, index );\n\t\t\t\t\t\t\tif ( allowed === false ) {\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\n\t\t\t\tstep = self.options.step;\n\t\t\t\tif ( self.options.values && self.options.values.length ) {\n\t\t\t\t\tcurVal = newVal = self.values( index );\n\t\t\t\t} else {\n\t\t\t\t\tcurVal = newVal = self.value();\n\t\t\t\t}\n\t\n\t\t\t\tswitch ( event.keyCode ) {\n\t\t\t\t\tcase $.ui.keyCode.HOME:\n\t\t\t\t\t\tnewVal = self._valueMin();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase $.ui.keyCode.END:\n\t\t\t\t\t\tnewVal = self._valueMax();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase $.ui.keyCode.PAGE_UP:\n\t\t\t\t\t\tnewVal = self._trimAlignValue( curVal + ( (self._valueMax() - self._valueMin()) / numPages ) );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase $.ui.keyCode.PAGE_DOWN:\n\t\t\t\t\t\tnewVal = self._trimAlignValue( curVal - ( (self._valueMax() - self._valueMin()) / numPages ) );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase $.ui.keyCode.UP:\n\t\t\t\t\tcase $.ui.keyCode.RIGHT:\n\t\t\t\t\t\tif ( curVal === self._valueMax() ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnewVal = self._trimAlignValue( curVal + step );\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase $.ui.keyCode.DOWN:\n\t\t\t\t\tcase $.ui.keyCode.LEFT:\n\t\t\t\t\t\tif ( curVal === self._valueMin() ) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnewVal = self._trimAlignValue( curVal - step );\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\n\t\t\t\tself._slide( event, index, newVal );\n\t\t\t})\n\t\t\t.keyup(function( event ) {\n\t\t\t\tvar index = $( this ).data( \"index.ui-slider-handle\" );\n\t\n\t\t\t\tif ( self._keySliding ) {\n\t\t\t\t\tself._keySliding = false;\n\t\t\t\t\tself._stop( event, index );\n\t\t\t\t\tself._change( event, index );\n\t\t\t\t\t$( this ).removeClass( \"ui-state-active\" );\n\t\t\t\t}\n\t\n\t\t\t});\n\n\t\tthis._refreshValue();\n\n\t\tthis._animateOff = false;\n\t},\n\n\tdestroy: function() {\n\t\tthis.handles.remove();\n\t\tthis.range.remove();\n\n\t\tthis.element\n\t\t\t.removeClass( \"ui-slider\" +\n\t\t\t\t\" ui-slider-horizontal\" +\n\t\t\t\t\" ui-slider-vertical\" +\n\t\t\t\t\" ui-slider-disabled\" +\n\t\t\t\t\" ui-widget\" +\n\t\t\t\t\" ui-widget-content\" +\n\t\t\t\t\" ui-corner-all\" )\n\t\t\t.removeData( \"slider\" )\n\t\t\t.unbind( \".slider\" );\n\n\t\tthis._mouseDestroy();\n\n\t\treturn this;\n\t},\n\n\t_mouseCapture: function( event ) {\n\t\tvar o = this.options,\n\t\t\tposition,\n\t\t\tnormValue,\n\t\t\tdistance,\n\t\t\tclosestHandle,\n\t\t\tself,\n\t\t\tindex,\n\t\t\tallowed,\n\t\t\toffset,\n\t\t\tmouseOverHandle;\n\n\t\tif ( o.disabled ) {\n\t\t\treturn false;\n\t\t}\n\n\t\tthis.elementSize = {\n\t\t\twidth: this.element.outerWidth(),\n\t\t\theight: this.element.outerHeight()\n\t\t};\n\t\tthis.elementOffset = this.element.offset();\n\n\t\tposition = { x: event.pageX, y: event.pageY };\n\t\tnormValue = this._normValueFromMouse( position );\n\t\tdistance = this._valueMax() - this._valueMin() + 1;\n\t\tself = this;\n\t\tthis.handles.each(function( i ) {\n\t\t\tvar thisDistance = Math.abs( normValue - self.values(i) );\n\t\t\tif ( distance > thisDistance ) {\n\t\t\t\tdistance = thisDistance;\n\t\t\t\tclosestHandle = $( this );\n\t\t\t\tindex = i;\n\t\t\t}\n\t\t});\n\n\t\t// workaround for bug #3736 (if both handles of a range are at 0,\n\t\t// the first is always used as the one with least distance,\n\t\t// and moving it is obviously prevented by preventing negative ranges)\n\t\tif( o.range === true && this.values(1) === o.min ) {\n\t\t\tindex += 1;\n\t\t\tclosestHandle = $( this.handles[index] );\n\t\t}\n\n\t\tallowed = this._start( event, index );\n\t\tif ( allowed === false ) {\n\t\t\treturn false;\n\t\t}\n\t\tthis._mouseSliding = true;\n\n\t\tself._handleIndex = index;\n\n\t\tclosestHandle\n\t\t\t.addClass( \"ui-state-active\" )\n\t\t\t.focus();\n\t\t\n\t\toffset = closestHandle.offset();\n\t\tmouseOverHandle = !$( event.target ).parents().andSelf().is( \".ui-slider-handle\" );\n\t\tthis._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : {\n\t\t\tleft: event.pageX - offset.left - ( closestHandle.width() / 2 ),\n\t\t\ttop: event.pageY - offset.top -\n\t\t\t\t( closestHandle.height() / 2 ) -\n\t\t\t\t( parseInt( closestHandle.css(\"borderTopWidth\"), 10 ) || 0 ) -\n\t\t\t\t( parseInt( closestHandle.css(\"borderBottomWidth\"), 10 ) || 0) +\n\t\t\t\t( parseInt( closestHandle.css(\"marginTop\"), 10 ) || 0)\n\t\t};\n\n\t\tif ( !this.handles.hasClass( \"ui-state-hover\" ) ) {\n\t\t\tthis._slide( event, index, normValue );\n\t\t}\n\t\tthis._animateOff = true;\n\t\treturn true;\n\t},\n\n\t_mouseStart: function( event ) {\n\t\treturn true;\n\t},\n\n\t_mouseDrag: function( event ) {\n\t\tvar position = { x: event.pageX, y: event.pageY },\n\t\t\tnormValue = this._normValueFromMouse( position );\n\t\t\n\t\tthis._slide( event, this._handleIndex, normValue );\n\n\t\treturn false;\n\t},\n\n\t_mouseStop: function( event ) {\n\t\tthis.handles.removeClass( \"ui-state-active\" );\n\t\tthis._mouseSliding = false;\n\n\t\tthis._stop( event, this._handleIndex );\n\t\tthis._change( event, this._handleIndex );\n\n\t\tthis._handleIndex = null;\n\t\tthis._clickOffset = null;\n\t\tthis._animateOff = false;\n\n\t\treturn false;\n\t},\n\t\n\t_detectOrientation: function() {\n\t\tthis.orientation = ( this.options.orientation === \"vertical\" ) ? \"vertical\" : \"horizontal\";\n\t},\n\n\t_normValueFromMouse: function( position ) {\n\t\tvar pixelTotal,\n\t\t\tpixelMouse,\n\t\t\tpercentMouse,\n\t\t\tvalueTotal,\n\t\t\tvalueMouse;\n\n\t\tif ( this.orientation === \"horizontal\" ) {\n\t\t\tpixelTotal = this.elementSize.width;\n\t\t\tpixelMouse = position.x - this.elementOffset.left - ( this._clickOffset ? this._clickOffset.left : 0 );\n\t\t} else {\n\t\t\tpixelTotal = this.elementSize.height;\n\t\t\tpixelMouse = position.y - this.elementOffset.top - ( this._clickOffset ? this._clickOffset.top : 0 );\n\t\t}\n\n\t\tpercentMouse = ( pixelMouse / pixelTotal );\n\t\tif ( percentMouse > 1 ) {\n\t\t\tpercentMouse = 1;\n\t\t}\n\t\tif ( percentMouse < 0 ) {\n\t\t\tpercentMouse = 0;\n\t\t}\n\t\tif ( this.orientation === \"vertical\" ) {\n\t\t\tpercentMouse = 1 - percentMouse;\n\t\t}\n\n\t\tvalueTotal = this._valueMax() - this._valueMin();\n\t\tvalueMouse = this._valueMin() + percentMouse * valueTotal;\n\n\t\treturn this._trimAlignValue( valueMouse );\n\t},\n\n\t_start: function( event, index ) {\n\t\tvar uiHash = {\n\t\t\thandle: this.handles[ index ],\n\t\t\tvalue: this.value()\n\t\t};\n\t\tif ( this.options.values && this.options.values.length ) {\n\t\t\tuiHash.value = this.values( index );\n\t\t\tuiHash.values = this.values();\n\t\t}\n\t\treturn this._trigger( \"start\", event, uiHash );\n\t},\n\n\t_slide: function( event, index, newVal ) {\n\t\tvar otherVal,\n\t\t\tnewValues,\n\t\t\tallowed;\n\n\t\tif ( this.options.values && this.options.values.length ) {\n\t\t\totherVal = this.values( index ? 0 : 1 );\n\n\t\t\tif ( ( this.options.values.length === 2 && this.options.range === true ) && \n\t\t\t\t\t( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )\n\t\t\t\t) {\n\t\t\t\tnewVal = otherVal;\n\t\t\t}\n\n\t\t\tif ( newVal !== this.values( index ) ) {\n\t\t\t\tnewValues = this.values();\n\t\t\t\tnewValues[ index ] = newVal;\n\t\t\t\t// A slide can be canceled by returning false from the slide callback\n\t\t\t\tallowed = this._trigger( \"slide\", event, {\n\t\t\t\t\thandle: this.handles[ index ],\n\t\t\t\t\tvalue: newVal,\n\t\t\t\t\tvalues: newValues\n\t\t\t\t} );\n\t\t\t\totherVal = this.values( index ? 0 : 1 );\n\t\t\t\tif ( allowed !== false ) {\n\t\t\t\t\tthis.values( index, newVal, true );\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif ( newVal !== this.value() ) {\n\t\t\t\t// A slide can be canceled by returning false from the slide callback\n\t\t\t\tallowed = this._trigger( \"slide\", event, {\n\t\t\t\t\thandle: this.handles[ index ],\n\t\t\t\t\tvalue: newVal\n\t\t\t\t} );\n\t\t\t\tif ( allowed !== false ) {\n\t\t\t\t\tthis.value( newVal );\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\n\t_stop: function( event, index ) {\n\t\tvar uiHash = {\n\t\t\thandle: this.handles[ index ],\n\t\t\tvalue: this.value()\n\t\t};\n\t\tif ( this.options.values && this.options.values.length ) {\n\t\t\tuiHash.value = this.values( index );\n\t\t\tuiHash.values = this.values();\n\t\t}\n\n\t\tthis._trigger( \"stop\", event, uiHash );\n\t},\n\n\t_change: function( event, index ) {\n\t\tif ( !this._keySliding && !this._mouseSliding ) {\n\t\t\tvar uiHash = {\n\t\t\t\thandle: this.handles[ index ],\n\t\t\t\tvalue: this.value()\n\t\t\t};\n\t\t\tif ( this.options.values && this.options.values.length ) {\n\t\t\t\tuiHash.value = this.values( index );\n\t\t\t\tuiHash.values = this.values();\n\t\t\t}\n\n\t\t\tthis._trigger( \"change\", event, uiHash );\n\t\t}\n\t},\n\n\tvalue: function( newValue ) {\n\t\tif ( arguments.length ) {\n\t\t\tthis.options.value = this._trimAlignValue( newValue );\n\t\t\tthis._refreshValue();\n\t\t\tthis._change( null, 0 );\n\t\t\treturn;\n\t\t}\n\n\t\treturn this._value();\n\t},\n\n\tvalues: function( index, newValue ) {\n\t\tvar vals,\n\t\t\tnewValues,\n\t\t\ti;\n\n\t\tif ( arguments.length > 1 ) {\n\t\t\tthis.options.values[ index ] = this._trimAlignValue( newValue );\n\t\t\tthis._refreshValue();\n\t\t\tthis._change( null, index );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( arguments.length ) {\n\t\t\tif ( $.isArray( arguments[ 0 ] ) ) {\n\t\t\t\tvals = this.options.values;\n\t\t\t\tnewValues = arguments[ 0 ];\n\t\t\t\tfor ( i = 0; i < vals.length; i += 1 ) {\n\t\t\t\t\tvals[ i ] = this._trimAlignValue( newValues[ i ] );\n\t\t\t\t\tthis._change( null, i );\n\t\t\t\t}\n\t\t\t\tthis._refreshValue();\n\t\t\t} else {\n\t\t\t\tif ( this.options.values && this.options.values.length ) {\n\t\t\t\t\treturn this._values( index );\n\t\t\t\t} else {\n\t\t\t\t\treturn this.value();\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\treturn this._values();\n\t\t}\n\t},\n\n\t_setOption: function( key, value ) {\n\t\tvar i,\n\t\t\tvalsLength = 0;\n\n\t\tif ( $.isArray( this.options.values ) ) {\n\t\t\tvalsLength = this.options.values.length;\n\t\t}\n\n\t\t$.Widget.prototype._setOption.apply( this, arguments );\n\n\t\tswitch ( key ) {\n\t\t\tcase \"disabled\":\n\t\t\t\tif ( value ) {\n\t\t\t\t\tthis.handles.filter( \".ui-state-focus\" ).blur();\n\t\t\t\t\tthis.handles.removeClass( \"ui-state-hover\" );\n\t\t\t\t\tthis.handles.propAttr( \"disabled\", true );\n\t\t\t\t\tthis.element.addClass( \"ui-disabled\" );\n\t\t\t\t} else {\n\t\t\t\t\tthis.handles.propAttr( \"disabled\", false );\n\t\t\t\t\tthis.element.removeClass( \"ui-disabled\" );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"orientation\":\n\t\t\t\tthis._detectOrientation();\n\t\t\t\tthis.element\n\t\t\t\t\t.removeClass( \"ui-slider-horizontal ui-slider-vertical\" )\n\t\t\t\t\t.addClass( \"ui-slider-\" + this.orientation );\n\t\t\t\tthis._refreshValue();\n\t\t\t\tbreak;\n\t\t\tcase \"value\":\n\t\t\t\tthis._animateOff = true;\n\t\t\t\tthis._refreshValue();\n\t\t\t\tthis._change( null, 0 );\n\t\t\t\tthis._animateOff = false;\n\t\t\t\tbreak;\n\t\t\tcase \"values\":\n\t\t\t\tthis._animateOff = true;\n\t\t\t\tthis._refreshValue();\n\t\t\t\tfor ( i = 0; i < valsLength; i += 1 ) {\n\t\t\t\t\tthis._change( null, i );\n\t\t\t\t}\n\t\t\t\tthis._animateOff = false;\n\t\t\t\tbreak;\n\t\t}\n\t},\n\n\t//internal value getter\n\t// _value() returns value trimmed by min and max, aligned by step\n\t_value: function() {\n\t\tvar val = this.options.value;\n\t\tval = this._trimAlignValue( val );\n\n\t\treturn val;\n\t},\n\n\t//internal values getter\n\t// _values() returns array of values trimmed by min and max, aligned by step\n\t// _values( index ) returns single value trimmed by min and max, aligned by step\n\t_values: function( index ) {\n\t\tvar val,\n\t\t\tvals,\n\t\t\ti;\n\n\t\tif ( arguments.length ) {\n\t\t\tval = this.options.values[ index ];\n\t\t\tval = this._trimAlignValue( val );\n\n\t\t\treturn val;\n\t\t} else {\n\t\t\t// .slice() creates a copy of the array\n\t\t\t// this copy gets trimmed by min and max and then returned\n\t\t\tvals = this.options.values.slice();\n\t\t\tfor ( i = 0; i < vals.length; i+= 1) {\n\t\t\t\tvals[ i ] = this._trimAlignValue( vals[ i ] );\n\t\t\t}\n\n\t\t\treturn vals;\n\t\t}\n\t},\n\t\n\t// returns the step-aligned value that val is closest to, between (inclusive) min and max\n\t_trimAlignValue: function( val ) {\n\t\tif ( val <= this._valueMin() ) {\n\t\t\treturn this._valueMin();\n\t\t}\n\t\tif ( val >= this._valueMax() ) {\n\t\t\treturn this._valueMax();\n\t\t}\n\t\tvar step = ( this.options.step > 0 ) ? this.options.step : 1,\n\t\t\tvalModStep = (val - this._valueMin()) % step,\n\t\t\talignValue = val - valModStep;\n\n\t\tif ( Math.abs(valModStep) * 2 >= step ) {\n\t\t\talignValue += ( valModStep > 0 ) ? step : ( -step );\n\t\t}\n\n\t\t// Since JavaScript has problems with large floats, round\n\t\t// the final value to 5 digits after the decimal point (see #4124)\n\t\treturn parseFloat( alignValue.toFixed(5) );\n\t},\n\n\t_valueMin: function() {\n\t\treturn this.options.min;\n\t},\n\n\t_valueMax: function() {\n\t\treturn this.options.max;\n\t},\n\t\n\t_refreshValue: function() {\n\t\tvar oRange = this.options.range,\n\t\t\to = this.options,\n\t\t\tself = this,\n\t\t\tanimate = ( !this._animateOff ) ? o.animate : false,\n\t\t\tvalPercent,\n\t\t\t_set = {},\n\t\t\tlastValPercent,\n\t\t\tvalue,\n\t\t\tvalueMin,\n\t\t\tvalueMax;\n\n\t\tif ( this.options.values && this.options.values.length ) {\n\t\t\tthis.handles.each(function( i, j ) {\n\t\t\t\tvalPercent = ( self.values(i) - self._valueMin() ) / ( self._valueMax() - self._valueMin() ) * 100;\n\t\t\t\t_set[ self.orientation === \"horizontal\" ? \"left\" : \"bottom\" ] = valPercent + \"%\";\n\t\t\t\t$( this ).stop( 1, 1 )[ animate ? \"animate\" : \"css\" ]( _set, o.animate );\n\t\t\t\tif ( self.options.range === true ) {\n\t\t\t\t\tif ( self.orientation === \"horizontal\" ) {\n\t\t\t\t\t\tif ( i === 0 ) {\n\t\t\t\t\t\t\tself.range.stop( 1, 1 )[ animate ? \"animate\" : \"css\" ]( { left: valPercent + \"%\" }, o.animate );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( i === 1 ) {\n\t\t\t\t\t\t\tself.range[ animate ? \"animate\" : \"css\" ]( { width: ( valPercent - lastValPercent ) + \"%\" }, { queue: false, duration: o.animate } );\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ( i === 0 ) {\n\t\t\t\t\t\t\tself.range.stop( 1, 1 )[ animate ? \"animate\" : \"css\" ]( { bottom: ( valPercent ) + \"%\" }, o.animate );\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( i === 1 ) {\n\t\t\t\t\t\t\tself.range[ animate ? \"animate\" : \"css\" ]( { height: ( valPercent - lastValPercent ) + \"%\" }, { queue: false, duration: o.animate } );\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlastValPercent = valPercent;\n\t\t\t});\n\t\t} else {\n\t\t\tvalue = this.value();\n\t\t\tvalueMin = this._valueMin();\n\t\t\tvalueMax = this._valueMax();\n\t\t\tvalPercent = ( valueMax !== valueMin ) ?\n\t\t\t\t\t( value - valueMin ) / ( valueMax - valueMin ) * 100 :\n\t\t\t\t\t0;\n\t\t\t_set[ self.orientation === \"horizontal\" ? \"left\" : \"bottom\" ] = valPercent + \"%\";\n\t\t\tthis.handle.stop( 1, 1 )[ animate ? \"animate\" : \"css\" ]( _set, o.animate );\n\n\t\t\tif ( oRange === \"min\" && this.orientation === \"horizontal\" ) {\n\t\t\t\tthis.range.stop( 1, 1 )[ animate ? \"animate\" : \"css\" ]( { width: valPercent + \"%\" }, o.animate );\n\t\t\t}\n\t\t\tif ( oRange === \"max\" && this.orientation === \"horizontal\" ) {\n\t\t\t\tthis.range[ animate ? \"animate\" : \"css\" ]( { width: ( 100 - valPercent ) + \"%\" }, { queue: false, duration: o.animate } );\n\t\t\t}\n\t\t\tif ( oRange === \"min\" && this.orientation === \"vertical\" ) {\n\t\t\t\tthis.range.stop( 1, 1 )[ animate ? \"animate\" : \"css\" ]( { height: valPercent + \"%\" }, o.animate );\n\t\t\t}\n\t\t\tif ( oRange === \"max\" && this.orientation === \"vertical\" ) {\n\t\t\t\tthis.range[ animate ? \"animate\" : \"css\" ]( { height: ( 100 - valPercent ) + \"%\" }, { queue: false, duration: o.animate } );\n\t\t\t}\n\t\t}\n\t}\n\n});\n\n$.extend( $.ui.slider, {\n\tversion: \"1.8.24\"\n});\n\n}(jQuery));\n\n(function( $, undefined ) {\n\nvar tabId = 0,\n\tlistId = 0;\n\nfunction getNextTabId() {\n\treturn ++tabId;\n}\n\nfunction getNextListId() {\n\treturn ++listId;\n}\n\n$.widget( \"ui.tabs\", {\n\toptions: {\n\t\tadd: null,\n\t\tajaxOptions: null,\n\t\tcache: false,\n\t\tcookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }\n\t\tcollapsible: false,\n\t\tdisable: null,\n\t\tdisabled: [],\n\t\tenable: null,\n\t\tevent: \"click\",\n\t\tfx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }\n\t\tidPrefix: \"ui-tabs-\",\n\t\tload: null,\n\t\tpanelTemplate: \"<div></div>\",\n\t\tremove: null,\n\t\tselect: null,\n\t\tshow: null,\n\t\tspinner: \"<em>Loading&#8230;</em>\",\n\t\ttabTemplate: \"<li><a href='#{href}'><span>#{label}</span></a></li>\"\n\t},\n\n\t_create: function() {\n\t\tthis._tabify( true );\n\t},\n\n\t_setOption: function( key, value ) {\n\t\tif ( key == \"selected\" ) {\n\t\t\tif (this.options.collapsible && value == this.options.selected ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tthis.select( value );\n\t\t} else {\n\t\t\tthis.options[ key ] = value;\n\t\t\tthis._tabify();\n\t\t}\n\t},\n\n\t_tabId: function( a ) {\n\t\treturn a.title && a.title.replace( /\\s/g, \"_\" ).replace( /[^\\w\\u00c0-\\uFFFF-]/g, \"\" ) ||\n\t\t\tthis.options.idPrefix + getNextTabId();\n\t},\n\n\t_sanitizeSelector: function( hash ) {\n\t\t// we need this because an id may contain a \":\"\n\t\treturn hash.replace( /:/g, \"\\\\:\" );\n\t},\n\n\t_cookie: function() {\n\t\tvar cookie = this.cookie ||\n\t\t\t( this.cookie = this.options.cookie.name || \"ui-tabs-\" + getNextListId() );\n\t\treturn $.cookie.apply( null, [ cookie ].concat( $.makeArray( arguments ) ) );\n\t},\n\n\t_ui: function( tab, panel ) {\n\t\treturn {\n\t\t\ttab: tab,\n\t\t\tpanel: panel,\n\t\t\tindex: this.anchors.index( tab )\n\t\t};\n\t},\n\n\t_cleanup: function() {\n\t\t// restore all former loading tabs labels\n\t\tthis.lis.filter( \".ui-state-processing\" )\n\t\t\t.removeClass( \"ui-state-processing\" )\n\t\t\t.find( \"span:data(label.tabs)\" )\n\t\t\t\t.each(function() {\n\t\t\t\t\tvar el = $( this );\n\t\t\t\t\tel.html( el.data( \"label.tabs\" ) ).removeData( \"label.tabs\" );\n\t\t\t\t});\n\t},\n\n\t_tabify: function( init ) {\n\t\tvar self = this,\n\t\t\to = this.options,\n\t\t\tfragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash\n\n\t\tthis.list = this.element.find( \"ol,ul\" ).eq( 0 );\n\t\tthis.lis = $( \" > li:has(a[href])\", this.list );\n\t\tthis.anchors = this.lis.map(function() {\n\t\t\treturn $( \"a\", this )[ 0 ];\n\t\t});\n\t\tthis.panels = $( [] );\n\n\t\tthis.anchors.each(function( i, a ) {\n\t\t\tvar href = $( a ).attr( \"href\" );\n\t\t\t// For dynamically created HTML that contains a hash as href IE < 8 expands\n\t\t\t// such href to the full page url with hash and then misinterprets tab as ajax.\n\t\t\t// Same consideration applies for an added tab with a fragment identifier\n\t\t\t// since a[href=#fragment-identifier] does unexpectedly not match.\n\t\t\t// Thus normalize href attribute...\n\t\t\tvar hrefBase = href.split( \"#\" )[ 0 ],\n\t\t\t\tbaseEl;\n\t\t\tif ( hrefBase && ( hrefBase === location.toString().split( \"#\" )[ 0 ] ||\n\t\t\t\t\t( baseEl = $( \"base\" )[ 0 ]) && hrefBase === baseEl.href ) ) {\n\t\t\t\thref = a.hash;\n\t\t\t\ta.href = href;\n\t\t\t}\n\n\t\t\t// inline tab\n\t\t\tif ( fragmentId.test( href ) ) {\n\t\t\t\tself.panels = self.panels.add( self.element.find( self._sanitizeSelector( href ) ) );\n\t\t\t// remote tab\n\t\t\t// prevent loading the page itself if href is just \"#\"\n\t\t\t} else if ( href && href !== \"#\" ) {\n\t\t\t\t// required for restore on destroy\n\t\t\t\t$.data( a, \"href.tabs\", href );\n\n\t\t\t\t// TODO until #3808 is fixed strip fragment identifier from url\n\t\t\t\t// (IE fails to load from such url)\n\t\t\t\t$.data( a, \"load.tabs\", href.replace( /#.*$/, \"\" ) );\n\n\t\t\t\tvar id = self._tabId( a );\n\t\t\t\ta.href = \"#\" + id;\n\t\t\t\tvar $panel = self.element.find( \"#\" + id );\n\t\t\t\tif ( !$panel.length ) {\n\t\t\t\t\t$panel = $( o.panelTemplate )\n\t\t\t\t\t\t.attr( \"id\", id )\n\t\t\t\t\t\t.addClass( \"ui-tabs-panel ui-widget-content ui-corner-bottom\" )\n\t\t\t\t\t\t.insertAfter( self.panels[ i - 1 ] || self.list );\n\t\t\t\t\t$panel.data( \"destroy.tabs\", true );\n\t\t\t\t}\n\t\t\t\tself.panels = self.panels.add( $panel );\n\t\t\t// invalid tab href\n\t\t\t} else {\n\t\t\t\to.disabled.push( i );\n\t\t\t}\n\t\t});\n\n\t\t// initialization from scratch\n\t\tif ( init ) {\n\t\t\t// attach necessary classes for styling\n\t\t\tthis.element.addClass( \"ui-tabs ui-widget ui-widget-content ui-corner-all\" );\n\t\t\tthis.list.addClass( \"ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all\" );\n\t\t\tthis.lis.addClass( \"ui-state-default ui-corner-top\" );\n\t\t\tthis.panels.addClass( \"ui-tabs-panel ui-widget-content ui-corner-bottom\" );\n\n\t\t\t// Selected tab\n\t\t\t// use \"selected\" option or try to retrieve:\n\t\t\t// 1. from fragment identifier in url\n\t\t\t// 2. from cookie\n\t\t\t// 3. from selected class attribute on <li>\n\t\t\tif ( o.selected === undefined ) {\n\t\t\t\tif ( location.hash ) {\n\t\t\t\t\tthis.anchors.each(function( i, a ) {\n\t\t\t\t\t\tif ( a.hash == location.hash ) {\n\t\t\t\t\t\t\to.selected = i;\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tif ( typeof o.selected !== \"number\" && o.cookie ) {\n\t\t\t\t\to.selected = parseInt( self._cookie(), 10 );\n\t\t\t\t}\n\t\t\t\tif ( typeof o.selected !== \"number\" && this.lis.filter( \".ui-tabs-selected\" ).length ) {\n\t\t\t\t\to.selected = this.lis.index( this.lis.filter( \".ui-tabs-selected\" ) );\n\t\t\t\t}\n\t\t\t\to.selected = o.selected || ( this.lis.length ? 0 : -1 );\n\t\t\t} else if ( o.selected === null ) { // usage of null is deprecated, TODO remove in next release\n\t\t\t\to.selected = -1;\n\t\t\t}\n\n\t\t\t// sanity check - default to first tab...\n\t\t\to.selected = ( ( o.selected >= 0 && this.anchors[ o.selected ] ) || o.selected < 0 )\n\t\t\t\t? o.selected\n\t\t\t\t: 0;\n\n\t\t\t// Take disabling tabs via class attribute from HTML\n\t\t\t// into account and update option properly.\n\t\t\t// A selected tab cannot become disabled.\n\t\t\to.disabled = $.unique( o.disabled.concat(\n\t\t\t\t$.map( this.lis.filter( \".ui-state-disabled\" ), function( n, i ) {\n\t\t\t\t\treturn self.lis.index( n );\n\t\t\t\t})\n\t\t\t) ).sort();\n\n\t\t\tif ( $.inArray( o.selected, o.disabled ) != -1 ) {\n\t\t\t\to.disabled.splice( $.inArray( o.selected, o.disabled ), 1 );\n\t\t\t}\n\n\t\t\t// highlight selected tab\n\t\t\tthis.panels.addClass( \"ui-tabs-hide\" );\n\t\t\tthis.lis.removeClass( \"ui-tabs-selected ui-state-active\" );\n\t\t\t// check for length avoids error when initializing empty list\n\t\t\tif ( o.selected >= 0 && this.anchors.length ) {\n\t\t\t\tself.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) ).removeClass( \"ui-tabs-hide\" );\n\t\t\t\tthis.lis.eq( o.selected ).addClass( \"ui-tabs-selected ui-state-active\" );\n\n\t\t\t\t// seems to be expected behavior that the show callback is fired\n\t\t\t\tself.element.queue( \"tabs\", function() {\n\t\t\t\t\tself._trigger( \"show\", null,\n\t\t\t\t\t\tself._ui( self.anchors[ o.selected ], self.element.find( self._sanitizeSelector( self.anchors[ o.selected ].hash ) )[ 0 ] ) );\n\t\t\t\t});\n\n\t\t\t\tthis.load( o.selected );\n\t\t\t}\n\n\t\t\t// clean up to avoid memory leaks in certain versions of IE 6\n\t\t\t// TODO: namespace this event\n\t\t\t$( window ).bind( \"unload\", function() {\n\t\t\t\tself.lis.add( self.anchors ).unbind( \".tabs\" );\n\t\t\t\tself.lis = self.anchors = self.panels = null;\n\t\t\t});\n\t\t// update selected after add/remove\n\t\t} else {\n\t\t\to.selected = this.lis.index( this.lis.filter( \".ui-tabs-selected\" ) );\n\t\t}\n\n\t\t// update collapsible\n\t\t// TODO: use .toggleClass()\n\t\tthis.element[ o.collapsible ? \"addClass\" : \"removeClass\" ]( \"ui-tabs-collapsible\" );\n\n\t\t// set or update cookie after init and add/remove respectively\n\t\tif ( o.cookie ) {\n\t\t\tthis._cookie( o.selected, o.cookie );\n\t\t}\n\n\t\t// disable tabs\n\t\tfor ( var i = 0, li; ( li = this.lis[ i ] ); i++ ) {\n\t\t\t$( li )[ $.inArray( i, o.disabled ) != -1 &&\n\t\t\t\t// TODO: use .toggleClass()\n\t\t\t\t!$( li ).hasClass( \"ui-tabs-selected\" ) ? \"addClass\" : \"removeClass\" ]( \"ui-state-disabled\" );\n\t\t}\n\n\t\t// reset cache if switching from cached to not cached\n\t\tif ( o.cache === false ) {\n\t\t\tthis.anchors.removeData( \"cache.tabs\" );\n\t\t}\n\n\t\t// remove all handlers before, tabify may run on existing tabs after add or option change\n\t\tthis.lis.add( this.anchors ).unbind( \".tabs\" );\n\n\t\tif ( o.event !== \"mouseover\" ) {\n\t\t\tvar addState = function( state, el ) {\n\t\t\t\tif ( el.is( \":not(.ui-state-disabled)\" ) ) {\n\t\t\t\t\tel.addClass( \"ui-state-\" + state );\n\t\t\t\t}\n\t\t\t};\n\t\t\tvar removeState = function( state, el ) {\n\t\t\t\tel.removeClass( \"ui-state-\" + state );\n\t\t\t};\n\t\t\tthis.lis.bind( \"mouseover.tabs\" , function() {\n\t\t\t\taddState( \"hover\", $( this ) );\n\t\t\t});\n\t\t\tthis.lis.bind( \"mouseout.tabs\", function() {\n\t\t\t\tremoveState( \"hover\", $( this ) );\n\t\t\t});\n\t\t\tthis.anchors.bind( \"focus.tabs\", function() {\n\t\t\t\taddState( \"focus\", $( this ).closest( \"li\" ) );\n\t\t\t});\n\t\t\tthis.anchors.bind( \"blur.tabs\", function() {\n\t\t\t\tremoveState( \"focus\", $( this ).closest( \"li\" ) );\n\t\t\t});\n\t\t}\n\n\t\t// set up animations\n\t\tvar hideFx, showFx;\n\t\tif ( o.fx ) {\n\t\t\tif ( $.isArray( o.fx ) ) {\n\t\t\t\thideFx = o.fx[ 0 ];\n\t\t\t\tshowFx = o.fx[ 1 ];\n\t\t\t} else {\n\t\t\t\thideFx = showFx = o.fx;\n\t\t\t}\n\t\t}\n\n\t\t// Reset certain styles left over from animation\n\t\t// and prevent IE's ClearType bug...\n\t\tfunction resetStyle( $el, fx ) {\n\t\t\t$el.css( \"display\", \"\" );\n\t\t\tif ( !$.support.opacity && fx.opacity ) {\n\t\t\t\t$el[ 0 ].style.removeAttribute( \"filter\" );\n\t\t\t}\n\t\t}\n\n\t\t// Show a tab...\n\t\tvar showTab = showFx\n\t\t\t? function( clicked, $show ) {\n\t\t\t\t$( clicked ).closest( \"li\" ).addClass( \"ui-tabs-selected ui-state-active\" );\n\t\t\t\t$show.hide().removeClass( \"ui-tabs-hide\" ) // avoid flicker that way\n\t\t\t\t\t.animate( showFx, showFx.duration || \"normal\", function() {\n\t\t\t\t\t\tresetStyle( $show, showFx );\n\t\t\t\t\t\tself._trigger( \"show\", null, self._ui( clicked, $show[ 0 ] ) );\n\t\t\t\t\t});\n\t\t\t}\n\t\t\t: function( clicked, $show ) {\n\t\t\t\t$( clicked ).closest( \"li\" ).addClass( \"ui-tabs-selected ui-state-active\" );\n\t\t\t\t$show.removeClass( \"ui-tabs-hide\" );\n\t\t\t\tself._trigger( \"show\", null, self._ui( clicked, $show[ 0 ] ) );\n\t\t\t};\n\n\t\t// Hide a tab, $show is optional...\n\t\tvar hideTab = hideFx\n\t\t\t? function( clicked, $hide ) {\n\t\t\t\t$hide.animate( hideFx, hideFx.duration || \"normal\", function() {\n\t\t\t\t\tself.lis.removeClass( \"ui-tabs-selected ui-state-active\" );\n\t\t\t\t\t$hide.addClass( \"ui-tabs-hide\" );\n\t\t\t\t\tresetStyle( $hide, hideFx );\n\t\t\t\t\tself.element.dequeue( \"tabs\" );\n\t\t\t\t});\n\t\t\t}\n\t\t\t: function( clicked, $hide, $show ) {\n\t\t\t\tself.lis.removeClass( \"ui-tabs-selected ui-state-active\" );\n\t\t\t\t$hide.addClass( \"ui-tabs-hide\" );\n\t\t\t\tself.element.dequeue( \"tabs\" );\n\t\t\t};\n\n\t\t// attach tab event handler, unbind to avoid duplicates from former tabifying...\n\t\tthis.anchors.bind( o.event + \".tabs\", function() {\n\t\t\tvar el = this,\n\t\t\t\t$li = $(el).closest( \"li\" ),\n\t\t\t\t$hide = self.panels.filter( \":not(.ui-tabs-hide)\" ),\n\t\t\t\t$show = self.element.find( self._sanitizeSelector( el.hash ) );\n\n\t\t\t// If tab is already selected and not collapsible or tab disabled or\n\t\t\t// or is already loading or click callback returns false stop here.\n\t\t\t// Check if click handler returns false last so that it is not executed\n\t\t\t// for a disabled or loading tab!\n\t\t\tif ( ( $li.hasClass( \"ui-tabs-selected\" ) && !o.collapsible) ||\n\t\t\t\t$li.hasClass( \"ui-state-disabled\" ) ||\n\t\t\t\t$li.hasClass( \"ui-state-processing\" ) ||\n\t\t\t\tself.panels.filter( \":animated\" ).length ||\n\t\t\t\tself._trigger( \"select\", null, self._ui( this, $show[ 0 ] ) ) === false ) {\n\t\t\t\tthis.blur();\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\to.selected = self.anchors.index( this );\n\n\t\t\tself.abort();\n\n\t\t\t// if tab may be closed\n\t\t\tif ( o.collapsible ) {\n\t\t\t\tif ( $li.hasClass( \"ui-tabs-selected\" ) ) {\n\t\t\t\t\to.selected = -1;\n\n\t\t\t\t\tif ( o.cookie ) {\n\t\t\t\t\t\tself._cookie( o.selected, o.cookie );\n\t\t\t\t\t}\n\n\t\t\t\t\tself.element.queue( \"tabs\", function() {\n\t\t\t\t\t\thideTab( el, $hide );\n\t\t\t\t\t}).dequeue( \"tabs\" );\n\n\t\t\t\t\tthis.blur();\n\t\t\t\t\treturn false;\n\t\t\t\t} else if ( !$hide.length ) {\n\t\t\t\t\tif ( o.cookie ) {\n\t\t\t\t\t\tself._cookie( o.selected, o.cookie );\n\t\t\t\t\t}\n\n\t\t\t\t\tself.element.queue( \"tabs\", function() {\n\t\t\t\t\t\tshowTab( el, $show );\n\t\t\t\t\t});\n\n\t\t\t\t\t// TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171\n\t\t\t\t\tself.load( self.anchors.index( this ) );\n\n\t\t\t\t\tthis.blur();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif ( o.cookie ) {\n\t\t\t\tself._cookie( o.selected, o.cookie );\n\t\t\t}\n\n\t\t\t// show new tab\n\t\t\tif ( $show.length ) {\n\t\t\t\tif ( $hide.length ) {\n\t\t\t\t\tself.element.queue( \"tabs\", function() {\n\t\t\t\t\t\thideTab( el, $hide );\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tself.element.queue( \"tabs\", function() {\n\t\t\t\t\tshowTab( el, $show );\n\t\t\t\t});\n\n\t\t\t\tself.load( self.anchors.index( this ) );\n\t\t\t} else {\n\t\t\t\tthrow \"jQuery UI Tabs: Mismatching fragment identifier.\";\n\t\t\t}\n\n\t\t\t// Prevent IE from keeping other link focussed when using the back button\n\t\t\t// and remove dotted border from clicked link. This is controlled via CSS\n\t\t\t// in modern browsers; blur() removes focus from address bar in Firefox\n\t\t\t// which can become a usability and annoying problem with tabs('rotate').\n\t\t\tif ( $.browser.msie ) {\n\t\t\t\tthis.blur();\n\t\t\t}\n\t\t});\n\n\t\t// disable click in any case\n\t\tthis.anchors.bind( \"click.tabs\", function(){\n\t\t\treturn false;\n\t\t});\n\t},\n\n    _getIndex: function( index ) {\n\t\t// meta-function to give users option to provide a href string instead of a numerical index.\n\t\t// also sanitizes numerical indexes to valid values.\n\t\tif ( typeof index == \"string\" ) {\n\t\t\tindex = this.anchors.index( this.anchors.filter( \"[href$='\" + index + \"']\" ) );\n\t\t}\n\n\t\treturn index;\n\t},\n\n\tdestroy: function() {\n\t\tvar o = this.options;\n\n\t\tthis.abort();\n\n\t\tthis.element\n\t\t\t.unbind( \".tabs\" )\n\t\t\t.removeClass( \"ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible\" )\n\t\t\t.removeData( \"tabs\" );\n\n\t\tthis.list.removeClass( \"ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all\" );\n\n\t\tthis.anchors.each(function() {\n\t\t\tvar href = $.data( this, \"href.tabs\" );\n\t\t\tif ( href ) {\n\t\t\t\tthis.href = href;\n\t\t\t}\n\t\t\tvar $this = $( this ).unbind( \".tabs\" );\n\t\t\t$.each( [ \"href\", \"load\", \"cache\" ], function( i, prefix ) {\n\t\t\t\t$this.removeData( prefix + \".tabs\" );\n\t\t\t});\n\t\t});\n\n\t\tthis.lis.unbind( \".tabs\" ).add( this.panels ).each(function() {\n\t\t\tif ( $.data( this, \"destroy.tabs\" ) ) {\n\t\t\t\t$( this ).remove();\n\t\t\t} else {\n\t\t\t\t$( this ).removeClass([\n\t\t\t\t\t\"ui-state-default\",\n\t\t\t\t\t\"ui-corner-top\",\n\t\t\t\t\t\"ui-tabs-selected\",\n\t\t\t\t\t\"ui-state-active\",\n\t\t\t\t\t\"ui-state-hover\",\n\t\t\t\t\t\"ui-state-focus\",\n\t\t\t\t\t\"ui-state-disabled\",\n\t\t\t\t\t\"ui-tabs-panel\",\n\t\t\t\t\t\"ui-widget-content\",\n\t\t\t\t\t\"ui-corner-bottom\",\n\t\t\t\t\t\"ui-tabs-hide\"\n\t\t\t\t].join( \" \" ) );\n\t\t\t}\n\t\t});\n\n\t\tif ( o.cookie ) {\n\t\t\tthis._cookie( null, o.cookie );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tadd: function( url, label, index ) {\n\t\tif ( index === undefined ) {\n\t\t\tindex = this.anchors.length;\n\t\t}\n\n\t\tvar self = this,\n\t\t\to = this.options,\n\t\t\t$li = $( o.tabTemplate.replace( /#\\{href\\}/g, url ).replace( /#\\{label\\}/g, label ) ),\n\t\t\tid = !url.indexOf( \"#\" ) ? url.replace( \"#\", \"\" ) : this._tabId( $( \"a\", $li )[ 0 ] );\n\n\t\t$li.addClass( \"ui-state-default ui-corner-top\" ).data( \"destroy.tabs\", true );\n\n\t\t// try to find an existing element before creating a new one\n\t\tvar $panel = self.element.find( \"#\" + id );\n\t\tif ( !$panel.length ) {\n\t\t\t$panel = $( o.panelTemplate )\n\t\t\t\t.attr( \"id\", id )\n\t\t\t\t.data( \"destroy.tabs\", true );\n\t\t}\n\t\t$panel.addClass( \"ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide\" );\n\n\t\tif ( index >= this.lis.length ) {\n\t\t\t$li.appendTo( this.list );\n\t\t\t$panel.appendTo( this.list[ 0 ].parentNode );\n\t\t} else {\n\t\t\t$li.insertBefore( this.lis[ index ] );\n\t\t\t$panel.insertBefore( this.panels[ index ] );\n\t\t}\n\n\t\to.disabled = $.map( o.disabled, function( n, i ) {\n\t\t\treturn n >= index ? ++n : n;\n\t\t});\n\n\t\tthis._tabify();\n\n\t\tif ( this.anchors.length == 1 ) {\n\t\t\to.selected = 0;\n\t\t\t$li.addClass( \"ui-tabs-selected ui-state-active\" );\n\t\t\t$panel.removeClass( \"ui-tabs-hide\" );\n\t\t\tthis.element.queue( \"tabs\", function() {\n\t\t\t\tself._trigger( \"show\", null, self._ui( self.anchors[ 0 ], self.panels[ 0 ] ) );\n\t\t\t});\n\n\t\t\tthis.load( 0 );\n\t\t}\n\n\t\tthis._trigger( \"add\", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );\n\t\treturn this;\n\t},\n\n\tremove: function( index ) {\n\t\tindex = this._getIndex( index );\n\t\tvar o = this.options,\n\t\t\t$li = this.lis.eq( index ).remove(),\n\t\t\t$panel = this.panels.eq( index ).remove();\n\n\t\t// If selected tab was removed focus tab to the right or\n\t\t// in case the last tab was removed the tab to the left.\n\t\tif ( $li.hasClass( \"ui-tabs-selected\" ) && this.anchors.length > 1) {\n\t\t\tthis.select( index + ( index + 1 < this.anchors.length ? 1 : -1 ) );\n\t\t}\n\n\t\to.disabled = $.map(\n\t\t\t$.grep( o.disabled, function(n, i) {\n\t\t\t\treturn n != index;\n\t\t\t}),\n\t\t\tfunction( n, i ) {\n\t\t\t\treturn n >= index ? --n : n;\n\t\t\t});\n\n\t\tthis._tabify();\n\n\t\tthis._trigger( \"remove\", null, this._ui( $li.find( \"a\" )[ 0 ], $panel[ 0 ] ) );\n\t\treturn this;\n\t},\n\n\tenable: function( index ) {\n\t\tindex = this._getIndex( index );\n\t\tvar o = this.options;\n\t\tif ( $.inArray( index, o.disabled ) == -1 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.lis.eq( index ).removeClass( \"ui-state-disabled\" );\n\t\to.disabled = $.grep( o.disabled, function( n, i ) {\n\t\t\treturn n != index;\n\t\t});\n\n\t\tthis._trigger( \"enable\", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );\n\t\treturn this;\n\t},\n\n\tdisable: function( index ) {\n\t\tindex = this._getIndex( index );\n\t\tvar self = this, o = this.options;\n\t\t// cannot disable already selected tab\n\t\tif ( index != o.selected ) {\n\t\t\tthis.lis.eq( index ).addClass( \"ui-state-disabled\" );\n\n\t\t\to.disabled.push( index );\n\t\t\to.disabled.sort();\n\n\t\t\tthis._trigger( \"disable\", null, this._ui( this.anchors[ index ], this.panels[ index ] ) );\n\t\t}\n\n\t\treturn this;\n\t},\n\n\tselect: function( index ) {\n\t\tindex = this._getIndex( index );\n\t\tif ( index == -1 ) {\n\t\t\tif ( this.options.collapsible && this.options.selected != -1 ) {\n\t\t\t\tindex = this.options.selected;\n\t\t\t} else {\n\t\t\t\treturn this;\n\t\t\t}\n\t\t}\n\t\tthis.anchors.eq( index ).trigger( this.options.event + \".tabs\" );\n\t\treturn this;\n\t},\n\n\tload: function( index ) {\n\t\tindex = this._getIndex( index );\n\t\tvar self = this,\n\t\t\to = this.options,\n\t\t\ta = this.anchors.eq( index )[ 0 ],\n\t\t\turl = $.data( a, \"load.tabs\" );\n\n\t\tthis.abort();\n\n\t\t// not remote or from cache\n\t\tif ( !url || this.element.queue( \"tabs\" ).length !== 0 && $.data( a, \"cache.tabs\" ) ) {\n\t\t\tthis.element.dequeue( \"tabs\" );\n\t\t\treturn;\n\t\t}\n\n\t\t// load remote from here on\n\t\tthis.lis.eq( index ).addClass( \"ui-state-processing\" );\n\n\t\tif ( o.spinner ) {\n\t\t\tvar span = $( \"span\", a );\n\t\t\tspan.data( \"label.tabs\", span.html() ).html( o.spinner );\n\t\t}\n\n\t\tthis.xhr = $.ajax( $.extend( {}, o.ajaxOptions, {\n\t\t\turl: url,\n\t\t\tsuccess: function( r, s ) {\n\t\t\t\tself.element.find( self._sanitizeSelector( a.hash ) ).html( r );\n\n\t\t\t\t// take care of tab labels\n\t\t\t\tself._cleanup();\n\n\t\t\t\tif ( o.cache ) {\n\t\t\t\t\t$.data( a, \"cache.tabs\", true );\n\t\t\t\t}\n\n\t\t\t\tself._trigger( \"load\", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );\n\t\t\t\ttry {\n\t\t\t\t\to.ajaxOptions.success( r, s );\n\t\t\t\t}\n\t\t\t\tcatch ( e ) {}\n\t\t\t},\n\t\t\terror: function( xhr, s, e ) {\n\t\t\t\t// take care of tab labels\n\t\t\t\tself._cleanup();\n\n\t\t\t\tself._trigger( \"load\", null, self._ui( self.anchors[ index ], self.panels[ index ] ) );\n\t\t\t\ttry {\n\t\t\t\t\t// Passing index avoid a race condition when this method is\n\t\t\t\t\t// called after the user has selected another tab.\n\t\t\t\t\t// Pass the anchor that initiated this request allows\n\t\t\t\t\t// loadError to manipulate the tab content panel via $(a.hash)\n\t\t\t\t\to.ajaxOptions.error( xhr, s, index, a );\n\t\t\t\t}\n\t\t\t\tcatch ( e ) {}\n\t\t\t}\n\t\t} ) );\n\n\t\t// last, so that load event is fired before show...\n\t\tself.element.dequeue( \"tabs\" );\n\n\t\treturn this;\n\t},\n\n\tabort: function() {\n\t\t// stop possibly running animations\n\t\tthis.element.queue( [] );\n\t\tthis.panels.stop( false, true );\n\n\t\t// \"tabs\" queue must not contain more than two elements,\n\t\t// which are the callbacks for the latest clicked tab...\n\t\tthis.element.queue( \"tabs\", this.element.queue( \"tabs\" ).splice( -2, 2 ) );\n\n\t\t// terminate pending requests from other tabs\n\t\tif ( this.xhr ) {\n\t\t\tthis.xhr.abort();\n\t\t\tdelete this.xhr;\n\t\t}\n\n\t\t// take care of tab labels\n\t\tthis._cleanup();\n\t\treturn this;\n\t},\n\n\turl: function( index, url ) {\n\t\tthis.anchors.eq( index ).removeData( \"cache.tabs\" ).data( \"load.tabs\", url );\n\t\treturn this;\n\t},\n\n\tlength: function() {\n\t\treturn this.anchors.length;\n\t}\n});\n\n$.extend( $.ui.tabs, {\n\tversion: \"1.8.24\"\n});\n\n/*\n * Tabs Extensions\n */\n\n/*\n * Rotate\n */\n$.extend( $.ui.tabs.prototype, {\n\trotation: null,\n\trotate: function( ms, continuing ) {\n\t\tvar self = this,\n\t\t\to = this.options;\n\n\t\tvar rotate = self._rotate || ( self._rotate = function( e ) {\n\t\t\tclearTimeout( self.rotation );\n\t\t\tself.rotation = setTimeout(function() {\n\t\t\t\tvar t = o.selected;\n\t\t\t\tself.select( ++t < self.anchors.length ? t : 0 );\n\t\t\t}, ms );\n\t\t\t\n\t\t\tif ( e ) {\n\t\t\t\te.stopPropagation();\n\t\t\t}\n\t\t});\n\n\t\tvar stop = self._unrotate || ( self._unrotate = !continuing\n\t\t\t? function(e) {\n\t\t\t\tif (e.clientX) { // in case of a true click\n\t\t\t\t\tself.rotate(null);\n\t\t\t\t}\n\t\t\t}\n\t\t\t: function( e ) {\n\t\t\t\trotate();\n\t\t\t});\n\n\t\t// start rotation\n\t\tif ( ms ) {\n\t\t\tthis.element.bind( \"tabsshow\", rotate );\n\t\t\tthis.anchors.bind( o.event + \".tabs\", stop );\n\t\t\trotate();\n\t\t// stop rotation\n\t\t} else {\n\t\t\tclearTimeout( self.rotation );\n\t\t\tthis.element.unbind( \"tabsshow\", rotate );\n\t\t\tthis.anchors.unbind( o.event + \".tabs\", stop );\n\t\t\tdelete this._rotate;\n\t\t\tdelete this._unrotate;\n\t\t}\n\n\t\treturn this;\n\t}\n});\n\n})( jQuery );\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Scripts/jquery.unobtrusive-ajax.js",
    "content": "﻿/*!\n** Unobtrusive Ajax support library for jQuery\n** Copyright (C) Microsoft Corporation. All rights reserved.\n*/\n\n/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */\n/*global window: false, jQuery: false */\n\n(function ($) {\n    var data_click = \"unobtrusiveAjaxClick\",\n        data_validation = \"unobtrusiveValidation\";\n\n    function getFunction(code, argNames) {\n        var fn = window, parts = (code || \"\").split(\".\");\n        while (fn && parts.length) {\n            fn = fn[parts.shift()];\n        }\n        if (typeof (fn) === \"function\") {\n            return fn;\n        }\n        argNames.push(code);\n        return Function.constructor.apply(null, argNames);\n    }\n\n    function isMethodProxySafe(method) {\n        return method === \"GET\" || method === \"POST\";\n    }\n\n    function asyncOnBeforeSend(xhr, method) {\n        if (!isMethodProxySafe(method)) {\n            xhr.setRequestHeader(\"X-HTTP-Method-Override\", method);\n        }\n    }\n\n    function asyncOnSuccess(element, data, contentType) {\n        var mode;\n\n        if (contentType.indexOf(\"application/x-javascript\") !== -1) {  // jQuery already executes JavaScript for us\n            return;\n        }\n\n        mode = (element.getAttribute(\"data-ajax-mode\") || \"\").toUpperCase();\n        $(element.getAttribute(\"data-ajax-update\")).each(function (i, update) {\n            var top;\n\n            switch (mode) {\n            case \"BEFORE\":\n                top = update.firstChild;\n                $(\"<div />\").html(data).contents().each(function () {\n                    update.insertBefore(this, top);\n                });\n                break;\n            case \"AFTER\":\n                $(\"<div />\").html(data).contents().each(function () {\n                    update.appendChild(this);\n                });\n                break;\n            default:\n                $(update).html(data);\n                break;\n            }\n        });\n    }\n\n    function asyncRequest(element, options) {\n        var confirm, loading, method, duration;\n\n        confirm = element.getAttribute(\"data-ajax-confirm\");\n        if (confirm && !window.confirm(confirm)) {\n            return;\n        }\n\n        loading = $(element.getAttribute(\"data-ajax-loading\"));\n        duration = element.getAttribute(\"data-ajax-loading-duration\") || 0;\n\n        $.extend(options, {\n            type: element.getAttribute(\"data-ajax-method\") || undefined,\n            url: element.getAttribute(\"data-ajax-url\") || undefined,\n            beforeSend: function (xhr) {\n                var result;\n                asyncOnBeforeSend(xhr, method);\n                result = getFunction(element.getAttribute(\"data-ajax-begin\"), [\"xhr\"]).apply(this, arguments);\n                if (result !== false) {\n                    loading.show(duration);\n                }\n                return result;\n            },\n            complete: function () {\n                loading.hide(duration);\n                getFunction(element.getAttribute(\"data-ajax-complete\"), [\"xhr\", \"status\"]).apply(this, arguments);\n            },\n            success: function (data, status, xhr) {\n                asyncOnSuccess(element, data, xhr.getResponseHeader(\"Content-Type\") || \"text/html\");\n                getFunction(element.getAttribute(\"data-ajax-success\"), [\"data\", \"status\", \"xhr\"]).apply(this, arguments);\n            },\n            error: getFunction(element.getAttribute(\"data-ajax-failure\"), [\"xhr\", \"status\", \"error\"])\n        });\n\n        options.data.push({ name: \"X-Requested-With\", value: \"XMLHttpRequest\" });\n\n        method = options.type.toUpperCase();\n        if (!isMethodProxySafe(method)) {\n            options.type = \"POST\";\n            options.data.push({ name: \"X-HTTP-Method-Override\", value: method });\n        }\n\n        $.ajax(options);\n    }\n\n    function validate(form) {\n        var validationInfo = $(form).data(data_validation);\n        return !validationInfo || !validationInfo.validate || validationInfo.validate();\n    }\n\n    $(document).on(\"click\", \"a[data-ajax=true]\", function (evt) {\n        evt.preventDefault();\n        asyncRequest(this, {\n            url: this.href,\n            type: \"GET\",\n            data: []\n        });\n    });\n\n    $(document).on(\"click\", \"form[data-ajax=true] input[type=image]\", function (evt) {\n        var name = evt.target.name,\n            $target = $(evt.target),\n            form = $target.parents(\"form\")[0],\n            offset = $target.offset();\n\n        $(form).data(data_click, [\n            { name: name + \".x\", value: Math.round(evt.pageX - offset.left) },\n            { name: name + \".y\", value: Math.round(evt.pageY - offset.top) }\n        ]);\n\n        setTimeout(function () {\n            $(form).removeData(data_click);\n        }, 0);\n    });\n\n    $(document).on(\"click\", \"form[data-ajax=true] :submit\", function (evt) {\n        var name = evt.target.name,\n            form = $(evt.target).parents(\"form\")[0];\n\n        $(form).data(data_click, name ? [{ name: name, value: evt.target.value }] : []);\n\n        setTimeout(function () {\n            $(form).removeData(data_click);\n        }, 0);\n    });\n\n    $(document).on(\"submit\", \"form[data-ajax=true]\", function (evt) {\n        var clickInfo = $(this).data(data_click) || [];\n        evt.preventDefault();\n        if (!validate(this)) {\n            return;\n        }\n        asyncRequest(this, {\n            url: this.action,\n            type: this.method || \"GET\",\n            data: clickInfo.concat($(this).serializeArray())\n        });\n    });\n}(jQuery));"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Scripts/jquery.validate-vsdoc.js",
    "content": "/*\n* This file has been commented to support Visual Studio Intellisense.\n* You should not use this file at runtime inside the browser--it is only\n* intended to be used only for design-time IntelliSense.  Please use the\n* standard jQuery library for all production use.\n*\n* Comment version: 1.10.0\n*/\n\n/*\n* Note: While Microsoft is not the author of this file, Microsoft is\n* offering you a license subject to the terms of the Microsoft Software\n* License Terms for Microsoft ASP.NET Model View Controller 3.\n* Microsoft reserves all other rights. The notices below are provided\n* for informational purposes only and are not the license terms under\n* which Microsoft distributed this file.\n*\n* jQuery validation plugin 1.10.0\n*\n* http://bassistance.de/jquery-plugins/jquery-plugin-validation/\n* http://docs.jquery.com/Plugins/Validation\n*\n* Copyright (c) 2006 - 2011 Jörn Zaefferer\n*\n*/\n\n(function($) {\n\n$.extend($.fn, {\n\t// http://docs.jquery.com/Plugins/Validation/validate\n\tvalidate: function( options ) {\n\t\t/// <summary>\n\t\t/// Validates the selected form. This method sets up event handlers for submit, focus,\n\t\t/// keyup, blur and click to trigger validation of the entire form or individual\n\t\t/// elements. Each one can be disabled, see the onxxx options (onsubmit, onfocusout,\n\t\t/// onkeyup, onclick). focusInvalid focuses elements when submitting a invalid form.\n\t\t/// </summary>\n\t\t/// <param name=\"options\" type=\"Object\">\n\t\t/// A set of key/value pairs that configure the validate. All options are optional.\n\t\t/// </param>\n\n\t\t// if nothing is selected, return nothing; can't chain anyway\n\t\tif (!this.length) {\n\t\t\toptions && options.debug && window.console && console.warn( \"nothing selected, can't validate, returning nothing\" );\n\t\t\treturn;\n\t\t}\n\n\t\t// check if a validator for this form was already created\n\t\tvar validator = $.data(this[0], 'validator');\n\t\tif ( validator ) {\n\t\t\treturn validator;\n\t\t}\n\t\t\n\t\tvalidator = new $.validator( options, this[0] );\n\t\t$.data(this[0], 'validator', validator); \n\t\t\n\t\tif ( validator.settings.onsubmit ) {\n\t\t\n\t\t\t// allow suppresing validation by adding a cancel class to the submit button\n\t\t\tthis.find(\"input, button\").filter(\".cancel\").click(function() {\n\t\t\t\tvalidator.cancelSubmit = true;\n\t\t\t});\n\t\t\t\n\t\t\t// when a submitHandler is used, capture the submitting button\n\t\t\tif (validator.settings.submitHandler) {\n\t\t\t\tthis.find(\"input, button\").filter(\":submit\").click(function() {\n\t\t\t\t\tvalidator.submitButton = this;\n\t\t\t\t});\n\t\t\t}\n\t\t\n\t\t\t// validate the form on submit\n\t\t\tthis.submit( function( event ) {\n\t\t\t\tif ( validator.settings.debug )\n\t\t\t\t\t// prevent form submit to be able to see console output\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\n\t\t\t\tfunction handle() {\n\t\t\t\t\tif ( validator.settings.submitHandler ) {\n\t\t\t\t\t\tif (validator.submitButton) {\n\t\t\t\t\t\t\t// insert a hidden input as a replacement for the missing submit button\n\t\t\t\t\t\t\tvar hidden = $(\"<input type='hidden'/>\").attr(\"name\", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalidator.settings.submitHandler.call( validator, validator.currentForm );\n\t\t\t\t\t\tif (validator.submitButton) {\n\t\t\t\t\t\t\t// and clean up afterwards; thanks to no-block-scope, hidden can be referenced\n\t\t\t\t\t\t\thidden.remove();\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t// prevent submit for invalid forms or custom submit handlers\n\t\t\t\tif ( validator.cancelSubmit ) {\n\t\t\t\t\tvalidator.cancelSubmit = false;\n\t\t\t\t\treturn handle();\n\t\t\t\t}\n\t\t\t\tif ( validator.form() ) {\n\t\t\t\t\tif ( validator.pendingRequest ) {\n\t\t\t\t\t\tvalidator.formSubmitted = true;\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\treturn handle();\n\t\t\t\t} else {\n\t\t\t\t\tvalidator.focusInvalid();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\t\n\t\treturn validator;\n\t},\n\t// http://docs.jquery.com/Plugins/Validation/valid\n\tvalid: function() {\n\t\t/// <summary>\n\t\t/// Checks if the selected form is valid or if all selected elements are valid.\n\t\t/// validate() needs to be called on the form before checking it using this method.\n\t\t/// </summary>\n\t\t/// <returns type=\"Boolean\" />\n\n        if ( $(this[0]).is('form')) {\n            return this.validate().form();\n        } else {\n            var valid = true;\n            var validator = $(this[0].form).validate();\n            this.each(function() {\n\t\t\t\tvalid &= validator.element(this);\n            });\n            return valid;\n        }\n    },\n\t// attributes: space seperated list of attributes to retrieve and remove\n\tremoveAttrs: function(attributes) {\n\t\t/// <summary>\n\t\t/// Remove the specified attributes from the first matched element and return them.\n\t\t/// </summary>\n\t\t/// <param name=\"attributes\" type=\"String\">\n\t\t/// A space-seperated list of attribute names to remove.\n\t\t/// </param>\n\n\t\tvar result = {},\n\t\t\t$element = this;\n\t\t$.each(attributes.split(/\\s/), function(index, value) {\n\t\t\tresult[value] = $element.attr(value);\n\t\t\t$element.removeAttr(value);\n\t\t});\n\t\treturn result;\n\t},\n\t// http://docs.jquery.com/Plugins/Validation/rules\n\trules: function(command, argument) {\n\t\t/// <summary>\n\t\t/// Return the validations rules for the first selected element.\n\t\t/// </summary>\n\t\t/// <param name=\"command\" type=\"String\">\n\t\t/// Can be either \"add\" or \"remove\".\n\t\t/// </param>\n\t\t/// <param name=\"argument\" type=\"\">\n\t\t/// A list of rules to add or remove.\n\t\t/// </param>\n\n\t\tvar element = this[0];\n\t\t\n\t\tif (command) {\n\t\t\tvar settings = $.data(element.form, 'validator').settings;\n\t\t\tvar staticRules = settings.rules;\n\t\t\tvar existingRules = $.validator.staticRules(element);\n\t\t\tswitch(command) {\n\t\t\tcase \"add\":\n\t\t\t\t$.extend(existingRules, $.validator.normalizeRule(argument));\n\t\t\t\tstaticRules[element.name] = existingRules;\n\t\t\t\tif (argument.messages)\n\t\t\t\t\tsettings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );\n\t\t\t\tbreak;\n\t\t\tcase \"remove\":\n\t\t\t\tif (!argument) {\n\t\t\t\t\tdelete staticRules[element.name];\n\t\t\t\t\treturn existingRules;\n\t\t\t\t}\n\t\t\t\tvar filtered = {};\n\t\t\t\t$.each(argument.split(/\\s/), function(index, method) {\n\t\t\t\t\tfiltered[method] = existingRules[method];\n\t\t\t\t\tdelete existingRules[method];\n\t\t\t\t});\n\t\t\t\treturn filtered;\n\t\t\t}\n\t\t}\n\t\t\n\t\tvar data = $.validator.normalizeRules(\n\t\t$.extend(\n\t\t\t{},\n\t\t\t$.validator.metadataRules(element),\n\t\t\t$.validator.classRules(element),\n\t\t\t$.validator.attributeRules(element),\n\t\t\t$.validator.staticRules(element)\n\t\t), element);\n\t\t\n\t\t// make sure required is at front\n\t\tif (data.required) {\n\t\t\tvar param = data.required;\n\t\t\tdelete data.required;\n\t\t\tdata = $.extend({required: param}, data);\n\t\t}\n\t\t\n\t\treturn data;\n\t}\n});\n\n// Custom selectors\n$.extend($.expr[\":\"], {\n\t// http://docs.jquery.com/Plugins/Validation/blank\n\tblank: function(a) {return !$.trim(\"\" + a.value);},\n\t// http://docs.jquery.com/Plugins/Validation/filled\n\tfilled: function(a) {return !!$.trim(\"\" + a.value);},\n\t// http://docs.jquery.com/Plugins/Validation/unchecked\n\tunchecked: function(a) {return !a.checked;}\n});\n\n// constructor for validator\n$.validator = function( options, form ) {\n\tthis.settings = $.extend( true, {}, $.validator.defaults, options );\n\tthis.currentForm = form;\n\tthis.init();\n};\n\n$.validator.format = function(source, params) {\n\t/// <summary>\n\t/// Replaces {n} placeholders with arguments.\n\t/// One or more arguments can be passed, in addition to the string template itself, to insert\n\t/// into the string.\n\t/// </summary>\n\t/// <param name=\"source\" type=\"String\">\n\t/// The string to format.\n\t/// </param>\n\t/// <param name=\"params\" type=\"String\">\n\t/// The first argument to insert, or an array of Strings to insert\n\t/// </param>\n\t/// <returns type=\"String\" />\n\n\tif ( arguments.length == 1 ) \n\t\treturn function() {\n\t\t\tvar args = $.makeArray(arguments);\n\t\t\targs.unshift(source);\n\t\t\treturn $.validator.format.apply( this, args );\n\t\t};\n\tif ( arguments.length > 2 && params.constructor != Array  ) {\n\t\tparams = $.makeArray(arguments).slice(1);\n\t}\n\tif ( params.constructor != Array ) {\n\t\tparams = [ params ];\n\t}\n\t$.each(params, function(i, n) {\n\t\tsource = source.replace(new RegExp(\"\\\\{\" + i + \"\\\\}\", \"g\"), n);\n\t});\n\treturn source;\n};\n\n$.extend($.validator, {\n\t\n\tdefaults: {\n\t\tmessages: {},\n\t\tgroups: {},\n\t\trules: {},\n\t\terrorClass: \"error\",\n\t\tvalidClass: \"valid\",\n\t\terrorElement: \"label\",\n\t\tfocusInvalid: true,\n\t\terrorContainer: $( [] ),\n\t\terrorLabelContainer: $( [] ),\n\t\tonsubmit: true,\n\t\tignore: [],\n\t\tignoreTitle: false,\n\t\tonfocusin: function(element) {\n\t\t\tthis.lastActive = element;\n\t\t\t\t\n\t\t\t// hide error label and remove error class on focus if enabled\n\t\t\tif ( this.settings.focusCleanup && !this.blockFocusCleanup ) {\n\t\t\t\tthis.settings.unhighlight && this.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );\n\t\t\t\tthis.addWrapper(this.errorsFor(element)).hide();\n\t\t\t}\n\t\t},\n\t\tonfocusout: function(element) {\n\t\t\tif ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {\n\t\t\t\tthis.element(element);\n\t\t\t}\n\t\t},\n\t\tonkeyup: function(element) {\n\t\t\tif ( element.name in this.submitted || element == this.lastElement ) {\n\t\t\t\tthis.element(element);\n\t\t\t}\n\t\t},\n\t\tonclick: function(element) {\n\t\t\t// click on selects, radiobuttons and checkboxes\n\t\t\tif ( element.name in this.submitted )\n\t\t\t\tthis.element(element);\n\t\t\t// or option elements, check parent select in that case\n\t\t\telse if (element.parentNode.name in this.submitted)\n\t\t\t\tthis.element(element.parentNode);\n\t\t},\n\t\thighlight: function( element, errorClass, validClass ) {\n\t\t\t$(element).addClass(errorClass).removeClass(validClass);\n\t\t},\n\t\tunhighlight: function( element, errorClass, validClass ) {\n\t\t\t$(element).removeClass(errorClass).addClass(validClass);\n\t\t}\n\t},\n\n\t// http://docs.jquery.com/Plugins/Validation/Validator/setDefaults\n\tsetDefaults: function(settings) {\n\t\t/// <summary>\n\t\t/// Modify default settings for validation.\n\t\t/// Accepts everything that Plugins/Validation/validate accepts.\n\t\t/// </summary>\n\t\t/// <param name=\"settings\" type=\"Options\">\n\t\t/// Options to set as default.\n\t\t/// </param>\n\n\t\t$.extend( $.validator.defaults, settings );\n\t},\n\n\tmessages: {\n\t\trequired: \"This field is required.\",\n\t\tremote: \"Please fix this field.\",\n\t\temail: \"Please enter a valid email address.\",\n\t\turl: \"Please enter a valid URL.\",\n\t\tdate: \"Please enter a valid date.\",\n\t\tdateISO: \"Please enter a valid date (ISO).\",\n\t\tnumber: \"Please enter a valid number.\",\n\t\tdigits: \"Please enter only digits.\",\n\t\tcreditcard: \"Please enter a valid credit card number.\",\n\t\tequalTo: \"Please enter the same value again.\",\n\t\taccept: \"Please enter a value with a valid extension.\",\n\t\tmaxlength: $.validator.format(\"Please enter no more than {0} characters.\"),\n\t\tminlength: $.validator.format(\"Please enter at least {0} characters.\"),\n\t\trangelength: $.validator.format(\"Please enter a value between {0} and {1} characters long.\"),\n\t\trange: $.validator.format(\"Please enter a value between {0} and {1}.\"),\n\t\tmax: $.validator.format(\"Please enter a value less than or equal to {0}.\"),\n\t\tmin: $.validator.format(\"Please enter a value greater than or equal to {0}.\")\n\t},\n\t\n\tautoCreateRanges: false,\n\t\n\tprototype: {\n\t\t\n\t\tinit: function() {\n\t\t\tthis.labelContainer = $(this.settings.errorLabelContainer);\n\t\t\tthis.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);\n\t\t\tthis.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer );\n\t\t\tthis.submitted = {};\n\t\t\tthis.valueCache = {};\n\t\t\tthis.pendingRequest = 0;\n\t\t\tthis.pending = {};\n\t\t\tthis.invalid = {};\n\t\t\tthis.reset();\n\t\t\t\n\t\t\tvar groups = (this.groups = {});\n\t\t\t$.each(this.settings.groups, function(key, value) {\n\t\t\t\t$.each(value.split(/\\s/), function(index, name) {\n\t\t\t\t\tgroups[name] = key;\n\t\t\t\t});\n\t\t\t});\n\t\t\tvar rules = this.settings.rules;\n\t\t\t$.each(rules, function(key, value) {\n\t\t\t\trules[key] = $.validator.normalizeRule(value);\n\t\t\t});\n\t\t\t\n\t\t\tfunction delegate(event) {\n\t\t\t\tvar validator = $.data(this[0].form, \"validator\"),\n\t\t\t\t\teventType = \"on\" + event.type.replace(/^validate/, \"\");\n\t\t\t\tvalidator.settings[eventType] && validator.settings[eventType].call(validator, this[0] );\n\t\t\t}\n\t\t\t$(this.currentForm)\n\t\t\t\t.validateDelegate(\":text, :password, :file, select, textarea\", \"focusin focusout keyup\", delegate)\n\t\t\t\t.validateDelegate(\":radio, :checkbox, select, option\", \"click\", delegate);\n\n\t\t\tif (this.settings.invalidHandler)\n\t\t\t\t$(this.currentForm).bind(\"invalid-form.validate\", this.settings.invalidHandler);\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Validator/form\n\t\tform: function() {\n\t\t\t/// <summary>\n\t\t\t/// Validates the form, returns true if it is valid, false otherwise.\n\t\t\t/// This behaves as a normal submit event, but returns the result.\n\t\t\t/// </summary>\n\t\t\t/// <returns type=\"Boolean\" />\n\n\t\t\tthis.checkForm();\n\t\t\t$.extend(this.submitted, this.errorMap);\n\t\t\tthis.invalid = $.extend({}, this.errorMap);\n\t\t\tif (!this.valid())\n\t\t\t\t$(this.currentForm).triggerHandler(\"invalid-form\", [this]);\n\t\t\tthis.showErrors();\n\t\t\treturn this.valid();\n\t\t},\n\t\t\n\t\tcheckForm: function() {\n\t\t\tthis.prepareForm();\n\t\t\tfor ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {\n\t\t\t\tthis.check( elements[i] );\n\t\t\t}\n\t\t\treturn this.valid(); \n\t\t},\n\t\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Validator/element\n\t\telement: function( element ) {\n\t\t\t/// <summary>\n\t\t\t/// Validates a single element, returns true if it is valid, false otherwise.\n\t\t\t/// This behaves as validation on blur or keyup, but returns the result.\n\t\t\t/// </summary>\n\t\t\t/// <param name=\"element\" type=\"Selector\">\n\t\t\t/// An element to validate, must be inside the validated form.\n\t\t\t/// </param>\n\t\t\t/// <returns type=\"Boolean\" />\n\n\t\t\telement = this.clean( element );\n\t\t\tthis.lastElement = element;\n\t\t\tthis.prepareElement( element );\n\t\t\tthis.currentElements = $(element);\n\t\t\tvar result = this.check( element );\n\t\t\tif ( result ) {\n\t\t\t\tdelete this.invalid[element.name];\n\t\t\t} else {\n\t\t\t\tthis.invalid[element.name] = true;\n\t\t\t}\n\t\t\tif ( !this.numberOfInvalids() ) {\n\t\t\t\t// Hide error containers on last error\n\t\t\t\tthis.toHide = this.toHide.add( this.containers );\n\t\t\t}\n\t\t\tthis.showErrors();\n\t\t\treturn result;\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Validator/showErrors\n\t\tshowErrors: function(errors) {\n\t\t\t/// <summary>\n\t\t\t/// Show the specified messages.\n\t\t\t/// Keys have to refer to the names of elements, values are displayed for those elements, using the configured error placement.\n\t\t\t/// </summary>\n\t\t\t/// <param name=\"errors\" type=\"Object\">\n\t\t\t/// One or more key/value pairs of input names and messages.\n\t\t\t/// </param>\n\n\t\t\tif(errors) {\n\t\t\t\t// add items to error list and map\n\t\t\t\t$.extend( this.errorMap, errors );\n\t\t\t\tthis.errorList = [];\n\t\t\t\tfor ( var name in errors ) {\n\t\t\t\t\tthis.errorList.push({\n\t\t\t\t\t\tmessage: errors[name],\n\t\t\t\t\t\telement: this.findByName(name)[0]\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t// remove items from success list\n\t\t\t\tthis.successList = $.grep( this.successList, function(element) {\n\t\t\t\t\treturn !(element.name in errors);\n\t\t\t\t});\n\t\t\t}\n\t\t\tthis.settings.showErrors\n\t\t\t\t? this.settings.showErrors.call( this, this.errorMap, this.errorList )\n\t\t\t\t: this.defaultShowErrors();\n\t\t},\n\t\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Validator/resetForm\n\t\tresetForm: function() {\n\t\t\t/// <summary>\n\t\t\t/// Resets the controlled form.\n\t\t\t/// Resets input fields to their original value (requires form plugin), removes classes\n\t\t\t/// indicating invalid elements and hides error messages.\n\t\t\t/// </summary>\n\n\t\t\tif ( $.fn.resetForm )\n\t\t\t\t$( this.currentForm ).resetForm();\n\t\t\tthis.submitted = {};\n\t\t\tthis.prepareForm();\n\t\t\tthis.hideErrors();\n\t\t\tthis.elements().removeClass( this.settings.errorClass );\n\t\t},\n\t\t\n\t\tnumberOfInvalids: function() {\n\t\t\t/// <summary>\n\t\t\t/// Returns the number of invalid fields.\n\t\t\t/// This depends on the internal validator state. It covers all fields only after\n\t\t\t/// validating the complete form (on submit or via $(\"form\").valid()). After validating\n\t\t\t/// a single element, only that element is counted. Most useful in combination with the\n\t\t\t/// invalidHandler-option.\n\t\t\t/// </summary>\n\t\t\t/// <returns type=\"Number\" />\n\n\t\t\treturn this.objectLength(this.invalid);\n\t\t},\n\t\t\n\t\tobjectLength: function( obj ) {\n\t\t\tvar count = 0;\n\t\t\tfor ( var i in obj )\n\t\t\t\tcount++;\n\t\t\treturn count;\n\t\t},\n\t\t\n\t\thideErrors: function() {\n\t\t\tthis.addWrapper( this.toHide ).hide();\n\t\t},\n\t\t\n\t\tvalid: function() {\n\t\t\treturn this.size() == 0;\n\t\t},\n\t\t\n\t\tsize: function() {\n\t\t\treturn this.errorList.length;\n\t\t},\n\t\t\n\t\tfocusInvalid: function() {\n\t\t\tif( this.settings.focusInvalid ) {\n\t\t\t\ttry {\n\t\t\t\t\t$(this.findLastActive() || this.errorList.length && this.errorList[0].element || [])\n\t\t\t\t\t.filter(\":visible\")\n\t\t\t\t\t.focus()\n\t\t\t\t\t// manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find\n\t\t\t\t\t.trigger(\"focusin\");\n\t\t\t\t} catch(e) {\n\t\t\t\t\t// ignore IE throwing errors when focusing hidden elements\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t\n\t\tfindLastActive: function() {\n\t\t\tvar lastActive = this.lastActive;\n\t\t\treturn lastActive && $.grep(this.errorList, function(n) {\n\t\t\t\treturn n.element.name == lastActive.name;\n\t\t\t}).length == 1 && lastActive;\n\t\t},\n\t\t\n\t\telements: function() {\n\t\t\tvar validator = this,\n\t\t\t\trulesCache = {};\n\t\t\t\n\t\t\t// select all valid inputs inside the form (no submit or reset buttons)\n\t\t\t// workaround $Query([]).add until http://dev.jquery.com/ticket/2114 is solved\n\t\t\treturn $([]).add(this.currentForm.elements)\n\t\t\t.filter(\":input\")\n\t\t\t.not(\":submit, :reset, :image, [disabled]\")\n\t\t\t.not( this.settings.ignore )\n\t\t\t.filter(function() {\n\t\t\t\t!this.name && validator.settings.debug && window.console && console.error( \"%o has no name assigned\", this);\n\t\t\t\n\t\t\t\t// select only the first element for each name, and only those with rules specified\n\t\t\t\tif ( this.name in rulesCache || !validator.objectLength($(this).rules()) )\n\t\t\t\t\treturn false;\n\t\t\t\t\n\t\t\t\trulesCache[this.name] = true;\n\t\t\t\treturn true;\n\t\t\t});\n\t\t},\n\t\t\n\t\tclean: function( selector ) {\n\t\t\treturn $( selector )[0];\n\t\t},\n\t\t\n\t\terrors: function() {\n\t\t\treturn $( this.settings.errorElement + \".\" + this.settings.errorClass, this.errorContext );\n\t\t},\n\t\t\n\t\treset: function() {\n\t\t\tthis.successList = [];\n\t\t\tthis.errorList = [];\n\t\t\tthis.errorMap = {};\n\t\t\tthis.toShow = $([]);\n\t\t\tthis.toHide = $([]);\n\t\t\tthis.currentElements = $([]);\n\t\t},\n\t\t\n\t\tprepareForm: function() {\n\t\t\tthis.reset();\n\t\t\tthis.toHide = this.errors().add( this.containers );\n\t\t},\n\t\t\n\t\tprepareElement: function( element ) {\n\t\t\tthis.reset();\n\t\t\tthis.toHide = this.errorsFor(element);\n\t\t},\n\t\n\t\tcheck: function( element ) {\n\t\t\telement = this.clean( element );\n\t\t\t\n\t\t\t// if radio/checkbox, validate first element in group instead\n\t\t\tif (this.checkable(element)) {\n\t\t\t    element = this.findByName(element.name).not(this.settings.ignore)[0];\n\t\t\t}\n\t\t\t\n\t\t\tvar rules = $(element).rules();\n\t\t\tvar dependencyMismatch = false;\n\t\t\tfor (var method in rules) {\n\t\t\t\tvar rule = { method: method, parameters: rules[method] };\n\t\t\t\ttry {\n\t\t\t\t\tvar result = $.validator.methods[method].call( this, element.value.replace(/\\r/g, \"\"), element, rule.parameters );\n\t\t\t\t\t\n\t\t\t\t\t// if a method indicates that the field is optional and therefore valid,\n\t\t\t\t\t// don't mark it as valid when there are no other rules\n\t\t\t\t\tif ( result == \"dependency-mismatch\" ) {\n\t\t\t\t\t\tdependencyMismatch = true;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tdependencyMismatch = false;\n\t\t\t\t\t\n\t\t\t\t\tif ( result == \"pending\" ) {\n\t\t\t\t\t\tthis.toHide = this.toHide.not( this.errorsFor(element) );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif( !result ) {\n\t\t\t\t\t\tthis.formatAndAdd( element, rule );\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} catch(e) {\n\t\t\t\t\tthis.settings.debug && window.console && console.log(\"exception occured when checking element \" + element.id\n\t\t\t\t\t\t + \", check the '\" + rule.method + \"' method\", e);\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (dependencyMismatch)\n\t\t\t\treturn;\n\t\t\tif ( this.objectLength(rules) )\n\t\t\t\tthis.successList.push(element);\n\t\t\treturn true;\n\t\t},\n\t\t\n\t\t// return the custom message for the given element and validation method\n\t\t// specified in the element's \"messages\" metadata\n\t\tcustomMetaMessage: function(element, method) {\n\t\t\tif (!$.metadata)\n\t\t\t\treturn;\n\t\t\t\n\t\t\tvar meta = this.settings.meta\n\t\t\t\t? $(element).metadata()[this.settings.meta]\n\t\t\t\t: $(element).metadata();\n\t\t\t\n\t\t\treturn meta && meta.messages && meta.messages[method];\n\t\t},\n\t\t\n\t\t// return the custom message for the given element name and validation method\n\t\tcustomMessage: function( name, method ) {\n\t\t\tvar m = this.settings.messages[name];\n\t\t\treturn m && (m.constructor == String\n\t\t\t\t? m\n\t\t\t\t: m[method]);\n\t\t},\n\t\t\n\t\t// return the first defined argument, allowing empty strings\n\t\tfindDefined: function() {\n\t\t\tfor(var i = 0; i < arguments.length; i++) {\n\t\t\t\tif (arguments[i] !== undefined)\n\t\t\t\t\treturn arguments[i];\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\t\t\n\t\tdefaultMessage: function( element, method) {\n\t\t\treturn this.findDefined(\n\t\t\t\tthis.customMessage( element.name, method ),\n\t\t\t\tthis.customMetaMessage( element, method ),\n\t\t\t\t// title is never undefined, so handle empty string as undefined\n\t\t\t\t!this.settings.ignoreTitle && element.title || undefined,\n\t\t\t\t$.validator.messages[method],\n\t\t\t\t\"<strong>Warning: No message defined for \" + element.name + \"</strong>\"\n\t\t\t);\n\t\t},\n\t\t\n\t\tformatAndAdd: function( element, rule ) {\n\t\t\tvar message = this.defaultMessage( element, rule.method ),\n\t\t\t\ttheregex = /\\$?\\{(\\d+)\\}/g;\n\t\t\tif ( typeof message == \"function\" ) {\n\t\t\t\tmessage = message.call(this, rule.parameters, element);\n\t\t\t} else if (theregex.test(message)) {\n\t\t\t\tmessage = jQuery.format(message.replace(theregex, '{$1}'), rule.parameters);\n\t\t\t}\t\t\t\n\t\t\tthis.errorList.push({\n\t\t\t\tmessage: message,\n\t\t\t\telement: element\n\t\t\t});\n\t\t\t\n\t\t\tthis.errorMap[element.name] = message;\n\t\t\tthis.submitted[element.name] = message;\n\t\t},\n\t\t\n\t\taddWrapper: function(toToggle) {\n\t\t\tif ( this.settings.wrapper )\n\t\t\t\ttoToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );\n\t\t\treturn toToggle;\n\t\t},\n\t\t\n\t\tdefaultShowErrors: function() {\n\t\t\tfor ( var i = 0; this.errorList[i]; i++ ) {\n\t\t\t\tvar error = this.errorList[i];\n\t\t\t\tthis.settings.highlight && this.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );\n\t\t\t\tthis.showLabel( error.element, error.message );\n\t\t\t}\n\t\t\tif( this.errorList.length ) {\n\t\t\t\tthis.toShow = this.toShow.add( this.containers );\n\t\t\t}\n\t\t\tif (this.settings.success) {\n\t\t\t\tfor ( var i = 0; this.successList[i]; i++ ) {\n\t\t\t\t\tthis.showLabel( this.successList[i] );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.settings.unhighlight) {\n\t\t\t\tfor ( var i = 0, elements = this.validElements(); elements[i]; i++ ) {\n\t\t\t\t\tthis.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.toHide = this.toHide.not( this.toShow );\n\t\t\tthis.hideErrors();\n\t\t\tthis.addWrapper( this.toShow ).show();\n\t\t},\n\t\t\n\t\tvalidElements: function() {\n\t\t\treturn this.currentElements.not(this.invalidElements());\n\t\t},\n\t\t\n\t\tinvalidElements: function() {\n\t\t\treturn $(this.errorList).map(function() {\n\t\t\t\treturn this.element;\n\t\t\t});\n\t\t},\n\t\t\n\t\tshowLabel: function(element, message) {\n\t\t\tvar label = this.errorsFor( element );\n\t\t\tif ( label.length ) {\n\t\t\t\t// refresh error/success class\n\t\t\t\tlabel.removeClass().addClass( this.settings.errorClass );\n\t\t\t\n\t\t\t\t// check if we have a generated label, replace the message then\n\t\t\t\tlabel.attr(\"generated\") && label.html(message);\n\t\t\t} else {\n\t\t\t\t// create label\n\t\t\t\tlabel = $(\"<\" + this.settings.errorElement + \"/>\")\n\t\t\t\t\t.attr({\"for\":  this.idOrName(element), generated: true})\n\t\t\t\t\t.addClass(this.settings.errorClass)\n\t\t\t\t\t.html(message || \"\");\n\t\t\t\tif ( this.settings.wrapper ) {\n\t\t\t\t\t// make sure the element is visible, even in IE\n\t\t\t\t\t// actually showing the wrapped element is handled elsewhere\n\t\t\t\t\tlabel = label.hide().show().wrap(\"<\" + this.settings.wrapper + \"/>\").parent();\n\t\t\t\t}\n\t\t\t\tif ( !this.labelContainer.append(label).length )\n\t\t\t\t\tthis.settings.errorPlacement\n\t\t\t\t\t\t? this.settings.errorPlacement(label, $(element) )\n\t\t\t\t\t\t: label.insertAfter(element);\n\t\t\t}\n\t\t\tif ( !message && this.settings.success ) {\n\t\t\t\tlabel.text(\"\");\n\t\t\t\ttypeof this.settings.success == \"string\"\n\t\t\t\t\t? label.addClass( this.settings.success )\n\t\t\t\t\t: this.settings.success( label );\n\t\t\t}\n\t\t\tthis.toShow = this.toShow.add(label);\n\t\t},\n\t\t\n\t\terrorsFor: function(element) {\n\t\t\tvar name = this.idOrName(element);\n    \t\treturn this.errors().filter(function() {\n\t\t\t\treturn $(this).attr('for') == name;\n\t\t\t});\n\t\t},\n\t\t\n\t\tidOrName: function(element) {\n\t\t\treturn this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);\n\t\t},\n\n\t\tcheckable: function( element ) {\n\t\t\treturn /radio|checkbox/i.test(element.type);\n\t\t},\n\t\t\n\t\tfindByName: function( name ) {\n\t\t\t// select by name and filter by form for performance over form.find(\"[name=...]\")\n\t\t\tvar form = this.currentForm;\n\t\t\treturn $(document.getElementsByName(name)).map(function(index, element) {\n\t\t\t\treturn element.form == form && element.name == name && element  || null;\n\t\t\t});\n\t\t},\n\t\t\n\t\tgetLength: function(value, element) {\n\t\t\tswitch( element.nodeName.toLowerCase() ) {\n\t\t\tcase 'select':\n\t\t\t\treturn $(\"option:selected\", element).length;\n\t\t\tcase 'input':\n\t\t\t\tif( this.checkable( element) )\n\t\t\t\t\treturn this.findByName(element.name).filter(':checked').length;\n\t\t\t}\n\t\t\treturn value.length;\n\t\t},\n\t\n\t\tdepend: function(param, element) {\n\t\t\treturn this.dependTypes[typeof param]\n\t\t\t\t? this.dependTypes[typeof param](param, element)\n\t\t\t\t: true;\n\t\t},\n\t\n\t\tdependTypes: {\n\t\t\t\"boolean\": function(param, element) {\n\t\t\t\treturn param;\n\t\t\t},\n\t\t\t\"string\": function(param, element) {\n\t\t\t\treturn !!$(param, element.form).length;\n\t\t\t},\n\t\t\t\"function\": function(param, element) {\n\t\t\t\treturn param(element);\n\t\t\t}\n\t\t},\n\t\t\n\t\toptional: function(element) {\n\t\t\treturn !$.validator.methods.required.call(this, $.trim(element.value), element) && \"dependency-mismatch\";\n\t\t},\n\t\t\n\t\tstartRequest: function(element) {\n\t\t\tif (!this.pending[element.name]) {\n\t\t\t\tthis.pendingRequest++;\n\t\t\t\tthis.pending[element.name] = true;\n\t\t\t}\n\t\t},\n\t\t\n\t\tstopRequest: function(element, valid) {\n\t\t\tthis.pendingRequest--;\n\t\t\t// sometimes synchronization fails, make sure pendingRequest is never < 0\n\t\t\tif (this.pendingRequest < 0)\n\t\t\t\tthis.pendingRequest = 0;\n\t\t\tdelete this.pending[element.name];\n\t\t\tif ( valid && this.pendingRequest == 0 && this.formSubmitted && this.form() ) {\n\t\t\t\t$(this.currentForm).submit();\n\t\t\t\tthis.formSubmitted = false;\n\t\t\t} else if (!valid && this.pendingRequest == 0 && this.formSubmitted) {\n\t\t\t\t$(this.currentForm).triggerHandler(\"invalid-form\", [this]);\n\t\t\t\tthis.formSubmitted = false;\n\t\t\t}\n\t\t},\n\t\t\n\t\tpreviousValue: function(element) {\n\t\t\treturn $.data(element, \"previousValue\") || $.data(element, \"previousValue\", {\n\t\t\t\told: null,\n\t\t\t\tvalid: true,\n\t\t\t\tmessage: this.defaultMessage( element, \"remote\" )\n\t\t\t});\n\t\t}\n\t\t\n\t},\n\t\n\tclassRuleSettings: {\n\t\trequired: {required: true},\n\t\temail: {email: true},\n\t\turl: {url: true},\n\t\tdate: {date: true},\n\t\tdateISO: {dateISO: true},\n\t\tdateDE: {dateDE: true},\n\t\tnumber: {number: true},\n\t\tnumberDE: {numberDE: true},\n\t\tdigits: {digits: true},\n\t\tcreditcard: {creditcard: true}\n\t},\n\t\n\taddClassRules: function(className, rules) {\n\t\t/// <summary>\n\t\t/// Add a compound class method - useful to refactor common combinations of rules into a single\n\t\t/// class.\n\t\t/// </summary>\n\t\t/// <param name=\"name\" type=\"String\">\n\t\t/// The name of the class rule to add\n\t\t/// </param>\n\t\t/// <param name=\"rules\" type=\"Options\">\n\t\t/// The compound rules\n\t\t/// </param>\n\n\t\tclassName.constructor == String ?\n\t\t\tthis.classRuleSettings[className] = rules :\n\t\t\t$.extend(this.classRuleSettings, className);\n\t},\n\t\n\tclassRules: function(element) {\n\t\tvar rules = {};\n\t\tvar classes = $(element).attr('class');\n\t\tclasses && $.each(classes.split(' '), function() {\n\t\t\tif (this in $.validator.classRuleSettings) {\n\t\t\t\t$.extend(rules, $.validator.classRuleSettings[this]);\n\t\t\t}\n\t\t});\n\t\treturn rules;\n\t},\n\t\n\tattributeRules: function(element) {\n\t\tvar rules = {};\n\t\tvar $element = $(element);\n\n\t\tfor (var method in $.validator.methods) {\n\t\t\tvar value = $element.attr(method);\n\t\t\tif (value) {\n\t\t\t\trules[method] = value;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs\n\t\tif (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {\n\t\t\tdelete rules.maxlength;\n\t\t}\n\t\t\n\t\treturn rules;\n\t},\n\t\n\tmetadataRules: function(element) {\n\t\tif (!$.metadata) return {};\n\t\t\n\t\tvar meta = $.data(element.form, 'validator').settings.meta;\n\t\treturn meta ?\n\t\t\t$(element).metadata()[meta] :\n\t\t\t$(element).metadata();\n\t},\n\t\n\tstaticRules: function(element) {\n\t\tvar rules = {};\n\t\tvar validator = $.data(element.form, 'validator');\n\t\tif (validator.settings.rules) {\n\t\t\trules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};\n\t\t}\n\t\treturn rules;\n\t},\n\t\n\tnormalizeRules: function(rules, element) {\n\t\t// handle dependency check\n\t\t$.each(rules, function(prop, val) {\n\t\t\t// ignore rule when param is explicitly false, eg. required:false\n\t\t\tif (val === false) {\n\t\t\t\tdelete rules[prop];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (val.param || val.depends) {\n\t\t\t\tvar keepRule = true;\n\t\t\t\tswitch (typeof val.depends) {\n\t\t\t\t\tcase \"string\":\n\t\t\t\t\t\tkeepRule = !!$(val.depends, element.form).length;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"function\":\n\t\t\t\t\t\tkeepRule = val.depends.call(element, element);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (keepRule) {\n\t\t\t\t\trules[prop] = val.param !== undefined ? val.param : true;\n\t\t\t\t} else {\n\t\t\t\t\tdelete rules[prop];\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\t// evaluate parameters\n\t\t$.each(rules, function(rule, parameter) {\n\t\t\trules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;\n\t\t});\n\t\t\n\t\t// clean number parameters\n\t\t$.each(['minlength', 'maxlength', 'min', 'max'], function() {\n\t\t\tif (rules[this]) {\n\t\t\t\trules[this] = Number(rules[this]);\n\t\t\t}\n\t\t});\n\t\t$.each(['rangelength', 'range'], function() {\n\t\t\tif (rules[this]) {\n\t\t\t\trules[this] = [Number(rules[this][0]), Number(rules[this][1])];\n\t\t\t}\n\t\t});\n\t\t\n\t\tif ($.validator.autoCreateRanges) {\n\t\t\t// auto-create ranges\n\t\t\tif (rules.min && rules.max) {\n\t\t\t\trules.range = [rules.min, rules.max];\n\t\t\t\tdelete rules.min;\n\t\t\t\tdelete rules.max;\n\t\t\t}\n\t\t\tif (rules.minlength && rules.maxlength) {\n\t\t\t\trules.rangelength = [rules.minlength, rules.maxlength];\n\t\t\t\tdelete rules.minlength;\n\t\t\t\tdelete rules.maxlength;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// To support custom messages in metadata ignore rule methods titled \"messages\"\n\t\tif (rules.messages) {\n\t\t\tdelete rules.messages;\n\t\t}\n\t\t\n\t\treturn rules;\n\t},\n\t\n\t// Converts a simple string to a {string: true} rule, e.g., \"required\" to {required:true}\n\tnormalizeRule: function(data) {\n\t\tif( typeof data == \"string\" ) {\n\t\t\tvar transformed = {};\n\t\t\t$.each(data.split(/\\s/), function() {\n\t\t\t\ttransformed[this] = true;\n\t\t\t});\n\t\t\tdata = transformed;\n\t\t}\n\t\treturn data;\n\t},\n\t\n\t// http://docs.jquery.com/Plugins/Validation/Validator/addMethod\n\taddMethod: function(name, method, message) {\n\t\t/// <summary>\n\t\t/// Add a custom validation method. It must consist of a name (must be a legal javascript \n\t\t/// identifier), a javascript based function and a default string message.\n\t\t/// </summary>\n\t\t/// <param name=\"name\" type=\"String\">\n\t\t/// The name of the method, used to identify and referencing it, must be a valid javascript\n\t\t/// identifier\n\t\t/// </param>\n\t\t/// <param name=\"method\" type=\"Function\">\n\t\t/// The actual method implementation, returning true if an element is valid\n\t\t/// </param>\n\t\t/// <param name=\"message\" type=\"String\" optional=\"true\">\n\t\t/// (Optional) The default message to display for this method. Can be a function created by \n\t\t/// jQuery.validator.format(value). When undefined, an already existing message is used \n\t\t/// (handy for localization), otherwise the field-specific messages have to be defined.\n\t\t/// </param>\n\n\t\t$.validator.methods[name] = method;\n\t\t$.validator.messages[name] = message != undefined ? message : $.validator.messages[name];\n\t\tif (method.length < 3) {\n\t\t\t$.validator.addClassRules(name, $.validator.normalizeRule(name));\n\t\t}\n\t},\n\n\tmethods: {\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/required\n\t\trequired: function(value, element, param) {\n\t\t\t// check if dependency is met\n\t\t\tif ( !this.depend(param, element) )\n\t\t\t\treturn \"dependency-mismatch\";\n\t\t\tswitch( element.nodeName.toLowerCase() ) {\n\t\t\tcase 'select':\n\t\t\t\t// could be an array for select-multiple or a string, both are fine this way\n\t\t\t\tvar val = $(element).val();\n\t\t\t\treturn val && val.length > 0;\n\t\t\tcase 'input':\n\t\t\t\tif ( this.checkable(element) )\n\t\t\t\t\treturn this.getLength(value, element) > 0;\n\t\t\tdefault:\n\t\t\t\treturn $.trim(value).length > 0;\n\t\t\t}\n\t\t},\n\t\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/remote\n\t\tremote: function(value, element, param) {\n\t\t\tif ( this.optional(element) )\n\t\t\t\treturn \"dependency-mismatch\";\n\t\t\t\n\t\t\tvar previous = this.previousValue(element);\n\t\t\tif (!this.settings.messages[element.name] )\n\t\t\t\tthis.settings.messages[element.name] = {};\n\t\t\tprevious.originalMessage = this.settings.messages[element.name].remote;\n\t\t\tthis.settings.messages[element.name].remote = previous.message;\n\t\t\t\n\t\t\tparam = typeof param == \"string\" && {url:param} || param; \n\t\t\t\n\t\t\tif ( this.pending[element.name] ) {\n\t\t\t\treturn \"pending\";\n\t\t\t}\n\t\t\tif ( previous.old === value ) {\n\t\t\t\treturn previous.valid;\n\t\t\t}\n\n\t\t\tprevious.old = value;\n\t\t\tvar validator = this;\n\t\t\tthis.startRequest(element);\n\t\t\tvar data = {};\n\t\t\tdata[element.name] = value;\n\t\t\t$.ajax($.extend(true, {\n\t\t\t\turl: param,\n\t\t\t\tmode: \"abort\",\n\t\t\t\tport: \"validate\" + element.name,\n\t\t\t\tdataType: \"json\",\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function(response) {\n\t\t\t\t\tvalidator.settings.messages[element.name].remote = previous.originalMessage;\n\t\t\t\t\tvar valid = response === true;\n\t\t\t\t\tif ( valid ) {\n\t\t\t\t\t\tvar submitted = validator.formSubmitted;\n\t\t\t\t\t\tvalidator.prepareElement(element);\n\t\t\t\t\t\tvalidator.formSubmitted = submitted;\n\t\t\t\t\t\tvalidator.successList.push(element);\n\t\t\t\t\t\tvalidator.showErrors();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar errors = {};\n\t\t\t\t\t\tvar message = response || validator.defaultMessage(element, \"remote\");\n\t\t\t\t\t\terrors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;\n\t\t\t\t\t\tvalidator.showErrors(errors);\n\t\t\t\t\t}\n\t\t\t\t\tprevious.valid = valid;\n\t\t\t\t\tvalidator.stopRequest(element, valid);\n\t\t\t\t}\n\t\t\t}, param));\n\t\t\treturn \"pending\";\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/minlength\n\t\tminlength: function(value, element, param) {\n\t\t\treturn this.optional(element) || this.getLength($.trim(value), element) >= param;\n\t\t},\n\t\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/maxlength\n\t\tmaxlength: function(value, element, param) {\n\t\t\treturn this.optional(element) || this.getLength($.trim(value), element) <= param;\n\t\t},\n\t\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/rangelength\n\t\trangelength: function(value, element, param) {\n\t\t\tvar length = this.getLength($.trim(value), element);\n\t\t\treturn this.optional(element) || ( length >= param[0] && length <= param[1] );\n\t\t},\n\t\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/min\n\t\tmin: function( value, element, param ) {\n\t\t\treturn this.optional(element) || value >= param;\n\t\t},\n\t\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/max\n\t\tmax: function( value, element, param ) {\n\t\t\treturn this.optional(element) || value <= param;\n\t\t},\n\t\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/range\n\t\trange: function( value, element, param ) {\n\t\t\treturn this.optional(element) || ( value >= param[0] && value <= param[1] );\n\t\t},\n\t\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/email\n\t\temail: function(value, element) {\n\t\t\t// contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/\n\t\t\treturn this.optional(element) || /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?$/i.test(value);\n\t\t},\n\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/url\n\t\turl: function(value, element) {\n\t\t\t// contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/\n\t\t\treturn this.optional(element) || /^(https?|ftp):\\/\\/(((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:)*@)?(((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]))|((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?)(:\\d*)?)(\\/((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)+(\\/(([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)*)*)?)?(\\?((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)|[\\uE000-\\uF8FF]|\\/|\\?)*)?(\\#((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$/i.test(value);\n\t\t},\n        \n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/date\n\t\tdate: function(value, element) {\n\t\t\treturn this.optional(element) || !/Invalid|NaN/.test(new Date(value));\n\t\t},\n\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/dateISO\n\t\tdateISO: function(value, element) {\n\t\t\treturn this.optional(element) || /^\\d{4}[\\/-]\\d{1,2}[\\/-]\\d{1,2}$/.test(value);\n\t\t},\n\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/number\n\t\tnumber: function(value, element) {\n\t\t\treturn this.optional(element) || /^-?(?:\\d+|\\d{1,3}(?:,\\d{3})+)(?:\\.\\d+)?$/.test(value);\n\t\t},\n\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/digits\n\t\tdigits: function(value, element) {\n\t\t\treturn this.optional(element) || /^\\d+$/.test(value);\n\t\t},\n\t\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/creditcard\n\t\t// based on http://en.wikipedia.org/wiki/Luhn\n\t\tcreditcard: function(value, element) {\n\t\t\tif ( this.optional(element) )\n\t\t\t\treturn \"dependency-mismatch\";\n\t\t\t// accept only digits and dashes\n\t\t\tif (/[^0-9-]+/.test(value))\n\t\t\t\treturn false;\n\t\t\tvar nCheck = 0,\n\t\t\t\tnDigit = 0,\n\t\t\t\tbEven = false;\n\n\t\t\tvalue = value.replace(/\\D/g, \"\");\n\n\t\t\tfor (var n = value.length - 1; n >= 0; n--) {\n\t\t\t\tvar cDigit = value.charAt(n);\n\t\t\t\tvar nDigit = parseInt(cDigit, 10);\n\t\t\t\tif (bEven) {\n\t\t\t\t\tif ((nDigit *= 2) > 9)\n\t\t\t\t\t\tnDigit -= 9;\n\t\t\t\t}\n\t\t\t\tnCheck += nDigit;\n\t\t\t\tbEven = !bEven;\n\t\t\t}\n\n\t\t\treturn (nCheck % 10) == 0;\n\t\t},\n\t\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/accept\n\t\taccept: function(value, element, param) {\n\t\t\tparam = typeof param == \"string\" ? param.replace(/,/g, '|') : \"png|jpe?g|gif\";\n\t\t\treturn this.optional(element) || value.match(new RegExp(\".(\" + param + \")$\", \"i\")); \n\t\t},\n\t\t\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/equalTo\n\t\tequalTo: function(value, element, param) {\n\t\t\t// bind to the blur event of the target in order to revalidate whenever the target field is updated\n\t\t\t// TODO find a way to bind the event just once, avoiding the unbind-rebind overhead\n\t\t\tvar target = $(param).unbind(\".validate-equalTo\").bind(\"blur.validate-equalTo\", function() {\n\t\t\t\t$(element).valid();\n\t\t\t});\n\t\t\treturn value == target.val();\n\t\t}\n\t\t\n\t}\n\t\n});\n\n// deprecated, use $.validator.format instead\n$.format = $.validator.format;\n\n})(jQuery);\n\n// ajax mode: abort\n// usage: $.ajax({ mode: \"abort\"[, port: \"uniqueport\"]});\n// if mode:\"abort\" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort() \n;(function($) {\n\tvar pendingRequests = {};\n\t\t// Use a prefilter if available (1.5+)\n\tif ( $.ajaxPrefilter ) {\n\t\t$.ajaxPrefilter(function(settings, _, xhr) {\n\t\t    var port = settings.port;\n\t\t    if (settings.mode == \"abort\") {\n\t\t\t    if ( pendingRequests[port] ) {\n\t\t\t\t    pendingRequests[port].abort();\n\t\t\t    }\t\t\t\tpendingRequests[port] = xhr;\n\t\t    }\n\t    });\n\t} else {\n\t\t// Proxy ajax\n\t\tvar ajax = $.ajax;\n\t\t$.ajax = function(settings) {\n\t\t\tvar mode = ( \"mode\" in settings ? settings : $.ajaxSettings ).mode,\n\t\t\t\tport = ( \"port\" in settings ? settings : $.ajaxSettings ).port;\n\t\t\tif (mode == \"abort\") {\n\t\t\t\tif ( pendingRequests[port] ) {\n\t\t\t\t\tpendingRequests[port].abort();\n\t\t\t\t}\n\n\t\t\t    return (pendingRequests[port] = ajax.apply(this, arguments));\n\t\t    }\n\t\t    return ajax.apply(this, arguments);\n\t    };\n    }\n})(jQuery);\n\n// provides cross-browser focusin and focusout events\n// IE has native support, in other browsers, use event caputuring (neither bubbles)\n\n// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation\n// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target \n;(function($) {\n\t// only implement if not provided by jQuery core (since 1.4)\n\t// TODO verify if jQuery 1.4's implementation is compatible with older jQuery special-event APIs\n\tif (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) {\n\t\t$.each({\n\t\t\tfocus: 'focusin',\n\t\t\tblur: 'focusout'\t\n\t\t}, function( original, fix ){\n\t\t\t$.event.special[fix] = {\n\t\t\t\tsetup:function() {\n\t\t\t\t\tthis.addEventListener( original, handler, true );\n\t\t\t\t},\n\t\t\t\tteardown:function() {\n\t\t\t\t\tthis.removeEventListener( original, handler, true );\n\t\t\t\t},\n\t\t\t\thandler: function(e) {\n\t\t\t\t\targuments[0] = $.event.fix(e);\n\t\t\t\t\targuments[0].type = fix;\n\t\t\t\t\treturn $.event.handle.apply(this, arguments);\n\t\t\t\t}\n\t\t\t};\n\t\t\tfunction handler(e) {\n\t\t\t\te = $.event.fix(e);\n\t\t\t\te.type = fix;\n\t\t\t\treturn $.event.handle.call(this, e);\n\t\t\t}\n\t\t});\n\t};\n\t$.extend($.fn, {\n\t\tvalidateDelegate: function(delegate, type, handler) {\n\t\t\treturn this.bind(type, function(event) {\n\t\t\t\tvar target = $(event.target);\n\t\t\t\tif (target.is(delegate)) {\n\t\t\t\t\treturn handler.apply(target, arguments);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n})(jQuery);\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Scripts/jquery.validate.js",
    "content": "/*! jQuery Validation Plugin - v1.10.0 - 9/7/2012\n* https://github.com/jzaefferer/jquery-validation\n* Copyright (c) 2012 Jörn Zaefferer; Licensed MIT */\n\n(function($) {\n\n$.extend($.fn, {\n\t// http://docs.jquery.com/Plugins/Validation/validate\n\tvalidate: function( options ) {\n\n\t\t// if nothing is selected, return nothing; can't chain anyway\n\t\tif (!this.length) {\n\t\t\tif (options && options.debug && window.console) {\n\t\t\t\tconsole.warn( \"nothing selected, can't validate, returning nothing\" );\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t// check if a validator for this form was already created\n\t\tvar validator = $.data(this[0], 'validator');\n\t\tif ( validator ) {\n\t\t\treturn validator;\n\t\t}\n\n\t\t// Add novalidate tag if HTML5.\n\t\tthis.attr('novalidate', 'novalidate');\n\n\t\tvalidator = new $.validator( options, this[0] );\n\t\t$.data(this[0], 'validator', validator);\n\n\t\tif ( validator.settings.onsubmit ) {\n\n\t\t\tthis.validateDelegate( \":submit\", \"click\", function(ev) {\n\t\t\t\tif ( validator.settings.submitHandler ) {\n\t\t\t\t\tvalidator.submitButton = ev.target;\n\t\t\t\t}\n\t\t\t\t// allow suppressing validation by adding a cancel class to the submit button\n\t\t\t\tif ( $(ev.target).hasClass('cancel') ) {\n\t\t\t\t\tvalidator.cancelSubmit = true;\n\t\t\t\t}\n\t\t\t});\n\n\t\t\t// validate the form on submit\n\t\t\tthis.submit( function( event ) {\n\t\t\t\tif ( validator.settings.debug ) {\n\t\t\t\t\t// prevent form submit to be able to see console output\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t}\n\t\t\t\tfunction handle() {\n\t\t\t\t\tvar hidden;\n\t\t\t\t\tif ( validator.settings.submitHandler ) {\n\t\t\t\t\t\tif (validator.submitButton) {\n\t\t\t\t\t\t\t// insert a hidden input as a replacement for the missing submit button\n\t\t\t\t\t\t\thidden = $(\"<input type='hidden'/>\").attr(\"name\", validator.submitButton.name).val(validator.submitButton.value).appendTo(validator.currentForm);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalidator.settings.submitHandler.call( validator, validator.currentForm, event );\n\t\t\t\t\t\tif (validator.submitButton) {\n\t\t\t\t\t\t\t// and clean up afterwards; thanks to no-block-scope, hidden can be referenced\n\t\t\t\t\t\t\thidden.remove();\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t// prevent submit for invalid forms or custom submit handlers\n\t\t\t\tif ( validator.cancelSubmit ) {\n\t\t\t\t\tvalidator.cancelSubmit = false;\n\t\t\t\t\treturn handle();\n\t\t\t\t}\n\t\t\t\tif ( validator.form() ) {\n\t\t\t\t\tif ( validator.pendingRequest ) {\n\t\t\t\t\t\tvalidator.formSubmitted = true;\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\treturn handle();\n\t\t\t\t} else {\n\t\t\t\t\tvalidator.focusInvalid();\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn validator;\n\t},\n\t// http://docs.jquery.com/Plugins/Validation/valid\n\tvalid: function() {\n\t\tif ( $(this[0]).is('form')) {\n\t\t\treturn this.validate().form();\n\t\t} else {\n\t\t\tvar valid = true;\n\t\t\tvar validator = $(this[0].form).validate();\n\t\t\tthis.each(function() {\n\t\t\t\tvalid &= validator.element(this);\n\t\t\t});\n\t\t\treturn valid;\n\t\t}\n\t},\n\t// attributes: space seperated list of attributes to retrieve and remove\n\tremoveAttrs: function(attributes) {\n\t\tvar result = {},\n\t\t\t$element = this;\n\t\t$.each(attributes.split(/\\s/), function(index, value) {\n\t\t\tresult[value] = $element.attr(value);\n\t\t\t$element.removeAttr(value);\n\t\t});\n\t\treturn result;\n\t},\n\t// http://docs.jquery.com/Plugins/Validation/rules\n\trules: function(command, argument) {\n\t\tvar element = this[0];\n\n\t\tif (command) {\n\t\t\tvar settings = $.data(element.form, 'validator').settings;\n\t\t\tvar staticRules = settings.rules;\n\t\t\tvar existingRules = $.validator.staticRules(element);\n\t\t\tswitch(command) {\n\t\t\tcase \"add\":\n\t\t\t\t$.extend(existingRules, $.validator.normalizeRule(argument));\n\t\t\t\tstaticRules[element.name] = existingRules;\n\t\t\t\tif (argument.messages) {\n\t\t\t\t\tsettings.messages[element.name] = $.extend( settings.messages[element.name], argument.messages );\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"remove\":\n\t\t\t\tif (!argument) {\n\t\t\t\t\tdelete staticRules[element.name];\n\t\t\t\t\treturn existingRules;\n\t\t\t\t}\n\t\t\t\tvar filtered = {};\n\t\t\t\t$.each(argument.split(/\\s/), function(index, method) {\n\t\t\t\t\tfiltered[method] = existingRules[method];\n\t\t\t\t\tdelete existingRules[method];\n\t\t\t\t});\n\t\t\t\treturn filtered;\n\t\t\t}\n\t\t}\n\n\t\tvar data = $.validator.normalizeRules(\n\t\t$.extend(\n\t\t\t{},\n\t\t\t$.validator.metadataRules(element),\n\t\t\t$.validator.classRules(element),\n\t\t\t$.validator.attributeRules(element),\n\t\t\t$.validator.staticRules(element)\n\t\t), element);\n\n\t\t// make sure required is at front\n\t\tif (data.required) {\n\t\t\tvar param = data.required;\n\t\t\tdelete data.required;\n\t\t\tdata = $.extend({required: param}, data);\n\t\t}\n\n\t\treturn data;\n\t}\n});\n\n// Custom selectors\n$.extend($.expr[\":\"], {\n\t// http://docs.jquery.com/Plugins/Validation/blank\n\tblank: function(a) {return !$.trim(\"\" + a.value);},\n\t// http://docs.jquery.com/Plugins/Validation/filled\n\tfilled: function(a) {return !!$.trim(\"\" + a.value);},\n\t// http://docs.jquery.com/Plugins/Validation/unchecked\n\tunchecked: function(a) {return !a.checked;}\n});\n\n// constructor for validator\n$.validator = function( options, form ) {\n\tthis.settings = $.extend( true, {}, $.validator.defaults, options );\n\tthis.currentForm = form;\n\tthis.init();\n};\n\n$.validator.format = function(source, params) {\n\tif ( arguments.length === 1 ) {\n\t\treturn function() {\n\t\t\tvar args = $.makeArray(arguments);\n\t\t\targs.unshift(source);\n\t\t\treturn $.validator.format.apply( this, args );\n\t\t};\n\t}\n\tif ( arguments.length > 2 && params.constructor !== Array  ) {\n\t\tparams = $.makeArray(arguments).slice(1);\n\t}\n\tif ( params.constructor !== Array ) {\n\t\tparams = [ params ];\n\t}\n\t$.each(params, function(i, n) {\n\t\tsource = source.replace(new RegExp(\"\\\\{\" + i + \"\\\\}\", \"g\"), n);\n\t});\n\treturn source;\n};\n\n$.extend($.validator, {\n\n\tdefaults: {\n\t\tmessages: {},\n\t\tgroups: {},\n\t\trules: {},\n\t\terrorClass: \"error\",\n\t\tvalidClass: \"valid\",\n\t\terrorElement: \"label\",\n\t\tfocusInvalid: true,\n\t\terrorContainer: $( [] ),\n\t\terrorLabelContainer: $( [] ),\n\t\tonsubmit: true,\n\t\tignore: \":hidden\",\n\t\tignoreTitle: false,\n\t\tonfocusin: function(element, event) {\n\t\t\tthis.lastActive = element;\n\n\t\t\t// hide error label and remove error class on focus if enabled\n\t\t\tif ( this.settings.focusCleanup && !this.blockFocusCleanup ) {\n\t\t\t\tif ( this.settings.unhighlight ) {\n\t\t\t\t\tthis.settings.unhighlight.call( this, element, this.settings.errorClass, this.settings.validClass );\n\t\t\t\t}\n\t\t\t\tthis.addWrapper(this.errorsFor(element)).hide();\n\t\t\t}\n\t\t},\n\t\tonfocusout: function(element, event) {\n\t\t\tif ( !this.checkable(element) && (element.name in this.submitted || !this.optional(element)) ) {\n\t\t\t\tthis.element(element);\n\t\t\t}\n\t\t},\n\t\tonkeyup: function(element, event) {\n\t\t\tif ( event.which === 9 && this.elementValue(element) === '' ) {\n\t\t\t\treturn;\n\t\t\t} else if ( element.name in this.submitted || element === this.lastActive ) {\n\t\t\t\tthis.element(element);\n\t\t\t}\n\t\t},\n\t\tonclick: function(element, event) {\n\t\t\t// click on selects, radiobuttons and checkboxes\n\t\t\tif ( element.name in this.submitted ) {\n\t\t\t\tthis.element(element);\n\t\t\t}\n\t\t\t// or option elements, check parent select in that case\n\t\t\telse if (element.parentNode.name in this.submitted) {\n\t\t\t\tthis.element(element.parentNode);\n\t\t\t}\n\t\t},\n\t\thighlight: function(element, errorClass, validClass) {\n\t\t\tif (element.type === 'radio') {\n\t\t\t\tthis.findByName(element.name).addClass(errorClass).removeClass(validClass);\n\t\t\t} else {\n\t\t\t\t$(element).addClass(errorClass).removeClass(validClass);\n\t\t\t}\n\t\t},\n\t\tunhighlight: function(element, errorClass, validClass) {\n\t\t\tif (element.type === 'radio') {\n\t\t\t\tthis.findByName(element.name).removeClass(errorClass).addClass(validClass);\n\t\t\t} else {\n\t\t\t\t$(element).removeClass(errorClass).addClass(validClass);\n\t\t\t}\n\t\t}\n\t},\n\n\t// http://docs.jquery.com/Plugins/Validation/Validator/setDefaults\n\tsetDefaults: function(settings) {\n\t\t$.extend( $.validator.defaults, settings );\n\t},\n\n\tmessages: {\n\t\trequired: \"This field is required.\",\n\t\tremote: \"Please fix this field.\",\n\t\temail: \"Please enter a valid email address.\",\n\t\turl: \"Please enter a valid URL.\",\n\t\tdate: \"Please enter a valid date.\",\n\t\tdateISO: \"Please enter a valid date (ISO).\",\n\t\tnumber: \"Please enter a valid number.\",\n\t\tdigits: \"Please enter only digits.\",\n\t\tcreditcard: \"Please enter a valid credit card number.\",\n\t\tequalTo: \"Please enter the same value again.\",\n\t\tmaxlength: $.validator.format(\"Please enter no more than {0} characters.\"),\n\t\tminlength: $.validator.format(\"Please enter at least {0} characters.\"),\n\t\trangelength: $.validator.format(\"Please enter a value between {0} and {1} characters long.\"),\n\t\trange: $.validator.format(\"Please enter a value between {0} and {1}.\"),\n\t\tmax: $.validator.format(\"Please enter a value less than or equal to {0}.\"),\n\t\tmin: $.validator.format(\"Please enter a value greater than or equal to {0}.\")\n\t},\n\n\tautoCreateRanges: false,\n\n\tprototype: {\n\n\t\tinit: function() {\n\t\t\tthis.labelContainer = $(this.settings.errorLabelContainer);\n\t\t\tthis.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);\n\t\t\tthis.containers = $(this.settings.errorContainer).add( this.settings.errorLabelContainer );\n\t\t\tthis.submitted = {};\n\t\t\tthis.valueCache = {};\n\t\t\tthis.pendingRequest = 0;\n\t\t\tthis.pending = {};\n\t\t\tthis.invalid = {};\n\t\t\tthis.reset();\n\n\t\t\tvar groups = (this.groups = {});\n\t\t\t$.each(this.settings.groups, function(key, value) {\n\t\t\t\t$.each(value.split(/\\s/), function(index, name) {\n\t\t\t\t\tgroups[name] = key;\n\t\t\t\t});\n\t\t\t});\n\t\t\tvar rules = this.settings.rules;\n\t\t\t$.each(rules, function(key, value) {\n\t\t\t\trules[key] = $.validator.normalizeRule(value);\n\t\t\t});\n\n\t\t\tfunction delegate(event) {\n\t\t\t\tvar validator = $.data(this[0].form, \"validator\"),\n\t\t\t\t\teventType = \"on\" + event.type.replace(/^validate/, \"\");\n\t\t\t\tif (validator.settings[eventType]) {\n\t\t\t\t\tvalidator.settings[eventType].call(validator, this[0], event);\n\t\t\t\t}\n\t\t\t}\n\t\t\t$(this.currentForm)\n\t\t\t\t.validateDelegate(\":text, [type='password'], [type='file'], select, textarea, \" +\n\t\t\t\t\t\"[type='number'], [type='search'] ,[type='tel'], [type='url'], \" +\n\t\t\t\t\t\"[type='email'], [type='datetime'], [type='date'], [type='month'], \" +\n\t\t\t\t\t\"[type='week'], [type='time'], [type='datetime-local'], \" +\n\t\t\t\t\t\"[type='range'], [type='color'] \",\n\t\t\t\t\t\"focusin focusout keyup\", delegate)\n\t\t\t\t.validateDelegate(\"[type='radio'], [type='checkbox'], select, option\", \"click\", delegate);\n\n\t\t\tif (this.settings.invalidHandler) {\n\t\t\t\t$(this.currentForm).bind(\"invalid-form.validate\", this.settings.invalidHandler);\n\t\t\t}\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Validator/form\n\t\tform: function() {\n\t\t\tthis.checkForm();\n\t\t\t$.extend(this.submitted, this.errorMap);\n\t\t\tthis.invalid = $.extend({}, this.errorMap);\n\t\t\tif (!this.valid()) {\n\t\t\t\t$(this.currentForm).triggerHandler(\"invalid-form\", [this]);\n\t\t\t}\n\t\t\tthis.showErrors();\n\t\t\treturn this.valid();\n\t\t},\n\n\t\tcheckForm: function() {\n\t\t\tthis.prepareForm();\n\t\t\tfor ( var i = 0, elements = (this.currentElements = this.elements()); elements[i]; i++ ) {\n\t\t\t\tthis.check( elements[i] );\n\t\t\t}\n\t\t\treturn this.valid();\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Validator/element\n\t\telement: function( element ) {\n\t\t\telement = this.validationTargetFor( this.clean( element ) );\n\t\t\tthis.lastElement = element;\n\t\t\tthis.prepareElement( element );\n\t\t\tthis.currentElements = $(element);\n\t\t\tvar result = this.check( element ) !== false;\n\t\t\tif (result) {\n\t\t\t\tdelete this.invalid[element.name];\n\t\t\t} else {\n\t\t\t\tthis.invalid[element.name] = true;\n\t\t\t}\n\t\t\tif ( !this.numberOfInvalids() ) {\n\t\t\t\t// Hide error containers on last error\n\t\t\t\tthis.toHide = this.toHide.add( this.containers );\n\t\t\t}\n\t\t\tthis.showErrors();\n\t\t\treturn result;\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Validator/showErrors\n\t\tshowErrors: function(errors) {\n\t\t\tif(errors) {\n\t\t\t\t// add items to error list and map\n\t\t\t\t$.extend( this.errorMap, errors );\n\t\t\t\tthis.errorList = [];\n\t\t\t\tfor ( var name in errors ) {\n\t\t\t\t\tthis.errorList.push({\n\t\t\t\t\t\tmessage: errors[name],\n\t\t\t\t\t\telement: this.findByName(name)[0]\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\t// remove items from success list\n\t\t\t\tthis.successList = $.grep( this.successList, function(element) {\n\t\t\t\t\treturn !(element.name in errors);\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (this.settings.showErrors) {\n\t\t\t\tthis.settings.showErrors.call( this, this.errorMap, this.errorList );\n\t\t\t} else {\n\t\t\t\tthis.defaultShowErrors();\n\t\t\t}\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Validator/resetForm\n\t\tresetForm: function() {\n\t\t\tif ( $.fn.resetForm ) {\n\t\t\t\t$( this.currentForm ).resetForm();\n\t\t\t}\n\t\t\tthis.submitted = {};\n\t\t\tthis.lastElement = null;\n\t\t\tthis.prepareForm();\n\t\t\tthis.hideErrors();\n\t\t\tthis.elements().removeClass( this.settings.errorClass ).removeData( \"previousValue\" );\n\t\t},\n\n\t\tnumberOfInvalids: function() {\n\t\t\treturn this.objectLength(this.invalid);\n\t\t},\n\n\t\tobjectLength: function( obj ) {\n\t\t\tvar count = 0;\n\t\t\tfor ( var i in obj ) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\treturn count;\n\t\t},\n\n\t\thideErrors: function() {\n\t\t\tthis.addWrapper( this.toHide ).hide();\n\t\t},\n\n\t\tvalid: function() {\n\t\t\treturn this.size() === 0;\n\t\t},\n\n\t\tsize: function() {\n\t\t\treturn this.errorList.length;\n\t\t},\n\n\t\tfocusInvalid: function() {\n\t\t\tif( this.settings.focusInvalid ) {\n\t\t\t\ttry {\n\t\t\t\t\t$(this.findLastActive() || this.errorList.length && this.errorList[0].element || [])\n\t\t\t\t\t.filter(\":visible\")\n\t\t\t\t\t.focus()\n\t\t\t\t\t// manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find\n\t\t\t\t\t.trigger(\"focusin\");\n\t\t\t\t} catch(e) {\n\t\t\t\t\t// ignore IE throwing errors when focusing hidden elements\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\tfindLastActive: function() {\n\t\t\tvar lastActive = this.lastActive;\n\t\t\treturn lastActive && $.grep(this.errorList, function(n) {\n\t\t\t\treturn n.element.name === lastActive.name;\n\t\t\t}).length === 1 && lastActive;\n\t\t},\n\n\t\telements: function() {\n\t\t\tvar validator = this,\n\t\t\t\trulesCache = {};\n\n\t\t\t// select all valid inputs inside the form (no submit or reset buttons)\n\t\t\treturn $(this.currentForm)\n\t\t\t.find(\"input, select, textarea\")\n\t\t\t.not(\":submit, :reset, :image, [disabled]\")\n\t\t\t.not( this.settings.ignore )\n\t\t\t.filter(function() {\n\t\t\t\tif ( !this.name && validator.settings.debug && window.console ) {\n\t\t\t\t\tconsole.error( \"%o has no name assigned\", this);\n\t\t\t\t}\n\n\t\t\t\t// select only the first element for each name, and only those with rules specified\n\t\t\t\tif ( this.name in rulesCache || !validator.objectLength($(this).rules()) ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\trulesCache[this.name] = true;\n\t\t\t\treturn true;\n\t\t\t});\n\t\t},\n\n\t\tclean: function( selector ) {\n\t\t\treturn $( selector )[0];\n\t\t},\n\n\t\terrors: function() {\n\t\t\tvar errorClass = this.settings.errorClass.replace(' ', '.');\n\t\t\treturn $( this.settings.errorElement + \".\" + errorClass, this.errorContext );\n\t\t},\n\n\t\treset: function() {\n\t\t\tthis.successList = [];\n\t\t\tthis.errorList = [];\n\t\t\tthis.errorMap = {};\n\t\t\tthis.toShow = $([]);\n\t\t\tthis.toHide = $([]);\n\t\t\tthis.currentElements = $([]);\n\t\t},\n\n\t\tprepareForm: function() {\n\t\t\tthis.reset();\n\t\t\tthis.toHide = this.errors().add( this.containers );\n\t\t},\n\n\t\tprepareElement: function( element ) {\n\t\t\tthis.reset();\n\t\t\tthis.toHide = this.errorsFor(element);\n\t\t},\n\n\t\telementValue: function( element ) {\n\t\t\tvar type = $(element).attr('type'),\n\t\t\t\tval = $(element).val();\n\n\t\t\tif ( type === 'radio' || type === 'checkbox' ) {\n\t\t\t\treturn $('input[name=\"' + $(element).attr('name') + '\"]:checked').val();\n\t\t\t}\n\n\t\t\tif ( typeof val === 'string' ) {\n\t\t\t\treturn val.replace(/\\r/g, \"\");\n\t\t\t}\n\t\t\treturn val;\n\t\t},\n\n\t\tcheck: function( element ) {\n\t\t\telement = this.validationTargetFor( this.clean( element ) );\n\n\t\t\tvar rules = $(element).rules();\n\t\t\tvar dependencyMismatch = false;\n\t\t\tvar val = this.elementValue(element);\n\t\t\tvar result;\n\n\t\t\tfor (var method in rules ) {\n\t\t\t\tvar rule = { method: method, parameters: rules[method] };\n\t\t\t\ttry {\n\n\t\t\t\t\tresult = $.validator.methods[method].call( this, val, element, rule.parameters );\n\n\t\t\t\t\t// if a method indicates that the field is optional and therefore valid,\n\t\t\t\t\t// don't mark it as valid when there are no other rules\n\t\t\t\t\tif ( result === \"dependency-mismatch\" ) {\n\t\t\t\t\t\tdependencyMismatch = true;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tdependencyMismatch = false;\n\n\t\t\t\t\tif ( result === \"pending\" ) {\n\t\t\t\t\t\tthis.toHide = this.toHide.not( this.errorsFor(element) );\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tif( !result ) {\n\t\t\t\t\t\tthis.formatAndAdd( element, rule );\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} catch(e) {\n\t\t\t\t\tif ( this.settings.debug && window.console ) {\n\t\t\t\t\t\tconsole.log(\"exception occured when checking element \" + element.id + \", check the '\" + rule.method + \"' method\", e);\n\t\t\t\t\t}\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (dependencyMismatch) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif ( this.objectLength(rules) ) {\n\t\t\t\tthis.successList.push(element);\n\t\t\t}\n\t\t\treturn true;\n\t\t},\n\n\t\t// return the custom message for the given element and validation method\n\t\t// specified in the element's \"messages\" metadata\n\t\tcustomMetaMessage: function(element, method) {\n\t\t\tif (!$.metadata) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar meta = this.settings.meta ? $(element).metadata()[this.settings.meta] : $(element).metadata();\n\t\t\treturn meta && meta.messages && meta.messages[method];\n\t\t},\n\n\t\t// return the custom message for the given element and validation method\n\t\t// specified in the element's HTML5 data attribute\n\t\tcustomDataMessage: function(element, method) {\n\t\t\treturn $(element).data('msg-' + method.toLowerCase()) || (element.attributes && $(element).attr('data-msg-' + method.toLowerCase()));\n\t\t},\n\n\t\t// return the custom message for the given element name and validation method\n\t\tcustomMessage: function( name, method ) {\n\t\t\tvar m = this.settings.messages[name];\n\t\t\treturn m && (m.constructor === String ? m : m[method]);\n\t\t},\n\n\t\t// return the first defined argument, allowing empty strings\n\t\tfindDefined: function() {\n\t\t\tfor(var i = 0; i < arguments.length; i++) {\n\t\t\t\tif (arguments[i] !== undefined) {\n\t\t\t\t\treturn arguments[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn undefined;\n\t\t},\n\n\t\tdefaultMessage: function( element, method) {\n\t\t\treturn this.findDefined(\n\t\t\t\tthis.customMessage( element.name, method ),\n\t\t\t\tthis.customDataMessage( element, method ),\n\t\t\t\tthis.customMetaMessage( element, method ),\n\t\t\t\t// title is never undefined, so handle empty string as undefined\n\t\t\t\t!this.settings.ignoreTitle && element.title || undefined,\n\t\t\t\t$.validator.messages[method],\n\t\t\t\t\"<strong>Warning: No message defined for \" + element.name + \"</strong>\"\n\t\t\t);\n\t\t},\n\n\t\tformatAndAdd: function( element, rule ) {\n\t\t\tvar message = this.defaultMessage( element, rule.method ),\n\t\t\t\ttheregex = /\\$?\\{(\\d+)\\}/g;\n\t\t\tif ( typeof message === \"function\" ) {\n\t\t\t\tmessage = message.call(this, rule.parameters, element);\n\t\t\t} else if (theregex.test(message)) {\n\t\t\t\tmessage = $.validator.format(message.replace(theregex, '{$1}'), rule.parameters);\n\t\t\t}\n\t\t\tthis.errorList.push({\n\t\t\t\tmessage: message,\n\t\t\t\telement: element\n\t\t\t});\n\n\t\t\tthis.errorMap[element.name] = message;\n\t\t\tthis.submitted[element.name] = message;\n\t\t},\n\n\t\taddWrapper: function(toToggle) {\n\t\t\tif ( this.settings.wrapper ) {\n\t\t\t\ttoToggle = toToggle.add( toToggle.parent( this.settings.wrapper ) );\n\t\t\t}\n\t\t\treturn toToggle;\n\t\t},\n\n\t\tdefaultShowErrors: function() {\n\t\t\tvar i, elements;\n\t\t\tfor ( i = 0; this.errorList[i]; i++ ) {\n\t\t\t\tvar error = this.errorList[i];\n\t\t\t\tif ( this.settings.highlight ) {\n\t\t\t\t\tthis.settings.highlight.call( this, error.element, this.settings.errorClass, this.settings.validClass );\n\t\t\t\t}\n\t\t\t\tthis.showLabel( error.element, error.message );\n\t\t\t}\n\t\t\tif( this.errorList.length ) {\n\t\t\t\tthis.toShow = this.toShow.add( this.containers );\n\t\t\t}\n\t\t\tif (this.settings.success) {\n\t\t\t\tfor ( i = 0; this.successList[i]; i++ ) {\n\t\t\t\t\tthis.showLabel( this.successList[i] );\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (this.settings.unhighlight) {\n\t\t\t\tfor ( i = 0, elements = this.validElements(); elements[i]; i++ ) {\n\t\t\t\t\tthis.settings.unhighlight.call( this, elements[i], this.settings.errorClass, this.settings.validClass );\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.toHide = this.toHide.not( this.toShow );\n\t\t\tthis.hideErrors();\n\t\t\tthis.addWrapper( this.toShow ).show();\n\t\t},\n\n\t\tvalidElements: function() {\n\t\t\treturn this.currentElements.not(this.invalidElements());\n\t\t},\n\n\t\tinvalidElements: function() {\n\t\t\treturn $(this.errorList).map(function() {\n\t\t\t\treturn this.element;\n\t\t\t});\n\t\t},\n\n\t\tshowLabel: function(element, message) {\n\t\t\tvar label = this.errorsFor( element );\n\t\t\tif ( label.length ) {\n\t\t\t\t// refresh error/success class\n\t\t\t\tlabel.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );\n\n\t\t\t\t// check if we have a generated label, replace the message then\n\t\t\t\tif ( label.attr(\"generated\") ) {\n\t\t\t\t\tlabel.html(message);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// create label\n\t\t\t\tlabel = $(\"<\" + this.settings.errorElement + \"/>\")\n\t\t\t\t\t.attr({\"for\":  this.idOrName(element), generated: true})\n\t\t\t\t\t.addClass(this.settings.errorClass)\n\t\t\t\t\t.html(message || \"\");\n\t\t\t\tif ( this.settings.wrapper ) {\n\t\t\t\t\t// make sure the element is visible, even in IE\n\t\t\t\t\t// actually showing the wrapped element is handled elsewhere\n\t\t\t\t\tlabel = label.hide().show().wrap(\"<\" + this.settings.wrapper + \"/>\").parent();\n\t\t\t\t}\n\t\t\t\tif ( !this.labelContainer.append(label).length ) {\n\t\t\t\t\tif ( this.settings.errorPlacement ) {\n\t\t\t\t\t\tthis.settings.errorPlacement(label, $(element) );\n\t\t\t\t\t} else {\n\t\t\t\t\tlabel.insertAfter(element);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( !message && this.settings.success ) {\n\t\t\t\tlabel.text(\"\");\n\t\t\t\tif ( typeof this.settings.success === \"string\" ) {\n\t\t\t\t\tlabel.addClass( this.settings.success );\n\t\t\t\t} else {\n\t\t\t\t\tthis.settings.success( label, element );\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis.toShow = this.toShow.add(label);\n\t\t},\n\n\t\terrorsFor: function(element) {\n\t\t\tvar name = this.idOrName(element);\n\t\t\treturn this.errors().filter(function() {\n\t\t\t\treturn $(this).attr('for') === name;\n\t\t\t});\n\t\t},\n\n\t\tidOrName: function(element) {\n\t\t\treturn this.groups[element.name] || (this.checkable(element) ? element.name : element.id || element.name);\n\t\t},\n\n\t\tvalidationTargetFor: function(element) {\n\t\t\t// if radio/checkbox, validate first element in group instead\n\t\t\tif (this.checkable(element)) {\n\t\t\t\telement = this.findByName( element.name ).not(this.settings.ignore)[0];\n\t\t\t}\n\t\t\treturn element;\n\t\t},\n\n\t\tcheckable: function( element ) {\n\t\t\treturn (/radio|checkbox/i).test(element.type);\n\t\t},\n\n\t\tfindByName: function( name ) {\n\t\t\treturn $(this.currentForm).find('[name=\"' + name + '\"]');\n\t\t},\n\n\t\tgetLength: function(value, element) {\n\t\t\tswitch( element.nodeName.toLowerCase() ) {\n\t\t\tcase 'select':\n\t\t\t\treturn $(\"option:selected\", element).length;\n\t\t\tcase 'input':\n\t\t\t\tif( this.checkable( element) ) {\n\t\t\t\t\treturn this.findByName(element.name).filter(':checked').length;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn value.length;\n\t\t},\n\n\t\tdepend: function(param, element) {\n\t\t\treturn this.dependTypes[typeof param] ? this.dependTypes[typeof param](param, element) : true;\n\t\t},\n\n\t\tdependTypes: {\n\t\t\t\"boolean\": function(param, element) {\n\t\t\t\treturn param;\n\t\t\t},\n\t\t\t\"string\": function(param, element) {\n\t\t\t\treturn !!$(param, element.form).length;\n\t\t\t},\n\t\t\t\"function\": function(param, element) {\n\t\t\t\treturn param(element);\n\t\t\t}\n\t\t},\n\n\t\toptional: function(element) {\n\t\t\tvar val = this.elementValue(element);\n\t\t\treturn !$.validator.methods.required.call(this, val, element) && \"dependency-mismatch\";\n\t\t},\n\n\t\tstartRequest: function(element) {\n\t\t\tif (!this.pending[element.name]) {\n\t\t\t\tthis.pendingRequest++;\n\t\t\t\tthis.pending[element.name] = true;\n\t\t\t}\n\t\t},\n\n\t\tstopRequest: function(element, valid) {\n\t\t\tthis.pendingRequest--;\n\t\t\t// sometimes synchronization fails, make sure pendingRequest is never < 0\n\t\t\tif (this.pendingRequest < 0) {\n\t\t\t\tthis.pendingRequest = 0;\n\t\t\t}\n\t\t\tdelete this.pending[element.name];\n\t\t\tif ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {\n\t\t\t\t$(this.currentForm).submit();\n\t\t\t\tthis.formSubmitted = false;\n\t\t\t} else if (!valid && this.pendingRequest === 0 && this.formSubmitted) {\n\t\t\t\t$(this.currentForm).triggerHandler(\"invalid-form\", [this]);\n\t\t\t\tthis.formSubmitted = false;\n\t\t\t}\n\t\t},\n\n\t\tpreviousValue: function(element) {\n\t\t\treturn $.data(element, \"previousValue\") || $.data(element, \"previousValue\", {\n\t\t\t\told: null,\n\t\t\t\tvalid: true,\n\t\t\t\tmessage: this.defaultMessage( element, \"remote\" )\n\t\t\t});\n\t\t}\n\n\t},\n\n\tclassRuleSettings: {\n\t\trequired: {required: true},\n\t\temail: {email: true},\n\t\turl: {url: true},\n\t\tdate: {date: true},\n\t\tdateISO: {dateISO: true},\n\t\tnumber: {number: true},\n\t\tdigits: {digits: true},\n\t\tcreditcard: {creditcard: true}\n\t},\n\n\taddClassRules: function(className, rules) {\n\t\tif ( className.constructor === String ) {\n\t\t\tthis.classRuleSettings[className] = rules;\n\t\t} else {\n\t\t\t$.extend(this.classRuleSettings, className);\n\t\t}\n\t},\n\n\tclassRules: function(element) {\n\t\tvar rules = {};\n\t\tvar classes = $(element).attr('class');\n\t\tif ( classes ) {\n\t\t\t$.each(classes.split(' '), function() {\n\t\t\t\tif (this in $.validator.classRuleSettings) {\n\t\t\t\t\t$.extend(rules, $.validator.classRuleSettings[this]);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn rules;\n\t},\n\n\tattributeRules: function(element) {\n\t\tvar rules = {};\n\t\tvar $element = $(element);\n\n\t\tfor (var method in $.validator.methods) {\n\t\t\tvar value;\n\n\t\t\t// support for <input required> in both html5 and older browsers\n\t\t\tif (method === 'required') {\n\t\t\t\tvalue = $element.get(0).getAttribute(method);\n\t\t\t\t// Some browsers return an empty string for the required attribute\n\t\t\t\t// and non-HTML5 browsers might have required=\"\" markup\n\t\t\t\tif (value === \"\") {\n\t\t\t\t\tvalue = true;\n\t\t\t\t}\n\t\t\t\t// force non-HTML5 browsers to return bool\n\t\t\t\tvalue = !!value;\n\t\t\t} else {\n\t\t\t\tvalue = $element.attr(method);\n\t\t\t}\n\n\t\t\tif (value) {\n\t\t\t\trules[method] = value;\n\t\t\t} else if ($element[0].getAttribute(\"type\") === method) {\n\t\t\t\trules[method] = true;\n\t\t\t}\n\t\t}\n\n\t\t// maxlength may be returned as -1, 2147483647 (IE) and 524288 (safari) for text inputs\n\t\tif (rules.maxlength && /-1|2147483647|524288/.test(rules.maxlength)) {\n\t\t\tdelete rules.maxlength;\n\t\t}\n\n\t\treturn rules;\n\t},\n\n\tmetadataRules: function(element) {\n\t\tif (!$.metadata) {\n\t\t\treturn {};\n\t\t}\n\n\t\tvar meta = $.data(element.form, 'validator').settings.meta;\n\t\treturn meta ?\n\t\t\t$(element).metadata()[meta] :\n\t\t\t$(element).metadata();\n\t},\n\n\tstaticRules: function(element) {\n\t\tvar rules = {};\n\t\tvar validator = $.data(element.form, 'validator');\n\t\tif (validator.settings.rules) {\n\t\t\trules = $.validator.normalizeRule(validator.settings.rules[element.name]) || {};\n\t\t}\n\t\treturn rules;\n\t},\n\n\tnormalizeRules: function(rules, element) {\n\t\t// handle dependency check\n\t\t$.each(rules, function(prop, val) {\n\t\t\t// ignore rule when param is explicitly false, eg. required:false\n\t\t\tif (val === false) {\n\t\t\t\tdelete rules[prop];\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (val.param || val.depends) {\n\t\t\t\tvar keepRule = true;\n\t\t\t\tswitch (typeof val.depends) {\n\t\t\t\t\tcase \"string\":\n\t\t\t\t\t\tkeepRule = !!$(val.depends, element.form).length;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"function\":\n\t\t\t\t\t\tkeepRule = val.depends.call(element, element);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (keepRule) {\n\t\t\t\t\trules[prop] = val.param !== undefined ? val.param : true;\n\t\t\t\t} else {\n\t\t\t\t\tdelete rules[prop];\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\t// evaluate parameters\n\t\t$.each(rules, function(rule, parameter) {\n\t\t\trules[rule] = $.isFunction(parameter) ? parameter(element) : parameter;\n\t\t});\n\n\t\t// clean number parameters\n\t\t$.each(['minlength', 'maxlength', 'min', 'max'], function() {\n\t\t\tif (rules[this]) {\n\t\t\t\trules[this] = Number(rules[this]);\n\t\t\t}\n\t\t});\n\t\t$.each(['rangelength', 'range'], function() {\n\t\t\tif (rules[this]) {\n\t\t\t\trules[this] = [Number(rules[this][0]), Number(rules[this][1])];\n\t\t\t}\n\t\t});\n\n\t\tif ($.validator.autoCreateRanges) {\n\t\t\t// auto-create ranges\n\t\t\tif (rules.min && rules.max) {\n\t\t\t\trules.range = [rules.min, rules.max];\n\t\t\t\tdelete rules.min;\n\t\t\t\tdelete rules.max;\n\t\t\t}\n\t\t\tif (rules.minlength && rules.maxlength) {\n\t\t\t\trules.rangelength = [rules.minlength, rules.maxlength];\n\t\t\t\tdelete rules.minlength;\n\t\t\t\tdelete rules.maxlength;\n\t\t\t}\n\t\t}\n\n\t\t// To support custom messages in metadata ignore rule methods titled \"messages\"\n\t\tif (rules.messages) {\n\t\t\tdelete rules.messages;\n\t\t}\n\n\t\treturn rules;\n\t},\n\n\t// Converts a simple string to a {string: true} rule, e.g., \"required\" to {required:true}\n\tnormalizeRule: function(data) {\n\t\tif( typeof data === \"string\" ) {\n\t\t\tvar transformed = {};\n\t\t\t$.each(data.split(/\\s/), function() {\n\t\t\t\ttransformed[this] = true;\n\t\t\t});\n\t\t\tdata = transformed;\n\t\t}\n\t\treturn data;\n\t},\n\n\t// http://docs.jquery.com/Plugins/Validation/Validator/addMethod\n\taddMethod: function(name, method, message) {\n\t\t$.validator.methods[name] = method;\n\t\t$.validator.messages[name] = message !== undefined ? message : $.validator.messages[name];\n\t\tif (method.length < 3) {\n\t\t\t$.validator.addClassRules(name, $.validator.normalizeRule(name));\n\t\t}\n\t},\n\n\tmethods: {\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/required\n\t\trequired: function(value, element, param) {\n\t\t\t// check if dependency is met\n\t\t\tif ( !this.depend(param, element) ) {\n\t\t\t\treturn \"dependency-mismatch\";\n\t\t\t}\n\t\t\tif ( element.nodeName.toLowerCase() === \"select\" ) {\n\t\t\t\t// could be an array for select-multiple or a string, both are fine this way\n\t\t\t\tvar val = $(element).val();\n\t\t\t\treturn val && val.length > 0;\n\t\t\t}\n\t\t\tif ( this.checkable(element) ) {\n\t\t\t\treturn this.getLength(value, element) > 0;\n\t\t\t}\n\t\t\treturn $.trim(value).length > 0;\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/remote\n\t\tremote: function(value, element, param) {\n\t\t\tif ( this.optional(element) ) {\n\t\t\t\treturn \"dependency-mismatch\";\n\t\t\t}\n\n\t\t\tvar previous = this.previousValue(element);\n\t\t\tif (!this.settings.messages[element.name] ) {\n\t\t\t\tthis.settings.messages[element.name] = {};\n\t\t\t}\n\t\t\tprevious.originalMessage = this.settings.messages[element.name].remote;\n\t\t\tthis.settings.messages[element.name].remote = previous.message;\n\n\t\t\tparam = typeof param === \"string\" && {url:param} || param;\n\n\t\t\tif ( this.pending[element.name] ) {\n\t\t\t\treturn \"pending\";\n\t\t\t}\n\t\t\tif ( previous.old === value ) {\n\t\t\t\treturn previous.valid;\n\t\t\t}\n\n\t\t\tprevious.old = value;\n\t\t\tvar validator = this;\n\t\t\tthis.startRequest(element);\n\t\t\tvar data = {};\n\t\t\tdata[element.name] = value;\n\t\t\t$.ajax($.extend(true, {\n\t\t\t\turl: param,\n\t\t\t\tmode: \"abort\",\n\t\t\t\tport: \"validate\" + element.name,\n\t\t\t\tdataType: \"json\",\n\t\t\t\tdata: data,\n\t\t\t\tsuccess: function(response) {\n\t\t\t\t\tvalidator.settings.messages[element.name].remote = previous.originalMessage;\n\t\t\t\t\tvar valid = response === true || response === \"true\";\n\t\t\t\t\tif ( valid ) {\n\t\t\t\t\t\tvar submitted = validator.formSubmitted;\n\t\t\t\t\t\tvalidator.prepareElement(element);\n\t\t\t\t\t\tvalidator.formSubmitted = submitted;\n\t\t\t\t\t\tvalidator.successList.push(element);\n\t\t\t\t\t\tdelete validator.invalid[element.name];\n\t\t\t\t\t\tvalidator.showErrors();\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar errors = {};\n\t\t\t\t\t\tvar message = response || validator.defaultMessage( element, \"remote\" );\n\t\t\t\t\t\terrors[element.name] = previous.message = $.isFunction(message) ? message(value) : message;\n\t\t\t\t\t\tvalidator.invalid[element.name] = true;\n\t\t\t\t\t\tvalidator.showErrors(errors);\n\t\t\t\t\t}\n\t\t\t\t\tprevious.valid = valid;\n\t\t\t\t\tvalidator.stopRequest(element, valid);\n\t\t\t\t}\n\t\t\t}, param));\n\t\t\treturn \"pending\";\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/minlength\n\t\tminlength: function(value, element, param) {\n\t\t\tvar length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);\n\t\t\treturn this.optional(element) || length >= param;\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/maxlength\n\t\tmaxlength: function(value, element, param) {\n\t\t\tvar length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);\n\t\t\treturn this.optional(element) || length <= param;\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/rangelength\n\t\trangelength: function(value, element, param) {\n\t\t\tvar length = $.isArray( value ) ? value.length : this.getLength($.trim(value), element);\n\t\t\treturn this.optional(element) || ( length >= param[0] && length <= param[1] );\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/min\n\t\tmin: function( value, element, param ) {\n\t\t\treturn this.optional(element) || value >= param;\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/max\n\t\tmax: function( value, element, param ) {\n\t\t\treturn this.optional(element) || value <= param;\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/range\n\t\trange: function( value, element, param ) {\n\t\t\treturn this.optional(element) || ( value >= param[0] && value <= param[1] );\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/email\n\t\temail: function(value, element) {\n\t\t\t// contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/\n\t\t\treturn this.optional(element) || /^((([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+(\\.([a-z]|\\d|[!#\\$%&'\\*\\+\\-\\/=\\?\\^_`{\\|}~]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])+)*)|((\\x22)((((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(([\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x7f]|\\x21|[\\x23-\\x5b]|[\\x5d-\\x7e]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(\\\\([\\x01-\\x09\\x0b\\x0c\\x0d-\\x7f]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]))))*(((\\x20|\\x09)*(\\x0d\\x0a))?(\\x20|\\x09)+)?(\\x22)))@((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))$/i.test(value);\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/url\n\t\turl: function(value, element) {\n\t\t\t// contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/\n\t\t\treturn this.optional(element) || /^(https?|ftp):\\/\\/(((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:)*@)?(((\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])\\.(\\d|[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5]))|((([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|\\d|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.)+(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])*([a-z]|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])))\\.?)(:\\d*)?)(\\/((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)+(\\/(([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)*)*)?)?(\\?((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)|[\\uE000-\\uF8FF]|\\/|\\?)*)?(\\#((([a-z]|\\d|-|\\.|_|~|[\\u00A0-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF])|(%[\\da-f]{2})|[!\\$&'\\(\\)\\*\\+,;=]|:|@)|\\/|\\?)*)?$/i.test(value);\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/date\n\t\tdate: function(value, element) {\n\t\t\treturn this.optional(element) || !/Invalid|NaN/.test(new Date(value));\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/dateISO\n\t\tdateISO: function(value, element) {\n\t\t\treturn this.optional(element) || /^\\d{4}[\\/\\-]\\d{1,2}[\\/\\-]\\d{1,2}$/.test(value);\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/number\n\t\tnumber: function(value, element) {\n\t\t\treturn this.optional(element) || /^-?(?:\\d+|\\d{1,3}(?:,\\d{3})+)?(?:\\.\\d+)?$/.test(value);\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/digits\n\t\tdigits: function(value, element) {\n\t\t\treturn this.optional(element) || /^\\d+$/.test(value);\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/creditcard\n\t\t// based on http://en.wikipedia.org/wiki/Luhn\n\t\tcreditcard: function(value, element) {\n\t\t\tif ( this.optional(element) ) {\n\t\t\t\treturn \"dependency-mismatch\";\n\t\t\t}\n\t\t\t// accept only spaces, digits and dashes\n\t\t\tif (/[^0-9 \\-]+/.test(value)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tvar nCheck = 0,\n\t\t\t\tnDigit = 0,\n\t\t\t\tbEven = false;\n\n\t\t\tvalue = value.replace(/\\D/g, \"\");\n\n\t\t\tfor (var n = value.length - 1; n >= 0; n--) {\n\t\t\t\tvar cDigit = value.charAt(n);\n\t\t\t\tnDigit = parseInt(cDigit, 10);\n\t\t\t\tif (bEven) {\n\t\t\t\t\tif ((nDigit *= 2) > 9) {\n\t\t\t\t\t\tnDigit -= 9;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tnCheck += nDigit;\n\t\t\t\tbEven = !bEven;\n\t\t\t}\n\n\t\t\treturn (nCheck % 10) === 0;\n\t\t},\n\n\t\t// http://docs.jquery.com/Plugins/Validation/Methods/equalTo\n\t\tequalTo: function(value, element, param) {\n\t\t\t// bind to the blur event of the target in order to revalidate whenever the target field is updated\n\t\t\t// TODO find a way to bind the event just once, avoiding the unbind-rebind overhead\n\t\t\tvar target = $(param);\n\t\t\tif (this.settings.onfocusout) {\n\t\t\t\ttarget.unbind(\".validate-equalTo\").bind(\"blur.validate-equalTo\", function() {\n\t\t\t\t\t$(element).valid();\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn value === target.val();\n\t\t}\n\n\t}\n\n});\n\n// deprecated, use $.validator.format instead\n$.format = $.validator.format;\n\n}(jQuery));\n\n// ajax mode: abort\n// usage: $.ajax({ mode: \"abort\"[, port: \"uniqueport\"]});\n// if mode:\"abort\" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()\n(function($) {\n\tvar pendingRequests = {};\n\t// Use a prefilter if available (1.5+)\n\tif ( $.ajaxPrefilter ) {\n\t\t$.ajaxPrefilter(function(settings, _, xhr) {\n\t\t\tvar port = settings.port;\n\t\t\tif (settings.mode === \"abort\") {\n\t\t\t\tif ( pendingRequests[port] ) {\n\t\t\t\t\tpendingRequests[port].abort();\n\t\t\t\t}\n\t\t\t\tpendingRequests[port] = xhr;\n\t\t\t}\n\t\t});\n\t} else {\n\t\t// Proxy ajax\n\t\tvar ajax = $.ajax;\n\t\t$.ajax = function(settings) {\n\t\t\tvar mode = ( \"mode\" in settings ? settings : $.ajaxSettings ).mode,\n\t\t\t\tport = ( \"port\" in settings ? settings : $.ajaxSettings ).port;\n\t\t\tif (mode === \"abort\") {\n\t\t\t\tif ( pendingRequests[port] ) {\n\t\t\t\t\tpendingRequests[port].abort();\n\t\t\t\t}\n\t\t\t\treturn (pendingRequests[port] = ajax.apply(this, arguments));\n\t\t\t}\n\t\t\treturn ajax.apply(this, arguments);\n\t\t};\n\t}\n}(jQuery));\n\n// provides cross-browser focusin and focusout events\n// IE has native support, in other browsers, use event caputuring (neither bubbles)\n\n// provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation\n// handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target\n(function($) {\n\t// only implement if not provided by jQuery core (since 1.4)\n\t// TODO verify if jQuery 1.4's implementation is compatible with older jQuery special-event APIs\n\tif (!jQuery.event.special.focusin && !jQuery.event.special.focusout && document.addEventListener) {\n\t\t$.each({\n\t\t\tfocus: 'focusin',\n\t\t\tblur: 'focusout'\n\t\t}, function( original, fix ){\n\t\t\t$.event.special[fix] = {\n\t\t\t\tsetup:function() {\n\t\t\t\t\tthis.addEventListener( original, handler, true );\n\t\t\t\t},\n\t\t\t\tteardown:function() {\n\t\t\t\t\tthis.removeEventListener( original, handler, true );\n\t\t\t\t},\n\t\t\t\thandler: function(e) {\n\t\t\t\t\tvar args = arguments;\n\t\t\t\t\targs[0] = $.event.fix(e);\n\t\t\t\t\targs[0].type = fix;\n\t\t\t\t\treturn $.event.handle.apply(this, args);\n\t\t\t\t}\n\t\t\t};\n\t\t\tfunction handler(e) {\n\t\t\t\te = $.event.fix(e);\n\t\t\t\te.type = fix;\n\t\t\t\treturn $.event.handle.call(this, e);\n\t\t\t}\n\t\t});\n\t}\n\t$.extend($.fn, {\n\t\tvalidateDelegate: function(delegate, type, handler) {\n\t\t\treturn this.bind(type, function(event) {\n\t\t\t\tvar target = $(event.target);\n\t\t\t\tif (target.is(delegate)) {\n\t\t\t\t\treturn handler.apply(target, arguments);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t});\n}(jQuery));\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Scripts/jquery.validate.unobtrusive.js",
    "content": "﻿/*!\n** Unobtrusive validation support library for jQuery and jQuery Validate\n** Copyright (C) Microsoft Corporation. All rights reserved.\n*/\n\n/*jslint white: true, browser: true, onevar: true, undef: true, nomen: true, eqeqeq: true, plusplus: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: false */\n/*global document: false, jQuery: false */\n\n(function ($) {\n    var $jQval = $.validator,\n        adapters,\n        data_validation = \"unobtrusiveValidation\";\n\n    function setValidationValues(options, ruleName, value) {\n        options.rules[ruleName] = value;\n        if (options.message) {\n            options.messages[ruleName] = options.message;\n        }\n    }\n\n    function splitAndTrim(value) {\n        return value.replace(/^\\s+|\\s+$/g, \"\").split(/\\s*,\\s*/g);\n    }\n\n    function escapeAttributeValue(value) {\n        // As mentioned on http://api.jquery.com/category/selectors/\n        return value.replace(/([!\"#$%&'()*+,./:;<=>?@\\[\\\\\\]^`{|}~])/g, \"\\\\$1\");\n    }\n\n    function getModelPrefix(fieldName) {\n        return fieldName.substr(0, fieldName.lastIndexOf(\".\") + 1);\n    }\n\n    function appendModelPrefix(value, prefix) {\n        if (value.indexOf(\"*.\") === 0) {\n            value = value.replace(\"*.\", prefix);\n        }\n        return value;\n    }\n\n    function onError(error, inputElement) {  // 'this' is the form element\n        var container = $(this).find(\"[data-valmsg-for='\" + escapeAttributeValue(inputElement[0].name) + \"']\"),\n            replaceAttrValue = container.attr(\"data-valmsg-replace\"),\n            replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) !== false : null;\n\n        container.removeClass(\"field-validation-valid\").addClass(\"field-validation-error\");\n        error.data(\"unobtrusiveContainer\", container);\n\n        if (replace) {\n            container.empty();\n            error.removeClass(\"input-validation-error\").appendTo(container);\n        }\n        else {\n            error.hide();\n        }\n    }\n\n    function onErrors(event, validator) {  // 'this' is the form element\n        var container = $(this).find(\"[data-valmsg-summary=true]\"),\n            list = container.find(\"ul\");\n\n        if (list && list.length && validator.errorList.length) {\n            list.empty();\n            container.addClass(\"validation-summary-errors\").removeClass(\"validation-summary-valid\");\n\n            $.each(validator.errorList, function () {\n                $(\"<li />\").html(this.message).appendTo(list);\n            });\n        }\n    }\n\n    function onSuccess(error) {  // 'this' is the form element\n        var container = error.data(\"unobtrusiveContainer\"),\n            replaceAttrValue = container.attr(\"data-valmsg-replace\"),\n            replace = replaceAttrValue ? $.parseJSON(replaceAttrValue) : null;\n\n        if (container) {\n            container.addClass(\"field-validation-valid\").removeClass(\"field-validation-error\");\n            error.removeData(\"unobtrusiveContainer\");\n\n            if (replace) {\n                container.empty();\n            }\n        }\n    }\n\n    function onReset(event) {  // 'this' is the form element\n        var $form = $(this);\n        $form.data(\"validator\").resetForm();\n        $form.find(\".validation-summary-errors\")\n            .addClass(\"validation-summary-valid\")\n            .removeClass(\"validation-summary-errors\");\n        $form.find(\".field-validation-error\")\n            .addClass(\"field-validation-valid\")\n            .removeClass(\"field-validation-error\")\n            .removeData(\"unobtrusiveContainer\")\n            .find(\">*\")  // If we were using valmsg-replace, get the underlying error\n                .removeData(\"unobtrusiveContainer\");\n    }\n\n    function validationInfo(form) {\n        var $form = $(form),\n            result = $form.data(data_validation),\n            onResetProxy = $.proxy(onReset, form);\n\n        if (!result) {\n            result = {\n                options: {  // options structure passed to jQuery Validate's validate() method\n                    errorClass: \"input-validation-error\",\n                    errorElement: \"span\",\n                    errorPlacement: $.proxy(onError, form),\n                    invalidHandler: $.proxy(onErrors, form),\n                    messages: {},\n                    rules: {},\n                    success: $.proxy(onSuccess, form)\n                },\n                attachValidation: function () {\n                    $form\n                        .unbind(\"reset.\" + data_validation, onResetProxy)\n                        .bind(\"reset.\" + data_validation, onResetProxy)\n                        .validate(this.options);\n                },\n                validate: function () {  // a validation function that is called by unobtrusive Ajax\n                    $form.validate();\n                    return $form.valid();\n                }\n            };\n            $form.data(data_validation, result);\n        }\n\n        return result;\n    }\n\n    $jQval.unobtrusive = {\n        adapters: [],\n\n        parseElement: function (element, skipAttach) {\n            /// <summary>\n            /// Parses a single HTML element for unobtrusive validation attributes.\n            /// </summary>\n            /// <param name=\"element\" domElement=\"true\">The HTML element to be parsed.</param>\n            /// <param name=\"skipAttach\" type=\"Boolean\">[Optional] true to skip attaching the\n            /// validation to the form. If parsing just this single element, you should specify true.\n            /// If parsing several elements, you should specify false, and manually attach the validation\n            /// to the form when you are finished. The default is false.</param>\n            var $element = $(element),\n                form = $element.parents(\"form\")[0],\n                valInfo, rules, messages;\n\n            if (!form) {  // Cannot do client-side validation without a form\n                return;\n            }\n\n            valInfo = validationInfo(form);\n            valInfo.options.rules[element.name] = rules = {};\n            valInfo.options.messages[element.name] = messages = {};\n\n            $.each(this.adapters, function () {\n                var prefix = \"data-val-\" + this.name,\n                    message = $element.attr(prefix),\n                    paramValues = {};\n\n                if (message !== undefined) {  // Compare against undefined, because an empty message is legal (and falsy)\n                    prefix += \"-\";\n\n                    $.each(this.params, function () {\n                        paramValues[this] = $element.attr(prefix + this);\n                    });\n\n                    this.adapt({\n                        element: element,\n                        form: form,\n                        message: message,\n                        params: paramValues,\n                        rules: rules,\n                        messages: messages\n                    });\n                }\n            });\n\n            $.extend(rules, { \"__dummy__\": true });\n\n            if (!skipAttach) {\n                valInfo.attachValidation();\n            }\n        },\n\n        parse: function (selector) {\n            /// <summary>\n            /// Parses all the HTML elements in the specified selector. It looks for input elements decorated\n            /// with the [data-val=true] attribute value and enables validation according to the data-val-*\n            /// attribute values.\n            /// </summary>\n            /// <param name=\"selector\" type=\"String\">Any valid jQuery selector.</param>\n            var $forms = $(selector)\n                .parents(\"form\")\n                .andSelf()\n                .add($(selector).find(\"form\"))\n                .filter(\"form\");\n\n            $(selector).find(\":input[data-val=true]\").each(function () {\n                $jQval.unobtrusive.parseElement(this, true);\n            });\n\n            $forms.each(function () {\n                var info = validationInfo(this);\n                if (info) {\n                    info.attachValidation();\n                }\n            });\n        }\n    };\n\n    adapters = $jQval.unobtrusive.adapters;\n\n    adapters.add = function (adapterName, params, fn) {\n        /// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation.</summary>\n        /// <param name=\"adapterName\" type=\"String\">The name of the adapter to be added. This matches the name used\n        /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>\n        /// <param name=\"params\" type=\"Array\" optional=\"true\">[Optional] An array of parameter names (strings) that will\n        /// be extracted from the data-val-nnnn-mmmm HTML attributes (where nnnn is the adapter name, and\n        /// mmmm is the parameter name).</param>\n        /// <param name=\"fn\" type=\"Function\">The function to call, which adapts the values from the HTML\n        /// attributes into jQuery Validate rules and/or messages.</param>\n        /// <returns type=\"jQuery.validator.unobtrusive.adapters\" />\n        if (!fn) {  // Called with no params, just a function\n            fn = params;\n            params = [];\n        }\n        this.push({ name: adapterName, params: params, adapt: fn });\n        return this;\n    };\n\n    adapters.addBool = function (adapterName, ruleName) {\n        /// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where\n        /// the jQuery Validate validation rule has no parameter values.</summary>\n        /// <param name=\"adapterName\" type=\"String\">The name of the adapter to be added. This matches the name used\n        /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>\n        /// <param name=\"ruleName\" type=\"String\" optional=\"true\">[Optional] The name of the jQuery Validate rule. If not provided, the value\n        /// of adapterName will be used instead.</param>\n        /// <returns type=\"jQuery.validator.unobtrusive.adapters\" />\n        return this.add(adapterName, function (options) {\n            setValidationValues(options, ruleName || adapterName, true);\n        });\n    };\n\n    adapters.addMinMax = function (adapterName, minRuleName, maxRuleName, minMaxRuleName, minAttribute, maxAttribute) {\n        /// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where\n        /// the jQuery Validate validation has three potential rules (one for min-only, one for max-only, and\n        /// one for min-and-max). The HTML parameters are expected to be named -min and -max.</summary>\n        /// <param name=\"adapterName\" type=\"String\">The name of the adapter to be added. This matches the name used\n        /// in the data-val-nnnn HTML attribute (where nnnn is the adapter name).</param>\n        /// <param name=\"minRuleName\" type=\"String\">The name of the jQuery Validate rule to be used when you only\n        /// have a minimum value.</param>\n        /// <param name=\"maxRuleName\" type=\"String\">The name of the jQuery Validate rule to be used when you only\n        /// have a maximum value.</param>\n        /// <param name=\"minMaxRuleName\" type=\"String\">The name of the jQuery Validate rule to be used when you\n        /// have both a minimum and maximum value.</param>\n        /// <param name=\"minAttribute\" type=\"String\" optional=\"true\">[Optional] The name of the HTML attribute that\n        /// contains the minimum value. The default is \"min\".</param>\n        /// <param name=\"maxAttribute\" type=\"String\" optional=\"true\">[Optional] The name of the HTML attribute that\n        /// contains the maximum value. The default is \"max\".</param>\n        /// <returns type=\"jQuery.validator.unobtrusive.adapters\" />\n        return this.add(adapterName, [minAttribute || \"min\", maxAttribute || \"max\"], function (options) {\n            var min = options.params.min,\n                max = options.params.max;\n\n            if (min && max) {\n                setValidationValues(options, minMaxRuleName, [min, max]);\n            }\n            else if (min) {\n                setValidationValues(options, minRuleName, min);\n            }\n            else if (max) {\n                setValidationValues(options, maxRuleName, max);\n            }\n        });\n    };\n\n    adapters.addSingleVal = function (adapterName, attribute, ruleName) {\n        /// <summary>Adds a new adapter to convert unobtrusive HTML into a jQuery Validate validation, where\n        /// the jQuery Validate validation rule has a single value.</summary>\n        /// <param name=\"adapterName\" type=\"String\">The name of the adapter to be added. This matches the name used\n        /// in the data-val-nnnn HTML attribute(where nnnn is the adapter name).</param>\n        /// <param name=\"attribute\" type=\"String\">[Optional] The name of the HTML attribute that contains the value.\n        /// The default is \"val\".</param>\n        /// <param name=\"ruleName\" type=\"String\" optional=\"true\">[Optional] The name of the jQuery Validate rule. If not provided, the value\n        /// of adapterName will be used instead.</param>\n        /// <returns type=\"jQuery.validator.unobtrusive.adapters\" />\n        return this.add(adapterName, [attribute || \"val\"], function (options) {\n            setValidationValues(options, ruleName || adapterName, options.params[attribute]);\n        });\n    };\n\n    $jQval.addMethod(\"__dummy__\", function (value, element, params) {\n        return true;\n    });\n\n    $jQval.addMethod(\"regex\", function (value, element, params) {\n        var match;\n        if (this.optional(element)) {\n            return true;\n        }\n\n        match = new RegExp(params).exec(value);\n        return (match && (match.index === 0) && (match[0].length === value.length));\n    });\n\n    $jQval.addMethod(\"nonalphamin\", function (value, element, nonalphamin) {\n        var match;\n        if (nonalphamin) {\n            match = value.match(/\\W/g);\n            match = match && match.length >= nonalphamin;\n        }\n        return match;\n    });\n\n    adapters.addSingleVal(\"accept\", \"exts\").addSingleVal(\"regex\", \"pattern\");\n    adapters.addBool(\"creditcard\").addBool(\"date\").addBool(\"digits\").addBool(\"email\").addBool(\"number\").addBool(\"url\");\n    adapters.addMinMax(\"length\", \"minlength\", \"maxlength\", \"rangelength\").addMinMax(\"range\", \"min\", \"max\", \"range\");\n    adapters.add(\"equalto\", [\"other\"], function (options) {\n        var prefix = getModelPrefix(options.element.name),\n            other = options.params.other,\n            fullOtherName = appendModelPrefix(other, prefix),\n            element = $(options.form).find(\":input[name='\" + escapeAttributeValue(fullOtherName) + \"']\")[0];\n\n        setValidationValues(options, \"equalTo\", element);\n    });\n    adapters.add(\"required\", function (options) {\n        // jQuery Validate equates \"required\" with \"mandatory\" for checkbox elements\n        if (options.element.tagName.toUpperCase() !== \"INPUT\" || options.element.type.toUpperCase() !== \"CHECKBOX\") {\n            setValidationValues(options, \"required\", true);\n        }\n    });\n    adapters.add(\"remote\", [\"url\", \"type\", \"additionalfields\"], function (options) {\n        var value = {\n            url: options.params.url,\n            type: options.params.type || \"GET\",\n            data: {}\n        },\n            prefix = getModelPrefix(options.element.name);\n\n        $.each(splitAndTrim(options.params.additionalfields || options.element.name), function (i, fieldName) {\n            var paramName = appendModelPrefix(fieldName, prefix);\n            value.data[paramName] = function () {\n                return $(options.form).find(\":input[name='\" + escapeAttributeValue(paramName) + \"']\").val();\n            };\n        });\n\n        setValidationValues(options, \"remote\", value);\n    });\n    adapters.add(\"password\", [\"min\", \"nonalphamin\", \"regex\"], function (options) {\n        if (options.params.min) {\n            setValidationValues(options, \"minlength\", options.params.min);\n        }\n        if (options.params.nonalphamin) {\n            setValidationValues(options, \"nonalphamin\", options.params.nonalphamin);\n        }\n        if (options.params.regex) {\n            setValidationValues(options, \"regex\", options.params.regex);\n        }\n    });\n\n    $(function () {\n        $jQval.unobtrusive.parse(document);\n    });\n} (jQuery));"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Scripts/knockout-2.2.0.debug.js",
    "content": "// Knockout JavaScript library v2.2.0\n// (c) Steven Sanderson - http://knockoutjs.com/\n// License: MIT (http://www.opensource.org/licenses/mit-license.php)\n\n(function(){\nvar DEBUG=true;\n(function(window,document,navigator,jQuery,undefined){\n!function(factory) {\n    // Support three module loading scenarios\n    if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {\n        // [1] CommonJS/Node.js\n        var target = module['exports'] || exports; // module.exports is for Node.js\n        factory(target);\n    } else if (typeof define === 'function' && define['amd']) {\n        // [2] AMD anonymous module\n        define(['exports'], factory);\n    } else {\n        // [3] No module loader (plain <script> tag) - put directly in global namespace\n        factory(window['ko'] = {});\n    }\n}(function(koExports){\n// Internally, all KO objects are attached to koExports (even the non-exported ones whose names will be minified by the closure compiler).\n// In the future, the following \"ko\" variable may be made distinct from \"koExports\" so that private objects are not externally reachable.\nvar ko = typeof koExports !== 'undefined' ? koExports : {};\n// Google Closure Compiler helpers (used only to make the minified file smaller)\nko.exportSymbol = function(koPath, object) {\n\tvar tokens = koPath.split(\".\");\n\n\t// In the future, \"ko\" may become distinct from \"koExports\" (so that non-exported objects are not reachable)\n\t// At that point, \"target\" would be set to: (typeof koExports !== \"undefined\" ? koExports : ko)\n\tvar target = ko;\n\n\tfor (var i = 0; i < tokens.length - 1; i++)\n\t\ttarget = target[tokens[i]];\n\ttarget[tokens[tokens.length - 1]] = object;\n};\nko.exportProperty = function(owner, publicName, object) {\n  owner[publicName] = object;\n};\nko.version = \"2.2.0\";\n\nko.exportSymbol('version', ko.version);\nko.utils = new (function () {\n    var stringTrimRegex = /^(\\s|\\u00A0)+|(\\s|\\u00A0)+$/g;\n\n    // Represent the known event types in a compact way, then at runtime transform it into a hash with event name as key (for fast lookup)\n    var knownEvents = {}, knownEventTypesByEventName = {};\n    var keyEventTypeName = /Firefox\\/2/i.test(navigator.userAgent) ? 'KeyboardEvent' : 'UIEvents';\n    knownEvents[keyEventTypeName] = ['keyup', 'keydown', 'keypress'];\n    knownEvents['MouseEvents'] = ['click', 'dblclick', 'mousedown', 'mouseup', 'mousemove', 'mouseover', 'mouseout', 'mouseenter', 'mouseleave'];\n    for (var eventType in knownEvents) {\n        var knownEventsForType = knownEvents[eventType];\n        if (knownEventsForType.length) {\n            for (var i = 0, j = knownEventsForType.length; i < j; i++)\n                knownEventTypesByEventName[knownEventsForType[i]] = eventType;\n        }\n    }\n    var eventsThatMustBeRegisteredUsingAttachEvent = { 'propertychange': true }; // Workaround for an IE9 issue - https://github.com/SteveSanderson/knockout/issues/406\n\n    // Detect IE versions for bug workarounds (uses IE conditionals, not UA string, for robustness)\n    // Note that, since IE 10 does not support conditional comments, the following logic only detects IE < 10.\n    // Currently this is by design, since IE 10+ behaves correctly when treated as a standard browser.\n    // If there is a future need to detect specific versions of IE10+, we will amend this.\n    var ieVersion = (function() {\n        var version = 3, div = document.createElement('div'), iElems = div.getElementsByTagName('i');\n\n        // Keep constructing conditional HTML blocks until we hit one that resolves to an empty fragment\n        while (\n            div.innerHTML = '<!--[if gt IE ' + (++version) + ']><i></i><![endif]-->',\n            iElems[0]\n        );\n        return version > 4 ? version : undefined;\n    }());\n    var isIe6 = ieVersion === 6,\n        isIe7 = ieVersion === 7;\n\n    function isClickOnCheckableElement(element, eventType) {\n        if ((ko.utils.tagNameLower(element) !== \"input\") || !element.type) return false;\n        if (eventType.toLowerCase() != \"click\") return false;\n        var inputType = element.type;\n        return (inputType == \"checkbox\") || (inputType == \"radio\");\n    }\n\n    return {\n        fieldsIncludedWithJsonPost: ['authenticity_token', /^__RequestVerificationToken(_.*)?$/],\n\n        arrayForEach: function (array, action) {\n            for (var i = 0, j = array.length; i < j; i++)\n                action(array[i]);\n        },\n\n        arrayIndexOf: function (array, item) {\n            if (typeof Array.prototype.indexOf == \"function\")\n                return Array.prototype.indexOf.call(array, item);\n            for (var i = 0, j = array.length; i < j; i++)\n                if (array[i] === item)\n                    return i;\n            return -1;\n        },\n\n        arrayFirst: function (array, predicate, predicateOwner) {\n            for (var i = 0, j = array.length; i < j; i++)\n                if (predicate.call(predicateOwner, array[i]))\n                    return array[i];\n            return null;\n        },\n\n        arrayRemoveItem: function (array, itemToRemove) {\n            var index = ko.utils.arrayIndexOf(array, itemToRemove);\n            if (index >= 0)\n                array.splice(index, 1);\n        },\n\n        arrayGetDistinctValues: function (array) {\n            array = array || [];\n            var result = [];\n            for (var i = 0, j = array.length; i < j; i++) {\n                if (ko.utils.arrayIndexOf(result, array[i]) < 0)\n                    result.push(array[i]);\n            }\n            return result;\n        },\n\n        arrayMap: function (array, mapping) {\n            array = array || [];\n            var result = [];\n            for (var i = 0, j = array.length; i < j; i++)\n                result.push(mapping(array[i]));\n            return result;\n        },\n\n        arrayFilter: function (array, predicate) {\n            array = array || [];\n            var result = [];\n            for (var i = 0, j = array.length; i < j; i++)\n                if (predicate(array[i]))\n                    result.push(array[i]);\n            return result;\n        },\n\n        arrayPushAll: function (array, valuesToPush) {\n            if (valuesToPush instanceof Array)\n                array.push.apply(array, valuesToPush);\n            else\n                for (var i = 0, j = valuesToPush.length; i < j; i++)\n                    array.push(valuesToPush[i]);\n            return array;\n        },\n\n        extend: function (target, source) {\n            if (source) {\n                for(var prop in source) {\n                    if(source.hasOwnProperty(prop)) {\n                        target[prop] = source[prop];\n                    }\n                }\n            }\n            return target;\n        },\n\n        emptyDomNode: function (domNode) {\n            while (domNode.firstChild) {\n                ko.removeNode(domNode.firstChild);\n            }\n        },\n\n        moveCleanedNodesToContainerElement: function(nodes) {\n            // Ensure it's a real array, as we're about to reparent the nodes and\n            // we don't want the underlying collection to change while we're doing that.\n            var nodesArray = ko.utils.makeArray(nodes);\n\n            var container = document.createElement('div');\n            for (var i = 0, j = nodesArray.length; i < j; i++) {\n                container.appendChild(ko.cleanNode(nodesArray[i]));\n            }\n            return container;\n        },\n\n        cloneNodes: function (nodesArray, shouldCleanNodes) {\n            for (var i = 0, j = nodesArray.length, newNodesArray = []; i < j; i++) {\n                var clonedNode = nodesArray[i].cloneNode(true);\n                newNodesArray.push(shouldCleanNodes ? ko.cleanNode(clonedNode) : clonedNode);\n            }\n            return newNodesArray;\n        },\n\n        setDomNodeChildren: function (domNode, childNodes) {\n            ko.utils.emptyDomNode(domNode);\n            if (childNodes) {\n                for (var i = 0, j = childNodes.length; i < j; i++)\n                    domNode.appendChild(childNodes[i]);\n            }\n        },\n\n        replaceDomNodes: function (nodeToReplaceOrNodeArray, newNodesArray) {\n            var nodesToReplaceArray = nodeToReplaceOrNodeArray.nodeType ? [nodeToReplaceOrNodeArray] : nodeToReplaceOrNodeArray;\n            if (nodesToReplaceArray.length > 0) {\n                var insertionPoint = nodesToReplaceArray[0];\n                var parent = insertionPoint.parentNode;\n                for (var i = 0, j = newNodesArray.length; i < j; i++)\n                    parent.insertBefore(newNodesArray[i], insertionPoint);\n                for (var i = 0, j = nodesToReplaceArray.length; i < j; i++) {\n                    ko.removeNode(nodesToReplaceArray[i]);\n                }\n            }\n        },\n\n        setOptionNodeSelectionState: function (optionNode, isSelected) {\n            // IE6 sometimes throws \"unknown error\" if you try to write to .selected directly, whereas Firefox struggles with setAttribute. Pick one based on browser.\n            if (ieVersion < 7)\n                optionNode.setAttribute(\"selected\", isSelected);\n            else\n                optionNode.selected = isSelected;\n        },\n\n        stringTrim: function (string) {\n            return (string || \"\").replace(stringTrimRegex, \"\");\n        },\n\n        stringTokenize: function (string, delimiter) {\n            var result = [];\n            var tokens = (string || \"\").split(delimiter);\n            for (var i = 0, j = tokens.length; i < j; i++) {\n                var trimmed = ko.utils.stringTrim(tokens[i]);\n                if (trimmed !== \"\")\n                    result.push(trimmed);\n            }\n            return result;\n        },\n\n        stringStartsWith: function (string, startsWith) {\n            string = string || \"\";\n            if (startsWith.length > string.length)\n                return false;\n            return string.substring(0, startsWith.length) === startsWith;\n        },\n\n        domNodeIsContainedBy: function (node, containedByNode) {\n            if (containedByNode.compareDocumentPosition)\n                return (containedByNode.compareDocumentPosition(node) & 16) == 16;\n            while (node != null) {\n                if (node == containedByNode)\n                    return true;\n                node = node.parentNode;\n            }\n            return false;\n        },\n\n        domNodeIsAttachedToDocument: function (node) {\n            return ko.utils.domNodeIsContainedBy(node, node.ownerDocument);\n        },\n\n        tagNameLower: function(element) {\n            // For HTML elements, tagName will always be upper case; for XHTML elements, it'll be lower case.\n            // Possible future optimization: If we know it's an element from an XHTML document (not HTML),\n            // we don't need to do the .toLowerCase() as it will always be lower case anyway.\n            return element && element.tagName && element.tagName.toLowerCase();\n        },\n\n        registerEventHandler: function (element, eventType, handler) {\n            var mustUseAttachEvent = ieVersion && eventsThatMustBeRegisteredUsingAttachEvent[eventType];\n            if (!mustUseAttachEvent && typeof jQuery != \"undefined\") {\n                if (isClickOnCheckableElement(element, eventType)) {\n                    // For click events on checkboxes, jQuery interferes with the event handling in an awkward way:\n                    // it toggles the element checked state *after* the click event handlers run, whereas native\n                    // click events toggle the checked state *before* the event handler.\n                    // Fix this by intecepting the handler and applying the correct checkedness before it runs.\n                    var originalHandler = handler;\n                    handler = function(event, eventData) {\n                        var jQuerySuppliedCheckedState = this.checked;\n                        if (eventData)\n                            this.checked = eventData.checkedStateBeforeEvent !== true;\n                        originalHandler.call(this, event);\n                        this.checked = jQuerySuppliedCheckedState; // Restore the state jQuery applied\n                    };\n                }\n                jQuery(element)['bind'](eventType, handler);\n            } else if (!mustUseAttachEvent && typeof element.addEventListener == \"function\")\n                element.addEventListener(eventType, handler, false);\n            else if (typeof element.attachEvent != \"undefined\")\n                element.attachEvent(\"on\" + eventType, function (event) {\n                    handler.call(element, event);\n                });\n            else\n                throw new Error(\"Browser doesn't support addEventListener or attachEvent\");\n        },\n\n        triggerEvent: function (element, eventType) {\n            if (!(element && element.nodeType))\n                throw new Error(\"element must be a DOM node when calling triggerEvent\");\n\n            if (typeof jQuery != \"undefined\") {\n                var eventData = [];\n                if (isClickOnCheckableElement(element, eventType)) {\n                    // Work around the jQuery \"click events on checkboxes\" issue described above by storing the original checked state before triggering the handler\n                    eventData.push({ checkedStateBeforeEvent: element.checked });\n                }\n                jQuery(element)['trigger'](eventType, eventData);\n            } else if (typeof document.createEvent == \"function\") {\n                if (typeof element.dispatchEvent == \"function\") {\n                    var eventCategory = knownEventTypesByEventName[eventType] || \"HTMLEvents\";\n                    var event = document.createEvent(eventCategory);\n                    event.initEvent(eventType, true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, element);\n                    element.dispatchEvent(event);\n                }\n                else\n                    throw new Error(\"The supplied element doesn't support dispatchEvent\");\n            } else if (typeof element.fireEvent != \"undefined\") {\n                // Unlike other browsers, IE doesn't change the checked state of checkboxes/radiobuttons when you trigger their \"click\" event\n                // so to make it consistent, we'll do it manually here\n                if (isClickOnCheckableElement(element, eventType))\n                    element.checked = element.checked !== true;\n                element.fireEvent(\"on\" + eventType);\n            }\n            else\n                throw new Error(\"Browser doesn't support triggering events\");\n        },\n\n        unwrapObservable: function (value) {\n            return ko.isObservable(value) ? value() : value;\n        },\n\n        peekObservable: function (value) {\n            return ko.isObservable(value) ? value.peek() : value;\n        },\n\n        toggleDomNodeCssClass: function (node, classNames, shouldHaveClass) {\n            if (classNames) {\n                var cssClassNameRegex = /[\\w-]+/g,\n                    currentClassNames = node.className.match(cssClassNameRegex) || [];\n                ko.utils.arrayForEach(classNames.match(cssClassNameRegex), function(className) {\n                    var indexOfClass = ko.utils.arrayIndexOf(currentClassNames, className);\n                    if (indexOfClass >= 0) {\n                        if (!shouldHaveClass)\n                            currentClassNames.splice(indexOfClass, 1);\n                    } else {\n                        if (shouldHaveClass)\n                            currentClassNames.push(className);\n                    }\n                });\n                node.className = currentClassNames.join(\" \");\n            }\n        },\n\n        setTextContent: function(element, textContent) {\n            var value = ko.utils.unwrapObservable(textContent);\n            if ((value === null) || (value === undefined))\n                value = \"\";\n\n            if (element.nodeType === 3) {\n                element.data = value;\n            } else {\n                // We need there to be exactly one child: a text node.\n                // If there are no children, more than one, or if it's not a text node,\n                // we'll clear everything and create a single text node.\n                var innerTextNode = ko.virtualElements.firstChild(element);\n                if (!innerTextNode || innerTextNode.nodeType != 3 || ko.virtualElements.nextSibling(innerTextNode)) {\n                    ko.virtualElements.setDomNodeChildren(element, [document.createTextNode(value)]);\n                } else {\n                    innerTextNode.data = value;\n                }\n\n                ko.utils.forceRefresh(element);\n            }\n        },\n\n        setElementName: function(element, name) {\n            element.name = name;\n\n            // Workaround IE 6/7 issue\n            // - https://github.com/SteveSanderson/knockout/issues/197\n            // - http://www.matts411.com/post/setting_the_name_attribute_in_ie_dom/\n            if (ieVersion <= 7) {\n                try {\n                    element.mergeAttributes(document.createElement(\"<input name='\" + element.name + \"'/>\"), false);\n                }\n                catch(e) {} // For IE9 with doc mode \"IE9 Standards\" and browser mode \"IE9 Compatibility View\"\n            }\n        },\n\n        forceRefresh: function(node) {\n            // Workaround for an IE9 rendering bug - https://github.com/SteveSanderson/knockout/issues/209\n            if (ieVersion >= 9) {\n                // For text nodes and comment nodes (most likely virtual elements), we will have to refresh the container\n                var elem = node.nodeType == 1 ? node : node.parentNode;\n                if (elem.style)\n                    elem.style.zoom = elem.style.zoom;\n            }\n        },\n\n        ensureSelectElementIsRenderedCorrectly: function(selectElement) {\n            // Workaround for IE9 rendering bug - it doesn't reliably display all the text in dynamically-added select boxes unless you force it to re-render by updating the width.\n            // (See https://github.com/SteveSanderson/knockout/issues/312, http://stackoverflow.com/questions/5908494/select-only-shows-first-char-of-selected-option)\n            if (ieVersion >= 9) {\n                var originalWidth = selectElement.style.width;\n                selectElement.style.width = 0;\n                selectElement.style.width = originalWidth;\n            }\n        },\n\n        range: function (min, max) {\n            min = ko.utils.unwrapObservable(min);\n            max = ko.utils.unwrapObservable(max);\n            var result = [];\n            for (var i = min; i <= max; i++)\n                result.push(i);\n            return result;\n        },\n\n        makeArray: function(arrayLikeObject) {\n            var result = [];\n            for (var i = 0, j = arrayLikeObject.length; i < j; i++) {\n                result.push(arrayLikeObject[i]);\n            };\n            return result;\n        },\n\n        isIe6 : isIe6,\n        isIe7 : isIe7,\n        ieVersion : ieVersion,\n\n        getFormFields: function(form, fieldName) {\n            var fields = ko.utils.makeArray(form.getElementsByTagName(\"input\")).concat(ko.utils.makeArray(form.getElementsByTagName(\"textarea\")));\n            var isMatchingField = (typeof fieldName == 'string')\n                ? function(field) { return field.name === fieldName }\n                : function(field) { return fieldName.test(field.name) }; // Treat fieldName as regex or object containing predicate\n            var matches = [];\n            for (var i = fields.length - 1; i >= 0; i--) {\n                if (isMatchingField(fields[i]))\n                    matches.push(fields[i]);\n            };\n            return matches;\n        },\n\n        parseJson: function (jsonString) {\n            if (typeof jsonString == \"string\") {\n                jsonString = ko.utils.stringTrim(jsonString);\n                if (jsonString) {\n                    if (window.JSON && window.JSON.parse) // Use native parsing where available\n                        return window.JSON.parse(jsonString);\n                    return (new Function(\"return \" + jsonString))(); // Fallback on less safe parsing for older browsers\n                }\n            }\n            return null;\n        },\n\n        stringifyJson: function (data, replacer, space) {   // replacer and space are optional\n            if ((typeof JSON == \"undefined\") || (typeof JSON.stringify == \"undefined\"))\n                throw new Error(\"Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js\");\n            return JSON.stringify(ko.utils.unwrapObservable(data), replacer, space);\n        },\n\n        postJson: function (urlOrForm, data, options) {\n            options = options || {};\n            var params = options['params'] || {};\n            var includeFields = options['includeFields'] || this.fieldsIncludedWithJsonPost;\n            var url = urlOrForm;\n\n            // If we were given a form, use its 'action' URL and pick out any requested field values\n            if((typeof urlOrForm == 'object') && (ko.utils.tagNameLower(urlOrForm) === \"form\")) {\n                var originalForm = urlOrForm;\n                url = originalForm.action;\n                for (var i = includeFields.length - 1; i >= 0; i--) {\n                    var fields = ko.utils.getFormFields(originalForm, includeFields[i]);\n                    for (var j = fields.length - 1; j >= 0; j--)\n                        params[fields[j].name] = fields[j].value;\n                }\n            }\n\n            data = ko.utils.unwrapObservable(data);\n            var form = document.createElement(\"form\");\n            form.style.display = \"none\";\n            form.action = url;\n            form.method = \"post\";\n            for (var key in data) {\n                var input = document.createElement(\"input\");\n                input.name = key;\n                input.value = ko.utils.stringifyJson(ko.utils.unwrapObservable(data[key]));\n                form.appendChild(input);\n            }\n            for (var key in params) {\n                var input = document.createElement(\"input\");\n                input.name = key;\n                input.value = params[key];\n                form.appendChild(input);\n            }\n            document.body.appendChild(form);\n            options['submitter'] ? options['submitter'](form) : form.submit();\n            setTimeout(function () { form.parentNode.removeChild(form); }, 0);\n        }\n    }\n})();\n\nko.exportSymbol('utils', ko.utils);\nko.exportSymbol('utils.arrayForEach', ko.utils.arrayForEach);\nko.exportSymbol('utils.arrayFirst', ko.utils.arrayFirst);\nko.exportSymbol('utils.arrayFilter', ko.utils.arrayFilter);\nko.exportSymbol('utils.arrayGetDistinctValues', ko.utils.arrayGetDistinctValues);\nko.exportSymbol('utils.arrayIndexOf', ko.utils.arrayIndexOf);\nko.exportSymbol('utils.arrayMap', ko.utils.arrayMap);\nko.exportSymbol('utils.arrayPushAll', ko.utils.arrayPushAll);\nko.exportSymbol('utils.arrayRemoveItem', ko.utils.arrayRemoveItem);\nko.exportSymbol('utils.extend', ko.utils.extend);\nko.exportSymbol('utils.fieldsIncludedWithJsonPost', ko.utils.fieldsIncludedWithJsonPost);\nko.exportSymbol('utils.getFormFields', ko.utils.getFormFields);\nko.exportSymbol('utils.peekObservable', ko.utils.peekObservable);\nko.exportSymbol('utils.postJson', ko.utils.postJson);\nko.exportSymbol('utils.parseJson', ko.utils.parseJson);\nko.exportSymbol('utils.registerEventHandler', ko.utils.registerEventHandler);\nko.exportSymbol('utils.stringifyJson', ko.utils.stringifyJson);\nko.exportSymbol('utils.range', ko.utils.range);\nko.exportSymbol('utils.toggleDomNodeCssClass', ko.utils.toggleDomNodeCssClass);\nko.exportSymbol('utils.triggerEvent', ko.utils.triggerEvent);\nko.exportSymbol('utils.unwrapObservable', ko.utils.unwrapObservable);\n\nif (!Function.prototype['bind']) {\n    // Function.prototype.bind is a standard part of ECMAScript 5th Edition (December 2009, http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf)\n    // In case the browser doesn't implement it natively, provide a JavaScript implementation. This implementation is based on the one in prototype.js\n    Function.prototype['bind'] = function (object) {\n        var originalFunction = this, args = Array.prototype.slice.call(arguments), object = args.shift();\n        return function () {\n            return originalFunction.apply(object, args.concat(Array.prototype.slice.call(arguments)));\n        };\n    };\n}\n\nko.utils.domData = new (function () {\n    var uniqueId = 0;\n    var dataStoreKeyExpandoPropertyName = \"__ko__\" + (new Date).getTime();\n    var dataStore = {};\n    return {\n        get: function (node, key) {\n            var allDataForNode = ko.utils.domData.getAll(node, false);\n            return allDataForNode === undefined ? undefined : allDataForNode[key];\n        },\n        set: function (node, key, value) {\n            if (value === undefined) {\n                // Make sure we don't actually create a new domData key if we are actually deleting a value\n                if (ko.utils.domData.getAll(node, false) === undefined)\n                    return;\n            }\n            var allDataForNode = ko.utils.domData.getAll(node, true);\n            allDataForNode[key] = value;\n        },\n        getAll: function (node, createIfNotFound) {\n            var dataStoreKey = node[dataStoreKeyExpandoPropertyName];\n            var hasExistingDataStore = dataStoreKey && (dataStoreKey !== \"null\") && dataStore[dataStoreKey];\n            if (!hasExistingDataStore) {\n                if (!createIfNotFound)\n                    return undefined;\n                dataStoreKey = node[dataStoreKeyExpandoPropertyName] = \"ko\" + uniqueId++;\n                dataStore[dataStoreKey] = {};\n            }\n            return dataStore[dataStoreKey];\n        },\n        clear: function (node) {\n            var dataStoreKey = node[dataStoreKeyExpandoPropertyName];\n            if (dataStoreKey) {\n                delete dataStore[dataStoreKey];\n                node[dataStoreKeyExpandoPropertyName] = null;\n                return true; // Exposing \"did clean\" flag purely so specs can infer whether things have been cleaned up as intended\n            }\n            return false;\n        }\n    }\n})();\n\nko.exportSymbol('utils.domData', ko.utils.domData);\nko.exportSymbol('utils.domData.clear', ko.utils.domData.clear); // Exporting only so specs can clear up after themselves fully\n\nko.utils.domNodeDisposal = new (function () {\n    var domDataKey = \"__ko_domNodeDisposal__\" + (new Date).getTime();\n    var cleanableNodeTypes = { 1: true, 8: true, 9: true };       // Element, Comment, Document\n    var cleanableNodeTypesWithDescendants = { 1: true, 9: true }; // Element, Document\n\n    function getDisposeCallbacksCollection(node, createIfNotFound) {\n        var allDisposeCallbacks = ko.utils.domData.get(node, domDataKey);\n        if ((allDisposeCallbacks === undefined) && createIfNotFound) {\n            allDisposeCallbacks = [];\n            ko.utils.domData.set(node, domDataKey, allDisposeCallbacks);\n        }\n        return allDisposeCallbacks;\n    }\n    function destroyCallbacksCollection(node) {\n        ko.utils.domData.set(node, domDataKey, undefined);\n    }\n\n    function cleanSingleNode(node) {\n        // Run all the dispose callbacks\n        var callbacks = getDisposeCallbacksCollection(node, false);\n        if (callbacks) {\n            callbacks = callbacks.slice(0); // Clone, as the array may be modified during iteration (typically, callbacks will remove themselves)\n            for (var i = 0; i < callbacks.length; i++)\n                callbacks[i](node);\n        }\n\n        // Also erase the DOM data\n        ko.utils.domData.clear(node);\n\n        // Special support for jQuery here because it's so commonly used.\n        // Many jQuery plugins (including jquery.tmpl) store data using jQuery's equivalent of domData\n        // so notify it to tear down any resources associated with the node & descendants here.\n        if ((typeof jQuery == \"function\") && (typeof jQuery['cleanData'] == \"function\"))\n            jQuery['cleanData']([node]);\n\n        // Also clear any immediate-child comment nodes, as these wouldn't have been found by\n        // node.getElementsByTagName(\"*\") in cleanNode() (comment nodes aren't elements)\n        if (cleanableNodeTypesWithDescendants[node.nodeType])\n            cleanImmediateCommentTypeChildren(node);\n    }\n\n    function cleanImmediateCommentTypeChildren(nodeWithChildren) {\n        var child, nextChild = nodeWithChildren.firstChild;\n        while (child = nextChild) {\n            nextChild = child.nextSibling;\n            if (child.nodeType === 8)\n                cleanSingleNode(child);\n        }\n    }\n\n    return {\n        addDisposeCallback : function(node, callback) {\n            if (typeof callback != \"function\")\n                throw new Error(\"Callback must be a function\");\n            getDisposeCallbacksCollection(node, true).push(callback);\n        },\n\n        removeDisposeCallback : function(node, callback) {\n            var callbacksCollection = getDisposeCallbacksCollection(node, false);\n            if (callbacksCollection) {\n                ko.utils.arrayRemoveItem(callbacksCollection, callback);\n                if (callbacksCollection.length == 0)\n                    destroyCallbacksCollection(node);\n            }\n        },\n\n        cleanNode : function(node) {\n            // First clean this node, where applicable\n            if (cleanableNodeTypes[node.nodeType]) {\n                cleanSingleNode(node);\n\n                // ... then its descendants, where applicable\n                if (cleanableNodeTypesWithDescendants[node.nodeType]) {\n                    // Clone the descendants list in case it changes during iteration\n                    var descendants = [];\n                    ko.utils.arrayPushAll(descendants, node.getElementsByTagName(\"*\"));\n                    for (var i = 0, j = descendants.length; i < j; i++)\n                        cleanSingleNode(descendants[i]);\n                }\n            }\n            return node;\n        },\n\n        removeNode : function(node) {\n            ko.cleanNode(node);\n            if (node.parentNode)\n                node.parentNode.removeChild(node);\n        }\n    }\n})();\nko.cleanNode = ko.utils.domNodeDisposal.cleanNode; // Shorthand name for convenience\nko.removeNode = ko.utils.domNodeDisposal.removeNode; // Shorthand name for convenience\nko.exportSymbol('cleanNode', ko.cleanNode);\nko.exportSymbol('removeNode', ko.removeNode);\nko.exportSymbol('utils.domNodeDisposal', ko.utils.domNodeDisposal);\nko.exportSymbol('utils.domNodeDisposal.addDisposeCallback', ko.utils.domNodeDisposal.addDisposeCallback);\nko.exportSymbol('utils.domNodeDisposal.removeDisposeCallback', ko.utils.domNodeDisposal.removeDisposeCallback);\n(function () {\n    var leadingCommentRegex = /^(\\s*)<!--(.*?)-->/;\n\n    function simpleHtmlParse(html) {\n        // Based on jQuery's \"clean\" function, but only accounting for table-related elements.\n        // If you have referenced jQuery, this won't be used anyway - KO will use jQuery's \"clean\" function directly\n\n        // Note that there's still an issue in IE < 9 whereby it will discard comment nodes that are the first child of\n        // a descendant node. For example: \"<div><!-- mycomment -->abc</div>\" will get parsed as \"<div>abc</div>\"\n        // This won't affect anyone who has referenced jQuery, and there's always the workaround of inserting a dummy node\n        // (possibly a text node) in front of the comment. So, KO does not attempt to workaround this IE issue automatically at present.\n\n        // Trim whitespace, otherwise indexOf won't work as expected\n        var tags = ko.utils.stringTrim(html).toLowerCase(), div = document.createElement(\"div\");\n\n        // Finds the first match from the left column, and returns the corresponding \"wrap\" data from the right column\n        var wrap = tags.match(/^<(thead|tbody|tfoot)/)              && [1, \"<table>\", \"</table>\"] ||\n                   !tags.indexOf(\"<tr\")                             && [2, \"<table><tbody>\", \"</tbody></table>\"] ||\n                   (!tags.indexOf(\"<td\") || !tags.indexOf(\"<th\"))   && [3, \"<table><tbody><tr>\", \"</tr></tbody></table>\"] ||\n                   /* anything else */                                 [0, \"\", \"\"];\n\n        // Go to html and back, then peel off extra wrappers\n        // Note that we always prefix with some dummy text, because otherwise, IE<9 will strip out leading comment nodes in descendants. Total madness.\n        var markup = \"ignored<div>\" + wrap[1] + html + wrap[2] + \"</div>\";\n        if (typeof window['innerShiv'] == \"function\") {\n            div.appendChild(window['innerShiv'](markup));\n        } else {\n            div.innerHTML = markup;\n        }\n\n        // Move to the right depth\n        while (wrap[0]--)\n            div = div.lastChild;\n\n        return ko.utils.makeArray(div.lastChild.childNodes);\n    }\n\n    function jQueryHtmlParse(html) {\n        var elems = jQuery['clean']([html]);\n\n        // As of jQuery 1.7.1, jQuery parses the HTML by appending it to some dummy parent nodes held in an in-memory document fragment.\n        // Unfortunately, it never clears the dummy parent nodes from the document fragment, so it leaks memory over time.\n        // Fix this by finding the top-most dummy parent element, and detaching it from its owner fragment.\n        if (elems && elems[0]) {\n            // Find the top-most parent element that's a direct child of a document fragment\n            var elem = elems[0];\n            while (elem.parentNode && elem.parentNode.nodeType !== 11 /* i.e., DocumentFragment */)\n                elem = elem.parentNode;\n            // ... then detach it\n            if (elem.parentNode)\n                elem.parentNode.removeChild(elem);\n        }\n\n        return elems;\n    }\n\n    ko.utils.parseHtmlFragment = function(html) {\n        return typeof jQuery != 'undefined' ? jQueryHtmlParse(html)   // As below, benefit from jQuery's optimisations where possible\n                                            : simpleHtmlParse(html);  // ... otherwise, this simple logic will do in most common cases.\n    };\n\n    ko.utils.setHtml = function(node, html) {\n        ko.utils.emptyDomNode(node);\n\n        // There's no legitimate reason to display a stringified observable without unwrapping it, so we'll unwrap it\n        html = ko.utils.unwrapObservable(html);\n\n        if ((html !== null) && (html !== undefined)) {\n            if (typeof html != 'string')\n                html = html.toString();\n\n            // jQuery contains a lot of sophisticated code to parse arbitrary HTML fragments,\n            // for example <tr> elements which are not normally allowed to exist on their own.\n            // If you've referenced jQuery we'll use that rather than duplicating its code.\n            if (typeof jQuery != 'undefined') {\n                jQuery(node)['html'](html);\n            } else {\n                // ... otherwise, use KO's own parsing logic.\n                var parsedNodes = ko.utils.parseHtmlFragment(html);\n                for (var i = 0; i < parsedNodes.length; i++)\n                    node.appendChild(parsedNodes[i]);\n            }\n        }\n    };\n})();\n\nko.exportSymbol('utils.parseHtmlFragment', ko.utils.parseHtmlFragment);\nko.exportSymbol('utils.setHtml', ko.utils.setHtml);\n\nko.memoization = (function () {\n    var memos = {};\n\n    function randomMax8HexChars() {\n        return (((1 + Math.random()) * 0x100000000) | 0).toString(16).substring(1);\n    }\n    function generateRandomId() {\n        return randomMax8HexChars() + randomMax8HexChars();\n    }\n    function findMemoNodes(rootNode, appendToArray) {\n        if (!rootNode)\n            return;\n        if (rootNode.nodeType == 8) {\n            var memoId = ko.memoization.parseMemoText(rootNode.nodeValue);\n            if (memoId != null)\n                appendToArray.push({ domNode: rootNode, memoId: memoId });\n        } else if (rootNode.nodeType == 1) {\n            for (var i = 0, childNodes = rootNode.childNodes, j = childNodes.length; i < j; i++)\n                findMemoNodes(childNodes[i], appendToArray);\n        }\n    }\n\n    return {\n        memoize: function (callback) {\n            if (typeof callback != \"function\")\n                throw new Error(\"You can only pass a function to ko.memoization.memoize()\");\n            var memoId = generateRandomId();\n            memos[memoId] = callback;\n            return \"<!--[ko_memo:\" + memoId + \"]-->\";\n        },\n\n        unmemoize: function (memoId, callbackParams) {\n            var callback = memos[memoId];\n            if (callback === undefined)\n                throw new Error(\"Couldn't find any memo with ID \" + memoId + \". Perhaps it's already been unmemoized.\");\n            try {\n                callback.apply(null, callbackParams || []);\n                return true;\n            }\n            finally { delete memos[memoId]; }\n        },\n\n        unmemoizeDomNodeAndDescendants: function (domNode, extraCallbackParamsArray) {\n            var memos = [];\n            findMemoNodes(domNode, memos);\n            for (var i = 0, j = memos.length; i < j; i++) {\n                var node = memos[i].domNode;\n                var combinedParams = [node];\n                if (extraCallbackParamsArray)\n                    ko.utils.arrayPushAll(combinedParams, extraCallbackParamsArray);\n                ko.memoization.unmemoize(memos[i].memoId, combinedParams);\n                node.nodeValue = \"\"; // Neuter this node so we don't try to unmemoize it again\n                if (node.parentNode)\n                    node.parentNode.removeChild(node); // If possible, erase it totally (not always possible - someone else might just hold a reference to it then call unmemoizeDomNodeAndDescendants again)\n            }\n        },\n\n        parseMemoText: function (memoText) {\n            var match = memoText.match(/^\\[ko_memo\\:(.*?)\\]$/);\n            return match ? match[1] : null;\n        }\n    };\n})();\n\nko.exportSymbol('memoization', ko.memoization);\nko.exportSymbol('memoization.memoize', ko.memoization.memoize);\nko.exportSymbol('memoization.unmemoize', ko.memoization.unmemoize);\nko.exportSymbol('memoization.parseMemoText', ko.memoization.parseMemoText);\nko.exportSymbol('memoization.unmemoizeDomNodeAndDescendants', ko.memoization.unmemoizeDomNodeAndDescendants);\nko.extenders = {\n    'throttle': function(target, timeout) {\n        // Throttling means two things:\n\n        // (1) For dependent observables, we throttle *evaluations* so that, no matter how fast its dependencies\n        //     notify updates, the target doesn't re-evaluate (and hence doesn't notify) faster than a certain rate\n        target['throttleEvaluation'] = timeout;\n\n        // (2) For writable targets (observables, or writable dependent observables), we throttle *writes*\n        //     so the target cannot change value synchronously or faster than a certain rate\n        var writeTimeoutInstance = null;\n        return ko.dependentObservable({\n            'read': target,\n            'write': function(value) {\n                clearTimeout(writeTimeoutInstance);\n                writeTimeoutInstance = setTimeout(function() {\n                    target(value);\n                }, timeout);\n            }\n        });\n    },\n\n    'notify': function(target, notifyWhen) {\n        target[\"equalityComparer\"] = notifyWhen == \"always\"\n            ? function() { return false } // Treat all values as not equal\n            : ko.observable[\"fn\"][\"equalityComparer\"];\n        return target;\n    }\n};\n\nfunction applyExtenders(requestedExtenders) {\n    var target = this;\n    if (requestedExtenders) {\n        for (var key in requestedExtenders) {\n            var extenderHandler = ko.extenders[key];\n            if (typeof extenderHandler == 'function') {\n                target = extenderHandler(target, requestedExtenders[key]);\n            }\n        }\n    }\n    return target;\n}\n\nko.exportSymbol('extenders', ko.extenders);\n\nko.subscription = function (target, callback, disposeCallback) {\n    this.target = target;\n    this.callback = callback;\n    this.disposeCallback = disposeCallback;\n    ko.exportProperty(this, 'dispose', this.dispose);\n};\nko.subscription.prototype.dispose = function () {\n    this.isDisposed = true;\n    this.disposeCallback();\n};\n\nko.subscribable = function () {\n    this._subscriptions = {};\n\n    ko.utils.extend(this, ko.subscribable['fn']);\n    ko.exportProperty(this, 'subscribe', this.subscribe);\n    ko.exportProperty(this, 'extend', this.extend);\n    ko.exportProperty(this, 'getSubscriptionsCount', this.getSubscriptionsCount);\n}\n\nvar defaultEvent = \"change\";\n\nko.subscribable['fn'] = {\n    subscribe: function (callback, callbackTarget, event) {\n        event = event || defaultEvent;\n        var boundCallback = callbackTarget ? callback.bind(callbackTarget) : callback;\n\n        var subscription = new ko.subscription(this, boundCallback, function () {\n            ko.utils.arrayRemoveItem(this._subscriptions[event], subscription);\n        }.bind(this));\n\n        if (!this._subscriptions[event])\n            this._subscriptions[event] = [];\n        this._subscriptions[event].push(subscription);\n        return subscription;\n    },\n\n    \"notifySubscribers\": function (valueToNotify, event) {\n        event = event || defaultEvent;\n        if (this._subscriptions[event]) {\n            ko.dependencyDetection.ignore(function() {\n                ko.utils.arrayForEach(this._subscriptions[event].slice(0), function (subscription) {\n                    // In case a subscription was disposed during the arrayForEach cycle, check\n                    // for isDisposed on each subscription before invoking its callback\n                    if (subscription && (subscription.isDisposed !== true))\n                        subscription.callback(valueToNotify);\n                });\n            }, this);\n        }\n    },\n\n    getSubscriptionsCount: function () {\n        var total = 0;\n        for (var eventName in this._subscriptions) {\n            if (this._subscriptions.hasOwnProperty(eventName))\n                total += this._subscriptions[eventName].length;\n        }\n        return total;\n    },\n\n    extend: applyExtenders\n};\n\n\nko.isSubscribable = function (instance) {\n    return typeof instance.subscribe == \"function\" && typeof instance[\"notifySubscribers\"] == \"function\";\n};\n\nko.exportSymbol('subscribable', ko.subscribable);\nko.exportSymbol('isSubscribable', ko.isSubscribable);\n\nko.dependencyDetection = (function () {\n    var _frames = [];\n\n    return {\n        begin: function (callback) {\n            _frames.push({ callback: callback, distinctDependencies:[] });\n        },\n\n        end: function () {\n            _frames.pop();\n        },\n\n        registerDependency: function (subscribable) {\n            if (!ko.isSubscribable(subscribable))\n                throw new Error(\"Only subscribable things can act as dependencies\");\n            if (_frames.length > 0) {\n                var topFrame = _frames[_frames.length - 1];\n                if (!topFrame || ko.utils.arrayIndexOf(topFrame.distinctDependencies, subscribable) >= 0)\n                    return;\n                topFrame.distinctDependencies.push(subscribable);\n                topFrame.callback(subscribable);\n            }\n        },\n\n        ignore: function(callback, callbackTarget, callbackArgs) {\n            try {\n                _frames.push(null);\n                return callback.apply(callbackTarget, callbackArgs || []);\n            } finally {\n                _frames.pop();\n            }\n        }\n    };\n})();\nvar primitiveTypes = { 'undefined':true, 'boolean':true, 'number':true, 'string':true };\n\nko.observable = function (initialValue) {\n    var _latestValue = initialValue;\n\n    function observable() {\n        if (arguments.length > 0) {\n            // Write\n\n            // Ignore writes if the value hasn't changed\n            if ((!observable['equalityComparer']) || !observable['equalityComparer'](_latestValue, arguments[0])) {\n                observable.valueWillMutate();\n                _latestValue = arguments[0];\n                if (DEBUG) observable._latestValue = _latestValue;\n                observable.valueHasMutated();\n            }\n            return this; // Permits chained assignments\n        }\n        else {\n            // Read\n            ko.dependencyDetection.registerDependency(observable); // The caller only needs to be notified of changes if they did a \"read\" operation\n            return _latestValue;\n        }\n    }\n    if (DEBUG) observable._latestValue = _latestValue;\n    ko.subscribable.call(observable);\n    observable.peek = function() { return _latestValue };\n    observable.valueHasMutated = function () { observable[\"notifySubscribers\"](_latestValue); }\n    observable.valueWillMutate = function () { observable[\"notifySubscribers\"](_latestValue, \"beforeChange\"); }\n    ko.utils.extend(observable, ko.observable['fn']);\n\n    ko.exportProperty(observable, 'peek', observable.peek);\n    ko.exportProperty(observable, \"valueHasMutated\", observable.valueHasMutated);\n    ko.exportProperty(observable, \"valueWillMutate\", observable.valueWillMutate);\n\n    return observable;\n}\n\nko.observable['fn'] = {\n    \"equalityComparer\": function valuesArePrimitiveAndEqual(a, b) {\n        var oldValueIsPrimitive = (a === null) || (typeof(a) in primitiveTypes);\n        return oldValueIsPrimitive ? (a === b) : false;\n    }\n};\n\nvar protoProperty = ko.observable.protoProperty = \"__ko_proto__\";\nko.observable['fn'][protoProperty] = ko.observable;\n\nko.hasPrototype = function(instance, prototype) {\n    if ((instance === null) || (instance === undefined) || (instance[protoProperty] === undefined)) return false;\n    if (instance[protoProperty] === prototype) return true;\n    return ko.hasPrototype(instance[protoProperty], prototype); // Walk the prototype chain\n};\n\nko.isObservable = function (instance) {\n    return ko.hasPrototype(instance, ko.observable);\n}\nko.isWriteableObservable = function (instance) {\n    // Observable\n    if ((typeof instance == \"function\") && instance[protoProperty] === ko.observable)\n        return true;\n    // Writeable dependent observable\n    if ((typeof instance == \"function\") && (instance[protoProperty] === ko.dependentObservable) && (instance.hasWriteFunction))\n        return true;\n    // Anything else\n    return false;\n}\n\n\nko.exportSymbol('observable', ko.observable);\nko.exportSymbol('isObservable', ko.isObservable);\nko.exportSymbol('isWriteableObservable', ko.isWriteableObservable);\nko.observableArray = function (initialValues) {\n    if (arguments.length == 0) {\n        // Zero-parameter constructor initializes to empty array\n        initialValues = [];\n    }\n    if ((initialValues !== null) && (initialValues !== undefined) && !('length' in initialValues))\n        throw new Error(\"The argument passed when initializing an observable array must be an array, or null, or undefined.\");\n\n    var result = ko.observable(initialValues);\n    ko.utils.extend(result, ko.observableArray['fn']);\n    return result;\n}\n\nko.observableArray['fn'] = {\n    'remove': function (valueOrPredicate) {\n        var underlyingArray = this.peek();\n        var removedValues = [];\n        var predicate = typeof valueOrPredicate == \"function\" ? valueOrPredicate : function (value) { return value === valueOrPredicate; };\n        for (var i = 0; i < underlyingArray.length; i++) {\n            var value = underlyingArray[i];\n            if (predicate(value)) {\n                if (removedValues.length === 0) {\n                    this.valueWillMutate();\n                }\n                removedValues.push(value);\n                underlyingArray.splice(i, 1);\n                i--;\n            }\n        }\n        if (removedValues.length) {\n            this.valueHasMutated();\n        }\n        return removedValues;\n    },\n\n    'removeAll': function (arrayOfValues) {\n        // If you passed zero args, we remove everything\n        if (arrayOfValues === undefined) {\n            var underlyingArray = this.peek();\n            var allValues = underlyingArray.slice(0);\n            this.valueWillMutate();\n            underlyingArray.splice(0, underlyingArray.length);\n            this.valueHasMutated();\n            return allValues;\n        }\n        // If you passed an arg, we interpret it as an array of entries to remove\n        if (!arrayOfValues)\n            return [];\n        return this['remove'](function (value) {\n            return ko.utils.arrayIndexOf(arrayOfValues, value) >= 0;\n        });\n    },\n\n    'destroy': function (valueOrPredicate) {\n        var underlyingArray = this.peek();\n        var predicate = typeof valueOrPredicate == \"function\" ? valueOrPredicate : function (value) { return value === valueOrPredicate; };\n        this.valueWillMutate();\n        for (var i = underlyingArray.length - 1; i >= 0; i--) {\n            var value = underlyingArray[i];\n            if (predicate(value))\n                underlyingArray[i][\"_destroy\"] = true;\n        }\n        this.valueHasMutated();\n    },\n\n    'destroyAll': function (arrayOfValues) {\n        // If you passed zero args, we destroy everything\n        if (arrayOfValues === undefined)\n            return this['destroy'](function() { return true });\n\n        // If you passed an arg, we interpret it as an array of entries to destroy\n        if (!arrayOfValues)\n            return [];\n        return this['destroy'](function (value) {\n            return ko.utils.arrayIndexOf(arrayOfValues, value) >= 0;\n        });\n    },\n\n    'indexOf': function (item) {\n        var underlyingArray = this();\n        return ko.utils.arrayIndexOf(underlyingArray, item);\n    },\n\n    'replace': function(oldItem, newItem) {\n        var index = this['indexOf'](oldItem);\n        if (index >= 0) {\n            this.valueWillMutate();\n            this.peek()[index] = newItem;\n            this.valueHasMutated();\n        }\n    }\n}\n\n// Populate ko.observableArray.fn with read/write functions from native arrays\n// Important: Do not add any additional functions here that may reasonably be used to *read* data from the array\n// because we'll eval them without causing subscriptions, so ko.computed output could end up getting stale\nko.utils.arrayForEach([\"pop\", \"push\", \"reverse\", \"shift\", \"sort\", \"splice\", \"unshift\"], function (methodName) {\n    ko.observableArray['fn'][methodName] = function () {\n        // Use \"peek\" to avoid creating a subscription in any computed that we're executing in the context of\n        // (for consistency with mutating regular observables)\n        var underlyingArray = this.peek();\n        this.valueWillMutate();\n        var methodCallResult = underlyingArray[methodName].apply(underlyingArray, arguments);\n        this.valueHasMutated();\n        return methodCallResult;\n    };\n});\n\n// Populate ko.observableArray.fn with read-only functions from native arrays\nko.utils.arrayForEach([\"slice\"], function (methodName) {\n    ko.observableArray['fn'][methodName] = function () {\n        var underlyingArray = this();\n        return underlyingArray[methodName].apply(underlyingArray, arguments);\n    };\n});\n\nko.exportSymbol('observableArray', ko.observableArray);\nko.dependentObservable = function (evaluatorFunctionOrOptions, evaluatorFunctionTarget, options) {\n    var _latestValue,\n        _hasBeenEvaluated = false,\n        _isBeingEvaluated = false,\n        readFunction = evaluatorFunctionOrOptions;\n\n    if (readFunction && typeof readFunction == \"object\") {\n        // Single-parameter syntax - everything is on this \"options\" param\n        options = readFunction;\n        readFunction = options[\"read\"];\n    } else {\n        // Multi-parameter syntax - construct the options according to the params passed\n        options = options || {};\n        if (!readFunction)\n            readFunction = options[\"read\"];\n    }\n    if (typeof readFunction != \"function\")\n        throw new Error(\"Pass a function that returns the value of the ko.computed\");\n\n    function addSubscriptionToDependency(subscribable) {\n        _subscriptionsToDependencies.push(subscribable.subscribe(evaluatePossiblyAsync));\n    }\n\n    function disposeAllSubscriptionsToDependencies() {\n        ko.utils.arrayForEach(_subscriptionsToDependencies, function (subscription) {\n            subscription.dispose();\n        });\n        _subscriptionsToDependencies = [];\n    }\n\n    function evaluatePossiblyAsync() {\n        var throttleEvaluationTimeout = dependentObservable['throttleEvaluation'];\n        if (throttleEvaluationTimeout && throttleEvaluationTimeout >= 0) {\n            clearTimeout(evaluationTimeoutInstance);\n            evaluationTimeoutInstance = setTimeout(evaluateImmediate, throttleEvaluationTimeout);\n        } else\n            evaluateImmediate();\n    }\n\n    function evaluateImmediate() {\n        if (_isBeingEvaluated) {\n            // If the evaluation of a ko.computed causes side effects, it's possible that it will trigger its own re-evaluation.\n            // This is not desirable (it's hard for a developer to realise a chain of dependencies might cause this, and they almost\n            // certainly didn't intend infinite re-evaluations). So, for predictability, we simply prevent ko.computeds from causing\n            // their own re-evaluation. Further discussion at https://github.com/SteveSanderson/knockout/pull/387\n            return;\n        }\n\n        // Don't dispose on first evaluation, because the \"disposeWhen\" callback might\n        // e.g., dispose when the associated DOM element isn't in the doc, and it's not\n        // going to be in the doc until *after* the first evaluation\n        if (_hasBeenEvaluated && disposeWhen()) {\n            dispose();\n            return;\n        }\n\n        _isBeingEvaluated = true;\n        try {\n            // Initially, we assume that none of the subscriptions are still being used (i.e., all are candidates for disposal).\n            // Then, during evaluation, we cross off any that are in fact still being used.\n            var disposalCandidates = ko.utils.arrayMap(_subscriptionsToDependencies, function(item) {return item.target;});\n\n            ko.dependencyDetection.begin(function(subscribable) {\n                var inOld;\n                if ((inOld = ko.utils.arrayIndexOf(disposalCandidates, subscribable)) >= 0)\n                    disposalCandidates[inOld] = undefined; // Don't want to dispose this subscription, as it's still being used\n                else\n                    addSubscriptionToDependency(subscribable); // Brand new subscription - add it\n            });\n\n            var newValue = readFunction.call(evaluatorFunctionTarget);\n\n            // For each subscription no longer being used, remove it from the active subscriptions list and dispose it\n            for (var i = disposalCandidates.length - 1; i >= 0; i--) {\n                if (disposalCandidates[i])\n                    _subscriptionsToDependencies.splice(i, 1)[0].dispose();\n            }\n            _hasBeenEvaluated = true;\n\n            dependentObservable[\"notifySubscribers\"](_latestValue, \"beforeChange\");\n            _latestValue = newValue;\n            if (DEBUG) dependentObservable._latestValue = _latestValue;\n        } finally {\n            ko.dependencyDetection.end();\n        }\n\n        dependentObservable[\"notifySubscribers\"](_latestValue);\n        _isBeingEvaluated = false;\n        if (!_subscriptionsToDependencies.length)\n            dispose();\n    }\n\n    function dependentObservable() {\n        if (arguments.length > 0) {\n            if (typeof writeFunction === \"function\") {\n                // Writing a value\n                writeFunction.apply(evaluatorFunctionTarget, arguments);\n            } else {\n                throw new Error(\"Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.\");\n            }\n            return this; // Permits chained assignments\n        } else {\n            // Reading the value\n            if (!_hasBeenEvaluated)\n                evaluateImmediate();\n            ko.dependencyDetection.registerDependency(dependentObservable);\n            return _latestValue;\n        }\n    }\n\n    function peek() {\n        if (!_hasBeenEvaluated)\n            evaluateImmediate();\n        return _latestValue;\n    }\n\n    function isActive() {\n        return !_hasBeenEvaluated || _subscriptionsToDependencies.length > 0;\n    }\n\n    // By here, \"options\" is always non-null\n    var writeFunction = options[\"write\"],\n        disposeWhenNodeIsRemoved = options[\"disposeWhenNodeIsRemoved\"] || options.disposeWhenNodeIsRemoved || null,\n        disposeWhen = options[\"disposeWhen\"] || options.disposeWhen || function() { return false; },\n        dispose = disposeAllSubscriptionsToDependencies,\n        _subscriptionsToDependencies = [],\n        evaluationTimeoutInstance = null;\n\n    if (!evaluatorFunctionTarget)\n        evaluatorFunctionTarget = options[\"owner\"];\n\n    dependentObservable.peek = peek;\n    dependentObservable.getDependenciesCount = function () { return _subscriptionsToDependencies.length; };\n    dependentObservable.hasWriteFunction = typeof options[\"write\"] === \"function\";\n    dependentObservable.dispose = function () { dispose(); };\n    dependentObservable.isActive = isActive;\n\n    ko.subscribable.call(dependentObservable);\n    ko.utils.extend(dependentObservable, ko.dependentObservable['fn']);\n\n    ko.exportProperty(dependentObservable, 'peek', dependentObservable.peek);\n    ko.exportProperty(dependentObservable, 'dispose', dependentObservable.dispose);\n    ko.exportProperty(dependentObservable, 'isActive', dependentObservable.isActive);\n    ko.exportProperty(dependentObservable, 'getDependenciesCount', dependentObservable.getDependenciesCount);\n\n    // Evaluate, unless deferEvaluation is true\n    if (options['deferEvaluation'] !== true)\n        evaluateImmediate();\n\n    // Build \"disposeWhenNodeIsRemoved\" and \"disposeWhenNodeIsRemovedCallback\" option values.\n    // But skip if isActive is false (there will never be any dependencies to dispose).\n    // (Note: \"disposeWhenNodeIsRemoved\" option both proactively disposes as soon as the node is removed using ko.removeNode(),\n    // plus adds a \"disposeWhen\" callback that, on each evaluation, disposes if the node was removed by some other means.)\n    if (disposeWhenNodeIsRemoved && isActive()) {\n        dispose = function() {\n            ko.utils.domNodeDisposal.removeDisposeCallback(disposeWhenNodeIsRemoved, arguments.callee);\n            disposeAllSubscriptionsToDependencies();\n        };\n        ko.utils.domNodeDisposal.addDisposeCallback(disposeWhenNodeIsRemoved, dispose);\n        var existingDisposeWhenFunction = disposeWhen;\n        disposeWhen = function () {\n            return !ko.utils.domNodeIsAttachedToDocument(disposeWhenNodeIsRemoved) || existingDisposeWhenFunction();\n        }\n    }\n\n    return dependentObservable;\n};\n\nko.isComputed = function(instance) {\n    return ko.hasPrototype(instance, ko.dependentObservable);\n};\n\nvar protoProp = ko.observable.protoProperty; // == \"__ko_proto__\"\nko.dependentObservable[protoProp] = ko.observable;\n\nko.dependentObservable['fn'] = {};\nko.dependentObservable['fn'][protoProp] = ko.dependentObservable;\n\nko.exportSymbol('dependentObservable', ko.dependentObservable);\nko.exportSymbol('computed', ko.dependentObservable); // Make \"ko.computed\" an alias for \"ko.dependentObservable\"\nko.exportSymbol('isComputed', ko.isComputed);\n\n(function() {\n    var maxNestedObservableDepth = 10; // Escape the (unlikely) pathalogical case where an observable's current value is itself (or similar reference cycle)\n\n    ko.toJS = function(rootObject) {\n        if (arguments.length == 0)\n            throw new Error(\"When calling ko.toJS, pass the object you want to convert.\");\n\n        // We just unwrap everything at every level in the object graph\n        return mapJsObjectGraph(rootObject, function(valueToMap) {\n            // Loop because an observable's value might in turn be another observable wrapper\n            for (var i = 0; ko.isObservable(valueToMap) && (i < maxNestedObservableDepth); i++)\n                valueToMap = valueToMap();\n            return valueToMap;\n        });\n    };\n\n    ko.toJSON = function(rootObject, replacer, space) {     // replacer and space are optional\n        var plainJavaScriptObject = ko.toJS(rootObject);\n        return ko.utils.stringifyJson(plainJavaScriptObject, replacer, space);\n    };\n\n    function mapJsObjectGraph(rootObject, mapInputCallback, visitedObjects) {\n        visitedObjects = visitedObjects || new objectLookup();\n\n        rootObject = mapInputCallback(rootObject);\n        var canHaveProperties = (typeof rootObject == \"object\") && (rootObject !== null) && (rootObject !== undefined) && (!(rootObject instanceof Date));\n        if (!canHaveProperties)\n            return rootObject;\n\n        var outputProperties = rootObject instanceof Array ? [] : {};\n        visitedObjects.save(rootObject, outputProperties);\n\n        visitPropertiesOrArrayEntries(rootObject, function(indexer) {\n            var propertyValue = mapInputCallback(rootObject[indexer]);\n\n            switch (typeof propertyValue) {\n                case \"boolean\":\n                case \"number\":\n                case \"string\":\n                case \"function\":\n                    outputProperties[indexer] = propertyValue;\n                    break;\n                case \"object\":\n                case \"undefined\":\n                    var previouslyMappedValue = visitedObjects.get(propertyValue);\n                    outputProperties[indexer] = (previouslyMappedValue !== undefined)\n                        ? previouslyMappedValue\n                        : mapJsObjectGraph(propertyValue, mapInputCallback, visitedObjects);\n                    break;\n            }\n        });\n\n        return outputProperties;\n    }\n\n    function visitPropertiesOrArrayEntries(rootObject, visitorCallback) {\n        if (rootObject instanceof Array) {\n            for (var i = 0; i < rootObject.length; i++)\n                visitorCallback(i);\n\n            // For arrays, also respect toJSON property for custom mappings (fixes #278)\n            if (typeof rootObject['toJSON'] == 'function')\n                visitorCallback('toJSON');\n        } else {\n            for (var propertyName in rootObject)\n                visitorCallback(propertyName);\n        }\n    };\n\n    function objectLookup() {\n        var keys = [];\n        var values = [];\n        this.save = function(key, value) {\n            var existingIndex = ko.utils.arrayIndexOf(keys, key);\n            if (existingIndex >= 0)\n                values[existingIndex] = value;\n            else {\n                keys.push(key);\n                values.push(value);\n            }\n        };\n        this.get = function(key) {\n            var existingIndex = ko.utils.arrayIndexOf(keys, key);\n            return (existingIndex >= 0) ? values[existingIndex] : undefined;\n        };\n    };\n})();\n\nko.exportSymbol('toJS', ko.toJS);\nko.exportSymbol('toJSON', ko.toJSON);\n(function () {\n    var hasDomDataExpandoProperty = '__ko__hasDomDataOptionValue__';\n\n    // Normally, SELECT elements and their OPTIONs can only take value of type 'string' (because the values\n    // are stored on DOM attributes). ko.selectExtensions provides a way for SELECTs/OPTIONs to have values\n    // that are arbitrary objects. This is very convenient when implementing things like cascading dropdowns.\n    ko.selectExtensions = {\n        readValue : function(element) {\n            switch (ko.utils.tagNameLower(element)) {\n                case 'option':\n                    if (element[hasDomDataExpandoProperty] === true)\n                        return ko.utils.domData.get(element, ko.bindingHandlers.options.optionValueDomDataKey);\n                    return ko.utils.ieVersion <= 7\n                        ? (element.getAttributeNode('value').specified ? element.value : element.text)\n                        : element.value;\n                case 'select':\n                    return element.selectedIndex >= 0 ? ko.selectExtensions.readValue(element.options[element.selectedIndex]) : undefined;\n                default:\n                    return element.value;\n            }\n        },\n\n        writeValue: function(element, value) {\n            switch (ko.utils.tagNameLower(element)) {\n                case 'option':\n                    switch(typeof value) {\n                        case \"string\":\n                            ko.utils.domData.set(element, ko.bindingHandlers.options.optionValueDomDataKey, undefined);\n                            if (hasDomDataExpandoProperty in element) { // IE <= 8 throws errors if you delete non-existent properties from a DOM node\n                                delete element[hasDomDataExpandoProperty];\n                            }\n                            element.value = value;\n                            break;\n                        default:\n                            // Store arbitrary object using DomData\n                            ko.utils.domData.set(element, ko.bindingHandlers.options.optionValueDomDataKey, value);\n                            element[hasDomDataExpandoProperty] = true;\n\n                            // Special treatment of numbers is just for backward compatibility. KO 1.2.1 wrote numerical values to element.value.\n                            element.value = typeof value === \"number\" ? value : \"\";\n                            break;\n                    }\n                    break;\n                case 'select':\n                    for (var i = element.options.length - 1; i >= 0; i--) {\n                        if (ko.selectExtensions.readValue(element.options[i]) == value) {\n                            element.selectedIndex = i;\n                            break;\n                        }\n                    }\n                    break;\n                default:\n                    if ((value === null) || (value === undefined))\n                        value = \"\";\n                    element.value = value;\n                    break;\n            }\n        }\n    };\n})();\n\nko.exportSymbol('selectExtensions', ko.selectExtensions);\nko.exportSymbol('selectExtensions.readValue', ko.selectExtensions.readValue);\nko.exportSymbol('selectExtensions.writeValue', ko.selectExtensions.writeValue);\nko.expressionRewriting = (function () {\n    var restoreCapturedTokensRegex = /\\@ko_token_(\\d+)\\@/g;\n    var javaScriptReservedWords = [\"true\", \"false\"];\n\n    // Matches something that can be assigned to--either an isolated identifier or something ending with a property accessor\n    // This is designed to be simple and avoid false negatives, but could produce false positives (e.g., a+b.c).\n    var javaScriptAssignmentTarget = /^(?:[$_a-z][$\\w]*|(.+)(\\.\\s*[$_a-z][$\\w]*|\\[.+\\]))$/i;\n\n    function restoreTokens(string, tokens) {\n        var prevValue = null;\n        while (string != prevValue) { // Keep restoring tokens until it no longer makes a difference (they may be nested)\n            prevValue = string;\n            string = string.replace(restoreCapturedTokensRegex, function (match, tokenIndex) {\n                return tokens[tokenIndex];\n            });\n        }\n        return string;\n    }\n\n    function getWriteableValue(expression) {\n        if (ko.utils.arrayIndexOf(javaScriptReservedWords, ko.utils.stringTrim(expression).toLowerCase()) >= 0)\n            return false;\n        var match = expression.match(javaScriptAssignmentTarget);\n        return match === null ? false : match[1] ? ('Object(' + match[1] + ')' + match[2]) : expression;\n    }\n\n    function ensureQuoted(key) {\n        var trimmedKey = ko.utils.stringTrim(key);\n        switch (trimmedKey.length && trimmedKey.charAt(0)) {\n            case \"'\":\n            case '\"':\n                return key;\n            default:\n                return \"'\" + trimmedKey + \"'\";\n        }\n    }\n\n    return {\n        bindingRewriteValidators: [],\n\n        parseObjectLiteral: function(objectLiteralString) {\n            // A full tokeniser+lexer would add too much weight to this library, so here's a simple parser\n            // that is sufficient just to split an object literal string into a set of top-level key-value pairs\n\n            var str = ko.utils.stringTrim(objectLiteralString);\n            if (str.length < 3)\n                return [];\n            if (str.charAt(0) === \"{\")// Ignore any braces surrounding the whole object literal\n                str = str.substring(1, str.length - 1);\n\n            // Pull out any string literals and regex literals\n            var tokens = [];\n            var tokenStart = null, tokenEndChar;\n            for (var position = 0; position < str.length; position++) {\n                var c = str.charAt(position);\n                if (tokenStart === null) {\n                    switch (c) {\n                        case '\"':\n                        case \"'\":\n                        case \"/\":\n                            tokenStart = position;\n                            tokenEndChar = c;\n                            break;\n                    }\n                } else if ((c == tokenEndChar) && (str.charAt(position - 1) !== \"\\\\\")) {\n                    var token = str.substring(tokenStart, position + 1);\n                    tokens.push(token);\n                    var replacement = \"@ko_token_\" + (tokens.length - 1) + \"@\";\n                    str = str.substring(0, tokenStart) + replacement + str.substring(position + 1);\n                    position -= (token.length - replacement.length);\n                    tokenStart = null;\n                }\n            }\n\n            // Next pull out balanced paren, brace, and bracket blocks\n            tokenStart = null;\n            tokenEndChar = null;\n            var tokenDepth = 0, tokenStartChar = null;\n            for (var position = 0; position < str.length; position++) {\n                var c = str.charAt(position);\n                if (tokenStart === null) {\n                    switch (c) {\n                        case \"{\": tokenStart = position; tokenStartChar = c;\n                                  tokenEndChar = \"}\";\n                                  break;\n                        case \"(\": tokenStart = position; tokenStartChar = c;\n                                  tokenEndChar = \")\";\n                                  break;\n                        case \"[\": tokenStart = position; tokenStartChar = c;\n                                  tokenEndChar = \"]\";\n                                  break;\n                    }\n                }\n\n                if (c === tokenStartChar)\n                    tokenDepth++;\n                else if (c === tokenEndChar) {\n                    tokenDepth--;\n                    if (tokenDepth === 0) {\n                        var token = str.substring(tokenStart, position + 1);\n                        tokens.push(token);\n                        var replacement = \"@ko_token_\" + (tokens.length - 1) + \"@\";\n                        str = str.substring(0, tokenStart) + replacement + str.substring(position + 1);\n                        position -= (token.length - replacement.length);\n                        tokenStart = null;\n                    }\n                }\n            }\n\n            // Now we can safely split on commas to get the key/value pairs\n            var result = [];\n            var keyValuePairs = str.split(\",\");\n            for (var i = 0, j = keyValuePairs.length; i < j; i++) {\n                var pair = keyValuePairs[i];\n                var colonPos = pair.indexOf(\":\");\n                if ((colonPos > 0) && (colonPos < pair.length - 1)) {\n                    var key = pair.substring(0, colonPos);\n                    var value = pair.substring(colonPos + 1);\n                    result.push({ 'key': restoreTokens(key, tokens), 'value': restoreTokens(value, tokens) });\n                } else {\n                    result.push({ 'unknown': restoreTokens(pair, tokens) });\n                }\n            }\n            return result;\n        },\n\n        preProcessBindings: function (objectLiteralStringOrKeyValueArray) {\n            var keyValueArray = typeof objectLiteralStringOrKeyValueArray === \"string\"\n                ? ko.expressionRewriting.parseObjectLiteral(objectLiteralStringOrKeyValueArray)\n                : objectLiteralStringOrKeyValueArray;\n            var resultStrings = [], propertyAccessorResultStrings = [];\n\n            var keyValueEntry;\n            for (var i = 0; keyValueEntry = keyValueArray[i]; i++) {\n                if (resultStrings.length > 0)\n                    resultStrings.push(\",\");\n\n                if (keyValueEntry['key']) {\n                    var quotedKey = ensureQuoted(keyValueEntry['key']), val = keyValueEntry['value'];\n                    resultStrings.push(quotedKey);\n                    resultStrings.push(\":\");\n                    resultStrings.push(val);\n\n                    if (val = getWriteableValue(ko.utils.stringTrim(val))) {\n                        if (propertyAccessorResultStrings.length > 0)\n                            propertyAccessorResultStrings.push(\", \");\n                        propertyAccessorResultStrings.push(quotedKey + \" : function(__ko_value) { \" + val + \" = __ko_value; }\");\n                    }\n                } else if (keyValueEntry['unknown']) {\n                    resultStrings.push(keyValueEntry['unknown']);\n                }\n            }\n\n            var combinedResult = resultStrings.join(\"\");\n            if (propertyAccessorResultStrings.length > 0) {\n                var allPropertyAccessors = propertyAccessorResultStrings.join(\"\");\n                combinedResult = combinedResult + \", '_ko_property_writers' : { \" + allPropertyAccessors + \" } \";\n            }\n\n            return combinedResult;\n        },\n\n        keyValueArrayContainsKey: function(keyValueArray, key) {\n            for (var i = 0; i < keyValueArray.length; i++)\n                if (ko.utils.stringTrim(keyValueArray[i]['key']) == key)\n                    return true;\n            return false;\n        },\n\n        // Internal, private KO utility for updating model properties from within bindings\n        // property:            If the property being updated is (or might be) an observable, pass it here\n        //                      If it turns out to be a writable observable, it will be written to directly\n        // allBindingsAccessor: All bindings in the current execution context.\n        //                      This will be searched for a '_ko_property_writers' property in case you're writing to a non-observable\n        // key:                 The key identifying the property to be written. Example: for { hasFocus: myValue }, write to 'myValue' by specifying the key 'hasFocus'\n        // value:               The value to be written\n        // checkIfDifferent:    If true, and if the property being written is a writable observable, the value will only be written if\n        //                      it is !== existing value on that writable observable\n        writeValueToProperty: function(property, allBindingsAccessor, key, value, checkIfDifferent) {\n            if (!property || !ko.isWriteableObservable(property)) {\n                var propWriters = allBindingsAccessor()['_ko_property_writers'];\n                if (propWriters && propWriters[key])\n                    propWriters[key](value);\n            } else if (!checkIfDifferent || property.peek() !== value) {\n                property(value);\n            }\n        }\n    };\n})();\n\nko.exportSymbol('expressionRewriting', ko.expressionRewriting);\nko.exportSymbol('expressionRewriting.bindingRewriteValidators', ko.expressionRewriting.bindingRewriteValidators);\nko.exportSymbol('expressionRewriting.parseObjectLiteral', ko.expressionRewriting.parseObjectLiteral);\nko.exportSymbol('expressionRewriting.preProcessBindings', ko.expressionRewriting.preProcessBindings);\n\n// For backward compatibility, define the following aliases. (Previously, these function names were misleading because\n// they referred to JSON specifically, even though they actually work with arbitrary JavaScript object literal expressions.)\nko.exportSymbol('jsonExpressionRewriting', ko.expressionRewriting);\nko.exportSymbol('jsonExpressionRewriting.insertPropertyAccessorsIntoJson', ko.expressionRewriting.preProcessBindings);(function() {\n    // \"Virtual elements\" is an abstraction on top of the usual DOM API which understands the notion that comment nodes\n    // may be used to represent hierarchy (in addition to the DOM's natural hierarchy).\n    // If you call the DOM-manipulating functions on ko.virtualElements, you will be able to read and write the state\n    // of that virtual hierarchy\n    //\n    // The point of all this is to support containerless templates (e.g., <!-- ko foreach:someCollection -->blah<!-- /ko -->)\n    // without having to scatter special cases all over the binding and templating code.\n\n    // IE 9 cannot reliably read the \"nodeValue\" property of a comment node (see https://github.com/SteveSanderson/knockout/issues/186)\n    // but it does give them a nonstandard alternative property called \"text\" that it can read reliably. Other browsers don't have that property.\n    // So, use node.text where available, and node.nodeValue elsewhere\n    var commentNodesHaveTextProperty = document.createComment(\"test\").text === \"<!--test-->\";\n\n    var startCommentRegex = commentNodesHaveTextProperty ? /^<!--\\s*ko(?:\\s+(.+\\s*\\:[\\s\\S]*))?\\s*-->$/ : /^\\s*ko(?:\\s+(.+\\s*\\:[\\s\\S]*))?\\s*$/;\n    var endCommentRegex =   commentNodesHaveTextProperty ? /^<!--\\s*\\/ko\\s*-->$/ : /^\\s*\\/ko\\s*$/;\n    var htmlTagsWithOptionallyClosingChildren = { 'ul': true, 'ol': true };\n\n    function isStartComment(node) {\n        return (node.nodeType == 8) && (commentNodesHaveTextProperty ? node.text : node.nodeValue).match(startCommentRegex);\n    }\n\n    function isEndComment(node) {\n        return (node.nodeType == 8) && (commentNodesHaveTextProperty ? node.text : node.nodeValue).match(endCommentRegex);\n    }\n\n    function getVirtualChildren(startComment, allowUnbalanced) {\n        var currentNode = startComment;\n        var depth = 1;\n        var children = [];\n        while (currentNode = currentNode.nextSibling) {\n            if (isEndComment(currentNode)) {\n                depth--;\n                if (depth === 0)\n                    return children;\n            }\n\n            children.push(currentNode);\n\n            if (isStartComment(currentNode))\n                depth++;\n        }\n        if (!allowUnbalanced)\n            throw new Error(\"Cannot find closing comment tag to match: \" + startComment.nodeValue);\n        return null;\n    }\n\n    function getMatchingEndComment(startComment, allowUnbalanced) {\n        var allVirtualChildren = getVirtualChildren(startComment, allowUnbalanced);\n        if (allVirtualChildren) {\n            if (allVirtualChildren.length > 0)\n                return allVirtualChildren[allVirtualChildren.length - 1].nextSibling;\n            return startComment.nextSibling;\n        } else\n            return null; // Must have no matching end comment, and allowUnbalanced is true\n    }\n\n    function getUnbalancedChildTags(node) {\n        // e.g., from <div>OK</div><!-- ko blah --><span>Another</span>, returns: <!-- ko blah --><span>Another</span>\n        //       from <div>OK</div><!-- /ko --><!-- /ko -->,             returns: <!-- /ko --><!-- /ko -->\n        var childNode = node.firstChild, captureRemaining = null;\n        if (childNode) {\n            do {\n                if (captureRemaining)                   // We already hit an unbalanced node and are now just scooping up all subsequent nodes\n                    captureRemaining.push(childNode);\n                else if (isStartComment(childNode)) {\n                    var matchingEndComment = getMatchingEndComment(childNode, /* allowUnbalanced: */ true);\n                    if (matchingEndComment)             // It's a balanced tag, so skip immediately to the end of this virtual set\n                        childNode = matchingEndComment;\n                    else\n                        captureRemaining = [childNode]; // It's unbalanced, so start capturing from this point\n                } else if (isEndComment(childNode)) {\n                    captureRemaining = [childNode];     // It's unbalanced (if it wasn't, we'd have skipped over it already), so start capturing\n                }\n            } while (childNode = childNode.nextSibling);\n        }\n        return captureRemaining;\n    }\n\n    ko.virtualElements = {\n        allowedBindings: {},\n\n        childNodes: function(node) {\n            return isStartComment(node) ? getVirtualChildren(node) : node.childNodes;\n        },\n\n        emptyNode: function(node) {\n            if (!isStartComment(node))\n                ko.utils.emptyDomNode(node);\n            else {\n                var virtualChildren = ko.virtualElements.childNodes(node);\n                for (var i = 0, j = virtualChildren.length; i < j; i++)\n                    ko.removeNode(virtualChildren[i]);\n            }\n        },\n\n        setDomNodeChildren: function(node, childNodes) {\n            if (!isStartComment(node))\n                ko.utils.setDomNodeChildren(node, childNodes);\n            else {\n                ko.virtualElements.emptyNode(node);\n                var endCommentNode = node.nextSibling; // Must be the next sibling, as we just emptied the children\n                for (var i = 0, j = childNodes.length; i < j; i++)\n                    endCommentNode.parentNode.insertBefore(childNodes[i], endCommentNode);\n            }\n        },\n\n        prepend: function(containerNode, nodeToPrepend) {\n            if (!isStartComment(containerNode)) {\n                if (containerNode.firstChild)\n                    containerNode.insertBefore(nodeToPrepend, containerNode.firstChild);\n                else\n                    containerNode.appendChild(nodeToPrepend);\n            } else {\n                // Start comments must always have a parent and at least one following sibling (the end comment)\n                containerNode.parentNode.insertBefore(nodeToPrepend, containerNode.nextSibling);\n            }\n        },\n\n        insertAfter: function(containerNode, nodeToInsert, insertAfterNode) {\n            if (!insertAfterNode) {\n                ko.virtualElements.prepend(containerNode, nodeToInsert);\n            } else if (!isStartComment(containerNode)) {\n                // Insert after insertion point\n                if (insertAfterNode.nextSibling)\n                    containerNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling);\n                else\n                    containerNode.appendChild(nodeToInsert);\n            } else {\n                // Children of start comments must always have a parent and at least one following sibling (the end comment)\n                containerNode.parentNode.insertBefore(nodeToInsert, insertAfterNode.nextSibling);\n            }\n        },\n\n        firstChild: function(node) {\n            if (!isStartComment(node))\n                return node.firstChild;\n            if (!node.nextSibling || isEndComment(node.nextSibling))\n                return null;\n            return node.nextSibling;\n        },\n\n        nextSibling: function(node) {\n            if (isStartComment(node))\n                node = getMatchingEndComment(node);\n            if (node.nextSibling && isEndComment(node.nextSibling))\n                return null;\n            return node.nextSibling;\n        },\n\n        virtualNodeBindingValue: function(node) {\n            var regexMatch = isStartComment(node);\n            return regexMatch ? regexMatch[1] : null;\n        },\n\n        normaliseVirtualElementDomStructure: function(elementVerified) {\n            // Workaround for https://github.com/SteveSanderson/knockout/issues/155\n            // (IE <= 8 or IE 9 quirks mode parses your HTML weirdly, treating closing </li> tags as if they don't exist, thereby moving comment nodes\n            // that are direct descendants of <ul> into the preceding <li>)\n            if (!htmlTagsWithOptionallyClosingChildren[ko.utils.tagNameLower(elementVerified)])\n                return;\n\n            // Scan immediate children to see if they contain unbalanced comment tags. If they do, those comment tags\n            // must be intended to appear *after* that child, so move them there.\n            var childNode = elementVerified.firstChild;\n            if (childNode) {\n                do {\n                    if (childNode.nodeType === 1) {\n                        var unbalancedTags = getUnbalancedChildTags(childNode);\n                        if (unbalancedTags) {\n                            // Fix up the DOM by moving the unbalanced tags to where they most likely were intended to be placed - *after* the child\n                            var nodeToInsertBefore = childNode.nextSibling;\n                            for (var i = 0; i < unbalancedTags.length; i++) {\n                                if (nodeToInsertBefore)\n                                    elementVerified.insertBefore(unbalancedTags[i], nodeToInsertBefore);\n                                else\n                                    elementVerified.appendChild(unbalancedTags[i]);\n                            }\n                        }\n                    }\n                } while (childNode = childNode.nextSibling);\n            }\n        }\n    };\n})();\nko.exportSymbol('virtualElements', ko.virtualElements);\nko.exportSymbol('virtualElements.allowedBindings', ko.virtualElements.allowedBindings);\nko.exportSymbol('virtualElements.emptyNode', ko.virtualElements.emptyNode);\n//ko.exportSymbol('virtualElements.firstChild', ko.virtualElements.firstChild);     // firstChild is not minified\nko.exportSymbol('virtualElements.insertAfter', ko.virtualElements.insertAfter);\n//ko.exportSymbol('virtualElements.nextSibling', ko.virtualElements.nextSibling);   // nextSibling is not minified\nko.exportSymbol('virtualElements.prepend', ko.virtualElements.prepend);\nko.exportSymbol('virtualElements.setDomNodeChildren', ko.virtualElements.setDomNodeChildren);\n(function() {\n    var defaultBindingAttributeName = \"data-bind\";\n\n    ko.bindingProvider = function() {\n        this.bindingCache = {};\n    };\n\n    ko.utils.extend(ko.bindingProvider.prototype, {\n        'nodeHasBindings': function(node) {\n            switch (node.nodeType) {\n                case 1: return node.getAttribute(defaultBindingAttributeName) != null;   // Element\n                case 8: return ko.virtualElements.virtualNodeBindingValue(node) != null; // Comment node\n                default: return false;\n            }\n        },\n\n        'getBindings': function(node, bindingContext) {\n            var bindingsString = this['getBindingsString'](node, bindingContext);\n            return bindingsString ? this['parseBindingsString'](bindingsString, bindingContext, node) : null;\n        },\n\n        // The following function is only used internally by this default provider.\n        // It's not part of the interface definition for a general binding provider.\n        'getBindingsString': function(node, bindingContext) {\n            switch (node.nodeType) {\n                case 1: return node.getAttribute(defaultBindingAttributeName);   // Element\n                case 8: return ko.virtualElements.virtualNodeBindingValue(node); // Comment node\n                default: return null;\n            }\n        },\n\n        // The following function is only used internally by this default provider.\n        // It's not part of the interface definition for a general binding provider.\n        'parseBindingsString': function(bindingsString, bindingContext, node) {\n            try {\n                var bindingFunction = createBindingsStringEvaluatorViaCache(bindingsString, this.bindingCache);\n                return bindingFunction(bindingContext, node);\n            } catch (ex) {\n                throw new Error(\"Unable to parse bindings.\\nMessage: \" + ex + \";\\nBindings value: \" + bindingsString);\n            }\n        }\n    });\n\n    ko.bindingProvider['instance'] = new ko.bindingProvider();\n\n    function createBindingsStringEvaluatorViaCache(bindingsString, cache) {\n        var cacheKey = bindingsString;\n        return cache[cacheKey]\n            || (cache[cacheKey] = createBindingsStringEvaluator(bindingsString));\n    }\n\n    function createBindingsStringEvaluator(bindingsString) {\n        // Build the source for a function that evaluates \"expression\"\n        // For each scope variable, add an extra level of \"with\" nesting\n        // Example result: with(sc1) { with(sc0) { return (expression) } }\n        var rewrittenBindings = ko.expressionRewriting.preProcessBindings(bindingsString),\n            functionBody = \"with($context){with($data||{}){return{\" + rewrittenBindings + \"}}}\";\n        return new Function(\"$context\", \"$element\", functionBody);\n    }\n})();\n\nko.exportSymbol('bindingProvider', ko.bindingProvider);\n(function () {\n    ko.bindingHandlers = {};\n\n    ko.bindingContext = function(dataItem, parentBindingContext, dataItemAlias) {\n        if (parentBindingContext) {\n            ko.utils.extend(this, parentBindingContext); // Inherit $root and any custom properties\n            this['$parentContext'] = parentBindingContext;\n            this['$parent'] = parentBindingContext['$data'];\n            this['$parents'] = (parentBindingContext['$parents'] || []).slice(0);\n            this['$parents'].unshift(this['$parent']);\n        } else {\n            this['$parents'] = [];\n            this['$root'] = dataItem;\n            // Export 'ko' in the binding context so it will be available in bindings and templates\n            // even if 'ko' isn't exported as a global, such as when using an AMD loader.\n            // See https://github.com/SteveSanderson/knockout/issues/490\n            this['ko'] = ko;\n        }\n        this['$data'] = dataItem;\n        if (dataItemAlias)\n            this[dataItemAlias] = dataItem;\n    }\n    ko.bindingContext.prototype['createChildContext'] = function (dataItem, dataItemAlias) {\n        return new ko.bindingContext(dataItem, this, dataItemAlias);\n    };\n    ko.bindingContext.prototype['extend'] = function(properties) {\n        var clone = ko.utils.extend(new ko.bindingContext(), this);\n        return ko.utils.extend(clone, properties);\n    };\n\n    function validateThatBindingIsAllowedForVirtualElements(bindingName) {\n        var validator = ko.virtualElements.allowedBindings[bindingName];\n        if (!validator)\n            throw new Error(\"The binding '\" + bindingName + \"' cannot be used with virtual elements\")\n    }\n\n    function applyBindingsToDescendantsInternal (viewModel, elementOrVirtualElement, bindingContextsMayDifferFromDomParentElement) {\n        var currentChild, nextInQueue = ko.virtualElements.firstChild(elementOrVirtualElement);\n        while (currentChild = nextInQueue) {\n            // Keep a record of the next child *before* applying bindings, in case the binding removes the current child from its position\n            nextInQueue = ko.virtualElements.nextSibling(currentChild);\n            applyBindingsToNodeAndDescendantsInternal(viewModel, currentChild, bindingContextsMayDifferFromDomParentElement);\n        }\n    }\n\n    function applyBindingsToNodeAndDescendantsInternal (viewModel, nodeVerified, bindingContextMayDifferFromDomParentElement) {\n        var shouldBindDescendants = true;\n\n        // Perf optimisation: Apply bindings only if...\n        // (1) We need to store the binding context on this node (because it may differ from the DOM parent node's binding context)\n        //     Note that we can't store binding contexts on non-elements (e.g., text nodes), as IE doesn't allow expando properties for those\n        // (2) It might have bindings (e.g., it has a data-bind attribute, or it's a marker for a containerless template)\n        var isElement = (nodeVerified.nodeType === 1);\n        if (isElement) // Workaround IE <= 8 HTML parsing weirdness\n            ko.virtualElements.normaliseVirtualElementDomStructure(nodeVerified);\n\n        var shouldApplyBindings = (isElement && bindingContextMayDifferFromDomParentElement)             // Case (1)\n                               || ko.bindingProvider['instance']['nodeHasBindings'](nodeVerified);       // Case (2)\n        if (shouldApplyBindings)\n            shouldBindDescendants = applyBindingsToNodeInternal(nodeVerified, null, viewModel, bindingContextMayDifferFromDomParentElement).shouldBindDescendants;\n\n        if (shouldBindDescendants) {\n            // We're recursing automatically into (real or virtual) child nodes without changing binding contexts. So,\n            //  * For children of a *real* element, the binding context is certainly the same as on their DOM .parentNode,\n            //    hence bindingContextsMayDifferFromDomParentElement is false\n            //  * For children of a *virtual* element, we can't be sure. Evaluating .parentNode on those children may\n            //    skip over any number of intermediate virtual elements, any of which might define a custom binding context,\n            //    hence bindingContextsMayDifferFromDomParentElement is true\n            applyBindingsToDescendantsInternal(viewModel, nodeVerified, /* bindingContextsMayDifferFromDomParentElement: */ !isElement);\n        }\n    }\n\n    function applyBindingsToNodeInternal (node, bindings, viewModelOrBindingContext, bindingContextMayDifferFromDomParentElement) {\n        // Need to be sure that inits are only run once, and updates never run until all the inits have been run\n        var initPhase = 0; // 0 = before all inits, 1 = during inits, 2 = after all inits\n\n        // Each time the dependentObservable is evaluated (after data changes),\n        // the binding attribute is reparsed so that it can pick out the correct\n        // model properties in the context of the changed data.\n        // DOM event callbacks need to be able to access this changed data,\n        // so we need a single parsedBindings variable (shared by all callbacks\n        // associated with this node's bindings) that all the closures can access.\n        var parsedBindings;\n        function makeValueAccessor(bindingKey) {\n            return function () { return parsedBindings[bindingKey] }\n        }\n        function parsedBindingsAccessor() {\n            return parsedBindings;\n        }\n\n        var bindingHandlerThatControlsDescendantBindings;\n        ko.dependentObservable(\n            function () {\n                // Ensure we have a nonnull binding context to work with\n                var bindingContextInstance = viewModelOrBindingContext && (viewModelOrBindingContext instanceof ko.bindingContext)\n                    ? viewModelOrBindingContext\n                    : new ko.bindingContext(ko.utils.unwrapObservable(viewModelOrBindingContext));\n                var viewModel = bindingContextInstance['$data'];\n\n                // Optimization: Don't store the binding context on this node if it's definitely the same as on node.parentNode, because\n                // we can easily recover it just by scanning up the node's ancestors in the DOM\n                // (note: here, parent node means \"real DOM parent\" not \"virtual parent\", as there's no O(1) way to find the virtual parent)\n                if (bindingContextMayDifferFromDomParentElement)\n                    ko.storedBindingContextForNode(node, bindingContextInstance);\n\n                // Use evaluatedBindings if given, otherwise fall back on asking the bindings provider to give us some bindings\n                var evaluatedBindings = (typeof bindings == \"function\") ? bindings(bindingContextInstance, node) : bindings;\n                parsedBindings = evaluatedBindings || ko.bindingProvider['instance']['getBindings'](node, bindingContextInstance);\n\n                if (parsedBindings) {\n                    // First run all the inits, so bindings can register for notification on changes\n                    if (initPhase === 0) {\n                        initPhase = 1;\n                        for (var bindingKey in parsedBindings) {\n                            var binding = ko.bindingHandlers[bindingKey];\n                            if (binding && node.nodeType === 8)\n                                validateThatBindingIsAllowedForVirtualElements(bindingKey);\n\n                            if (binding && typeof binding[\"init\"] == \"function\") {\n                                var handlerInitFn = binding[\"init\"];\n                                var initResult = handlerInitFn(node, makeValueAccessor(bindingKey), parsedBindingsAccessor, viewModel, bindingContextInstance);\n\n                                // If this binding handler claims to control descendant bindings, make a note of this\n                                if (initResult && initResult['controlsDescendantBindings']) {\n                                    if (bindingHandlerThatControlsDescendantBindings !== undefined)\n                                        throw new Error(\"Multiple bindings (\" + bindingHandlerThatControlsDescendantBindings + \" and \" + bindingKey + \") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.\");\n                                    bindingHandlerThatControlsDescendantBindings = bindingKey;\n                                }\n                            }\n                        }\n                        initPhase = 2;\n                    }\n\n                    // ... then run all the updates, which might trigger changes even on the first evaluation\n                    if (initPhase === 2) {\n                        for (var bindingKey in parsedBindings) {\n                            var binding = ko.bindingHandlers[bindingKey];\n                            if (binding && typeof binding[\"update\"] == \"function\") {\n                                var handlerUpdateFn = binding[\"update\"];\n                                handlerUpdateFn(node, makeValueAccessor(bindingKey), parsedBindingsAccessor, viewModel, bindingContextInstance);\n                            }\n                        }\n                    }\n                }\n            },\n            null,\n            { disposeWhenNodeIsRemoved : node }\n        );\n\n        return {\n            shouldBindDescendants: bindingHandlerThatControlsDescendantBindings === undefined\n        };\n    };\n\n    var storedBindingContextDomDataKey = \"__ko_bindingContext__\";\n    ko.storedBindingContextForNode = function (node, bindingContext) {\n        if (arguments.length == 2)\n            ko.utils.domData.set(node, storedBindingContextDomDataKey, bindingContext);\n        else\n            return ko.utils.domData.get(node, storedBindingContextDomDataKey);\n    }\n\n    ko.applyBindingsToNode = function (node, bindings, viewModel) {\n        if (node.nodeType === 1) // If it's an element, workaround IE <= 8 HTML parsing weirdness\n            ko.virtualElements.normaliseVirtualElementDomStructure(node);\n        return applyBindingsToNodeInternal(node, bindings, viewModel, true);\n    };\n\n    ko.applyBindingsToDescendants = function(viewModel, rootNode) {\n        if (rootNode.nodeType === 1 || rootNode.nodeType === 8)\n            applyBindingsToDescendantsInternal(viewModel, rootNode, true);\n    };\n\n    ko.applyBindings = function (viewModel, rootNode) {\n        if (rootNode && (rootNode.nodeType !== 1) && (rootNode.nodeType !== 8))\n            throw new Error(\"ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node\");\n        rootNode = rootNode || window.document.body; // Make \"rootNode\" parameter optional\n\n        applyBindingsToNodeAndDescendantsInternal(viewModel, rootNode, true);\n    };\n\n    // Retrieving binding context from arbitrary nodes\n    ko.contextFor = function(node) {\n        // We can only do something meaningful for elements and comment nodes (in particular, not text nodes, as IE can't store domdata for them)\n        switch (node.nodeType) {\n            case 1:\n            case 8:\n                var context = ko.storedBindingContextForNode(node);\n                if (context) return context;\n                if (node.parentNode) return ko.contextFor(node.parentNode);\n                break;\n        }\n        return undefined;\n    };\n    ko.dataFor = function(node) {\n        var context = ko.contextFor(node);\n        return context ? context['$data'] : undefined;\n    };\n\n    ko.exportSymbol('bindingHandlers', ko.bindingHandlers);\n    ko.exportSymbol('applyBindings', ko.applyBindings);\n    ko.exportSymbol('applyBindingsToDescendants', ko.applyBindingsToDescendants);\n    ko.exportSymbol('applyBindingsToNode', ko.applyBindingsToNode);\n    ko.exportSymbol('contextFor', ko.contextFor);\n    ko.exportSymbol('dataFor', ko.dataFor);\n})();\nvar attrHtmlToJavascriptMap = { 'class': 'className', 'for': 'htmlFor' };\nko.bindingHandlers['attr'] = {\n    'update': function(element, valueAccessor, allBindingsAccessor) {\n        var value = ko.utils.unwrapObservable(valueAccessor()) || {};\n        for (var attrName in value) {\n            if (typeof attrName == \"string\") {\n                var attrValue = ko.utils.unwrapObservable(value[attrName]);\n\n                // To cover cases like \"attr: { checked:someProp }\", we want to remove the attribute entirely\n                // when someProp is a \"no value\"-like value (strictly null, false, or undefined)\n                // (because the absence of the \"checked\" attr is how to mark an element as not checked, etc.)\n                var toRemove = (attrValue === false) || (attrValue === null) || (attrValue === undefined);\n                if (toRemove)\n                    element.removeAttribute(attrName);\n\n                // In IE <= 7 and IE8 Quirks Mode, you have to use the Javascript property name instead of the\n                // HTML attribute name for certain attributes. IE8 Standards Mode supports the correct behavior,\n                // but instead of figuring out the mode, we'll just set the attribute through the Javascript\n                // property for IE <= 8.\n                if (ko.utils.ieVersion <= 8 && attrName in attrHtmlToJavascriptMap) {\n                    attrName = attrHtmlToJavascriptMap[attrName];\n                    if (toRemove)\n                        element.removeAttribute(attrName);\n                    else\n                        element[attrName] = attrValue;\n                } else if (!toRemove) {\n                    element.setAttribute(attrName, attrValue.toString());\n                }\n\n                // Treat \"name\" specially - although you can think of it as an attribute, it also needs\n                // special handling on older versions of IE (https://github.com/SteveSanderson/knockout/pull/333)\n                // Deliberately being case-sensitive here because XHTML would regard \"Name\" as a different thing\n                // entirely, and there's no strong reason to allow for such casing in HTML.\n                if (attrName === \"name\") {\n                    ko.utils.setElementName(element, toRemove ? \"\" : attrValue.toString());\n                }\n            }\n        }\n    }\n};\nko.bindingHandlers['checked'] = {\n    'init': function (element, valueAccessor, allBindingsAccessor) {\n        var updateHandler = function() {\n            var valueToWrite;\n            if (element.type == \"checkbox\") {\n                valueToWrite = element.checked;\n            } else if ((element.type == \"radio\") && (element.checked)) {\n                valueToWrite = element.value;\n            } else {\n                return; // \"checked\" binding only responds to checkboxes and selected radio buttons\n            }\n\n            var modelValue = valueAccessor(), unwrappedValue = ko.utils.unwrapObservable(modelValue);\n            if ((element.type == \"checkbox\") && (unwrappedValue instanceof Array)) {\n                // For checkboxes bound to an array, we add/remove the checkbox value to that array\n                // This works for both observable and non-observable arrays\n                var existingEntryIndex = ko.utils.arrayIndexOf(unwrappedValue, element.value);\n                if (element.checked && (existingEntryIndex < 0))\n                    modelValue.push(element.value);\n                else if ((!element.checked) && (existingEntryIndex >= 0))\n                    modelValue.splice(existingEntryIndex, 1);\n            } else {\n                ko.expressionRewriting.writeValueToProperty(modelValue, allBindingsAccessor, 'checked', valueToWrite, true);\n            }\n        };\n        ko.utils.registerEventHandler(element, \"click\", updateHandler);\n\n        // IE 6 won't allow radio buttons to be selected unless they have a name\n        if ((element.type == \"radio\") && !element.name)\n            ko.bindingHandlers['uniqueName']['init'](element, function() { return true });\n    },\n    'update': function (element, valueAccessor) {\n        var value = ko.utils.unwrapObservable(valueAccessor());\n\n        if (element.type == \"checkbox\") {\n            if (value instanceof Array) {\n                // When bound to an array, the checkbox being checked represents its value being present in that array\n                element.checked = ko.utils.arrayIndexOf(value, element.value) >= 0;\n            } else {\n                // When bound to anything other value (not an array), the checkbox being checked represents the value being trueish\n                element.checked = value;\n            }\n        } else if (element.type == \"radio\") {\n            element.checked = (element.value == value);\n        }\n    }\n};\nvar classesWrittenByBindingKey = '__ko__cssValue';\nko.bindingHandlers['css'] = {\n    'update': function (element, valueAccessor) {\n        var value = ko.utils.unwrapObservable(valueAccessor());\n        if (typeof value == \"object\") {\n            for (var className in value) {\n                var shouldHaveClass = ko.utils.unwrapObservable(value[className]);\n                ko.utils.toggleDomNodeCssClass(element, className, shouldHaveClass);\n            }\n        } else {\n            value = String(value || ''); // Make sure we don't try to store or set a non-string value\n            ko.utils.toggleDomNodeCssClass(element, element[classesWrittenByBindingKey], false);\n            element[classesWrittenByBindingKey] = value;\n            ko.utils.toggleDomNodeCssClass(element, value, true);\n        }\n    }\n};\nko.bindingHandlers['enable'] = {\n    'update': function (element, valueAccessor) {\n        var value = ko.utils.unwrapObservable(valueAccessor());\n        if (value && element.disabled)\n            element.removeAttribute(\"disabled\");\n        else if ((!value) && (!element.disabled))\n            element.disabled = true;\n    }\n};\n\nko.bindingHandlers['disable'] = {\n    'update': function (element, valueAccessor) {\n        ko.bindingHandlers['enable']['update'](element, function() { return !ko.utils.unwrapObservable(valueAccessor()) });\n    }\n};\n// For certain common events (currently just 'click'), allow a simplified data-binding syntax\n// e.g. click:handler instead of the usual full-length event:{click:handler}\nfunction makeEventHandlerShortcut(eventName) {\n    ko.bindingHandlers[eventName] = {\n        'init': function(element, valueAccessor, allBindingsAccessor, viewModel) {\n            var newValueAccessor = function () {\n                var result = {};\n                result[eventName] = valueAccessor();\n                return result;\n            };\n            return ko.bindingHandlers['event']['init'].call(this, element, newValueAccessor, allBindingsAccessor, viewModel);\n        }\n    }\n}\n\nko.bindingHandlers['event'] = {\n    'init' : function (element, valueAccessor, allBindingsAccessor, viewModel) {\n        var eventsToHandle = valueAccessor() || {};\n        for(var eventNameOutsideClosure in eventsToHandle) {\n            (function() {\n                var eventName = eventNameOutsideClosure; // Separate variable to be captured by event handler closure\n                if (typeof eventName == \"string\") {\n                    ko.utils.registerEventHandler(element, eventName, function (event) {\n                        var handlerReturnValue;\n                        var handlerFunction = valueAccessor()[eventName];\n                        if (!handlerFunction)\n                            return;\n                        var allBindings = allBindingsAccessor();\n\n                        try {\n                            // Take all the event args, and prefix with the viewmodel\n                            var argsForHandler = ko.utils.makeArray(arguments);\n                            argsForHandler.unshift(viewModel);\n                            handlerReturnValue = handlerFunction.apply(viewModel, argsForHandler);\n                        } finally {\n                            if (handlerReturnValue !== true) { // Normally we want to prevent default action. Developer can override this be explicitly returning true.\n                                if (event.preventDefault)\n                                    event.preventDefault();\n                                else\n                                    event.returnValue = false;\n                            }\n                        }\n\n                        var bubble = allBindings[eventName + 'Bubble'] !== false;\n                        if (!bubble) {\n                            event.cancelBubble = true;\n                            if (event.stopPropagation)\n                                event.stopPropagation();\n                        }\n                    });\n                }\n            })();\n        }\n    }\n};\n// \"foreach: someExpression\" is equivalent to \"template: { foreach: someExpression }\"\n// \"foreach: { data: someExpression, afterAdd: myfn }\" is equivalent to \"template: { foreach: someExpression, afterAdd: myfn }\"\nko.bindingHandlers['foreach'] = {\n    makeTemplateValueAccessor: function(valueAccessor) {\n        return function() {\n            var modelValue = valueAccessor(),\n                unwrappedValue = ko.utils.peekObservable(modelValue);    // Unwrap without setting a dependency here\n\n            // If unwrappedValue is the array, pass in the wrapped value on its own\n            // The value will be unwrapped and tracked within the template binding\n            // (See https://github.com/SteveSanderson/knockout/issues/523)\n            if ((!unwrappedValue) || typeof unwrappedValue.length == \"number\")\n                return { 'foreach': modelValue, 'templateEngine': ko.nativeTemplateEngine.instance };\n\n            // If unwrappedValue.data is the array, preserve all relevant options and unwrap again value so we get updates\n            ko.utils.unwrapObservable(modelValue);\n            return {\n                'foreach': unwrappedValue['data'],\n                'as': unwrappedValue['as'],\n                'includeDestroyed': unwrappedValue['includeDestroyed'],\n                'afterAdd': unwrappedValue['afterAdd'],\n                'beforeRemove': unwrappedValue['beforeRemove'],\n                'afterRender': unwrappedValue['afterRender'],\n                'beforeMove': unwrappedValue['beforeMove'],\n                'afterMove': unwrappedValue['afterMove'],\n                'templateEngine': ko.nativeTemplateEngine.instance\n            };\n        };\n    },\n    'init': function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {\n        return ko.bindingHandlers['template']['init'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor));\n    },\n    'update': function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {\n        return ko.bindingHandlers['template']['update'](element, ko.bindingHandlers['foreach'].makeTemplateValueAccessor(valueAccessor), allBindingsAccessor, viewModel, bindingContext);\n    }\n};\nko.expressionRewriting.bindingRewriteValidators['foreach'] = false; // Can't rewrite control flow bindings\nko.virtualElements.allowedBindings['foreach'] = true;\nvar hasfocusUpdatingProperty = '__ko_hasfocusUpdating';\nko.bindingHandlers['hasfocus'] = {\n    'init': function(element, valueAccessor, allBindingsAccessor) {\n        var handleElementFocusChange = function(isFocused) {\n            // Where possible, ignore which event was raised and determine focus state using activeElement,\n            // as this avoids phantom focus/blur events raised when changing tabs in modern browsers.\n            // However, not all KO-targeted browsers (Firefox 2) support activeElement. For those browsers,\n            // prevent a loss of focus when changing tabs/windows by setting a flag that prevents hasfocus\n            // from calling 'blur()' on the element when it loses focus.\n            // Discussion at https://github.com/SteveSanderson/knockout/pull/352\n            element[hasfocusUpdatingProperty] = true;\n            var ownerDoc = element.ownerDocument;\n            if (\"activeElement\" in ownerDoc) {\n                isFocused = (ownerDoc.activeElement === element);\n            }\n            var modelValue = valueAccessor();\n            ko.expressionRewriting.writeValueToProperty(modelValue, allBindingsAccessor, 'hasfocus', isFocused, true);\n            element[hasfocusUpdatingProperty] = false;\n        };\n        var handleElementFocusIn = handleElementFocusChange.bind(null, true);\n        var handleElementFocusOut = handleElementFocusChange.bind(null, false);\n\n        ko.utils.registerEventHandler(element, \"focus\", handleElementFocusIn);\n        ko.utils.registerEventHandler(element, \"focusin\", handleElementFocusIn); // For IE\n        ko.utils.registerEventHandler(element, \"blur\",  handleElementFocusOut);\n        ko.utils.registerEventHandler(element, \"focusout\",  handleElementFocusOut); // For IE\n    },\n    'update': function(element, valueAccessor) {\n        var value = ko.utils.unwrapObservable(valueAccessor());\n        if (!element[hasfocusUpdatingProperty]) {\n            value ? element.focus() : element.blur();\n            ko.dependencyDetection.ignore(ko.utils.triggerEvent, null, [element, value ? \"focusin\" : \"focusout\"]); // For IE, which doesn't reliably fire \"focus\" or \"blur\" events synchronously\n        }\n    }\n};\nko.bindingHandlers['html'] = {\n    'init': function() {\n        // Prevent binding on the dynamically-injected HTML (as developers are unlikely to expect that, and it has security implications)\n        return { 'controlsDescendantBindings': true };\n    },\n    'update': function (element, valueAccessor) {\n        // setHtml will unwrap the value if needed\n        ko.utils.setHtml(element, valueAccessor());\n    }\n};\nvar withIfDomDataKey = '__ko_withIfBindingData';\n// Makes a binding like with or if\nfunction makeWithIfBinding(bindingKey, isWith, isNot, makeContextCallback) {\n    ko.bindingHandlers[bindingKey] = {\n        'init': function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {\n            ko.utils.domData.set(element, withIfDomDataKey, {});\n            return { 'controlsDescendantBindings': true };\n        },\n        'update': function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {\n            var withIfData = ko.utils.domData.get(element, withIfDomDataKey),\n                dataValue = ko.utils.unwrapObservable(valueAccessor()),\n                shouldDisplay = !isNot !== !dataValue, // equivalent to isNot ? !dataValue : !!dataValue\n                isFirstRender = !withIfData.savedNodes,\n                needsRefresh = isFirstRender || isWith || (shouldDisplay !== withIfData.didDisplayOnLastUpdate);\n\n            if (needsRefresh) {\n                if (isFirstRender) {\n                    withIfData.savedNodes = ko.utils.cloneNodes(ko.virtualElements.childNodes(element), true /* shouldCleanNodes */);\n                }\n\n                if (shouldDisplay) {\n                    if (!isFirstRender) {\n                        ko.virtualElements.setDomNodeChildren(element, ko.utils.cloneNodes(withIfData.savedNodes));\n                    }\n                    ko.applyBindingsToDescendants(makeContextCallback ? makeContextCallback(bindingContext, dataValue) : bindingContext, element);\n                } else {\n                    ko.virtualElements.emptyNode(element);\n                }\n\n                withIfData.didDisplayOnLastUpdate = shouldDisplay;\n            }\n        }\n    };\n    ko.expressionRewriting.bindingRewriteValidators[bindingKey] = false; // Can't rewrite control flow bindings\n    ko.virtualElements.allowedBindings[bindingKey] = true;\n}\n\n// Construct the actual binding handlers\nmakeWithIfBinding('if');\nmakeWithIfBinding('ifnot', false /* isWith */, true /* isNot */);\nmakeWithIfBinding('with', true /* isWith */, false /* isNot */,\n    function(bindingContext, dataValue) {\n        return bindingContext['createChildContext'](dataValue);\n    }\n);\nfunction ensureDropdownSelectionIsConsistentWithModelValue(element, modelValue, preferModelValue) {\n    if (preferModelValue) {\n        if (modelValue !== ko.selectExtensions.readValue(element))\n            ko.selectExtensions.writeValue(element, modelValue);\n    }\n\n    // No matter which direction we're syncing in, we want the end result to be equality between dropdown value and model value.\n    // If they aren't equal, either we prefer the dropdown value, or the model value couldn't be represented, so either way,\n    // change the model value to match the dropdown.\n    if (modelValue !== ko.selectExtensions.readValue(element))\n        ko.dependencyDetection.ignore(ko.utils.triggerEvent, null, [element, \"change\"]);\n};\n\nko.bindingHandlers['options'] = {\n    'update': function (element, valueAccessor, allBindingsAccessor) {\n        if (ko.utils.tagNameLower(element) !== \"select\")\n            throw new Error(\"options binding applies only to SELECT elements\");\n\n        var selectWasPreviouslyEmpty = element.length == 0;\n        var previousSelectedValues = ko.utils.arrayMap(ko.utils.arrayFilter(element.childNodes, function (node) {\n            return node.tagName && (ko.utils.tagNameLower(node) === \"option\") && node.selected;\n        }), function (node) {\n            return ko.selectExtensions.readValue(node) || node.innerText || node.textContent;\n        });\n        var previousScrollTop = element.scrollTop;\n\n        var value = ko.utils.unwrapObservable(valueAccessor());\n        var selectedValue = element.value;\n\n        // Remove all existing <option>s.\n        // Need to use .remove() rather than .removeChild() for <option>s otherwise IE behaves oddly (https://github.com/SteveSanderson/knockout/issues/134)\n        while (element.length > 0) {\n            ko.cleanNode(element.options[0]);\n            element.remove(0);\n        }\n\n        if (value) {\n            var allBindings = allBindingsAccessor(),\n                includeDestroyed = allBindings['optionsIncludeDestroyed'];\n\n            if (typeof value.length != \"number\")\n                value = [value];\n            if (allBindings['optionsCaption']) {\n                var option = document.createElement(\"option\");\n                ko.utils.setHtml(option, allBindings['optionsCaption']);\n                ko.selectExtensions.writeValue(option, undefined);\n                element.appendChild(option);\n            }\n\n            for (var i = 0, j = value.length; i < j; i++) {\n                // Skip destroyed items\n                var arrayEntry = value[i];\n                if (arrayEntry && arrayEntry['_destroy'] && !includeDestroyed)\n                    continue;\n\n                var option = document.createElement(\"option\");\n\n                function applyToObject(object, predicate, defaultValue) {\n                    var predicateType = typeof predicate;\n                    if (predicateType == \"function\")    // Given a function; run it against the data value\n                        return predicate(object);\n                    else if (predicateType == \"string\") // Given a string; treat it as a property name on the data value\n                        return object[predicate];\n                    else                                // Given no optionsText arg; use the data value itself\n                        return defaultValue;\n                }\n\n                // Apply a value to the option element\n                var optionValue = applyToObject(arrayEntry, allBindings['optionsValue'], arrayEntry);\n                ko.selectExtensions.writeValue(option, ko.utils.unwrapObservable(optionValue));\n\n                // Apply some text to the option element\n                var optionText = applyToObject(arrayEntry, allBindings['optionsText'], optionValue);\n                ko.utils.setTextContent(option, optionText);\n\n                element.appendChild(option);\n            }\n\n            // IE6 doesn't like us to assign selection to OPTION nodes before they're added to the document.\n            // That's why we first added them without selection. Now it's time to set the selection.\n            var newOptions = element.getElementsByTagName(\"option\");\n            var countSelectionsRetained = 0;\n            for (var i = 0, j = newOptions.length; i < j; i++) {\n                if (ko.utils.arrayIndexOf(previousSelectedValues, ko.selectExtensions.readValue(newOptions[i])) >= 0) {\n                    ko.utils.setOptionNodeSelectionState(newOptions[i], true);\n                    countSelectionsRetained++;\n                }\n            }\n\n            element.scrollTop = previousScrollTop;\n\n            if (selectWasPreviouslyEmpty && ('value' in allBindings)) {\n                // Ensure consistency between model value and selected option.\n                // If the dropdown is being populated for the first time here (or was otherwise previously empty),\n                // the dropdown selection state is meaningless, so we preserve the model value.\n                ensureDropdownSelectionIsConsistentWithModelValue(element, ko.utils.peekObservable(allBindings['value']), /* preferModelValue */ true);\n            }\n\n            // Workaround for IE9 bug\n            ko.utils.ensureSelectElementIsRenderedCorrectly(element);\n        }\n    }\n};\nko.bindingHandlers['options'].optionValueDomDataKey = '__ko.optionValueDomData__';\nko.bindingHandlers['selectedOptions'] = {\n    'init': function (element, valueAccessor, allBindingsAccessor) {\n        ko.utils.registerEventHandler(element, \"change\", function () {\n            var value = valueAccessor(), valueToWrite = [];\n            ko.utils.arrayForEach(element.getElementsByTagName(\"option\"), function(node) {\n                if (node.selected)\n                    valueToWrite.push(ko.selectExtensions.readValue(node));\n            });\n            ko.expressionRewriting.writeValueToProperty(value, allBindingsAccessor, 'value', valueToWrite);\n        });\n    },\n    'update': function (element, valueAccessor) {\n        if (ko.utils.tagNameLower(element) != \"select\")\n            throw new Error(\"values binding applies only to SELECT elements\");\n\n        var newValue = ko.utils.unwrapObservable(valueAccessor());\n        if (newValue && typeof newValue.length == \"number\") {\n            ko.utils.arrayForEach(element.getElementsByTagName(\"option\"), function(node) {\n                var isSelected = ko.utils.arrayIndexOf(newValue, ko.selectExtensions.readValue(node)) >= 0;\n                ko.utils.setOptionNodeSelectionState(node, isSelected);\n            });\n        }\n    }\n};\nko.bindingHandlers['style'] = {\n    'update': function (element, valueAccessor) {\n        var value = ko.utils.unwrapObservable(valueAccessor() || {});\n        for (var styleName in value) {\n            if (typeof styleName == \"string\") {\n                var styleValue = ko.utils.unwrapObservable(value[styleName]);\n                element.style[styleName] = styleValue || \"\"; // Empty string removes the value, whereas null/undefined have no effect\n            }\n        }\n    }\n};\nko.bindingHandlers['submit'] = {\n    'init': function (element, valueAccessor, allBindingsAccessor, viewModel) {\n        if (typeof valueAccessor() != \"function\")\n            throw new Error(\"The value for a submit binding must be a function\");\n        ko.utils.registerEventHandler(element, \"submit\", function (event) {\n            var handlerReturnValue;\n            var value = valueAccessor();\n            try { handlerReturnValue = value.call(viewModel, element); }\n            finally {\n                if (handlerReturnValue !== true) { // Normally we want to prevent default action. Developer can override this be explicitly returning true.\n                    if (event.preventDefault)\n                        event.preventDefault();\n                    else\n                        event.returnValue = false;\n                }\n            }\n        });\n    }\n};\nko.bindingHandlers['text'] = {\n    'update': function (element, valueAccessor) {\n        ko.utils.setTextContent(element, valueAccessor());\n    }\n};\nko.virtualElements.allowedBindings['text'] = true;\nko.bindingHandlers['uniqueName'] = {\n    'init': function (element, valueAccessor) {\n        if (valueAccessor()) {\n            var name = \"ko_unique_\" + (++ko.bindingHandlers['uniqueName'].currentIndex);\n            ko.utils.setElementName(element, name);\n        }\n    }\n};\nko.bindingHandlers['uniqueName'].currentIndex = 0;\nko.bindingHandlers['value'] = {\n    'init': function (element, valueAccessor, allBindingsAccessor) {\n        // Always catch \"change\" event; possibly other events too if asked\n        var eventsToCatch = [\"change\"];\n        var requestedEventsToCatch = allBindingsAccessor()[\"valueUpdate\"];\n        var propertyChangedFired = false;\n        if (requestedEventsToCatch) {\n            if (typeof requestedEventsToCatch == \"string\") // Allow both individual event names, and arrays of event names\n                requestedEventsToCatch = [requestedEventsToCatch];\n            ko.utils.arrayPushAll(eventsToCatch, requestedEventsToCatch);\n            eventsToCatch = ko.utils.arrayGetDistinctValues(eventsToCatch);\n        }\n\n        var valueUpdateHandler = function() {\n            propertyChangedFired = false;\n            var modelValue = valueAccessor();\n            var elementValue = ko.selectExtensions.readValue(element);\n            ko.expressionRewriting.writeValueToProperty(modelValue, allBindingsAccessor, 'value', elementValue);\n        }\n\n        // Workaround for https://github.com/SteveSanderson/knockout/issues/122\n        // IE doesn't fire \"change\" events on textboxes if the user selects a value from its autocomplete list\n        var ieAutoCompleteHackNeeded = ko.utils.ieVersion && element.tagName.toLowerCase() == \"input\" && element.type == \"text\"\n                                       && element.autocomplete != \"off\" && (!element.form || element.form.autocomplete != \"off\");\n        if (ieAutoCompleteHackNeeded && ko.utils.arrayIndexOf(eventsToCatch, \"propertychange\") == -1) {\n            ko.utils.registerEventHandler(element, \"propertychange\", function () { propertyChangedFired = true });\n            ko.utils.registerEventHandler(element, \"blur\", function() {\n                if (propertyChangedFired) {\n                    valueUpdateHandler();\n                }\n            });\n        }\n\n        ko.utils.arrayForEach(eventsToCatch, function(eventName) {\n            // The syntax \"after<eventname>\" means \"run the handler asynchronously after the event\"\n            // This is useful, for example, to catch \"keydown\" events after the browser has updated the control\n            // (otherwise, ko.selectExtensions.readValue(this) will receive the control's value *before* the key event)\n            var handler = valueUpdateHandler;\n            if (ko.utils.stringStartsWith(eventName, \"after\")) {\n                handler = function() { setTimeout(valueUpdateHandler, 0) };\n                eventName = eventName.substring(\"after\".length);\n            }\n            ko.utils.registerEventHandler(element, eventName, handler);\n        });\n    },\n    'update': function (element, valueAccessor) {\n        var valueIsSelectOption = ko.utils.tagNameLower(element) === \"select\";\n        var newValue = ko.utils.unwrapObservable(valueAccessor());\n        var elementValue = ko.selectExtensions.readValue(element);\n        var valueHasChanged = (newValue != elementValue);\n\n        // JavaScript's 0 == \"\" behavious is unfortunate here as it prevents writing 0 to an empty text box (loose equality suggests the values are the same).\n        // We don't want to do a strict equality comparison as that is more confusing for developers in certain cases, so we specifically special case 0 != \"\" here.\n        if ((newValue === 0) && (elementValue !== 0) && (elementValue !== \"0\"))\n            valueHasChanged = true;\n\n        if (valueHasChanged) {\n            var applyValueAction = function () { ko.selectExtensions.writeValue(element, newValue); };\n            applyValueAction();\n\n            // Workaround for IE6 bug: It won't reliably apply values to SELECT nodes during the same execution thread\n            // right after you've changed the set of OPTION nodes on it. So for that node type, we'll schedule a second thread\n            // to apply the value as well.\n            var alsoApplyAsynchronously = valueIsSelectOption;\n            if (alsoApplyAsynchronously)\n                setTimeout(applyValueAction, 0);\n        }\n\n        // If you try to set a model value that can't be represented in an already-populated dropdown, reject that change,\n        // because you're not allowed to have a model value that disagrees with a visible UI selection.\n        if (valueIsSelectOption && (element.length > 0))\n            ensureDropdownSelectionIsConsistentWithModelValue(element, newValue, /* preferModelValue */ false);\n    }\n};\nko.bindingHandlers['visible'] = {\n    'update': function (element, valueAccessor) {\n        var value = ko.utils.unwrapObservable(valueAccessor());\n        var isCurrentlyVisible = !(element.style.display == \"none\");\n        if (value && !isCurrentlyVisible)\n            element.style.display = \"\";\n        else if ((!value) && isCurrentlyVisible)\n            element.style.display = \"none\";\n    }\n};\n// 'click' is just a shorthand for the usual full-length event:{click:handler}\nmakeEventHandlerShortcut('click');\n// If you want to make a custom template engine,\n//\n// [1] Inherit from this class (like ko.nativeTemplateEngine does)\n// [2] Override 'renderTemplateSource', supplying a function with this signature:\n//\n//        function (templateSource, bindingContext, options) {\n//            // - templateSource.text() is the text of the template you should render\n//            // - bindingContext.$data is the data you should pass into the template\n//            //   - you might also want to make bindingContext.$parent, bindingContext.$parents,\n//            //     and bindingContext.$root available in the template too\n//            // - options gives you access to any other properties set on \"data-bind: { template: options }\"\n//            //\n//            // Return value: an array of DOM nodes\n//        }\n//\n// [3] Override 'createJavaScriptEvaluatorBlock', supplying a function with this signature:\n//\n//        function (script) {\n//            // Return value: Whatever syntax means \"Evaluate the JavaScript statement 'script' and output the result\"\n//            //               For example, the jquery.tmpl template engine converts 'someScript' to '${ someScript }'\n//        }\n//\n//     This is only necessary if you want to allow data-bind attributes to reference arbitrary template variables.\n//     If you don't want to allow that, you can set the property 'allowTemplateRewriting' to false (like ko.nativeTemplateEngine does)\n//     and then you don't need to override 'createJavaScriptEvaluatorBlock'.\n\nko.templateEngine = function () { };\n\nko.templateEngine.prototype['renderTemplateSource'] = function (templateSource, bindingContext, options) {\n    throw new Error(\"Override renderTemplateSource\");\n};\n\nko.templateEngine.prototype['createJavaScriptEvaluatorBlock'] = function (script) {\n    throw new Error(\"Override createJavaScriptEvaluatorBlock\");\n};\n\nko.templateEngine.prototype['makeTemplateSource'] = function(template, templateDocument) {\n    // Named template\n    if (typeof template == \"string\") {\n        templateDocument = templateDocument || document;\n        var elem = templateDocument.getElementById(template);\n        if (!elem)\n            throw new Error(\"Cannot find template with ID \" + template);\n        return new ko.templateSources.domElement(elem);\n    } else if ((template.nodeType == 1) || (template.nodeType == 8)) {\n        // Anonymous template\n        return new ko.templateSources.anonymousTemplate(template);\n    } else\n        throw new Error(\"Unknown template type: \" + template);\n};\n\nko.templateEngine.prototype['renderTemplate'] = function (template, bindingContext, options, templateDocument) {\n    var templateSource = this['makeTemplateSource'](template, templateDocument);\n    return this['renderTemplateSource'](templateSource, bindingContext, options);\n};\n\nko.templateEngine.prototype['isTemplateRewritten'] = function (template, templateDocument) {\n    // Skip rewriting if requested\n    if (this['allowTemplateRewriting'] === false)\n        return true;\n    return this['makeTemplateSource'](template, templateDocument)['data'](\"isRewritten\");\n};\n\nko.templateEngine.prototype['rewriteTemplate'] = function (template, rewriterCallback, templateDocument) {\n    var templateSource = this['makeTemplateSource'](template, templateDocument);\n    var rewritten = rewriterCallback(templateSource['text']());\n    templateSource['text'](rewritten);\n    templateSource['data'](\"isRewritten\", true);\n};\n\nko.exportSymbol('templateEngine', ko.templateEngine);\n\nko.templateRewriting = (function () {\n    var memoizeDataBindingAttributeSyntaxRegex = /(<[a-z]+\\d*(\\s+(?!data-bind=)[a-z0-9\\-]+(=(\\\"[^\\\"]*\\\"|\\'[^\\']*\\'))?)*\\s+)data-bind=([\"'])([\\s\\S]*?)\\5/gi;\n    var memoizeVirtualContainerBindingSyntaxRegex = /<!--\\s*ko\\b\\s*([\\s\\S]*?)\\s*-->/g;\n\n    function validateDataBindValuesForRewriting(keyValueArray) {\n        var allValidators = ko.expressionRewriting.bindingRewriteValidators;\n        for (var i = 0; i < keyValueArray.length; i++) {\n            var key = keyValueArray[i]['key'];\n            if (allValidators.hasOwnProperty(key)) {\n                var validator = allValidators[key];\n\n                if (typeof validator === \"function\") {\n                    var possibleErrorMessage = validator(keyValueArray[i]['value']);\n                    if (possibleErrorMessage)\n                        throw new Error(possibleErrorMessage);\n                } else if (!validator) {\n                    throw new Error(\"This template engine does not support the '\" + key + \"' binding within its templates\");\n                }\n            }\n        }\n    }\n\n    function constructMemoizedTagReplacement(dataBindAttributeValue, tagToRetain, templateEngine) {\n        var dataBindKeyValueArray = ko.expressionRewriting.parseObjectLiteral(dataBindAttributeValue);\n        validateDataBindValuesForRewriting(dataBindKeyValueArray);\n        var rewrittenDataBindAttributeValue = ko.expressionRewriting.preProcessBindings(dataBindKeyValueArray);\n\n        // For no obvious reason, Opera fails to evaluate rewrittenDataBindAttributeValue unless it's wrapped in an additional\n        // anonymous function, even though Opera's built-in debugger can evaluate it anyway. No other browser requires this\n        // extra indirection.\n        var applyBindingsToNextSiblingScript =\n            \"ko.__tr_ambtns(function($context,$element){return(function(){return{ \" + rewrittenDataBindAttributeValue + \" } })()})\";\n        return templateEngine['createJavaScriptEvaluatorBlock'](applyBindingsToNextSiblingScript) + tagToRetain;\n    }\n\n    return {\n        ensureTemplateIsRewritten: function (template, templateEngine, templateDocument) {\n            if (!templateEngine['isTemplateRewritten'](template, templateDocument))\n                templateEngine['rewriteTemplate'](template, function (htmlString) {\n                    return ko.templateRewriting.memoizeBindingAttributeSyntax(htmlString, templateEngine);\n                }, templateDocument);\n        },\n\n        memoizeBindingAttributeSyntax: function (htmlString, templateEngine) {\n            return htmlString.replace(memoizeDataBindingAttributeSyntaxRegex, function () {\n                return constructMemoizedTagReplacement(/* dataBindAttributeValue: */ arguments[6], /* tagToRetain: */ arguments[1], templateEngine);\n            }).replace(memoizeVirtualContainerBindingSyntaxRegex, function() {\n                return constructMemoizedTagReplacement(/* dataBindAttributeValue: */ arguments[1], /* tagToRetain: */ \"<!-- ko -->\", templateEngine);\n            });\n        },\n\n        applyMemoizedBindingsToNextSibling: function (bindings) {\n            return ko.memoization.memoize(function (domNode, bindingContext) {\n                if (domNode.nextSibling)\n                    ko.applyBindingsToNode(domNode.nextSibling, bindings, bindingContext);\n            });\n        }\n    }\n})();\n\n\n// Exported only because it has to be referenced by string lookup from within rewritten template\nko.exportSymbol('__tr_ambtns', ko.templateRewriting.applyMemoizedBindingsToNextSibling);\n(function() {\n    // A template source represents a read/write way of accessing a template. This is to eliminate the need for template loading/saving\n    // logic to be duplicated in every template engine (and means they can all work with anonymous templates, etc.)\n    //\n    // Two are provided by default:\n    //  1. ko.templateSources.domElement       - reads/writes the text content of an arbitrary DOM element\n    //  2. ko.templateSources.anonymousElement - uses ko.utils.domData to read/write text *associated* with the DOM element, but\n    //                                           without reading/writing the actual element text content, since it will be overwritten\n    //                                           with the rendered template output.\n    // You can implement your own template source if you want to fetch/store templates somewhere other than in DOM elements.\n    // Template sources need to have the following functions:\n    //   text() \t\t\t- returns the template text from your storage location\n    //   text(value)\t\t- writes the supplied template text to your storage location\n    //   data(key)\t\t\t- reads values stored using data(key, value) - see below\n    //   data(key, value)\t- associates \"value\" with this template and the key \"key\". Is used to store information like \"isRewritten\".\n    //\n    // Optionally, template sources can also have the following functions:\n    //   nodes()            - returns a DOM element containing the nodes of this template, where available\n    //   nodes(value)       - writes the given DOM element to your storage location\n    // If a DOM element is available for a given template source, template engines are encouraged to use it in preference over text()\n    // for improved speed. However, all templateSources must supply text() even if they don't supply nodes().\n    //\n    // Once you've implemented a templateSource, make your template engine use it by subclassing whatever template engine you were\n    // using and overriding \"makeTemplateSource\" to return an instance of your custom template source.\n\n    ko.templateSources = {};\n\n    // ---- ko.templateSources.domElement -----\n\n    ko.templateSources.domElement = function(element) {\n        this.domElement = element;\n    }\n\n    ko.templateSources.domElement.prototype['text'] = function(/* valueToWrite */) {\n        var tagNameLower = ko.utils.tagNameLower(this.domElement),\n            elemContentsProperty = tagNameLower === \"script\" ? \"text\"\n                                 : tagNameLower === \"textarea\" ? \"value\"\n                                 : \"innerHTML\";\n\n        if (arguments.length == 0) {\n            return this.domElement[elemContentsProperty];\n        } else {\n            var valueToWrite = arguments[0];\n            if (elemContentsProperty === \"innerHTML\")\n                ko.utils.setHtml(this.domElement, valueToWrite);\n            else\n                this.domElement[elemContentsProperty] = valueToWrite;\n        }\n    };\n\n    ko.templateSources.domElement.prototype['data'] = function(key /*, valueToWrite */) {\n        if (arguments.length === 1) {\n            return ko.utils.domData.get(this.domElement, \"templateSourceData_\" + key);\n        } else {\n            ko.utils.domData.set(this.domElement, \"templateSourceData_\" + key, arguments[1]);\n        }\n    };\n\n    // ---- ko.templateSources.anonymousTemplate -----\n    // Anonymous templates are normally saved/retrieved as DOM nodes through \"nodes\".\n    // For compatibility, you can also read \"text\"; it will be serialized from the nodes on demand.\n    // Writing to \"text\" is still supported, but then the template data will not be available as DOM nodes.\n\n    var anonymousTemplatesDomDataKey = \"__ko_anon_template__\";\n    ko.templateSources.anonymousTemplate = function(element) {\n        this.domElement = element;\n    }\n    ko.templateSources.anonymousTemplate.prototype = new ko.templateSources.domElement();\n    ko.templateSources.anonymousTemplate.prototype['text'] = function(/* valueToWrite */) {\n        if (arguments.length == 0) {\n            var templateData = ko.utils.domData.get(this.domElement, anonymousTemplatesDomDataKey) || {};\n            if (templateData.textData === undefined && templateData.containerData)\n                templateData.textData = templateData.containerData.innerHTML;\n            return templateData.textData;\n        } else {\n            var valueToWrite = arguments[0];\n            ko.utils.domData.set(this.domElement, anonymousTemplatesDomDataKey, {textData: valueToWrite});\n        }\n    };\n    ko.templateSources.domElement.prototype['nodes'] = function(/* valueToWrite */) {\n        if (arguments.length == 0) {\n            var templateData = ko.utils.domData.get(this.domElement, anonymousTemplatesDomDataKey) || {};\n            return templateData.containerData;\n        } else {\n            var valueToWrite = arguments[0];\n            ko.utils.domData.set(this.domElement, anonymousTemplatesDomDataKey, {containerData: valueToWrite});\n        }\n    };\n\n    ko.exportSymbol('templateSources', ko.templateSources);\n    ko.exportSymbol('templateSources.domElement', ko.templateSources.domElement);\n    ko.exportSymbol('templateSources.anonymousTemplate', ko.templateSources.anonymousTemplate);\n})();\n(function () {\n    var _templateEngine;\n    ko.setTemplateEngine = function (templateEngine) {\n        if ((templateEngine != undefined) && !(templateEngine instanceof ko.templateEngine))\n            throw new Error(\"templateEngine must inherit from ko.templateEngine\");\n        _templateEngine = templateEngine;\n    }\n\n    function invokeForEachNodeOrCommentInContinuousRange(firstNode, lastNode, action) {\n        var node, nextInQueue = firstNode, firstOutOfRangeNode = ko.virtualElements.nextSibling(lastNode);\n        while (nextInQueue && ((node = nextInQueue) !== firstOutOfRangeNode)) {\n            nextInQueue = ko.virtualElements.nextSibling(node);\n            if (node.nodeType === 1 || node.nodeType === 8)\n                action(node);\n        }\n    }\n\n    function activateBindingsOnContinuousNodeArray(continuousNodeArray, bindingContext) {\n        // To be used on any nodes that have been rendered by a template and have been inserted into some parent element\n        // Walks through continuousNodeArray (which *must* be continuous, i.e., an uninterrupted sequence of sibling nodes, because\n        // the algorithm for walking them relies on this), and for each top-level item in the virtual-element sense,\n        // (1) Does a regular \"applyBindings\" to associate bindingContext with this node and to activate any non-memoized bindings\n        // (2) Unmemoizes any memos in the DOM subtree (e.g., to activate bindings that had been memoized during template rewriting)\n\n        if (continuousNodeArray.length) {\n            var firstNode = continuousNodeArray[0], lastNode = continuousNodeArray[continuousNodeArray.length - 1];\n\n            // Need to applyBindings *before* unmemoziation, because unmemoization might introduce extra nodes (that we don't want to re-bind)\n            // whereas a regular applyBindings won't introduce new memoized nodes\n            invokeForEachNodeOrCommentInContinuousRange(firstNode, lastNode, function(node) {\n                ko.applyBindings(bindingContext, node);\n            });\n            invokeForEachNodeOrCommentInContinuousRange(firstNode, lastNode, function(node) {\n                ko.memoization.unmemoizeDomNodeAndDescendants(node, [bindingContext]);\n            });\n        }\n    }\n\n    function getFirstNodeFromPossibleArray(nodeOrNodeArray) {\n        return nodeOrNodeArray.nodeType ? nodeOrNodeArray\n                                        : nodeOrNodeArray.length > 0 ? nodeOrNodeArray[0]\n                                        : null;\n    }\n\n    function executeTemplate(targetNodeOrNodeArray, renderMode, template, bindingContext, options) {\n        options = options || {};\n        var firstTargetNode = targetNodeOrNodeArray && getFirstNodeFromPossibleArray(targetNodeOrNodeArray);\n        var templateDocument = firstTargetNode && firstTargetNode.ownerDocument;\n        var templateEngineToUse = (options['templateEngine'] || _templateEngine);\n        ko.templateRewriting.ensureTemplateIsRewritten(template, templateEngineToUse, templateDocument);\n        var renderedNodesArray = templateEngineToUse['renderTemplate'](template, bindingContext, options, templateDocument);\n\n        // Loosely check result is an array of DOM nodes\n        if ((typeof renderedNodesArray.length != \"number\") || (renderedNodesArray.length > 0 && typeof renderedNodesArray[0].nodeType != \"number\"))\n            throw new Error(\"Template engine must return an array of DOM nodes\");\n\n        var haveAddedNodesToParent = false;\n        switch (renderMode) {\n            case \"replaceChildren\":\n                ko.virtualElements.setDomNodeChildren(targetNodeOrNodeArray, renderedNodesArray);\n                haveAddedNodesToParent = true;\n                break;\n            case \"replaceNode\":\n                ko.utils.replaceDomNodes(targetNodeOrNodeArray, renderedNodesArray);\n                haveAddedNodesToParent = true;\n                break;\n            case \"ignoreTargetNode\": break;\n            default:\n                throw new Error(\"Unknown renderMode: \" + renderMode);\n        }\n\n        if (haveAddedNodesToParent) {\n            activateBindingsOnContinuousNodeArray(renderedNodesArray, bindingContext);\n            if (options['afterRender'])\n                ko.dependencyDetection.ignore(options['afterRender'], null, [renderedNodesArray, bindingContext['$data']]);\n        }\n\n        return renderedNodesArray;\n    }\n\n    ko.renderTemplate = function (template, dataOrBindingContext, options, targetNodeOrNodeArray, renderMode) {\n        options = options || {};\n        if ((options['templateEngine'] || _templateEngine) == undefined)\n            throw new Error(\"Set a template engine before calling renderTemplate\");\n        renderMode = renderMode || \"replaceChildren\";\n\n        if (targetNodeOrNodeArray) {\n            var firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray);\n\n            var whenToDispose = function () { return (!firstTargetNode) || !ko.utils.domNodeIsAttachedToDocument(firstTargetNode); }; // Passive disposal (on next evaluation)\n            var activelyDisposeWhenNodeIsRemoved = (firstTargetNode && renderMode == \"replaceNode\") ? firstTargetNode.parentNode : firstTargetNode;\n\n            return ko.dependentObservable( // So the DOM is automatically updated when any dependency changes\n                function () {\n                    // Ensure we've got a proper binding context to work with\n                    var bindingContext = (dataOrBindingContext && (dataOrBindingContext instanceof ko.bindingContext))\n                        ? dataOrBindingContext\n                        : new ko.bindingContext(ko.utils.unwrapObservable(dataOrBindingContext));\n\n                    // Support selecting template as a function of the data being rendered\n                    var templateName = typeof(template) == 'function' ? template(bindingContext['$data'], bindingContext) : template;\n\n                    var renderedNodesArray = executeTemplate(targetNodeOrNodeArray, renderMode, templateName, bindingContext, options);\n                    if (renderMode == \"replaceNode\") {\n                        targetNodeOrNodeArray = renderedNodesArray;\n                        firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray);\n                    }\n                },\n                null,\n                { disposeWhen: whenToDispose, disposeWhenNodeIsRemoved: activelyDisposeWhenNodeIsRemoved }\n            );\n        } else {\n            // We don't yet have a DOM node to evaluate, so use a memo and render the template later when there is a DOM node\n            return ko.memoization.memoize(function (domNode) {\n                ko.renderTemplate(template, dataOrBindingContext, options, domNode, \"replaceNode\");\n            });\n        }\n    };\n\n    ko.renderTemplateForEach = function (template, arrayOrObservableArray, options, targetNode, parentBindingContext) {\n        // Since setDomNodeChildrenFromArrayMapping always calls executeTemplateForArrayItem and then\n        // activateBindingsCallback for added items, we can store the binding context in the former to use in the latter.\n        var arrayItemContext;\n\n        // This will be called by setDomNodeChildrenFromArrayMapping to get the nodes to add to targetNode\n        var executeTemplateForArrayItem = function (arrayValue, index) {\n            // Support selecting template as a function of the data being rendered\n            arrayItemContext = parentBindingContext['createChildContext'](ko.utils.unwrapObservable(arrayValue), options['as']);\n            arrayItemContext['$index'] = index;\n            var templateName = typeof(template) == 'function' ? template(arrayValue, arrayItemContext) : template;\n            return executeTemplate(null, \"ignoreTargetNode\", templateName, arrayItemContext, options);\n        }\n\n        // This will be called whenever setDomNodeChildrenFromArrayMapping has added nodes to targetNode\n        var activateBindingsCallback = function(arrayValue, addedNodesArray, index) {\n            activateBindingsOnContinuousNodeArray(addedNodesArray, arrayItemContext);\n            if (options['afterRender'])\n                options['afterRender'](addedNodesArray, arrayValue);\n        };\n\n        return ko.dependentObservable(function () {\n            var unwrappedArray = ko.utils.unwrapObservable(arrayOrObservableArray) || [];\n            if (typeof unwrappedArray.length == \"undefined\") // Coerce single value into array\n                unwrappedArray = [unwrappedArray];\n\n            // Filter out any entries marked as destroyed\n            var filteredArray = ko.utils.arrayFilter(unwrappedArray, function(item) {\n                return options['includeDestroyed'] || item === undefined || item === null || !ko.utils.unwrapObservable(item['_destroy']);\n            });\n\n            // Call setDomNodeChildrenFromArrayMapping, ignoring any observables unwrapped within (most likely from a callback function).\n            // If the array items are observables, though, they will be unwrapped in executeTemplateForArrayItem and managed within setDomNodeChildrenFromArrayMapping.\n            ko.dependencyDetection.ignore(ko.utils.setDomNodeChildrenFromArrayMapping, null, [targetNode, filteredArray, executeTemplateForArrayItem, options, activateBindingsCallback]);\n\n        }, null, { disposeWhenNodeIsRemoved: targetNode });\n    };\n\n    var templateComputedDomDataKey = '__ko__templateComputedDomDataKey__';\n    function disposeOldComputedAndStoreNewOne(element, newComputed) {\n        var oldComputed = ko.utils.domData.get(element, templateComputedDomDataKey);\n        if (oldComputed && (typeof(oldComputed.dispose) == 'function'))\n            oldComputed.dispose();\n        ko.utils.domData.set(element, templateComputedDomDataKey, (newComputed && newComputed.isActive()) ? newComputed : undefined);\n    }\n\n    ko.bindingHandlers['template'] = {\n        'init': function(element, valueAccessor) {\n            // Support anonymous templates\n            var bindingValue = ko.utils.unwrapObservable(valueAccessor());\n            if ((typeof bindingValue != \"string\") && (!bindingValue['name']) && (element.nodeType == 1 || element.nodeType == 8)) {\n                // It's an anonymous template - store the element contents, then clear the element\n                var templateNodes = element.nodeType == 1 ? element.childNodes : ko.virtualElements.childNodes(element),\n                    container = ko.utils.moveCleanedNodesToContainerElement(templateNodes); // This also removes the nodes from their current parent\n                new ko.templateSources.anonymousTemplate(element)['nodes'](container);\n            }\n            return { 'controlsDescendantBindings': true };\n        },\n        'update': function (element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {\n            var templateName = ko.utils.unwrapObservable(valueAccessor()),\n                options = {},\n                shouldDisplay = true,\n                dataValue,\n                templateComputed = null;\n\n            if (typeof templateName != \"string\") {\n                options = templateName;\n                templateName = options['name'];\n\n                // Support \"if\"/\"ifnot\" conditions\n                if ('if' in options)\n                    shouldDisplay = ko.utils.unwrapObservable(options['if']);\n                if (shouldDisplay && 'ifnot' in options)\n                    shouldDisplay = !ko.utils.unwrapObservable(options['ifnot']);\n\n                dataValue = ko.utils.unwrapObservable(options['data']);\n            }\n\n            if ('foreach' in options) {\n                // Render once for each data point (treating data set as empty if shouldDisplay==false)\n                var dataArray = (shouldDisplay && options['foreach']) || [];\n                templateComputed = ko.renderTemplateForEach(templateName || element, dataArray, options, element, bindingContext);\n            } else if (!shouldDisplay) {\n                ko.virtualElements.emptyNode(element);\n            } else {\n                // Render once for this single data point (or use the viewModel if no data was provided)\n                var innerBindingContext = ('data' in options) ?\n                    bindingContext['createChildContext'](dataValue, options['as']) :  // Given an explitit 'data' value, we create a child binding context for it\n                    bindingContext;                                                        // Given no explicit 'data' value, we retain the same binding context\n                templateComputed = ko.renderTemplate(templateName || element, innerBindingContext, options, element);\n            }\n\n            // It only makes sense to have a single template computed per element (otherwise which one should have its output displayed?)\n            disposeOldComputedAndStoreNewOne(element, templateComputed);\n        }\n    };\n\n    // Anonymous templates can't be rewritten. Give a nice error message if you try to do it.\n    ko.expressionRewriting.bindingRewriteValidators['template'] = function(bindingValue) {\n        var parsedBindingValue = ko.expressionRewriting.parseObjectLiteral(bindingValue);\n\n        if ((parsedBindingValue.length == 1) && parsedBindingValue[0]['unknown'])\n            return null; // It looks like a string literal, not an object literal, so treat it as a named template (which is allowed for rewriting)\n\n        if (ko.expressionRewriting.keyValueArrayContainsKey(parsedBindingValue, \"name\"))\n            return null; // Named templates can be rewritten, so return \"no error\"\n        return \"This template engine does not support anonymous templates nested within its templates\";\n    };\n\n    ko.virtualElements.allowedBindings['template'] = true;\n})();\n\nko.exportSymbol('setTemplateEngine', ko.setTemplateEngine);\nko.exportSymbol('renderTemplate', ko.renderTemplate);\n\nko.utils.compareArrays = (function () {\n    var statusNotInOld = 'added', statusNotInNew = 'deleted';\n\n    // Simple calculation based on Levenshtein distance.\n    function compareArrays(oldArray, newArray, dontLimitMoves) {\n        oldArray = oldArray || [];\n        newArray = newArray || [];\n\n        if (oldArray.length <= newArray.length)\n            return compareSmallArrayToBigArray(oldArray, newArray, statusNotInOld, statusNotInNew, dontLimitMoves);\n        else\n            return compareSmallArrayToBigArray(newArray, oldArray, statusNotInNew, statusNotInOld, dontLimitMoves);\n    }\n\n    function compareSmallArrayToBigArray(smlArray, bigArray, statusNotInSml, statusNotInBig, dontLimitMoves) {\n        var myMin = Math.min,\n            myMax = Math.max,\n            editDistanceMatrix = [],\n            smlIndex, smlIndexMax = smlArray.length,\n            bigIndex, bigIndexMax = bigArray.length,\n            compareRange = (bigIndexMax - smlIndexMax) || 1,\n            maxDistance = smlIndexMax + bigIndexMax + 1,\n            thisRow, lastRow,\n            bigIndexMaxForRow, bigIndexMinForRow;\n\n        for (smlIndex = 0; smlIndex <= smlIndexMax; smlIndex++) {\n            lastRow = thisRow;\n            editDistanceMatrix.push(thisRow = []);\n            bigIndexMaxForRow = myMin(bigIndexMax, smlIndex + compareRange);\n            bigIndexMinForRow = myMax(0, smlIndex - 1);\n            for (bigIndex = bigIndexMinForRow; bigIndex <= bigIndexMaxForRow; bigIndex++) {\n                if (!bigIndex)\n                    thisRow[bigIndex] = smlIndex + 1;\n                else if (!smlIndex)  // Top row - transform empty array into new array via additions\n                    thisRow[bigIndex] = bigIndex + 1;\n                else if (smlArray[smlIndex - 1] === bigArray[bigIndex - 1])\n                    thisRow[bigIndex] = lastRow[bigIndex - 1];                  // copy value (no edit)\n                else {\n                    var northDistance = lastRow[bigIndex] || maxDistance;       // not in big (deletion)\n                    var westDistance = thisRow[bigIndex - 1] || maxDistance;    // not in small (addition)\n                    thisRow[bigIndex] = myMin(northDistance, westDistance) + 1;\n                }\n            }\n        }\n\n        var editScript = [], meMinusOne, notInSml = [], notInBig = [];\n        for (smlIndex = smlIndexMax, bigIndex = bigIndexMax; smlIndex || bigIndex;) {\n            meMinusOne = editDistanceMatrix[smlIndex][bigIndex] - 1;\n            if (bigIndex && meMinusOne === editDistanceMatrix[smlIndex][bigIndex-1]) {\n                notInSml.push(editScript[editScript.length] = {     // added\n                    'status': statusNotInSml,\n                    'value': bigArray[--bigIndex],\n                    'index': bigIndex });\n            } else if (smlIndex && meMinusOne === editDistanceMatrix[smlIndex - 1][bigIndex]) {\n                notInBig.push(editScript[editScript.length] = {     // deleted\n                    'status': statusNotInBig,\n                    'value': smlArray[--smlIndex],\n                    'index': smlIndex });\n            } else {\n                editScript.push({\n                    'status': \"retained\",\n                    'value': bigArray[--bigIndex] });\n                --smlIndex;\n            }\n        }\n\n        if (notInSml.length && notInBig.length) {\n            // Set a limit on the number of consecutive non-matching comparisons; having it a multiple of\n            // smlIndexMax keeps the time complexity of this algorithm linear.\n            var limitFailedCompares = smlIndexMax * 10, failedCompares,\n                a, d, notInSmlItem, notInBigItem;\n            // Go through the items that have been added and deleted and try to find matches between them.\n            for (failedCompares = a = 0; (dontLimitMoves || failedCompares < limitFailedCompares) && (notInSmlItem = notInSml[a]); a++) {\n                for (d = 0; notInBigItem = notInBig[d]; d++) {\n                    if (notInSmlItem['value'] === notInBigItem['value']) {\n                        notInSmlItem['moved'] = notInBigItem['index'];\n                        notInBigItem['moved'] = notInSmlItem['index'];\n                        notInBig.splice(d,1);       // This item is marked as moved; so remove it from notInBig list\n                        failedCompares = d = 0;     // Reset failed compares count because we're checking for consecutive failures\n                        break;\n                    }\n                }\n                failedCompares += d;\n            }\n        }\n        return editScript.reverse();\n    }\n\n    return compareArrays;\n})();\n\nko.exportSymbol('utils.compareArrays', ko.utils.compareArrays);\n\n(function () {\n    // Objective:\n    // * Given an input array, a container DOM node, and a function from array elements to arrays of DOM nodes,\n    //   map the array elements to arrays of DOM nodes, concatenate together all these arrays, and use them to populate the container DOM node\n    // * Next time we're given the same combination of things (with the array possibly having mutated), update the container DOM node\n    //   so that its children is again the concatenation of the mappings of the array elements, but don't re-map any array elements that we\n    //   previously mapped - retain those nodes, and just insert/delete other ones\n\n    // \"callbackAfterAddingNodes\" will be invoked after any \"mapping\"-generated nodes are inserted into the container node\n    // You can use this, for example, to activate bindings on those nodes.\n\n    function fixUpNodesToBeMovedOrRemoved(contiguousNodeArray) {\n        // Before moving, deleting, or replacing a set of nodes that were previously outputted by the \"map\" function, we have to reconcile\n        // them against what is in the DOM right now. It may be that some of the nodes have already been removed from the document,\n        // or that new nodes might have been inserted in the middle, for example by a binding. Also, there may previously have been\n        // leading comment nodes (created by rewritten string-based templates) that have since been removed during binding.\n        // So, this function translates the old \"map\" output array into its best guess of what set of current DOM nodes should be removed.\n        //\n        // Rules:\n        //   [A] Any leading nodes that aren't in the document any more should be ignored\n        //       These most likely correspond to memoization nodes that were already removed during binding\n        //       See https://github.com/SteveSanderson/knockout/pull/440\n        //   [B] We want to output a contiguous series of nodes that are still in the document. So, ignore any nodes that\n        //       have already been removed, and include any nodes that have been inserted among the previous collection\n\n        // Rule [A]\n        while (contiguousNodeArray.length && !ko.utils.domNodeIsAttachedToDocument(contiguousNodeArray[0]))\n            contiguousNodeArray.splice(0, 1);\n\n        // Rule [B]\n        if (contiguousNodeArray.length > 1) {\n            // Build up the actual new contiguous node set\n            var current = contiguousNodeArray[0], last = contiguousNodeArray[contiguousNodeArray.length - 1], newContiguousSet = [current];\n            while (current !== last) {\n                current = current.nextSibling;\n                if (!current) // Won't happen, except if the developer has manually removed some DOM elements (then we're in an undefined scenario)\n                    return;\n                newContiguousSet.push(current);\n            }\n\n            // ... then mutate the input array to match this.\n            // (The following line replaces the contents of contiguousNodeArray with newContiguousSet)\n            Array.prototype.splice.apply(contiguousNodeArray, [0, contiguousNodeArray.length].concat(newContiguousSet));\n        }\n        return contiguousNodeArray;\n    }\n\n    function mapNodeAndRefreshWhenChanged(containerNode, mapping, valueToMap, callbackAfterAddingNodes, index) {\n        // Map this array value inside a dependentObservable so we re-map when any dependency changes\n        var mappedNodes = [];\n        var dependentObservable = ko.dependentObservable(function() {\n            var newMappedNodes = mapping(valueToMap, index) || [];\n\n            // On subsequent evaluations, just replace the previously-inserted DOM nodes\n            if (mappedNodes.length > 0) {\n                ko.utils.replaceDomNodes(fixUpNodesToBeMovedOrRemoved(mappedNodes), newMappedNodes);\n                if (callbackAfterAddingNodes)\n                    ko.dependencyDetection.ignore(callbackAfterAddingNodes, null, [valueToMap, newMappedNodes, index]);\n            }\n\n            // Replace the contents of the mappedNodes array, thereby updating the record\n            // of which nodes would be deleted if valueToMap was itself later removed\n            mappedNodes.splice(0, mappedNodes.length);\n            ko.utils.arrayPushAll(mappedNodes, newMappedNodes);\n        }, null, { disposeWhenNodeIsRemoved: containerNode, disposeWhen: function() { return (mappedNodes.length == 0) || !ko.utils.domNodeIsAttachedToDocument(mappedNodes[0]) } });\n        return { mappedNodes : mappedNodes, dependentObservable : (dependentObservable.isActive() ? dependentObservable : undefined) };\n    }\n\n    var lastMappingResultDomDataKey = \"setDomNodeChildrenFromArrayMapping_lastMappingResult\";\n\n    ko.utils.setDomNodeChildrenFromArrayMapping = function (domNode, array, mapping, options, callbackAfterAddingNodes) {\n        // Compare the provided array against the previous one\n        array = array || [];\n        options = options || {};\n        var isFirstExecution = ko.utils.domData.get(domNode, lastMappingResultDomDataKey) === undefined;\n        var lastMappingResult = ko.utils.domData.get(domNode, lastMappingResultDomDataKey) || [];\n        var lastArray = ko.utils.arrayMap(lastMappingResult, function (x) { return x.arrayEntry; });\n        var editScript = ko.utils.compareArrays(lastArray, array);\n\n        // Build the new mapping result\n        var newMappingResult = [];\n        var lastMappingResultIndex = 0;\n        var newMappingResultIndex = 0;\n\n        var nodesToDelete = [];\n        var itemsToProcess = [];\n        var itemsForBeforeRemoveCallbacks = [];\n        var itemsForMoveCallbacks = [];\n        var itemsForAfterAddCallbacks = [];\n        var mapData;\n\n        function itemMovedOrRetained(editScriptIndex, oldPosition) {\n            mapData = lastMappingResult[oldPosition];\n            if (newMappingResultIndex !== oldPosition)\n                itemsForMoveCallbacks[editScriptIndex] = mapData;\n            // Since updating the index might change the nodes, do so before calling fixUpNodesToBeMovedOrRemoved\n            mapData.indexObservable(newMappingResultIndex++);\n            fixUpNodesToBeMovedOrRemoved(mapData.mappedNodes);\n            newMappingResult.push(mapData);\n            itemsToProcess.push(mapData);\n        }\n\n        function callCallback(callback, items) {\n            if (callback) {\n                for (var i = 0, n = items.length; i < n; i++) {\n                    if (items[i]) {\n                        ko.utils.arrayForEach(items[i].mappedNodes, function(node) {\n                            callback(node, i, items[i].arrayEntry);\n                        });\n                    }\n                }\n            }\n        }\n\n        for (var i = 0, editScriptItem, movedIndex; editScriptItem = editScript[i]; i++) {\n            movedIndex = editScriptItem['moved'];\n            switch (editScriptItem['status']) {\n                case \"deleted\":\n                    if (movedIndex === undefined) {\n                        mapData = lastMappingResult[lastMappingResultIndex];\n\n                        // Stop tracking changes to the mapping for these nodes\n                        if (mapData.dependentObservable)\n                            mapData.dependentObservable.dispose();\n\n                        // Queue these nodes for later removal\n                        nodesToDelete.push.apply(nodesToDelete, fixUpNodesToBeMovedOrRemoved(mapData.mappedNodes));\n                        if (options['beforeRemove']) {\n                            itemsForBeforeRemoveCallbacks[i] = mapData;\n                            itemsToProcess.push(mapData);\n                        }\n                    }\n                    lastMappingResultIndex++;\n                    break;\n\n                case \"retained\":\n                    itemMovedOrRetained(i, lastMappingResultIndex++);\n                    break;\n\n                case \"added\":\n                    if (movedIndex !== undefined) {\n                        itemMovedOrRetained(i, movedIndex);\n                    } else {\n                        mapData = { arrayEntry: editScriptItem['value'], indexObservable: ko.observable(newMappingResultIndex++) };\n                        newMappingResult.push(mapData);\n                        itemsToProcess.push(mapData);\n                        if (!isFirstExecution)\n                            itemsForAfterAddCallbacks[i] = mapData;\n                    }\n                    break;\n            }\n        }\n\n        // Call beforeMove first before any changes have been made to the DOM\n        callCallback(options['beforeMove'], itemsForMoveCallbacks);\n\n        // Next remove nodes for deleted items (or just clean if there's a beforeRemove callback)\n        ko.utils.arrayForEach(nodesToDelete, options['beforeRemove'] ? ko.cleanNode : ko.removeNode);\n\n        // Next add/reorder the remaining items (will include deleted items if there's a beforeRemove callback)\n        for (var i = 0, nextNode = ko.virtualElements.firstChild(domNode), lastNode, node; mapData = itemsToProcess[i]; i++) {\n            // Get nodes for newly added items\n            if (!mapData.mappedNodes)\n                ko.utils.extend(mapData, mapNodeAndRefreshWhenChanged(domNode, mapping, mapData.arrayEntry, callbackAfterAddingNodes, mapData.indexObservable));\n\n            // Put nodes in the right place if they aren't there already\n            for (var j = 0; node = mapData.mappedNodes[j]; nextNode = node.nextSibling, lastNode = node, j++) {\n                if (node !== nextNode)\n                    ko.virtualElements.insertAfter(domNode, node, lastNode);\n            }\n\n            // Run the callbacks for newly added nodes (for example, to apply bindings, etc.)\n            if (!mapData.initialized && callbackAfterAddingNodes) {\n                callbackAfterAddingNodes(mapData.arrayEntry, mapData.mappedNodes, mapData.indexObservable);\n                mapData.initialized = true;\n            }\n        }\n\n        // If there's a beforeRemove callback, call it after reordering.\n        // Note that we assume that the beforeRemove callback will usually be used to remove the nodes using\n        // some sort of animation, which is why we first reorder the nodes that will be removed. If the\n        // callback instead removes the nodes right away, it would be more efficient to skip reordering them.\n        // Perhaps we'll make that change in the future if this scenario becomes more common.\n        callCallback(options['beforeRemove'], itemsForBeforeRemoveCallbacks);\n\n        // Finally call afterMove and afterAdd callbacks\n        callCallback(options['afterMove'], itemsForMoveCallbacks);\n        callCallback(options['afterAdd'], itemsForAfterAddCallbacks);\n\n        // Store a copy of the array items we just considered so we can difference it next time\n        ko.utils.domData.set(domNode, lastMappingResultDomDataKey, newMappingResult);\n    }\n})();\n\nko.exportSymbol('utils.setDomNodeChildrenFromArrayMapping', ko.utils.setDomNodeChildrenFromArrayMapping);\nko.nativeTemplateEngine = function () {\n    this['allowTemplateRewriting'] = false;\n}\n\nko.nativeTemplateEngine.prototype = new ko.templateEngine();\nko.nativeTemplateEngine.prototype['renderTemplateSource'] = function (templateSource, bindingContext, options) {\n    var useNodesIfAvailable = !(ko.utils.ieVersion < 9), // IE<9 cloneNode doesn't work properly\n        templateNodesFunc = useNodesIfAvailable ? templateSource['nodes'] : null,\n        templateNodes = templateNodesFunc ? templateSource['nodes']() : null;\n\n    if (templateNodes) {\n        return ko.utils.makeArray(templateNodes.cloneNode(true).childNodes);\n    } else {\n        var templateText = templateSource['text']();\n        return ko.utils.parseHtmlFragment(templateText);\n    }\n};\n\nko.nativeTemplateEngine.instance = new ko.nativeTemplateEngine();\nko.setTemplateEngine(ko.nativeTemplateEngine.instance);\n\nko.exportSymbol('nativeTemplateEngine', ko.nativeTemplateEngine);\n(function() {\n    ko.jqueryTmplTemplateEngine = function () {\n        // Detect which version of jquery-tmpl you're using. Unfortunately jquery-tmpl\n        // doesn't expose a version number, so we have to infer it.\n        // Note that as of Knockout 1.3, we only support jQuery.tmpl 1.0.0pre and later,\n        // which KO internally refers to as version \"2\", so older versions are no longer detected.\n        var jQueryTmplVersion = this.jQueryTmplVersion = (function() {\n            if ((typeof(jQuery) == \"undefined\") || !(jQuery['tmpl']))\n                return 0;\n            // Since it exposes no official version number, we use our own numbering system. To be updated as jquery-tmpl evolves.\n            try {\n                if (jQuery['tmpl']['tag']['tmpl']['open'].toString().indexOf('__') >= 0) {\n                    // Since 1.0.0pre, custom tags should append markup to an array called \"__\"\n                    return 2; // Final version of jquery.tmpl\n                }\n            } catch(ex) { /* Apparently not the version we were looking for */ }\n\n            return 1; // Any older version that we don't support\n        })();\n\n        function ensureHasReferencedJQueryTemplates() {\n            if (jQueryTmplVersion < 2)\n                throw new Error(\"Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.\");\n        }\n\n        function executeTemplate(compiledTemplate, data, jQueryTemplateOptions) {\n            return jQuery['tmpl'](compiledTemplate, data, jQueryTemplateOptions);\n        }\n\n        this['renderTemplateSource'] = function(templateSource, bindingContext, options) {\n            options = options || {};\n            ensureHasReferencedJQueryTemplates();\n\n            // Ensure we have stored a precompiled version of this template (don't want to reparse on every render)\n            var precompiled = templateSource['data']('precompiled');\n            if (!precompiled) {\n                var templateText = templateSource['text']() || \"\";\n                // Wrap in \"with($whatever.koBindingContext) { ... }\"\n                templateText = \"{{ko_with $item.koBindingContext}}\" + templateText + \"{{/ko_with}}\";\n\n                precompiled = jQuery['template'](null, templateText);\n                templateSource['data']('precompiled', precompiled);\n            }\n\n            var data = [bindingContext['$data']]; // Prewrap the data in an array to stop jquery.tmpl from trying to unwrap any arrays\n            var jQueryTemplateOptions = jQuery['extend']({ 'koBindingContext': bindingContext }, options['templateOptions']);\n\n            var resultNodes = executeTemplate(precompiled, data, jQueryTemplateOptions);\n            resultNodes['appendTo'](document.createElement(\"div\")); // Using \"appendTo\" forces jQuery/jQuery.tmpl to perform necessary cleanup work\n\n            jQuery['fragments'] = {}; // Clear jQuery's fragment cache to avoid a memory leak after a large number of template renders\n            return resultNodes;\n        };\n\n        this['createJavaScriptEvaluatorBlock'] = function(script) {\n            return \"{{ko_code ((function() { return \" + script + \" })()) }}\";\n        };\n\n        this['addTemplate'] = function(templateName, templateMarkup) {\n            document.write(\"<script type='text/html' id='\" + templateName + \"'>\" + templateMarkup + \"</script>\");\n        };\n\n        if (jQueryTmplVersion > 0) {\n            jQuery['tmpl']['tag']['ko_code'] = {\n                open: \"__.push($1 || '');\"\n            };\n            jQuery['tmpl']['tag']['ko_with'] = {\n                open: \"with($1) {\",\n                close: \"} \"\n            };\n        }\n    };\n\n    ko.jqueryTmplTemplateEngine.prototype = new ko.templateEngine();\n\n    // Use this one by default *only if jquery.tmpl is referenced*\n    var jqueryTmplTemplateEngineInstance = new ko.jqueryTmplTemplateEngine();\n    if (jqueryTmplTemplateEngineInstance.jQueryTmplVersion > 0)\n        ko.setTemplateEngine(jqueryTmplTemplateEngineInstance);\n\n    ko.exportSymbol('jqueryTmplTemplateEngine', ko.jqueryTmplTemplateEngine);\n})();\n});\n})(window,document,navigator,window[\"jQuery\"]);\n})();\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Scripts/knockout-2.2.0.js",
    "content": "// Knockout JavaScript library v2.2.0\n// (c) Steven Sanderson - http://knockoutjs.com/\n// License: MIT (http://www.opensource.org/licenses/mit-license.php)\n\n(function() {function i(v){throw v;}var l=!0,n=null,q=!1;function t(v){return function(){return v}};var w=window,x=document,fa=navigator,E=window.jQuery,H=void 0;\nfunction K(v){function ga(a,d,c,e,f){var g=[],a=b.j(function(){var a=d(c,f)||[];0<g.length&&(b.a.Xa(L(g),a),e&&b.r.K(e,n,[c,a,f]));g.splice(0,g.length);b.a.P(g,a)},n,{W:a,Ja:function(){return 0==g.length||!b.a.X(g[0])}});return{M:g,j:a.oa()?a:H}}function L(a){for(;a.length&&!b.a.X(a[0]);)a.splice(0,1);if(1<a.length){for(var d=a[0],c=a[a.length-1],e=[d];d!==c;){d=d.nextSibling;if(!d)return;e.push(d)}Array.prototype.splice.apply(a,[0,a.length].concat(e))}return a}function R(a,b,c,e,f){var g=Math.min,\nh=Math.max,j=[],k,m=a.length,p,r=b.length,u=r-m||1,F=m+r+1,I,z,y;for(k=0;k<=m;k++){z=I;j.push(I=[]);y=g(r,k+u);for(p=h(0,k-1);p<=y;p++)I[p]=p?k?a[k-1]===b[p-1]?z[p-1]:g(z[p]||F,I[p-1]||F)+1:p+1:k+1}g=[];h=[];u=[];k=m;for(p=r;k||p;)r=j[k][p]-1,p&&r===j[k][p-1]?h.push(g[g.length]={status:c,value:b[--p],index:p}):k&&r===j[k-1][p]?u.push(g[g.length]={status:e,value:a[--k],index:k}):(g.push({status:\"retained\",value:b[--p]}),--k);if(h.length&&u.length)for(var a=10*m,s,b=c=0;(f||b<a)&&(s=h[c]);c++){for(e=\n0;j=u[e];e++)if(s.value===j.value){s.moved=j.index;j.moved=s.index;u.splice(e,1);b=e=0;break}b+=e}return g.reverse()}function S(a,d,c,e,f){var f=f||{},g=a&&M(a),g=g&&g.ownerDocument,h=f.templateEngine||N;b.ya.ub(c,h,g);c=h.renderTemplate(c,e,f,g);(\"number\"!=typeof c.length||0<c.length&&\"number\"!=typeof c[0].nodeType)&&i(Error(\"Template engine must return an array of DOM nodes\"));g=q;switch(d){case \"replaceChildren\":b.e.N(a,c);g=l;break;case \"replaceNode\":b.a.Xa(a,c);g=l;break;case \"ignoreTargetNode\":break;\ndefault:i(Error(\"Unknown renderMode: \"+d))}g&&(T(c,e),f.afterRender&&b.r.K(f.afterRender,n,[c,e.$data]));return c}function M(a){return a.nodeType?a:0<a.length?a[0]:n}function T(a,d){if(a.length){var c=a[0],e=a[a.length-1];U(c,e,function(a){b.Ca(d,a)});U(c,e,function(a){b.s.hb(a,[d])})}}function U(a,d,c){for(var e,d=b.e.nextSibling(d);a&&(e=a)!==d;)a=b.e.nextSibling(e),(1===e.nodeType||8===e.nodeType)&&c(e)}function V(a,d,c){for(var a=b.g.aa(a),e=b.g.Q,f=0;f<a.length;f++){var g=a[f].key;if(e.hasOwnProperty(g)){var h=\ne[g];\"function\"===typeof h?(g=h(a[f].value))&&i(Error(g)):h||i(Error(\"This template engine does not support the '\"+g+\"' binding within its templates\"))}}a=\"ko.__tr_ambtns(function($context,$element){return(function(){return{ \"+b.g.ba(a)+\" } })()})\";return c.createJavaScriptEvaluatorBlock(a)+d}function W(a,d,c,e){function f(a){return function(){return j[a]}}function g(){return j}var h=0,j,k;b.j(function(){var m=c&&c instanceof b.z?c:new b.z(b.a.d(c)),p=m.$data;e&&b.cb(a,m);if(j=(\"function\"==typeof d?\nd(m,a):d)||b.J.instance.getBindings(a,m)){if(0===h){h=1;for(var r in j){var u=b.c[r];u&&8===a.nodeType&&!b.e.I[r]&&i(Error(\"The binding '\"+r+\"' cannot be used with virtual elements\"));if(u&&\"function\"==typeof u.init&&(u=(0,u.init)(a,f(r),g,p,m))&&u.controlsDescendantBindings)k!==H&&i(Error(\"Multiple bindings (\"+k+\" and \"+r+\") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.\")),k=r}h=2}if(2===h)for(r in j)(u=b.c[r])&&\"function\"==\ntypeof u.update&&(0,u.update)(a,f(r),g,p,m)}},n,{W:a});return{Mb:k===H}}function X(a,d,c){var e=l,f=1===d.nodeType;f&&b.e.Sa(d);if(f&&c||b.J.instance.nodeHasBindings(d))e=W(d,n,a,c).Mb;e&&Y(a,d,!f)}function Y(a,d,c){for(var e=b.e.firstChild(d);d=e;)e=b.e.nextSibling(d),X(a,d,c)}function Z(a,b){var c=$(a,b);return c?0<c.length?c[c.length-1].nextSibling:a.nextSibling:n}function $(a,b){for(var c=a,e=1,f=[];c=c.nextSibling;){if(G(c)&&(e--,0===e))return f;f.push(c);A(c)&&e++}b||i(Error(\"Cannot find closing comment tag to match: \"+\na.nodeValue));return n}function G(a){return 8==a.nodeType&&(J?a.text:a.nodeValue).match(ha)}function A(a){return 8==a.nodeType&&(J?a.text:a.nodeValue).match(ia)}function O(a,b){for(var c=n;a!=c;)c=a,a=a.replace(ja,function(a,c){return b[c]});return a}function ka(){var a=[],d=[];this.save=function(c,e){var f=b.a.i(a,c);0<=f?d[f]=e:(a.push(c),d.push(e))};this.get=function(c){c=b.a.i(a,c);return 0<=c?d[c]:H}}function aa(a,b,c){function e(e){var g=b(a[e]);switch(typeof g){case \"boolean\":case \"number\":case \"string\":case \"function\":f[e]=\ng;break;case \"object\":case \"undefined\":var h=c.get(g);f[e]=h!==H?h:aa(g,b,c)}}c=c||new ka;a=b(a);if(!(\"object\"==typeof a&&a!==n&&a!==H&&!(a instanceof Date)))return a;var f=a instanceof Array?[]:{};c.save(a,f);var g=a;if(g instanceof Array){for(var h=0;h<g.length;h++)e(h);\"function\"==typeof g.toJSON&&e(\"toJSON\")}else for(h in g)e(h);return f}function ba(a,d){if(a)if(8==a.nodeType){var c=b.s.Ta(a.nodeValue);c!=n&&d.push({rb:a,Eb:c})}else if(1==a.nodeType)for(var c=0,e=a.childNodes,f=e.length;c<f;c++)ba(e[c],\nd)}function P(a,d,c,e){b.c[a]={init:function(a){b.a.f.set(a,ca,{});return{controlsDescendantBindings:l}},update:function(a,g,h,j,k){var h=b.a.f.get(a,ca),g=b.a.d(g()),j=!c!==!g,m=!h.Ya;if(m||d||j!==h.pb)m&&(h.Ya=b.a.Ha(b.e.childNodes(a),l)),j?(m||b.e.N(a,b.a.Ha(h.Ya)),b.Da(e?e(k,g):k,a)):b.e.Y(a),h.pb=j}};b.g.Q[a]=q;b.e.I[a]=l}function da(a,d,c){c&&d!==b.k.q(a)&&b.k.T(a,d);d!==b.k.q(a)&&b.r.K(b.a.Aa,n,[a,\"change\"])}var b=\"undefined\"!==typeof v?v:{};b.b=function(a,d){for(var c=a.split(\".\"),e=b,f=0;f<\nc.length-1;f++)e=e[c[f]];e[c[c.length-1]]=d};b.p=function(a,b,c){a[b]=c};b.version=\"2.2.0\";b.b(\"version\",b.version);b.a=new function(){function a(a,d){if(\"input\"!==b.a.u(a)||!a.type||\"click\"!=d.toLowerCase())return q;var c=a.type;return\"checkbox\"==c||\"radio\"==c}var d=/^(\\s|\\u00A0)+|(\\s|\\u00A0)+$/g,c={},e={};c[/Firefox\\/2/i.test(fa.userAgent)?\"KeyboardEvent\":\"UIEvents\"]=[\"keyup\",\"keydown\",\"keypress\"];c.MouseEvents=\"click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave\".split(\" \");\nfor(var f in c){var g=c[f];if(g.length)for(var h=0,j=g.length;h<j;h++)e[g[h]]=f}var k={propertychange:l},m,c=3;f=x.createElement(\"div\");for(g=f.getElementsByTagName(\"i\");f.innerHTML=\"<\\!--[if gt IE \"+ ++c+\"]><i></i><![endif]--\\>\",g[0];);m=4<c?c:H;return{Ma:[\"authenticity_token\",/^__RequestVerificationToken(_.*)?$/],o:function(a,b){for(var d=0,c=a.length;d<c;d++)b(a[d])},i:function(a,b){if(\"function\"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(a,b);for(var d=0,c=a.length;d<\nc;d++)if(a[d]===b)return d;return-1},kb:function(a,b,d){for(var c=0,e=a.length;c<e;c++)if(b.call(d,a[c]))return a[c];return n},ga:function(a,d){var c=b.a.i(a,d);0<=c&&a.splice(c,1)},Fa:function(a){for(var a=a||[],d=[],c=0,e=a.length;c<e;c++)0>b.a.i(d,a[c])&&d.push(a[c]);return d},V:function(a,b){for(var a=a||[],d=[],c=0,e=a.length;c<e;c++)d.push(b(a[c]));return d},fa:function(a,b){for(var a=a||[],d=[],c=0,e=a.length;c<e;c++)b(a[c])&&d.push(a[c]);return d},P:function(a,b){if(b instanceof Array)a.push.apply(a,\nb);else for(var d=0,c=b.length;d<c;d++)a.push(b[d]);return a},extend:function(a,b){if(b)for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);return a},ka:function(a){for(;a.firstChild;)b.removeNode(a.firstChild)},Gb:function(a){for(var a=b.a.L(a),d=x.createElement(\"div\"),c=0,e=a.length;c<e;c++)d.appendChild(b.A(a[c]));return d},Ha:function(a,d){for(var c=0,e=a.length,g=[];c<e;c++){var f=a[c].cloneNode(l);g.push(d?b.A(f):f)}return g},N:function(a,d){b.a.ka(a);if(d)for(var c=0,e=d.length;c<e;c++)a.appendChild(d[c])},\nXa:function(a,d){var c=a.nodeType?[a]:a;if(0<c.length){for(var e=c[0],g=e.parentNode,f=0,h=d.length;f<h;f++)g.insertBefore(d[f],e);f=0;for(h=c.length;f<h;f++)b.removeNode(c[f])}},ab:function(a,b){7>m?a.setAttribute(\"selected\",b):a.selected=b},D:function(a){return(a||\"\").replace(d,\"\")},Qb:function(a,d){for(var c=[],e=(a||\"\").split(d),f=0,g=e.length;f<g;f++){var h=b.a.D(e[f]);\"\"!==h&&c.push(h)}return c},Nb:function(a,b){a=a||\"\";return b.length>a.length?q:a.substring(0,b.length)===b},sb:function(a,b){if(b.compareDocumentPosition)return 16==\n(b.compareDocumentPosition(a)&16);for(;a!=n;){if(a==b)return l;a=a.parentNode}return q},X:function(a){return b.a.sb(a,a.ownerDocument)},u:function(a){return a&&a.tagName&&a.tagName.toLowerCase()},n:function(b,d,c){var e=m&&k[d];if(!e&&\"undefined\"!=typeof E){if(a(b,d))var f=c,c=function(a,b){var d=this.checked;b&&(this.checked=b.mb!==l);f.call(this,a);this.checked=d};E(b).bind(d,c)}else!e&&\"function\"==typeof b.addEventListener?b.addEventListener(d,c,q):\"undefined\"!=typeof b.attachEvent?b.attachEvent(\"on\"+\nd,function(a){c.call(b,a)}):i(Error(\"Browser doesn't support addEventListener or attachEvent\"))},Aa:function(b,d){(!b||!b.nodeType)&&i(Error(\"element must be a DOM node when calling triggerEvent\"));if(\"undefined\"!=typeof E){var c=[];a(b,d)&&c.push({mb:b.checked});E(b).trigger(d,c)}else\"function\"==typeof x.createEvent?\"function\"==typeof b.dispatchEvent?(c=x.createEvent(e[d]||\"HTMLEvents\"),c.initEvent(d,l,l,w,0,0,0,0,0,q,q,q,q,0,b),b.dispatchEvent(c)):i(Error(\"The supplied element doesn't support dispatchEvent\")):\n\"undefined\"!=typeof b.fireEvent?(a(b,d)&&(b.checked=b.checked!==l),b.fireEvent(\"on\"+d)):i(Error(\"Browser doesn't support triggering events\"))},d:function(a){return b.$(a)?a():a},ta:function(a){return b.$(a)?a.t():a},da:function(a,d,c){if(d){var e=/[\\w-]+/g,f=a.className.match(e)||[];b.a.o(d.match(e),function(a){var d=b.a.i(f,a);0<=d?c||f.splice(d,1):c&&f.push(a)});a.className=f.join(\" \")}},bb:function(a,d){var c=b.a.d(d);if(c===n||c===H)c=\"\";if(3===a.nodeType)a.data=c;else{var e=b.e.firstChild(a);\n!e||3!=e.nodeType||b.e.nextSibling(e)?b.e.N(a,[x.createTextNode(c)]):e.data=c;b.a.vb(a)}},$a:function(a,b){a.name=b;if(7>=m)try{a.mergeAttributes(x.createElement(\"<input name='\"+a.name+\"'/>\"),q)}catch(d){}},vb:function(a){9<=m&&(a=1==a.nodeType?a:a.parentNode,a.style&&(a.style.zoom=a.style.zoom))},tb:function(a){if(9<=m){var b=a.style.width;a.style.width=0;a.style.width=b}},Kb:function(a,d){for(var a=b.a.d(a),d=b.a.d(d),c=[],e=a;e<=d;e++)c.push(e);return c},L:function(a){for(var b=[],d=0,c=a.length;d<\nc;d++)b.push(a[d]);return b},Ob:6===m,Pb:7===m,Z:m,Na:function(a,d){for(var c=b.a.L(a.getElementsByTagName(\"input\")).concat(b.a.L(a.getElementsByTagName(\"textarea\"))),e=\"string\"==typeof d?function(a){return a.name===d}:function(a){return d.test(a.name)},f=[],g=c.length-1;0<=g;g--)e(c[g])&&f.push(c[g]);return f},Hb:function(a){return\"string\"==typeof a&&(a=b.a.D(a))?w.JSON&&w.JSON.parse?w.JSON.parse(a):(new Function(\"return \"+a))():n},wa:function(a,d,c){(\"undefined\"==typeof JSON||\"undefined\"==typeof JSON.stringify)&&\ni(Error(\"Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js\"));return JSON.stringify(b.a.d(a),d,c)},Ib:function(a,d,c){var c=c||{},e=c.params||{},f=c.includeFields||this.Ma,g=a;if(\"object\"==typeof a&&\"form\"===b.a.u(a))for(var g=a.action,h=f.length-1;0<=h;h--)for(var j=b.a.Na(a,f[h]),k=j.length-1;0<=k;k--)e[j[k].name]=j[k].value;var d=b.a.d(d),m=x.createElement(\"form\");\nm.style.display=\"none\";m.action=g;m.method=\"post\";for(var v in d)a=x.createElement(\"input\"),a.name=v,a.value=b.a.wa(b.a.d(d[v])),m.appendChild(a);for(v in e)a=x.createElement(\"input\"),a.name=v,a.value=e[v],m.appendChild(a);x.body.appendChild(m);c.submitter?c.submitter(m):m.submit();setTimeout(function(){m.parentNode.removeChild(m)},0)}}};b.b(\"utils\",b.a);b.b(\"utils.arrayForEach\",b.a.o);b.b(\"utils.arrayFirst\",b.a.kb);b.b(\"utils.arrayFilter\",b.a.fa);b.b(\"utils.arrayGetDistinctValues\",b.a.Fa);b.b(\"utils.arrayIndexOf\",\nb.a.i);b.b(\"utils.arrayMap\",b.a.V);b.b(\"utils.arrayPushAll\",b.a.P);b.b(\"utils.arrayRemoveItem\",b.a.ga);b.b(\"utils.extend\",b.a.extend);b.b(\"utils.fieldsIncludedWithJsonPost\",b.a.Ma);b.b(\"utils.getFormFields\",b.a.Na);b.b(\"utils.peekObservable\",b.a.ta);b.b(\"utils.postJson\",b.a.Ib);b.b(\"utils.parseJson\",b.a.Hb);b.b(\"utils.registerEventHandler\",b.a.n);b.b(\"utils.stringifyJson\",b.a.wa);b.b(\"utils.range\",b.a.Kb);b.b(\"utils.toggleDomNodeCssClass\",b.a.da);b.b(\"utils.triggerEvent\",b.a.Aa);b.b(\"utils.unwrapObservable\",\nb.a.d);Function.prototype.bind||(Function.prototype.bind=function(a){var b=this,c=Array.prototype.slice.call(arguments),a=c.shift();return function(){return b.apply(a,c.concat(Array.prototype.slice.call(arguments)))}});b.a.f=new function(){var a=0,d=\"__ko__\"+(new Date).getTime(),c={};return{get:function(a,d){var c=b.a.f.getAll(a,q);return c===H?H:c[d]},set:function(a,d,c){c===H&&b.a.f.getAll(a,q)===H||(b.a.f.getAll(a,l)[d]=c)},getAll:function(b,f){var g=b[d];if(!g||!(\"null\"!==g&&c[g])){if(!f)return H;\ng=b[d]=\"ko\"+a++;c[g]={}}return c[g]},clear:function(a){var b=a[d];return b?(delete c[b],a[d]=n,l):q}}};b.b(\"utils.domData\",b.a.f);b.b(\"utils.domData.clear\",b.a.f.clear);b.a.F=new function(){function a(a,d){var e=b.a.f.get(a,c);e===H&&d&&(e=[],b.a.f.set(a,c,e));return e}function d(c){var e=a(c,q);if(e)for(var e=e.slice(0),j=0;j<e.length;j++)e[j](c);b.a.f.clear(c);\"function\"==typeof E&&\"function\"==typeof E.cleanData&&E.cleanData([c]);if(f[c.nodeType])for(e=c.firstChild;c=e;)e=c.nextSibling,8===c.nodeType&&\nd(c)}var c=\"__ko_domNodeDisposal__\"+(new Date).getTime(),e={1:l,8:l,9:l},f={1:l,9:l};return{Ba:function(b,d){\"function\"!=typeof d&&i(Error(\"Callback must be a function\"));a(b,l).push(d)},Wa:function(d,e){var f=a(d,q);f&&(b.a.ga(f,e),0==f.length&&b.a.f.set(d,c,H))},A:function(a){if(e[a.nodeType]&&(d(a),f[a.nodeType])){var c=[];b.a.P(c,a.getElementsByTagName(\"*\"));for(var j=0,k=c.length;j<k;j++)d(c[j])}return a},removeNode:function(a){b.A(a);a.parentNode&&a.parentNode.removeChild(a)}}};b.A=b.a.F.A;\nb.removeNode=b.a.F.removeNode;b.b(\"cleanNode\",b.A);b.b(\"removeNode\",b.removeNode);b.b(\"utils.domNodeDisposal\",b.a.F);b.b(\"utils.domNodeDisposal.addDisposeCallback\",b.a.F.Ba);b.b(\"utils.domNodeDisposal.removeDisposeCallback\",b.a.F.Wa);b.a.sa=function(a){var d;if(\"undefined\"!=typeof E){if((d=E.clean([a]))&&d[0]){for(a=d[0];a.parentNode&&11!==a.parentNode.nodeType;)a=a.parentNode;a.parentNode&&a.parentNode.removeChild(a)}}else{var c=b.a.D(a).toLowerCase();d=x.createElement(\"div\");c=c.match(/^<(thead|tbody|tfoot)/)&&\n[1,\"<table>\",\"</table>\"]||!c.indexOf(\"<tr\")&&[2,\"<table><tbody>\",\"</tbody></table>\"]||(!c.indexOf(\"<td\")||!c.indexOf(\"<th\"))&&[3,\"<table><tbody><tr>\",\"</tr></tbody></table>\"]||[0,\"\",\"\"];a=\"ignored<div>\"+c[1]+a+c[2]+\"</div>\";for(\"function\"==typeof w.innerShiv?d.appendChild(w.innerShiv(a)):d.innerHTML=a;c[0]--;)d=d.lastChild;d=b.a.L(d.lastChild.childNodes)}return d};b.a.ca=function(a,d){b.a.ka(a);d=b.a.d(d);if(d!==n&&d!==H)if(\"string\"!=typeof d&&(d=d.toString()),\"undefined\"!=typeof E)E(a).html(d);else for(var c=\nb.a.sa(d),e=0;e<c.length;e++)a.appendChild(c[e])};b.b(\"utils.parseHtmlFragment\",b.a.sa);b.b(\"utils.setHtml\",b.a.ca);var Q={};b.s={qa:function(a){\"function\"!=typeof a&&i(Error(\"You can only pass a function to ko.memoization.memoize()\"));var b=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);Q[b]=a;return\"<\\!--[ko_memo:\"+b+\"]--\\>\"},gb:function(a,b){var c=Q[a];c===H&&i(Error(\"Couldn't find any memo with ID \"+a+\". Perhaps it's already been unmemoized.\"));\ntry{return c.apply(n,b||[]),l}finally{delete Q[a]}},hb:function(a,d){var c=[];ba(a,c);for(var e=0,f=c.length;e<f;e++){var g=c[e].rb,h=[g];d&&b.a.P(h,d);b.s.gb(c[e].Eb,h);g.nodeValue=\"\";g.parentNode&&g.parentNode.removeChild(g)}},Ta:function(a){return(a=a.match(/^\\[ko_memo\\:(.*?)\\]$/))?a[1]:n}};b.b(\"memoization\",b.s);b.b(\"memoization.memoize\",b.s.qa);b.b(\"memoization.unmemoize\",b.s.gb);b.b(\"memoization.parseMemoText\",b.s.Ta);b.b(\"memoization.unmemoizeDomNodeAndDescendants\",b.s.hb);b.La={throttle:function(a,\nd){a.throttleEvaluation=d;var c=n;return b.j({read:a,write:function(b){clearTimeout(c);c=setTimeout(function(){a(b)},d)}})},notify:function(a,d){a.equalityComparer=\"always\"==d?t(q):b.m.fn.equalityComparer;return a}};b.b(\"extenders\",b.La);b.eb=function(a,d,c){this.target=a;this.ha=d;this.qb=c;b.p(this,\"dispose\",this.B)};b.eb.prototype.B=function(){this.Bb=l;this.qb()};b.S=function(){this.w={};b.a.extend(this,b.S.fn);b.p(this,\"subscribe\",this.xa);b.p(this,\"extend\",this.extend);b.p(this,\"getSubscriptionsCount\",\nthis.xb)};b.S.fn={xa:function(a,d,c){var c=c||\"change\",a=d?a.bind(d):a,e=new b.eb(this,a,function(){b.a.ga(this.w[c],e)}.bind(this));this.w[c]||(this.w[c]=[]);this.w[c].push(e);return e},notifySubscribers:function(a,d){d=d||\"change\";this.w[d]&&b.r.K(function(){b.a.o(this.w[d].slice(0),function(b){b&&b.Bb!==l&&b.ha(a)})},this)},xb:function(){var a=0,b;for(b in this.w)this.w.hasOwnProperty(b)&&(a+=this.w[b].length);return a},extend:function(a){var d=this;if(a)for(var c in a){var e=b.La[c];\"function\"==\ntypeof e&&(d=e(d,a[c]))}return d}};b.Pa=function(a){return\"function\"==typeof a.xa&&\"function\"==typeof a.notifySubscribers};b.b(\"subscribable\",b.S);b.b(\"isSubscribable\",b.Pa);var B=[];b.r={lb:function(a){B.push({ha:a,Ka:[]})},end:function(){B.pop()},Va:function(a){b.Pa(a)||i(Error(\"Only subscribable things can act as dependencies\"));if(0<B.length){var d=B[B.length-1];d&&!(0<=b.a.i(d.Ka,a))&&(d.Ka.push(a),d.ha(a))}},K:function(a,b,c){try{return B.push(n),a.apply(b,c||[])}finally{B.pop()}}};var la={undefined:l,\n\"boolean\":l,number:l,string:l};b.m=function(a){function d(){if(0<arguments.length){if(!d.equalityComparer||!d.equalityComparer(c,arguments[0]))d.H(),c=arguments[0],d.G();return this}b.r.Va(d);return c}var c=a;b.S.call(d);d.t=function(){return c};d.G=function(){d.notifySubscribers(c)};d.H=function(){d.notifySubscribers(c,\"beforeChange\")};b.a.extend(d,b.m.fn);b.p(d,\"peek\",d.t);b.p(d,\"valueHasMutated\",d.G);b.p(d,\"valueWillMutate\",d.H);return d};b.m.fn={equalityComparer:function(a,b){return a===n||typeof a in\nla?a===b:q}};var D=b.m.Jb=\"__ko_proto__\";b.m.fn[D]=b.m;b.la=function(a,d){return a===n||a===H||a[D]===H?q:a[D]===d?l:b.la(a[D],d)};b.$=function(a){return b.la(a,b.m)};b.Qa=function(a){return\"function\"==typeof a&&a[D]===b.m||\"function\"==typeof a&&a[D]===b.j&&a.yb?l:q};b.b(\"observable\",b.m);b.b(\"isObservable\",b.$);b.b(\"isWriteableObservable\",b.Qa);b.R=function(a){0==arguments.length&&(a=[]);a!==n&&(a!==H&&!(\"length\"in a))&&i(Error(\"The argument passed when initializing an observable array must be an array, or null, or undefined.\"));\nvar d=b.m(a);b.a.extend(d,b.R.fn);return d};b.R.fn={remove:function(a){for(var b=this.t(),c=[],e=\"function\"==typeof a?a:function(b){return b===a},f=0;f<b.length;f++){var g=b[f];e(g)&&(0===c.length&&this.H(),c.push(g),b.splice(f,1),f--)}c.length&&this.G();return c},removeAll:function(a){if(a===H){var d=this.t(),c=d.slice(0);this.H();d.splice(0,d.length);this.G();return c}return!a?[]:this.remove(function(d){return 0<=b.a.i(a,d)})},destroy:function(a){var b=this.t(),c=\"function\"==typeof a?a:function(b){return b===\na};this.H();for(var e=b.length-1;0<=e;e--)c(b[e])&&(b[e]._destroy=l);this.G()},destroyAll:function(a){return a===H?this.destroy(t(l)):!a?[]:this.destroy(function(d){return 0<=b.a.i(a,d)})},indexOf:function(a){var d=this();return b.a.i(d,a)},replace:function(a,b){var c=this.indexOf(a);0<=c&&(this.H(),this.t()[c]=b,this.G())}};b.a.o(\"pop push reverse shift sort splice unshift\".split(\" \"),function(a){b.R.fn[a]=function(){var b=this.t();this.H();b=b[a].apply(b,arguments);this.G();return b}});b.a.o([\"slice\"],\nfunction(a){b.R.fn[a]=function(){var b=this();return b[a].apply(b,arguments)}});b.b(\"observableArray\",b.R);b.j=function(a,d,c){function e(){b.a.o(y,function(a){a.B()});y=[]}function f(){var a=h.throttleEvaluation;a&&0<=a?(clearTimeout(s),s=setTimeout(g,a)):g()}function g(){if(!p)if(m&&v())z();else{p=l;try{var a=b.a.V(y,function(a){return a.target});b.r.lb(function(c){var d;0<=(d=b.a.i(a,c))?a[d]=H:y.push(c.xa(f))});for(var c=r.call(d),e=a.length-1;0<=e;e--)a[e]&&y.splice(e,1)[0].B();m=l;h.notifySubscribers(k,\n\"beforeChange\");k=c}finally{b.r.end()}h.notifySubscribers(k);p=q;y.length||z()}}function h(){if(0<arguments.length)return\"function\"===typeof u?u.apply(d,arguments):i(Error(\"Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.\")),this;m||g();b.r.Va(h);return k}function j(){return!m||0<y.length}var k,m=q,p=q,r=a;r&&\"object\"==typeof r?(c=r,r=c.read):(c=c||{},r||(r=c.read));\"function\"!=typeof r&&i(Error(\"Pass a function that returns the value of the ko.computed\"));\nvar u=c.write,F=c.disposeWhenNodeIsRemoved||c.W||n,v=c.disposeWhen||c.Ja||t(q),z=e,y=[],s=n;d||(d=c.owner);h.t=function(){m||g();return k};h.wb=function(){return y.length};h.yb=\"function\"===typeof c.write;h.B=function(){z()};h.oa=j;b.S.call(h);b.a.extend(h,b.j.fn);b.p(h,\"peek\",h.t);b.p(h,\"dispose\",h.B);b.p(h,\"isActive\",h.oa);b.p(h,\"getDependenciesCount\",h.wb);c.deferEvaluation!==l&&g();if(F&&j()){z=function(){b.a.F.Wa(F,arguments.callee);e()};b.a.F.Ba(F,z);var C=v,v=function(){return!b.a.X(F)||C()}}return h};\nb.Ab=function(a){return b.la(a,b.j)};v=b.m.Jb;b.j[v]=b.m;b.j.fn={};b.j.fn[v]=b.j;b.b(\"dependentObservable\",b.j);b.b(\"computed\",b.j);b.b(\"isComputed\",b.Ab);b.fb=function(a){0==arguments.length&&i(Error(\"When calling ko.toJS, pass the object you want to convert.\"));return aa(a,function(a){for(var c=0;b.$(a)&&10>c;c++)a=a();return a})};b.toJSON=function(a,d,c){a=b.fb(a);return b.a.wa(a,d,c)};b.b(\"toJS\",b.fb);b.b(\"toJSON\",b.toJSON);b.k={q:function(a){switch(b.a.u(a)){case \"option\":return a.__ko__hasDomDataOptionValue__===\nl?b.a.f.get(a,b.c.options.ra):7>=b.a.Z?a.getAttributeNode(\"value\").specified?a.value:a.text:a.value;case \"select\":return 0<=a.selectedIndex?b.k.q(a.options[a.selectedIndex]):H;default:return a.value}},T:function(a,d){switch(b.a.u(a)){case \"option\":switch(typeof d){case \"string\":b.a.f.set(a,b.c.options.ra,H);\"__ko__hasDomDataOptionValue__\"in a&&delete a.__ko__hasDomDataOptionValue__;a.value=d;break;default:b.a.f.set(a,b.c.options.ra,d),a.__ko__hasDomDataOptionValue__=l,a.value=\"number\"===typeof d?\nd:\"\"}break;case \"select\":for(var c=a.options.length-1;0<=c;c--)if(b.k.q(a.options[c])==d){a.selectedIndex=c;break}break;default:if(d===n||d===H)d=\"\";a.value=d}}};b.b(\"selectExtensions\",b.k);b.b(\"selectExtensions.readValue\",b.k.q);b.b(\"selectExtensions.writeValue\",b.k.T);var ja=/\\@ko_token_(\\d+)\\@/g,ma=[\"true\",\"false\"],na=/^(?:[$_a-z][$\\w]*|(.+)(\\.\\s*[$_a-z][$\\w]*|\\[.+\\]))$/i;b.g={Q:[],aa:function(a){var d=b.a.D(a);if(3>d.length)return[];\"{\"===d.charAt(0)&&(d=d.substring(1,d.length-1));for(var a=[],\nc=n,e,f=0;f<d.length;f++){var g=d.charAt(f);if(c===n)switch(g){case '\"':case \"'\":case \"/\":c=f,e=g}else if(g==e&&\"\\\\\"!==d.charAt(f-1)){g=d.substring(c,f+1);a.push(g);var h=\"@ko_token_\"+(a.length-1)+\"@\",d=d.substring(0,c)+h+d.substring(f+1),f=f-(g.length-h.length),c=n}}e=c=n;for(var j=0,k=n,f=0;f<d.length;f++){g=d.charAt(f);if(c===n)switch(g){case \"{\":c=f;k=g;e=\"}\";break;case \"(\":c=f;k=g;e=\")\";break;case \"[\":c=f,k=g,e=\"]\"}g===k?j++:g===e&&(j--,0===j&&(g=d.substring(c,f+1),a.push(g),h=\"@ko_token_\"+(a.length-\n1)+\"@\",d=d.substring(0,c)+h+d.substring(f+1),f-=g.length-h.length,c=n))}e=[];d=d.split(\",\");c=0;for(f=d.length;c<f;c++)j=d[c],k=j.indexOf(\":\"),0<k&&k<j.length-1?(g=j.substring(k+1),e.push({key:O(j.substring(0,k),a),value:O(g,a)})):e.push({unknown:O(j,a)});return e},ba:function(a){for(var d=\"string\"===typeof a?b.g.aa(a):a,c=[],a=[],e,f=0;e=d[f];f++)if(0<c.length&&c.push(\",\"),e.key){var g;a:{g=e.key;var h=b.a.D(g);switch(h.length&&h.charAt(0)){case \"'\":case '\"':break a;default:g=\"'\"+h+\"'\"}}e=e.value;\nc.push(g);c.push(\":\");c.push(e);e=b.a.D(e);0<=b.a.i(ma,b.a.D(e).toLowerCase())?e=q:(h=e.match(na),e=h===n?q:h[1]?\"Object(\"+h[1]+\")\"+h[2]:e);e&&(0<a.length&&a.push(\", \"),a.push(g+\" : function(__ko_value) { \"+e+\" = __ko_value; }\"))}else e.unknown&&c.push(e.unknown);d=c.join(\"\");0<a.length&&(d=d+\", '_ko_property_writers' : { \"+a.join(\"\")+\" } \");return d},Db:function(a,d){for(var c=0;c<a.length;c++)if(b.a.D(a[c].key)==d)return l;return q},ea:function(a,d,c,e,f){if(!a||!b.Qa(a)){if((a=d()._ko_property_writers)&&\na[c])a[c](e)}else(!f||a.t()!==e)&&a(e)}};b.b(\"expressionRewriting\",b.g);b.b(\"expressionRewriting.bindingRewriteValidators\",b.g.Q);b.b(\"expressionRewriting.parseObjectLiteral\",b.g.aa);b.b(\"expressionRewriting.preProcessBindings\",b.g.ba);b.b(\"jsonExpressionRewriting\",b.g);b.b(\"jsonExpressionRewriting.insertPropertyAccessorsIntoJson\",b.g.ba);var J=\"<\\!--test--\\>\"===x.createComment(\"test\").text,ia=J?/^<\\!--\\s*ko(?:\\s+(.+\\s*\\:[\\s\\S]*))?\\s*--\\>$/:/^\\s*ko(?:\\s+(.+\\s*\\:[\\s\\S]*))?\\s*$/,ha=J?/^<\\!--\\s*\\/ko\\s*--\\>$/:\n/^\\s*\\/ko\\s*$/,oa={ul:l,ol:l};b.e={I:{},childNodes:function(a){return A(a)?$(a):a.childNodes},Y:function(a){if(A(a))for(var a=b.e.childNodes(a),d=0,c=a.length;d<c;d++)b.removeNode(a[d]);else b.a.ka(a)},N:function(a,d){if(A(a)){b.e.Y(a);for(var c=a.nextSibling,e=0,f=d.length;e<f;e++)c.parentNode.insertBefore(d[e],c)}else b.a.N(a,d)},Ua:function(a,b){A(a)?a.parentNode.insertBefore(b,a.nextSibling):a.firstChild?a.insertBefore(b,a.firstChild):a.appendChild(b)},Oa:function(a,d,c){c?A(a)?a.parentNode.insertBefore(d,\nc.nextSibling):c.nextSibling?a.insertBefore(d,c.nextSibling):a.appendChild(d):b.e.Ua(a,d)},firstChild:function(a){return!A(a)?a.firstChild:!a.nextSibling||G(a.nextSibling)?n:a.nextSibling},nextSibling:function(a){A(a)&&(a=Z(a));return a.nextSibling&&G(a.nextSibling)?n:a.nextSibling},ib:function(a){return(a=A(a))?a[1]:n},Sa:function(a){if(oa[b.a.u(a)]){var d=a.firstChild;if(d){do if(1===d.nodeType){var c;c=d.firstChild;var e=n;if(c){do if(e)e.push(c);else if(A(c)){var f=Z(c,l);f?c=f:e=[c]}else G(c)&&\n(e=[c]);while(c=c.nextSibling)}if(c=e){e=d.nextSibling;for(f=0;f<c.length;f++)e?a.insertBefore(c[f],e):a.appendChild(c[f])}}while(d=d.nextSibling)}}}};b.b(\"virtualElements\",b.e);b.b(\"virtualElements.allowedBindings\",b.e.I);b.b(\"virtualElements.emptyNode\",b.e.Y);b.b(\"virtualElements.insertAfter\",b.e.Oa);b.b(\"virtualElements.prepend\",b.e.Ua);b.b(\"virtualElements.setDomNodeChildren\",b.e.N);b.J=function(){this.Ga={}};b.a.extend(b.J.prototype,{nodeHasBindings:function(a){switch(a.nodeType){case 1:return a.getAttribute(\"data-bind\")!=\nn;case 8:return b.e.ib(a)!=n;default:return q}},getBindings:function(a,b){var c=this.getBindingsString(a,b);return c?this.parseBindingsString(c,b,a):n},getBindingsString:function(a){switch(a.nodeType){case 1:return a.getAttribute(\"data-bind\");case 8:return b.e.ib(a);default:return n}},parseBindingsString:function(a,d,c){try{var e;if(!(e=this.Ga[a])){var f=this.Ga,g=\"with($context){with($data||{}){return{\"+b.g.ba(a)+\"}}}\";e=f[a]=new Function(\"$context\",\"$element\",g)}return e(d,c)}catch(h){i(Error(\"Unable to parse bindings.\\nMessage: \"+\nh+\";\\nBindings value: \"+a))}}});b.J.instance=new b.J;b.b(\"bindingProvider\",b.J);b.c={};b.z=function(a,d,c){d?(b.a.extend(this,d),this.$parentContext=d,this.$parent=d.$data,this.$parents=(d.$parents||[]).slice(0),this.$parents.unshift(this.$parent)):(this.$parents=[],this.$root=a,this.ko=b);this.$data=a;c&&(this[c]=a)};b.z.prototype.createChildContext=function(a,d){return new b.z(a,this,d)};b.z.prototype.extend=function(a){var d=b.a.extend(new b.z,this);return b.a.extend(d,a)};b.cb=function(a,d){if(2==\narguments.length)b.a.f.set(a,\"__ko_bindingContext__\",d);else return b.a.f.get(a,\"__ko_bindingContext__\")};b.Ea=function(a,d,c){1===a.nodeType&&b.e.Sa(a);return W(a,d,c,l)};b.Da=function(a,b){(1===b.nodeType||8===b.nodeType)&&Y(a,b,l)};b.Ca=function(a,b){b&&(1!==b.nodeType&&8!==b.nodeType)&&i(Error(\"ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node\"));b=b||w.document.body;X(a,b,l)};b.ja=function(a){switch(a.nodeType){case 1:case 8:var d=b.cb(a);if(d)return d;\nif(a.parentNode)return b.ja(a.parentNode)}return H};b.ob=function(a){return(a=b.ja(a))?a.$data:H};b.b(\"bindingHandlers\",b.c);b.b(\"applyBindings\",b.Ca);b.b(\"applyBindingsToDescendants\",b.Da);b.b(\"applyBindingsToNode\",b.Ea);b.b(\"contextFor\",b.ja);b.b(\"dataFor\",b.ob);var ea={\"class\":\"className\",\"for\":\"htmlFor\"};b.c.attr={update:function(a,d){var c=b.a.d(d())||{},e;for(e in c)if(\"string\"==typeof e){var f=b.a.d(c[e]),g=f===q||f===n||f===H;g&&a.removeAttribute(e);8>=b.a.Z&&e in ea?(e=ea[e],g?a.removeAttribute(e):\na[e]=f):g||a.setAttribute(e,f.toString());\"name\"===e&&b.a.$a(a,g?\"\":f.toString())}}};b.c.checked={init:function(a,d,c){b.a.n(a,\"click\",function(){var e;if(\"checkbox\"==a.type)e=a.checked;else if(\"radio\"==a.type&&a.checked)e=a.value;else return;var f=d(),g=b.a.d(f);\"checkbox\"==a.type&&g instanceof Array?(e=b.a.i(g,a.value),a.checked&&0>e?f.push(a.value):!a.checked&&0<=e&&f.splice(e,1)):b.g.ea(f,c,\"checked\",e,l)});\"radio\"==a.type&&!a.name&&b.c.uniqueName.init(a,t(l))},update:function(a,d){var c=b.a.d(d());\n\"checkbox\"==a.type?a.checked=c instanceof Array?0<=b.a.i(c,a.value):c:\"radio\"==a.type&&(a.checked=a.value==c)}};b.c.css={update:function(a,d){var c=b.a.d(d());if(\"object\"==typeof c)for(var e in c){var f=b.a.d(c[e]);b.a.da(a,e,f)}else c=String(c||\"\"),b.a.da(a,a.__ko__cssValue,q),a.__ko__cssValue=c,b.a.da(a,c,l)}};b.c.enable={update:function(a,d){var c=b.a.d(d());c&&a.disabled?a.removeAttribute(\"disabled\"):!c&&!a.disabled&&(a.disabled=l)}};b.c.disable={update:function(a,d){b.c.enable.update(a,function(){return!b.a.d(d())})}};\nb.c.event={init:function(a,d,c,e){var f=d()||{},g;for(g in f)(function(){var f=g;\"string\"==typeof f&&b.a.n(a,f,function(a){var g,m=d()[f];if(m){var p=c();try{var r=b.a.L(arguments);r.unshift(e);g=m.apply(e,r)}finally{g!==l&&(a.preventDefault?a.preventDefault():a.returnValue=q)}p[f+\"Bubble\"]===q&&(a.cancelBubble=l,a.stopPropagation&&a.stopPropagation())}})})()}};b.c.foreach={Ra:function(a){return function(){var d=a(),c=b.a.ta(d);if(!c||\"number\"==typeof c.length)return{foreach:d,templateEngine:b.C.na};\nb.a.d(d);return{foreach:c.data,as:c.as,includeDestroyed:c.includeDestroyed,afterAdd:c.afterAdd,beforeRemove:c.beforeRemove,afterRender:c.afterRender,beforeMove:c.beforeMove,afterMove:c.afterMove,templateEngine:b.C.na}}},init:function(a,d){return b.c.template.init(a,b.c.foreach.Ra(d))},update:function(a,d,c,e,f){return b.c.template.update(a,b.c.foreach.Ra(d),c,e,f)}};b.g.Q.foreach=q;b.e.I.foreach=l;b.c.hasfocus={init:function(a,d,c){function e(e){a.__ko_hasfocusUpdating=l;var f=a.ownerDocument;\"activeElement\"in\nf&&(e=f.activeElement===a);f=d();b.g.ea(f,c,\"hasfocus\",e,l);a.__ko_hasfocusUpdating=q}var f=e.bind(n,l),g=e.bind(n,q);b.a.n(a,\"focus\",f);b.a.n(a,\"focusin\",f);b.a.n(a,\"blur\",g);b.a.n(a,\"focusout\",g)},update:function(a,d){var c=b.a.d(d());a.__ko_hasfocusUpdating||(c?a.focus():a.blur(),b.r.K(b.a.Aa,n,[a,c?\"focusin\":\"focusout\"]))}};b.c.html={init:function(){return{controlsDescendantBindings:l}},update:function(a,d){b.a.ca(a,d())}};var ca=\"__ko_withIfBindingData\";P(\"if\");P(\"ifnot\",q,l);P(\"with\",l,q,function(a,\nb){return a.createChildContext(b)});b.c.options={update:function(a,d,c){\"select\"!==b.a.u(a)&&i(Error(\"options binding applies only to SELECT elements\"));for(var e=0==a.length,f=b.a.V(b.a.fa(a.childNodes,function(a){return a.tagName&&\"option\"===b.a.u(a)&&a.selected}),function(a){return b.k.q(a)||a.innerText||a.textContent}),g=a.scrollTop,h=b.a.d(d());0<a.length;)b.A(a.options[0]),a.remove(0);if(h){var c=c(),j=c.optionsIncludeDestroyed;\"number\"!=typeof h.length&&(h=[h]);if(c.optionsCaption){var k=x.createElement(\"option\");\nb.a.ca(k,c.optionsCaption);b.k.T(k,H);a.appendChild(k)}for(var d=0,m=h.length;d<m;d++){var p=h[d];if(!p||!p._destroy||j){var k=x.createElement(\"option\"),r=function(a,b,c){var d=typeof b;return\"function\"==d?b(a):\"string\"==d?a[b]:c},u=r(p,c.optionsValue,p);b.k.T(k,b.a.d(u));p=r(p,c.optionsText,u);b.a.bb(k,p);a.appendChild(k)}}h=a.getElementsByTagName(\"option\");d=j=0;for(m=h.length;d<m;d++)0<=b.a.i(f,b.k.q(h[d]))&&(b.a.ab(h[d],l),j++);a.scrollTop=g;e&&\"value\"in c&&da(a,b.a.ta(c.value),l);b.a.tb(a)}}};\nb.c.options.ra=\"__ko.optionValueDomData__\";b.c.selectedOptions={init:function(a,d,c){b.a.n(a,\"change\",function(){var e=d(),f=[];b.a.o(a.getElementsByTagName(\"option\"),function(a){a.selected&&f.push(b.k.q(a))});b.g.ea(e,c,\"value\",f)})},update:function(a,d){\"select\"!=b.a.u(a)&&i(Error(\"values binding applies only to SELECT elements\"));var c=b.a.d(d());c&&\"number\"==typeof c.length&&b.a.o(a.getElementsByTagName(\"option\"),function(a){var d=0<=b.a.i(c,b.k.q(a));b.a.ab(a,d)})}};b.c.style={update:function(a,\nd){var c=b.a.d(d()||{}),e;for(e in c)if(\"string\"==typeof e){var f=b.a.d(c[e]);a.style[e]=f||\"\"}}};b.c.submit={init:function(a,d,c,e){\"function\"!=typeof d()&&i(Error(\"The value for a submit binding must be a function\"));b.a.n(a,\"submit\",function(b){var c,h=d();try{c=h.call(e,a)}finally{c!==l&&(b.preventDefault?b.preventDefault():b.returnValue=q)}})}};b.c.text={update:function(a,d){b.a.bb(a,d())}};b.e.I.text=l;b.c.uniqueName={init:function(a,d){if(d()){var c=\"ko_unique_\"+ ++b.c.uniqueName.nb;b.a.$a(a,\nc)}}};b.c.uniqueName.nb=0;b.c.value={init:function(a,d,c){function e(){h=q;var e=d(),f=b.k.q(a);b.g.ea(e,c,\"value\",f)}var f=[\"change\"],g=c().valueUpdate,h=q;g&&(\"string\"==typeof g&&(g=[g]),b.a.P(f,g),f=b.a.Fa(f));if(b.a.Z&&(\"input\"==a.tagName.toLowerCase()&&\"text\"==a.type&&\"off\"!=a.autocomplete&&(!a.form||\"off\"!=a.form.autocomplete))&&-1==b.a.i(f,\"propertychange\"))b.a.n(a,\"propertychange\",function(){h=l}),b.a.n(a,\"blur\",function(){h&&e()});b.a.o(f,function(c){var d=e;b.a.Nb(c,\"after\")&&(d=function(){setTimeout(e,\n0)},c=c.substring(5));b.a.n(a,c,d)})},update:function(a,d){var c=\"select\"===b.a.u(a),e=b.a.d(d()),f=b.k.q(a),g=e!=f;0===e&&(0!==f&&\"0\"!==f)&&(g=l);g&&(f=function(){b.k.T(a,e)},f(),c&&setTimeout(f,0));c&&0<a.length&&da(a,e,q)}};b.c.visible={update:function(a,d){var c=b.a.d(d()),e=\"none\"!=a.style.display;c&&!e?a.style.display=\"\":!c&&e&&(a.style.display=\"none\")}};b.c.click={init:function(a,d,c,e){return b.c.event.init.call(this,a,function(){var a={};a.click=d();return a},c,e)}};b.v=function(){};b.v.prototype.renderTemplateSource=\nfunction(){i(Error(\"Override renderTemplateSource\"))};b.v.prototype.createJavaScriptEvaluatorBlock=function(){i(Error(\"Override createJavaScriptEvaluatorBlock\"))};b.v.prototype.makeTemplateSource=function(a,d){if(\"string\"==typeof a){var d=d||x,c=d.getElementById(a);c||i(Error(\"Cannot find template with ID \"+a));return new b.l.h(c)}if(1==a.nodeType||8==a.nodeType)return new b.l.O(a);i(Error(\"Unknown template type: \"+a))};b.v.prototype.renderTemplate=function(a,b,c,e){a=this.makeTemplateSource(a,e);\nreturn this.renderTemplateSource(a,b,c)};b.v.prototype.isTemplateRewritten=function(a,b){return this.allowTemplateRewriting===q?l:this.makeTemplateSource(a,b).data(\"isRewritten\")};b.v.prototype.rewriteTemplate=function(a,b,c){a=this.makeTemplateSource(a,c);b=b(a.text());a.text(b);a.data(\"isRewritten\",l)};b.b(\"templateEngine\",b.v);var pa=/(<[a-z]+\\d*(\\s+(?!data-bind=)[a-z0-9\\-]+(=(\\\"[^\\\"]*\\\"|\\'[^\\']*\\'))?)*\\s+)data-bind=([\"'])([\\s\\S]*?)\\5/gi,qa=/<\\!--\\s*ko\\b\\s*([\\s\\S]*?)\\s*--\\>/g;b.ya={ub:function(a,\nd,c){d.isTemplateRewritten(a,c)||d.rewriteTemplate(a,function(a){return b.ya.Fb(a,d)},c)},Fb:function(a,b){return a.replace(pa,function(a,e,f,g,h,j,k){return V(k,e,b)}).replace(qa,function(a,e){return V(e,\"<\\!-- ko --\\>\",b)})},jb:function(a){return b.s.qa(function(d,c){d.nextSibling&&b.Ea(d.nextSibling,a,c)})}};b.b(\"__tr_ambtns\",b.ya.jb);b.l={};b.l.h=function(a){this.h=a};b.l.h.prototype.text=function(){var a=b.a.u(this.h),a=\"script\"===a?\"text\":\"textarea\"===a?\"value\":\"innerHTML\";if(0==arguments.length)return this.h[a];\nvar d=arguments[0];\"innerHTML\"===a?b.a.ca(this.h,d):this.h[a]=d};b.l.h.prototype.data=function(a){if(1===arguments.length)return b.a.f.get(this.h,\"templateSourceData_\"+a);b.a.f.set(this.h,\"templateSourceData_\"+a,arguments[1])};b.l.O=function(a){this.h=a};b.l.O.prototype=new b.l.h;b.l.O.prototype.text=function(){if(0==arguments.length){var a=b.a.f.get(this.h,\"__ko_anon_template__\")||{};a.za===H&&a.ia&&(a.za=a.ia.innerHTML);return a.za}b.a.f.set(this.h,\"__ko_anon_template__\",{za:arguments[0]})};b.l.h.prototype.nodes=\nfunction(){if(0==arguments.length)return(b.a.f.get(this.h,\"__ko_anon_template__\")||{}).ia;b.a.f.set(this.h,\"__ko_anon_template__\",{ia:arguments[0]})};b.b(\"templateSources\",b.l);b.b(\"templateSources.domElement\",b.l.h);b.b(\"templateSources.anonymousTemplate\",b.l.O);var N;b.va=function(a){a!=H&&!(a instanceof b.v)&&i(Error(\"templateEngine must inherit from ko.templateEngine\"));N=a};b.ua=function(a,d,c,e,f){c=c||{};(c.templateEngine||N)==H&&i(Error(\"Set a template engine before calling renderTemplate\"));\nf=f||\"replaceChildren\";if(e){var g=M(e);return b.j(function(){var h=d&&d instanceof b.z?d:new b.z(b.a.d(d)),j=\"function\"==typeof a?a(h.$data,h):a,h=S(e,f,j,h,c);\"replaceNode\"==f&&(e=h,g=M(e))},n,{Ja:function(){return!g||!b.a.X(g)},W:g&&\"replaceNode\"==f?g.parentNode:g})}return b.s.qa(function(e){b.ua(a,d,c,e,\"replaceNode\")})};b.Lb=function(a,d,c,e,f){function g(a,b){T(b,j);c.afterRender&&c.afterRender(b,a)}function h(d,e){j=f.createChildContext(b.a.d(d),c.as);j.$index=e;var g=\"function\"==typeof a?\na(d,j):a;return S(n,\"ignoreTargetNode\",g,j,c)}var j;return b.j(function(){var a=b.a.d(d)||[];\"undefined\"==typeof a.length&&(a=[a]);a=b.a.fa(a,function(a){return c.includeDestroyed||a===H||a===n||!b.a.d(a._destroy)});b.r.K(b.a.Za,n,[e,a,h,c,g])},n,{W:e})};b.c.template={init:function(a,d){var c=b.a.d(d());if(\"string\"!=typeof c&&!c.name&&(1==a.nodeType||8==a.nodeType))c=1==a.nodeType?a.childNodes:b.e.childNodes(a),c=b.a.Gb(c),(new b.l.O(a)).nodes(c);return{controlsDescendantBindings:l}},update:function(a,\nd,c,e,f){var d=b.a.d(d()),c={},e=l,g,h=n;\"string\"!=typeof d&&(c=d,d=c.name,\"if\"in c&&(e=b.a.d(c[\"if\"])),e&&\"ifnot\"in c&&(e=!b.a.d(c.ifnot)),g=b.a.d(c.data));\"foreach\"in c?h=b.Lb(d||a,e&&c.foreach||[],c,a,f):e?(f=\"data\"in c?f.createChildContext(g,c.as):f,h=b.ua(d||a,f,c,a)):b.e.Y(a);f=h;(g=b.a.f.get(a,\"__ko__templateComputedDomDataKey__\"))&&\"function\"==typeof g.B&&g.B();b.a.f.set(a,\"__ko__templateComputedDomDataKey__\",f&&f.oa()?f:H)}};b.g.Q.template=function(a){a=b.g.aa(a);return 1==a.length&&a[0].unknown||\nb.g.Db(a,\"name\")?n:\"This template engine does not support anonymous templates nested within its templates\"};b.e.I.template=l;b.b(\"setTemplateEngine\",b.va);b.b(\"renderTemplate\",b.ua);b.a.Ia=function(a,b,c){a=a||[];b=b||[];return a.length<=b.length?R(a,b,\"added\",\"deleted\",c):R(b,a,\"deleted\",\"added\",c)};b.b(\"utils.compareArrays\",b.a.Ia);b.a.Za=function(a,d,c,e,f){function g(a,b){s=k[b];v!==b&&(y[a]=s);s.ma(v++);L(s.M);r.push(s);z.push(s)}function h(a,c){if(a)for(var d=0,e=c.length;d<e;d++)c[d]&&b.a.o(c[d].M,\nfunction(b){a(b,d,c[d].U)})}for(var d=d||[],e=e||{},j=b.a.f.get(a,\"setDomNodeChildrenFromArrayMapping_lastMappingResult\")===H,k=b.a.f.get(a,\"setDomNodeChildrenFromArrayMapping_lastMappingResult\")||[],m=b.a.V(k,function(a){return a.U}),p=b.a.Ia(m,d),r=[],u=0,v=0,A=[],z=[],d=[],y=[],m=[],s,C=0,B,D;B=p[C];C++)switch(D=B.moved,B.status){case \"deleted\":D===H&&(s=k[u],s.j&&s.j.B(),A.push.apply(A,L(s.M)),e.beforeRemove&&(d[C]=s,z.push(s)));u++;break;case \"retained\":g(C,u++);break;case \"added\":D!==H?g(C,\nD):(s={U:B.value,ma:b.m(v++)},r.push(s),z.push(s),j||(m[C]=s))}h(e.beforeMove,y);b.a.o(A,e.beforeRemove?b.A:b.removeNode);for(var C=0,j=b.e.firstChild(a),G;s=z[C];C++){s.M||b.a.extend(s,ga(a,c,s.U,f,s.ma));for(u=0;p=s.M[u];j=p.nextSibling,G=p,u++)p!==j&&b.e.Oa(a,p,G);!s.zb&&f&&(f(s.U,s.M,s.ma),s.zb=l)}h(e.beforeRemove,d);h(e.afterMove,y);h(e.afterAdd,m);b.a.f.set(a,\"setDomNodeChildrenFromArrayMapping_lastMappingResult\",r)};b.b(\"utils.setDomNodeChildrenFromArrayMapping\",b.a.Za);b.C=function(){this.allowTemplateRewriting=\nq};b.C.prototype=new b.v;b.C.prototype.renderTemplateSource=function(a){var d=!(9>b.a.Z)&&a.nodes?a.nodes():n;if(d)return b.a.L(d.cloneNode(l).childNodes);a=a.text();return b.a.sa(a)};b.C.na=new b.C;b.va(b.C.na);b.b(\"nativeTemplateEngine\",b.C);b.pa=function(){var a=this.Cb=function(){if(\"undefined\"==typeof E||!E.tmpl)return 0;try{if(0<=E.tmpl.tag.tmpl.open.toString().indexOf(\"__\"))return 2}catch(a){}return 1}();this.renderTemplateSource=function(b,c,e){e=e||{};2>a&&i(Error(\"Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.\"));\nvar f=b.data(\"precompiled\");f||(f=b.text()||\"\",f=E.template(n,\"{{ko_with $item.koBindingContext}}\"+f+\"{{/ko_with}}\"),b.data(\"precompiled\",f));b=[c.$data];c=E.extend({koBindingContext:c},e.templateOptions);c=E.tmpl(f,b,c);c.appendTo(x.createElement(\"div\"));E.fragments={};return c};this.createJavaScriptEvaluatorBlock=function(a){return\"{{ko_code ((function() { return \"+a+\" })()) }}\"};this.addTemplate=function(a,b){x.write(\"<script type='text/html' id='\"+a+\"'>\"+b+\"<\\/script>\")};0<a&&(E.tmpl.tag.ko_code=\n{open:\"__.push($1 || '');\"},E.tmpl.tag.ko_with={open:\"with($1) {\",close:\"} \"})};b.pa.prototype=new b.v;v=new b.pa;0<v.Cb&&b.va(v);b.b(\"jqueryTmplTemplateEngine\",b.pa)}\"function\"===typeof require&&\"object\"===typeof exports&&\"object\"===typeof module?K(module.exports||exports):\"function\"===typeof define&&define.amd?define([\"exports\"],K):K(w.ko={});l;\n})();\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Scripts/modernizr-2.6.2.js",
    "content": "/*!\n * Modernizr v2.6.2\n * www.modernizr.com\n *\n * Copyright (c) Faruk Ates, Paul Irish, Alex Sexton\n * Available under the BSD and MIT licenses: www.modernizr.com/license/\n */\n\n/*\n * Modernizr tests which native CSS3 and HTML5 features are available in\n * the current UA and makes the results available to you in two ways:\n * as properties on a global Modernizr object, and as classes on the\n * <html> element. This information allows you to progressively enhance\n * your pages with a granular level of control over the experience.\n *\n * Modernizr has an optional (not included) conditional resource loader\n * called Modernizr.load(), based on Yepnope.js (yepnopejs.com).\n * To get a build that includes Modernizr.load(), as well as choosing\n * which tests to include, go to www.modernizr.com/download/\n *\n * Authors        Faruk Ates, Paul Irish, Alex Sexton\n * Contributors   Ryan Seddon, Ben Alman\n */\n\nwindow.Modernizr = (function( window, document, undefined ) {\n\n    var version = '2.6.2',\n\n    Modernizr = {},\n\n    /*>>cssclasses*/\n    // option for enabling the HTML classes to be added\n    enableClasses = true,\n    /*>>cssclasses*/\n\n    docElement = document.documentElement,\n\n    /**\n     * Create our \"modernizr\" element that we do most feature tests on.\n     */\n    mod = 'modernizr',\n    modElem = document.createElement(mod),\n    mStyle = modElem.style,\n\n    /**\n     * Create the input element for various Web Forms feature tests.\n     */\n    inputElem /*>>inputelem*/ = document.createElement('input') /*>>inputelem*/ ,\n\n    /*>>smile*/\n    smile = ':)',\n    /*>>smile*/\n\n    toString = {}.toString,\n\n    // TODO :: make the prefixes more granular\n    /*>>prefixes*/\n    // List of property values to set for css tests. See ticket #21\n    prefixes = ' -webkit- -moz- -o- -ms- '.split(' '),\n    /*>>prefixes*/\n\n    /*>>domprefixes*/\n    // Following spec is to expose vendor-specific style properties as:\n    //   elem.style.WebkitBorderRadius\n    // and the following would be incorrect:\n    //   elem.style.webkitBorderRadius\n\n    // Webkit ghosts their properties in lowercase but Opera & Moz do not.\n    // Microsoft uses a lowercase `ms` instead of the correct `Ms` in IE8+\n    //   erik.eae.net/archives/2008/03/10/21.48.10/\n\n    // More here: github.com/Modernizr/Modernizr/issues/issue/21\n    omPrefixes = 'Webkit Moz O ms',\n\n    cssomPrefixes = omPrefixes.split(' '),\n\n    domPrefixes = omPrefixes.toLowerCase().split(' '),\n    /*>>domprefixes*/\n\n    /*>>ns*/\n    ns = {'svg': 'http://www.w3.org/2000/svg'},\n    /*>>ns*/\n\n    tests = {},\n    inputs = {},\n    attrs = {},\n\n    classes = [],\n\n    slice = classes.slice,\n\n    featureName, // used in testing loop\n\n\n    /*>>teststyles*/\n    // Inject element with style element and some CSS rules\n    injectElementWithStyles = function( rule, callback, nodes, testnames ) {\n\n      var style, ret, node, docOverflow,\n          div = document.createElement('div'),\n          // After page load injecting a fake body doesn't work so check if body exists\n          body = document.body,\n          // IE6 and 7 won't return offsetWidth or offsetHeight unless it's in the body element, so we fake it.\n          fakeBody = body || document.createElement('body');\n\n      if ( parseInt(nodes, 10) ) {\n          // In order not to give false positives we create a node for each test\n          // This also allows the method to scale for unspecified uses\n          while ( nodes-- ) {\n              node = document.createElement('div');\n              node.id = testnames ? testnames[nodes] : mod + (nodes + 1);\n              div.appendChild(node);\n          }\n      }\n\n      // <style> elements in IE6-9 are considered 'NoScope' elements and therefore will be removed\n      // when injected with innerHTML. To get around this you need to prepend the 'NoScope' element\n      // with a 'scoped' element, in our case the soft-hyphen entity as it won't mess with our measurements.\n      // msdn.microsoft.com/en-us/library/ms533897%28VS.85%29.aspx\n      // Documents served as xml will throw if using &shy; so use xml friendly encoded version. See issue #277\n      style = ['&#173;','<style id=\"s', mod, '\">', rule, '</style>'].join('');\n      div.id = mod;\n      // IE6 will false positive on some tests due to the style element inside the test div somehow interfering offsetHeight, so insert it into body or fakebody.\n      // Opera will act all quirky when injecting elements in documentElement when page is served as xml, needs fakebody too. #270\n      (body ? div : fakeBody).innerHTML += style;\n      fakeBody.appendChild(div);\n      if ( !body ) {\n          //avoid crashing IE8, if background image is used\n          fakeBody.style.background = '';\n          //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible\n          fakeBody.style.overflow = 'hidden';\n          docOverflow = docElement.style.overflow;\n          docElement.style.overflow = 'hidden';\n          docElement.appendChild(fakeBody);\n      }\n\n      ret = callback(div, rule);\n      // If this is done after page load we don't want to remove the body so check if body exists\n      if ( !body ) {\n          fakeBody.parentNode.removeChild(fakeBody);\n          docElement.style.overflow = docOverflow;\n      } else {\n          div.parentNode.removeChild(div);\n      }\n\n      return !!ret;\n\n    },\n    /*>>teststyles*/\n\n    /*>>mq*/\n    // adapted from matchMedia polyfill\n    // by Scott Jehl and Paul Irish\n    // gist.github.com/786768\n    testMediaQuery = function( mq ) {\n\n      var matchMedia = window.matchMedia || window.msMatchMedia;\n      if ( matchMedia ) {\n        return matchMedia(mq).matches;\n      }\n\n      var bool;\n\n      injectElementWithStyles('@media ' + mq + ' { #' + mod + ' { position: absolute; } }', function( node ) {\n        bool = (window.getComputedStyle ?\n                  getComputedStyle(node, null) :\n                  node.currentStyle)['position'] == 'absolute';\n      });\n\n      return bool;\n\n     },\n     /*>>mq*/\n\n\n    /*>>hasevent*/\n    //\n    // isEventSupported determines if a given element supports the given event\n    // kangax.github.com/iseventsupported/\n    //\n    // The following results are known incorrects:\n    //   Modernizr.hasEvent(\"webkitTransitionEnd\", elem) // false negative\n    //   Modernizr.hasEvent(\"textInput\") // in Webkit. github.com/Modernizr/Modernizr/issues/333\n    //   ...\n    isEventSupported = (function() {\n\n      var TAGNAMES = {\n        'select': 'input', 'change': 'input',\n        'submit': 'form', 'reset': 'form',\n        'error': 'img', 'load': 'img', 'abort': 'img'\n      };\n\n      function isEventSupported( eventName, element ) {\n\n        element = element || document.createElement(TAGNAMES[eventName] || 'div');\n        eventName = 'on' + eventName;\n\n        // When using `setAttribute`, IE skips \"unload\", WebKit skips \"unload\" and \"resize\", whereas `in` \"catches\" those\n        var isSupported = eventName in element;\n\n        if ( !isSupported ) {\n          // If it has no `setAttribute` (i.e. doesn't implement Node interface), try generic element\n          if ( !element.setAttribute ) {\n            element = document.createElement('div');\n          }\n          if ( element.setAttribute && element.removeAttribute ) {\n            element.setAttribute(eventName, '');\n            isSupported = is(element[eventName], 'function');\n\n            // If property was created, \"remove it\" (by setting value to `undefined`)\n            if ( !is(element[eventName], 'undefined') ) {\n              element[eventName] = undefined;\n            }\n            element.removeAttribute(eventName);\n          }\n        }\n\n        element = null;\n        return isSupported;\n      }\n      return isEventSupported;\n    })(),\n    /*>>hasevent*/\n\n    // TODO :: Add flag for hasownprop ? didn't last time\n\n    // hasOwnProperty shim by kangax needed for Safari 2.0 support\n    _hasOwnProperty = ({}).hasOwnProperty, hasOwnProp;\n\n    if ( !is(_hasOwnProperty, 'undefined') && !is(_hasOwnProperty.call, 'undefined') ) {\n      hasOwnProp = function (object, property) {\n        return _hasOwnProperty.call(object, property);\n      };\n    }\n    else {\n      hasOwnProp = function (object, property) { /* yes, this can give false positives/negatives, but most of the time we don't care about those */\n        return ((property in object) && is(object.constructor.prototype[property], 'undefined'));\n      };\n    }\n\n    // Adapted from ES5-shim https://github.com/kriskowal/es5-shim/blob/master/es5-shim.js\n    // es5.github.com/#x15.3.4.5\n\n    if (!Function.prototype.bind) {\n      Function.prototype.bind = function bind(that) {\n\n        var target = this;\n\n        if (typeof target != \"function\") {\n            throw new TypeError();\n        }\n\n        var args = slice.call(arguments, 1),\n            bound = function () {\n\n            if (this instanceof bound) {\n\n              var F = function(){};\n              F.prototype = target.prototype;\n              var self = new F();\n\n              var result = target.apply(\n                  self,\n                  args.concat(slice.call(arguments))\n              );\n              if (Object(result) === result) {\n                  return result;\n              }\n              return self;\n\n            } else {\n\n              return target.apply(\n                  that,\n                  args.concat(slice.call(arguments))\n              );\n\n            }\n\n        };\n\n        return bound;\n      };\n    }\n\n    /**\n     * setCss applies given styles to the Modernizr DOM node.\n     */\n    function setCss( str ) {\n        mStyle.cssText = str;\n    }\n\n    /**\n     * setCssAll extrapolates all vendor-specific css strings.\n     */\n    function setCssAll( str1, str2 ) {\n        return setCss(prefixes.join(str1 + ';') + ( str2 || '' ));\n    }\n\n    /**\n     * is returns a boolean for if typeof obj is exactly type.\n     */\n    function is( obj, type ) {\n        return typeof obj === type;\n    }\n\n    /**\n     * contains returns a boolean for if substr is found within str.\n     */\n    function contains( str, substr ) {\n        return !!~('' + str).indexOf(substr);\n    }\n\n    /*>>testprop*/\n\n    // testProps is a generic CSS / DOM property test.\n\n    // In testing support for a given CSS property, it's legit to test:\n    //    `elem.style[styleName] !== undefined`\n    // If the property is supported it will return an empty string,\n    // if unsupported it will return undefined.\n\n    // We'll take advantage of this quick test and skip setting a style\n    // on our modernizr element, but instead just testing undefined vs\n    // empty string.\n\n    // Because the testing of the CSS property names (with \"-\", as\n    // opposed to the camelCase DOM properties) is non-portable and\n    // non-standard but works in WebKit and IE (but not Gecko or Opera),\n    // we explicitly reject properties with dashes so that authors\n    // developing in WebKit or IE first don't end up with\n    // browser-specific content by accident.\n\n    function testProps( props, prefixed ) {\n        for ( var i in props ) {\n            var prop = props[i];\n            if ( !contains(prop, \"-\") && mStyle[prop] !== undefined ) {\n                return prefixed == 'pfx' ? prop : true;\n            }\n        }\n        return false;\n    }\n    /*>>testprop*/\n\n    // TODO :: add testDOMProps\n    /**\n     * testDOMProps is a generic DOM property test; if a browser supports\n     *   a certain property, it won't return undefined for it.\n     */\n    function testDOMProps( props, obj, elem ) {\n        for ( var i in props ) {\n            var item = obj[props[i]];\n            if ( item !== undefined) {\n\n                // return the property name as a string\n                if (elem === false) return props[i];\n\n                // let's bind a function\n                if (is(item, 'function')){\n                  // default to autobind unless override\n                  return item.bind(elem || obj);\n                }\n\n                // return the unbound function or obj or value\n                return item;\n            }\n        }\n        return false;\n    }\n\n    /*>>testallprops*/\n    /**\n     * testPropsAll tests a list of DOM properties we want to check against.\n     *   We specify literally ALL possible (known and/or likely) properties on\n     *   the element including the non-vendor prefixed one, for forward-\n     *   compatibility.\n     */\n    function testPropsAll( prop, prefixed, elem ) {\n\n        var ucProp  = prop.charAt(0).toUpperCase() + prop.slice(1),\n            props   = (prop + ' ' + cssomPrefixes.join(ucProp + ' ') + ucProp).split(' ');\n\n        // did they call .prefixed('boxSizing') or are we just testing a prop?\n        if(is(prefixed, \"string\") || is(prefixed, \"undefined\")) {\n          return testProps(props, prefixed);\n\n        // otherwise, they called .prefixed('requestAnimationFrame', window[, elem])\n        } else {\n          props = (prop + ' ' + (domPrefixes).join(ucProp + ' ') + ucProp).split(' ');\n          return testDOMProps(props, prefixed, elem);\n        }\n    }\n    /*>>testallprops*/\n\n\n    /**\n     * Tests\n     * -----\n     */\n\n    // The *new* flexbox\n    // dev.w3.org/csswg/css3-flexbox\n\n    tests['flexbox'] = function() {\n      return testPropsAll('flexWrap');\n    };\n\n    // The *old* flexbox\n    // www.w3.org/TR/2009/WD-css3-flexbox-20090723/\n\n    tests['flexboxlegacy'] = function() {\n        return testPropsAll('boxDirection');\n    };\n\n    // On the S60 and BB Storm, getContext exists, but always returns undefined\n    // so we actually have to call getContext() to verify\n    // github.com/Modernizr/Modernizr/issues/issue/97/\n\n    tests['canvas'] = function() {\n        var elem = document.createElement('canvas');\n        return !!(elem.getContext && elem.getContext('2d'));\n    };\n\n    tests['canvastext'] = function() {\n        return !!(Modernizr['canvas'] && is(document.createElement('canvas').getContext('2d').fillText, 'function'));\n    };\n\n    // webk.it/70117 is tracking a legit WebGL feature detect proposal\n\n    // We do a soft detect which may false positive in order to avoid\n    // an expensive context creation: bugzil.la/732441\n\n    tests['webgl'] = function() {\n        return !!window.WebGLRenderingContext;\n    };\n\n    /*\n     * The Modernizr.touch test only indicates if the browser supports\n     *    touch events, which does not necessarily reflect a touchscreen\n     *    device, as evidenced by tablets running Windows 7 or, alas,\n     *    the Palm Pre / WebOS (touch) phones.\n     *\n     * Additionally, Chrome (desktop) used to lie about its support on this,\n     *    but that has since been rectified: crbug.com/36415\n     *\n     * We also test for Firefox 4 Multitouch Support.\n     *\n     * For more info, see: modernizr.github.com/Modernizr/touch.html\n     */\n\n    tests['touch'] = function() {\n        var bool;\n\n        if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {\n          bool = true;\n        } else {\n          injectElementWithStyles(['@media (',prefixes.join('touch-enabled),('),mod,')','{#modernizr{top:9px;position:absolute}}'].join(''), function( node ) {\n            bool = node.offsetTop === 9;\n          });\n        }\n\n        return bool;\n    };\n\n\n    // geolocation is often considered a trivial feature detect...\n    // Turns out, it's quite tricky to get right:\n    //\n    // Using !!navigator.geolocation does two things we don't want. It:\n    //   1. Leaks memory in IE9: github.com/Modernizr/Modernizr/issues/513\n    //   2. Disables page caching in WebKit: webk.it/43956\n    //\n    // Meanwhile, in Firefox < 8, an about:config setting could expose\n    // a false positive that would throw an exception: bugzil.la/688158\n\n    tests['geolocation'] = function() {\n        return 'geolocation' in navigator;\n    };\n\n\n    tests['postmessage'] = function() {\n      return !!window.postMessage;\n    };\n\n\n    // Chrome incognito mode used to throw an exception when using openDatabase\n    // It doesn't anymore.\n    tests['websqldatabase'] = function() {\n      return !!window.openDatabase;\n    };\n\n    // Vendors had inconsistent prefixing with the experimental Indexed DB:\n    // - Webkit's implementation is accessible through webkitIndexedDB\n    // - Firefox shipped moz_indexedDB before FF4b9, but since then has been mozIndexedDB\n    // For speed, we don't test the legacy (and beta-only) indexedDB\n    tests['indexedDB'] = function() {\n      return !!testPropsAll(\"indexedDB\", window);\n    };\n\n    // documentMode logic from YUI to filter out IE8 Compat Mode\n    //   which false positives.\n    tests['hashchange'] = function() {\n      return isEventSupported('hashchange', window) && (document.documentMode === undefined || document.documentMode > 7);\n    };\n\n    // Per 1.6:\n    // This used to be Modernizr.historymanagement but the longer\n    // name has been deprecated in favor of a shorter and property-matching one.\n    // The old API is still available in 1.6, but as of 2.0 will throw a warning,\n    // and in the first release thereafter disappear entirely.\n    tests['history'] = function() {\n      return !!(window.history && history.pushState);\n    };\n\n    tests['draganddrop'] = function() {\n        var div = document.createElement('div');\n        return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div);\n    };\n\n    // FF3.6 was EOL'ed on 4/24/12, but the ESR version of FF10\n    // will be supported until FF19 (2/12/13), at which time, ESR becomes FF17.\n    // FF10 still uses prefixes, so check for it until then.\n    // for more ESR info, see: mozilla.org/en-US/firefox/organizations/faq/\n    tests['websockets'] = function() {\n        return 'WebSocket' in window || 'MozWebSocket' in window;\n    };\n\n\n    // css-tricks.com/rgba-browser-support/\n    tests['rgba'] = function() {\n        // Set an rgba() color and check the returned value\n\n        setCss('background-color:rgba(150,255,150,.5)');\n\n        return contains(mStyle.backgroundColor, 'rgba');\n    };\n\n    tests['hsla'] = function() {\n        // Same as rgba(), in fact, browsers re-map hsla() to rgba() internally,\n        //   except IE9 who retains it as hsla\n\n        setCss('background-color:hsla(120,40%,100%,.5)');\n\n        return contains(mStyle.backgroundColor, 'rgba') || contains(mStyle.backgroundColor, 'hsla');\n    };\n\n    tests['multiplebgs'] = function() {\n        // Setting multiple images AND a color on the background shorthand property\n        //  and then querying the style.background property value for the number of\n        //  occurrences of \"url(\" is a reliable method for detecting ACTUAL support for this!\n\n        setCss('background:url(https://),url(https://),red url(https://)');\n\n        // If the UA supports multiple backgrounds, there should be three occurrences\n        //   of the string \"url(\" in the return value for elemStyle.background\n\n        return (/(url\\s*\\(.*?){3}/).test(mStyle.background);\n    };\n\n\n\n    // this will false positive in Opera Mini\n    //   github.com/Modernizr/Modernizr/issues/396\n\n    tests['backgroundsize'] = function() {\n        return testPropsAll('backgroundSize');\n    };\n\n    tests['borderimage'] = function() {\n        return testPropsAll('borderImage');\n    };\n\n\n    // Super comprehensive table about all the unique implementations of\n    // border-radius: muddledramblings.com/table-of-css3-border-radius-compliance\n\n    tests['borderradius'] = function() {\n        return testPropsAll('borderRadius');\n    };\n\n    // WebOS unfortunately false positives on this test.\n    tests['boxshadow'] = function() {\n        return testPropsAll('boxShadow');\n    };\n\n    // FF3.0 will false positive on this test\n    tests['textshadow'] = function() {\n        return document.createElement('div').style.textShadow === '';\n    };\n\n\n    tests['opacity'] = function() {\n        // Browsers that actually have CSS Opacity implemented have done so\n        //  according to spec, which means their return values are within the\n        //  range of [0.0,1.0] - including the leading zero.\n\n        setCssAll('opacity:.55');\n\n        // The non-literal . in this regex is intentional:\n        //   German Chrome returns this value as 0,55\n        // github.com/Modernizr/Modernizr/issues/#issue/59/comment/516632\n        return (/^0.55$/).test(mStyle.opacity);\n    };\n\n\n    // Note, Android < 4 will pass this test, but can only animate\n    //   a single property at a time\n    //   daneden.me/2011/12/putting-up-with-androids-bullshit/\n    tests['cssanimations'] = function() {\n        return testPropsAll('animationName');\n    };\n\n\n    tests['csscolumns'] = function() {\n        return testPropsAll('columnCount');\n    };\n\n\n    tests['cssgradients'] = function() {\n        /**\n         * For CSS Gradients syntax, please see:\n         * webkit.org/blog/175/introducing-css-gradients/\n         * developer.mozilla.org/en/CSS/-moz-linear-gradient\n         * developer.mozilla.org/en/CSS/-moz-radial-gradient\n         * dev.w3.org/csswg/css3-images/#gradients-\n         */\n\n        var str1 = 'background-image:',\n            str2 = 'gradient(linear,left top,right bottom,from(#9f9),to(white));',\n            str3 = 'linear-gradient(left top,#9f9, white);';\n\n        setCss(\n             // legacy webkit syntax (FIXME: remove when syntax not in use anymore)\n              (str1 + '-webkit- '.split(' ').join(str2 + str1) +\n             // standard syntax             // trailing 'background-image:'\n              prefixes.join(str3 + str1)).slice(0, -str1.length)\n        );\n\n        return contains(mStyle.backgroundImage, 'gradient');\n    };\n\n\n    tests['cssreflections'] = function() {\n        return testPropsAll('boxReflect');\n    };\n\n\n    tests['csstransforms'] = function() {\n        return !!testPropsAll('transform');\n    };\n\n\n    tests['csstransforms3d'] = function() {\n\n        var ret = !!testPropsAll('perspective');\n\n        // Webkit's 3D transforms are passed off to the browser's own graphics renderer.\n        //   It works fine in Safari on Leopard and Snow Leopard, but not in Chrome in\n        //   some conditions. As a result, Webkit typically recognizes the syntax but\n        //   will sometimes throw a false positive, thus we must do a more thorough check:\n        if ( ret && 'webkitPerspective' in docElement.style ) {\n\n          // Webkit allows this media query to succeed only if the feature is enabled.\n          // `@media (transform-3d),(-webkit-transform-3d){ ... }`\n          injectElementWithStyles('@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}', function( node, rule ) {\n            ret = node.offsetLeft === 9 && node.offsetHeight === 3;\n          });\n        }\n        return ret;\n    };\n\n\n    tests['csstransitions'] = function() {\n        return testPropsAll('transition');\n    };\n\n\n    /*>>fontface*/\n    // @font-face detection routine by Diego Perini\n    // javascript.nwbox.com/CSSSupport/\n\n    // false positives:\n    //   WebOS github.com/Modernizr/Modernizr/issues/342\n    //   WP7   github.com/Modernizr/Modernizr/issues/538\n    tests['fontface'] = function() {\n        var bool;\n\n        injectElementWithStyles('@font-face {font-family:\"font\";src:url(\"https://\")}', function( node, rule ) {\n          var style = document.getElementById('smodernizr'),\n              sheet = style.sheet || style.styleSheet,\n              cssText = sheet ? (sheet.cssRules && sheet.cssRules[0] ? sheet.cssRules[0].cssText : sheet.cssText || '') : '';\n\n          bool = /src/i.test(cssText) && cssText.indexOf(rule.split(' ')[0]) === 0;\n        });\n\n        return bool;\n    };\n    /*>>fontface*/\n\n    // CSS generated content detection\n    tests['generatedcontent'] = function() {\n        var bool;\n\n        injectElementWithStyles(['#',mod,'{font:0/0 a}#',mod,':after{content:\"',smile,'\";visibility:hidden;font:3px/1 a}'].join(''), function( node ) {\n          bool = node.offsetHeight >= 3;\n        });\n\n        return bool;\n    };\n\n\n\n    // These tests evaluate support of the video/audio elements, as well as\n    // testing what types of content they support.\n    //\n    // We're using the Boolean constructor here, so that we can extend the value\n    // e.g.  Modernizr.video     // true\n    //       Modernizr.video.ogg // 'probably'\n    //\n    // Codec values from : github.com/NielsLeenheer/html5test/blob/9106a8/index.html#L845\n    //                     thx to NielsLeenheer and zcorpan\n\n    // Note: in some older browsers, \"no\" was a return value instead of empty string.\n    //   It was live in FF3.5.0 and 3.5.1, but fixed in 3.5.2\n    //   It was also live in Safari 4.0.0 - 4.0.4, but fixed in 4.0.5\n\n    tests['video'] = function() {\n        var elem = document.createElement('video'),\n            bool = false;\n\n        // IE9 Running on Windows Server SKU can cause an exception to be thrown, bug #224\n        try {\n            if ( bool = !!elem.canPlayType ) {\n                bool      = new Boolean(bool);\n                bool.ogg  = elem.canPlayType('video/ogg; codecs=\"theora\"')      .replace(/^no$/,'');\n\n                // Without QuickTime, this value will be `undefined`. github.com/Modernizr/Modernizr/issues/546\n                bool.h264 = elem.canPlayType('video/mp4; codecs=\"avc1.42E01E\"') .replace(/^no$/,'');\n\n                bool.webm = elem.canPlayType('video/webm; codecs=\"vp8, vorbis\"').replace(/^no$/,'');\n            }\n\n        } catch(e) { }\n\n        return bool;\n    };\n\n    tests['audio'] = function() {\n        var elem = document.createElement('audio'),\n            bool = false;\n\n        try {\n            if ( bool = !!elem.canPlayType ) {\n                bool      = new Boolean(bool);\n                bool.ogg  = elem.canPlayType('audio/ogg; codecs=\"vorbis\"').replace(/^no$/,'');\n                bool.mp3  = elem.canPlayType('audio/mpeg;')               .replace(/^no$/,'');\n\n                // Mimetypes accepted:\n                //   developer.mozilla.org/En/Media_formats_supported_by_the_audio_and_video_elements\n                //   bit.ly/iphoneoscodecs\n                bool.wav  = elem.canPlayType('audio/wav; codecs=\"1\"')     .replace(/^no$/,'');\n                bool.m4a  = ( elem.canPlayType('audio/x-m4a;')            ||\n                              elem.canPlayType('audio/aac;'))             .replace(/^no$/,'');\n            }\n        } catch(e) { }\n\n        return bool;\n    };\n\n\n    // In FF4, if disabled, window.localStorage should === null.\n\n    // Normally, we could not test that directly and need to do a\n    //   `('localStorage' in window) && ` test first because otherwise Firefox will\n    //   throw bugzil.la/365772 if cookies are disabled\n\n    // Also in iOS5 Private Browsing mode, attempting to use localStorage.setItem\n    // will throw the exception:\n    //   QUOTA_EXCEEDED_ERRROR DOM Exception 22.\n    // Peculiarly, getItem and removeItem calls do not throw.\n\n    // Because we are forced to try/catch this, we'll go aggressive.\n\n    // Just FWIW: IE8 Compat mode supports these features completely:\n    //   www.quirksmode.org/dom/html5.html\n    // But IE8 doesn't support either with local files\n\n    tests['localstorage'] = function() {\n        try {\n            localStorage.setItem(mod, mod);\n            localStorage.removeItem(mod);\n            return true;\n        } catch(e) {\n            return false;\n        }\n    };\n\n    tests['sessionstorage'] = function() {\n        try {\n            sessionStorage.setItem(mod, mod);\n            sessionStorage.removeItem(mod);\n            return true;\n        } catch(e) {\n            return false;\n        }\n    };\n\n\n    tests['webworkers'] = function() {\n        return !!window.Worker;\n    };\n\n\n    tests['applicationcache'] = function() {\n        return !!window.applicationCache;\n    };\n\n\n    // Thanks to Erik Dahlstrom\n    tests['svg'] = function() {\n        return !!document.createElementNS && !!document.createElementNS(ns.svg, 'svg').createSVGRect;\n    };\n\n    // specifically for SVG inline in HTML, not within XHTML\n    // test page: paulirish.com/demo/inline-svg\n    tests['inlinesvg'] = function() {\n      var div = document.createElement('div');\n      div.innerHTML = '<svg/>';\n      return (div.firstChild && div.firstChild.namespaceURI) == ns.svg;\n    };\n\n    // SVG SMIL animation\n    tests['smil'] = function() {\n        return !!document.createElementNS && /SVGAnimate/.test(toString.call(document.createElementNS(ns.svg, 'animate')));\n    };\n\n    // This test is only for clip paths in SVG proper, not clip paths on HTML content\n    // demo: srufaculty.sru.edu/david.dailey/svg/newstuff/clipPath4.svg\n\n    // However read the comments to dig into applying SVG clippaths to HTML content here:\n    //   github.com/Modernizr/Modernizr/issues/213#issuecomment-1149491\n    tests['svgclippaths'] = function() {\n        return !!document.createElementNS && /SVGClipPath/.test(toString.call(document.createElementNS(ns.svg, 'clipPath')));\n    };\n\n    /*>>webforms*/\n    // input features and input types go directly onto the ret object, bypassing the tests loop.\n    // Hold this guy to execute in a moment.\n    function webforms() {\n        /*>>input*/\n        // Run through HTML5's new input attributes to see if the UA understands any.\n        // We're using f which is the <input> element created early on\n        // Mike Taylr has created a comprehensive resource for testing these attributes\n        //   when applied to all input types:\n        //   miketaylr.com/code/input-type-attr.html\n        // spec: www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary\n\n        // Only input placeholder is tested while textarea's placeholder is not.\n        // Currently Safari 4 and Opera 11 have support only for the input placeholder\n        // Both tests are available in feature-detects/forms-placeholder.js\n        Modernizr['input'] = (function( props ) {\n            for ( var i = 0, len = props.length; i < len; i++ ) {\n                attrs[ props[i] ] = !!(props[i] in inputElem);\n            }\n            if (attrs.list){\n              // safari false positive's on datalist: webk.it/74252\n              // see also github.com/Modernizr/Modernizr/issues/146\n              attrs.list = !!(document.createElement('datalist') && window.HTMLDataListElement);\n            }\n            return attrs;\n        })('autocomplete autofocus list placeholder max min multiple pattern required step'.split(' '));\n        /*>>input*/\n\n        /*>>inputtypes*/\n        // Run through HTML5's new input types to see if the UA understands any.\n        //   This is put behind the tests runloop because it doesn't return a\n        //   true/false like all the other tests; instead, it returns an object\n        //   containing each input type with its corresponding true/false value\n\n        // Big thanks to @miketaylr for the html5 forms expertise. miketaylr.com/\n        Modernizr['inputtypes'] = (function(props) {\n\n            for ( var i = 0, bool, inputElemType, defaultView, len = props.length; i < len; i++ ) {\n\n                inputElem.setAttribute('type', inputElemType = props[i]);\n                bool = inputElem.type !== 'text';\n\n                // We first check to see if the type we give it sticks..\n                // If the type does, we feed it a textual value, which shouldn't be valid.\n                // If the value doesn't stick, we know there's input sanitization which infers a custom UI\n                if ( bool ) {\n\n                    inputElem.value         = smile;\n                    inputElem.style.cssText = 'position:absolute;visibility:hidden;';\n\n                    if ( /^range$/.test(inputElemType) && inputElem.style.WebkitAppearance !== undefined ) {\n\n                      docElement.appendChild(inputElem);\n                      defaultView = document.defaultView;\n\n                      // Safari 2-4 allows the smiley as a value, despite making a slider\n                      bool =  defaultView.getComputedStyle &&\n                              defaultView.getComputedStyle(inputElem, null).WebkitAppearance !== 'textfield' &&\n                              // Mobile android web browser has false positive, so must\n                              // check the height to see if the widget is actually there.\n                              (inputElem.offsetHeight !== 0);\n\n                      docElement.removeChild(inputElem);\n\n                    } else if ( /^(search|tel)$/.test(inputElemType) ){\n                      // Spec doesn't define any special parsing or detectable UI\n                      //   behaviors so we pass these through as true\n\n                      // Interestingly, opera fails the earlier test, so it doesn't\n                      //  even make it here.\n\n                    } else if ( /^(url|email)$/.test(inputElemType) ) {\n                      // Real url and email support comes with prebaked validation.\n                      bool = inputElem.checkValidity && inputElem.checkValidity() === false;\n\n                    } else {\n                      // If the upgraded input compontent rejects the :) text, we got a winner\n                      bool = inputElem.value != smile;\n                    }\n                }\n\n                inputs[ props[i] ] = !!bool;\n            }\n            return inputs;\n        })('search tel url email datetime date month week time datetime-local number range color'.split(' '));\n        /*>>inputtypes*/\n    }\n    /*>>webforms*/\n\n\n    // End of test definitions\n    // -----------------------\n\n\n\n    // Run through all tests and detect their support in the current UA.\n    // todo: hypothetically we could be doing an array of tests and use a basic loop here.\n    for ( var feature in tests ) {\n        if ( hasOwnProp(tests, feature) ) {\n            // run the test, throw the return value into the Modernizr,\n            //   then based on that boolean, define an appropriate className\n            //   and push it into an array of classes we'll join later.\n            featureName  = feature.toLowerCase();\n            Modernizr[featureName] = tests[feature]();\n\n            classes.push((Modernizr[featureName] ? '' : 'no-') + featureName);\n        }\n    }\n\n    /*>>webforms*/\n    // input tests need to run.\n    Modernizr.input || webforms();\n    /*>>webforms*/\n\n\n    /**\n     * addTest allows the user to define their own feature tests\n     * the result will be added onto the Modernizr object,\n     * as well as an appropriate className set on the html element\n     *\n     * @param feature - String naming the feature\n     * @param test - Function returning true if feature is supported, false if not\n     */\n     Modernizr.addTest = function ( feature, test ) {\n       if ( typeof feature == 'object' ) {\n         for ( var key in feature ) {\n           if ( hasOwnProp( feature, key ) ) {\n             Modernizr.addTest( key, feature[ key ] );\n           }\n         }\n       } else {\n\n         feature = feature.toLowerCase();\n\n         if ( Modernizr[feature] !== undefined ) {\n           // we're going to quit if you're trying to overwrite an existing test\n           // if we were to allow it, we'd do this:\n           //   var re = new RegExp(\"\\\\b(no-)?\" + feature + \"\\\\b\");\n           //   docElement.className = docElement.className.replace( re, '' );\n           // but, no rly, stuff 'em.\n           return Modernizr;\n         }\n\n         test = typeof test == 'function' ? test() : test;\n\n         if (typeof enableClasses !== \"undefined\" && enableClasses) {\n           docElement.className += ' ' + (test ? '' : 'no-') + feature;\n         }\n         Modernizr[feature] = test;\n\n       }\n\n       return Modernizr; // allow chaining.\n     };\n\n\n    // Reset modElem.cssText to nothing to reduce memory footprint.\n    setCss('');\n    modElem = inputElem = null;\n\n    /*>>shiv*/\n    /*! HTML5 Shiv v3.6.1 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed */\n    ;(function(window, document) {\n    /*jshint evil:true */\n      /** Preset options */\n      var options = window.html5 || {};\n\n      /** Used to skip problem elements */\n      var reSkip = /^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i;\n\n      /** Not all elements can be cloned in IE **/\n      var saveClones = /^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i;\n\n      /** Detect whether the browser supports default html5 styles */\n      var supportsHtml5Styles;\n\n      /** Name of the expando, to work with multiple documents or to re-shiv one document */\n      var expando = '_html5shiv';\n\n      /** The id for the the documents expando */\n      var expanID = 0;\n\n      /** Cached data for each document */\n      var expandoData = {};\n\n      /** Detect whether the browser supports unknown elements */\n      var supportsUnknownElements;\n\n      (function() {\n        try {\n            var a = document.createElement('a');\n            a.innerHTML = '<xyz></xyz>';\n            //if the hidden property is implemented we can assume, that the browser supports basic HTML5 Styles\n            supportsHtml5Styles = ('hidden' in a);\n\n            supportsUnknownElements = a.childNodes.length == 1 || (function() {\n              // assign a false positive if unable to shiv\n              (document.createElement)('a');\n              var frag = document.createDocumentFragment();\n              return (\n                typeof frag.cloneNode == 'undefined' ||\n                typeof frag.createDocumentFragment == 'undefined' ||\n                typeof frag.createElement == 'undefined'\n              );\n            }());\n        } catch(e) {\n          supportsHtml5Styles = true;\n          supportsUnknownElements = true;\n        }\n\n      }());\n\n      /*--------------------------------------------------------------------------*/\n\n      /**\n       * Creates a style sheet with the given CSS text and adds it to the document.\n       * @private\n       * @param {Document} ownerDocument The document.\n       * @param {String} cssText The CSS text.\n       * @returns {StyleSheet} The style element.\n       */\n      function addStyleSheet(ownerDocument, cssText) {\n        var p = ownerDocument.createElement('p'),\n            parent = ownerDocument.getElementsByTagName('head')[0] || ownerDocument.documentElement;\n\n        p.innerHTML = 'x<style>' + cssText + '</style>';\n        return parent.insertBefore(p.lastChild, parent.firstChild);\n      }\n\n      /**\n       * Returns the value of `html5.elements` as an array.\n       * @private\n       * @returns {Array} An array of shived element node names.\n       */\n      function getElements() {\n        var elements = html5.elements;\n        return typeof elements == 'string' ? elements.split(' ') : elements;\n      }\n\n        /**\n       * Returns the data associated to the given document\n       * @private\n       * @param {Document} ownerDocument The document.\n       * @returns {Object} An object of data.\n       */\n      function getExpandoData(ownerDocument) {\n        var data = expandoData[ownerDocument[expando]];\n        if (!data) {\n            data = {};\n            expanID++;\n            ownerDocument[expando] = expanID;\n            expandoData[expanID] = data;\n        }\n        return data;\n      }\n\n      /**\n       * returns a shived element for the given nodeName and document\n       * @memberOf html5\n       * @param {String} nodeName name of the element\n       * @param {Document} ownerDocument The context document.\n       * @returns {Object} The shived element.\n       */\n      function createElement(nodeName, ownerDocument, data){\n        if (!ownerDocument) {\n            ownerDocument = document;\n        }\n        if(supportsUnknownElements){\n            return ownerDocument.createElement(nodeName);\n        }\n        if (!data) {\n            data = getExpandoData(ownerDocument);\n        }\n        var node;\n\n        if (data.cache[nodeName]) {\n            node = data.cache[nodeName].cloneNode();\n        } else if (saveClones.test(nodeName)) {\n            node = (data.cache[nodeName] = data.createElem(nodeName)).cloneNode();\n        } else {\n            node = data.createElem(nodeName);\n        }\n\n        // Avoid adding some elements to fragments in IE < 9 because\n        // * Attributes like `name` or `type` cannot be set/changed once an element\n        //   is inserted into a document/fragment\n        // * Link elements with `src` attributes that are inaccessible, as with\n        //   a 403 response, will cause the tab/window to crash\n        // * Script elements appended to fragments will execute when their `src`\n        //   or `text` property is set\n        return node.canHaveChildren && !reSkip.test(nodeName) ? data.frag.appendChild(node) : node;\n      }\n\n      /**\n       * returns a shived DocumentFragment for the given document\n       * @memberOf html5\n       * @param {Document} ownerDocument The context document.\n       * @returns {Object} The shived DocumentFragment.\n       */\n      function createDocumentFragment(ownerDocument, data){\n        if (!ownerDocument) {\n            ownerDocument = document;\n        }\n        if(supportsUnknownElements){\n            return ownerDocument.createDocumentFragment();\n        }\n        data = data || getExpandoData(ownerDocument);\n        var clone = data.frag.cloneNode(),\n            i = 0,\n            elems = getElements(),\n            l = elems.length;\n        for(;i<l;i++){\n            clone.createElement(elems[i]);\n        }\n        return clone;\n      }\n\n      /**\n       * Shivs the `createElement` and `createDocumentFragment` methods of the document.\n       * @private\n       * @param {Document|DocumentFragment} ownerDocument The document.\n       * @param {Object} data of the document.\n       */\n      function shivMethods(ownerDocument, data) {\n        if (!data.cache) {\n            data.cache = {};\n            data.createElem = ownerDocument.createElement;\n            data.createFrag = ownerDocument.createDocumentFragment;\n            data.frag = data.createFrag();\n        }\n\n\n        ownerDocument.createElement = function(nodeName) {\n          //abort shiv\n          if (!html5.shivMethods) {\n              return data.createElem(nodeName);\n          }\n          return createElement(nodeName, ownerDocument, data);\n        };\n\n        ownerDocument.createDocumentFragment = Function('h,f', 'return function(){' +\n          'var n=f.cloneNode(),c=n.createElement;' +\n          'h.shivMethods&&(' +\n            // unroll the `createElement` calls\n            getElements().join().replace(/\\w+/g, function(nodeName) {\n              data.createElem(nodeName);\n              data.frag.createElement(nodeName);\n              return 'c(\"' + nodeName + '\")';\n            }) +\n          ');return n}'\n        )(html5, data.frag);\n      }\n\n      /*--------------------------------------------------------------------------*/\n\n      /**\n       * Shivs the given document.\n       * @memberOf html5\n       * @param {Document} ownerDocument The document to shiv.\n       * @returns {Document} The shived document.\n       */\n      function shivDocument(ownerDocument) {\n        if (!ownerDocument) {\n            ownerDocument = document;\n        }\n        var data = getExpandoData(ownerDocument);\n\n        if (html5.shivCSS && !supportsHtml5Styles && !data.hasCSS) {\n          data.hasCSS = !!addStyleSheet(ownerDocument,\n            // corrects block display not defined in IE6/7/8/9\n            'article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}' +\n            // adds styling not present in IE6/7/8/9\n            'mark{background:#FF0;color:#000}'\n          );\n        }\n        if (!supportsUnknownElements) {\n          shivMethods(ownerDocument, data);\n        }\n        return ownerDocument;\n      }\n\n      /*--------------------------------------------------------------------------*/\n\n      /**\n       * The `html5` object is exposed so that more elements can be shived and\n       * existing shiving can be detected on iframes.\n       * @type Object\n       * @example\n       *\n       * // options can be changed before the script is included\n       * html5 = { 'elements': 'mark section', 'shivCSS': false, 'shivMethods': false };\n       */\n      var html5 = {\n\n        /**\n         * An array or space separated string of node names of the elements to shiv.\n         * @memberOf html5\n         * @type Array|String\n         */\n        'elements': options.elements || 'abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video',\n\n        /**\n         * A flag to indicate that the HTML5 style sheet should be inserted.\n         * @memberOf html5\n         * @type Boolean\n         */\n        'shivCSS': (options.shivCSS !== false),\n\n        /**\n         * Is equal to true if a browser supports creating unknown/HTML5 elements\n         * @memberOf html5\n         * @type boolean\n         */\n        'supportsUnknownElements': supportsUnknownElements,\n\n        /**\n         * A flag to indicate that the document's `createElement` and `createDocumentFragment`\n         * methods should be overwritten.\n         * @memberOf html5\n         * @type Boolean\n         */\n        'shivMethods': (options.shivMethods !== false),\n\n        /**\n         * A string to describe the type of `html5` object (\"default\" or \"default print\").\n         * @memberOf html5\n         * @type String\n         */\n        'type': 'default',\n\n        // shivs the document according to the specified `html5` object options\n        'shivDocument': shivDocument,\n\n        //creates a shived element\n        createElement: createElement,\n\n        //creates a shived documentFragment\n        createDocumentFragment: createDocumentFragment\n      };\n\n      /*--------------------------------------------------------------------------*/\n\n      // expose html5\n      window.html5 = html5;\n\n      // shiv the document\n      shivDocument(document);\n\n    }(this, document));\n    /*>>shiv*/\n\n    // Assign private properties to the return object with prefix\n    Modernizr._version      = version;\n\n    // expose these for the plugin API. Look in the source for how to join() them against your input\n    /*>>prefixes*/\n    Modernizr._prefixes     = prefixes;\n    /*>>prefixes*/\n    /*>>domprefixes*/\n    Modernizr._domPrefixes  = domPrefixes;\n    Modernizr._cssomPrefixes  = cssomPrefixes;\n    /*>>domprefixes*/\n\n    /*>>mq*/\n    // Modernizr.mq tests a given media query, live against the current state of the window\n    // A few important notes:\n    //   * If a browser does not support media queries at all (eg. oldIE) the mq() will always return false\n    //   * A max-width or orientation query will be evaluated against the current state, which may change later.\n    //   * You must specify values. Eg. If you are testing support for the min-width media query use:\n    //       Modernizr.mq('(min-width:0)')\n    // usage:\n    // Modernizr.mq('only screen and (max-width:768)')\n    Modernizr.mq            = testMediaQuery;\n    /*>>mq*/\n\n    /*>>hasevent*/\n    // Modernizr.hasEvent() detects support for a given event, with an optional element to test on\n    // Modernizr.hasEvent('gesturestart', elem)\n    Modernizr.hasEvent      = isEventSupported;\n    /*>>hasevent*/\n\n    /*>>testprop*/\n    // Modernizr.testProp() investigates whether a given style property is recognized\n    // Note that the property names must be provided in the camelCase variant.\n    // Modernizr.testProp('pointerEvents')\n    Modernizr.testProp      = function(prop){\n        return testProps([prop]);\n    };\n    /*>>testprop*/\n\n    /*>>testallprops*/\n    // Modernizr.testAllProps() investigates whether a given style property,\n    //   or any of its vendor-prefixed variants, is recognized\n    // Note that the property names must be provided in the camelCase variant.\n    // Modernizr.testAllProps('boxSizing')\n    Modernizr.testAllProps  = testPropsAll;\n    /*>>testallprops*/\n\n\n    /*>>teststyles*/\n    // Modernizr.testStyles() allows you to add custom styles to the document and test an element afterwards\n    // Modernizr.testStyles('#modernizr { position:absolute }', function(elem, rule){ ... })\n    Modernizr.testStyles    = injectElementWithStyles;\n    /*>>teststyles*/\n\n\n    /*>>prefixed*/\n    // Modernizr.prefixed() returns the prefixed or nonprefixed property name variant of your input\n    // Modernizr.prefixed('boxSizing') // 'MozBoxSizing'\n\n    // Properties must be passed as dom-style camelcase, rather than `box-sizing` hypentated style.\n    // Return values will also be the camelCase variant, if you need to translate that to hypenated style use:\n    //\n    //     str.replace(/([A-Z])/g, function(str,m1){ return '-' + m1.toLowerCase(); }).replace(/^ms-/,'-ms-');\n\n    // If you're trying to ascertain which transition end event to bind to, you might do something like...\n    //\n    //     var transEndEventNames = {\n    //       'WebkitTransition' : 'webkitTransitionEnd',\n    //       'MozTransition'    : 'transitionend',\n    //       'OTransition'      : 'oTransitionEnd',\n    //       'msTransition'     : 'MSTransitionEnd',\n    //       'transition'       : 'transitionend'\n    //     },\n    //     transEndEventName = transEndEventNames[ Modernizr.prefixed('transition') ];\n\n    Modernizr.prefixed      = function(prop, obj, elem){\n      if(!obj) {\n        return testPropsAll(prop, 'pfx');\n      } else {\n        // Testing DOM property e.g. Modernizr.prefixed('requestAnimationFrame', window) // 'mozRequestAnimationFrame'\n        return testPropsAll(prop, obj, elem);\n      }\n    };\n    /*>>prefixed*/\n\n\n    /*>>cssclasses*/\n    // Remove \"no-js\" class from <html> element, if it exists:\n    docElement.className = docElement.className.replace(/(^|\\s)no-js(\\s|$)/, '$1$2') +\n\n                            // Add the new classes to the <html> element.\n                            (enableClasses ? ' js ' + classes.join(' ') : '');\n    /*>>cssclasses*/\n\n    return Modernizr;\n\n})(this, this.document);\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/SlabReconfigurationWebRole.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProductVersion>\n    </ProductVersion>\n    <SchemaVersion>2.0</SchemaVersion>\n    <ProjectGuid>{33F16A52-A92B-4138-AC8B-1D34993C69F0}</ProjectGuid>\n    <ProjectTypeGuids>{E3E379DF-F4C6-4180-9B81-6769533ABE47};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>\n    <OutputType>Library</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>SlabReconfigurationWebRole</RootNamespace>\n    <AssemblyName>SlabReconfigurationWebRole</AssemblyName>\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\n    <MvcBuildViews>false</MvcBuildViews>\n    <UseIISExpress>true</UseIISExpress>\n    <IISExpressSSLPort />\n    <IISExpressAnonymousAuthentication />\n    <IISExpressWindowsAuthentication />\n    <IISExpressUseClassicPipelineMode />\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"Microsoft.Data.Edm, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\packages\\Microsoft.Data.Edm.5.2.0\\lib\\net40\\Microsoft.Data.Edm.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Data.OData, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\packages\\Microsoft.Data.OData.5.2.0\\lib\\net40\\Microsoft.Data.OData.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging\">\n      <HintPath>..\\packages\\EnterpriseLibrary.SemanticLogging.1.0.1304.0\\lib\\NET45\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.WindowsAzure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\packages\\EnterpriseLibrary.SemanticLogging.WindowsAzure.1.0.1304.1\\lib\\NET45\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.WindowsAzure.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.WindowsAzure.Configuration, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\Microsoft.WindowsAzure.ConfigurationManager.1.8.0.0\\lib\\net35-full\\Microsoft.WindowsAzure.Configuration.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.WindowsAzure.Diagnostics, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\">\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"Microsoft.WindowsAzure.ServiceRuntime, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\">\n      <Private>False</Private>\n    </Reference>\n    <Reference Include=\"Microsoft.WindowsAzure.Storage, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\WindowsAzure.Storage.2.0.5.1\\lib\\net40\\Microsoft.WindowsAzure.Storage.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Data.Entity\" />\n    <Reference Include=\"System.Data.Services.Client\" />\n    <Reference Include=\"System.Drawing\" />\n    <Reference Include=\"System.Spatial, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\packages\\System.Spatial.5.2.0\\lib\\net40\\System.Spatial.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Web.DynamicData\" />\n    <Reference Include=\"System.Web.Entity\" />\n    <Reference Include=\"System.Web.ApplicationServices\" />\n    <Reference Include=\"System.ComponentModel.DataAnnotations\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Web\" />\n    <Reference Include=\"System.Web.Extensions\" />\n    <Reference Include=\"System.Web.Abstractions\" />\n    <Reference Include=\"System.Web.Routing\" />\n    <Reference Include=\"System.Xml\" />\n    <Reference Include=\"System.Configuration\" />\n    <Reference Include=\"System.Web.Services\" />\n    <Reference Include=\"System.EnterpriseServices\" />\n    <Reference Include=\"EntityFramework\">\n      <HintPath>..\\packages\\EntityFramework.5.0.0\\lib\\net45\\EntityFramework.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <Private>True</Private>\n      <HintPath>..\\packages\\Microsoft.Web.Infrastructure.1.0.0.0\\lib\\net40\\Microsoft.Web.Infrastructure.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Web.Mvc.FixedDisplayModes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <Private>True</Private>\n      <HintPath>..\\packages\\Microsoft.AspNet.Mvc.FixedDisplayModes.1.0.0\\lib\\net40\\Microsoft.Web.Mvc.FixedDisplayModes.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Newtonsoft.Json\">\n      <HintPath>..\\packages\\Newtonsoft.Json.4.5.11\\lib\\net40\\Newtonsoft.Json.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Net.Http\">\n    </Reference>\n    <Reference Include=\"System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\Microsoft.AspNet.WebApi.Client.4.0.20710.0\\lib\\net40\\System.Net.Http.Formatting.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Net.Http.WebRequest\">\n    </Reference>\n    <Reference Include=\"System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\Microsoft.AspNet.WebApi.Core.4.0.20710.0\\lib\\net40\\System.Web.Http.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\packages\\Microsoft.AspNet.WebApi.WebHost.4.0.20710.0\\lib\\net40\\System.Web.Http.WebHost.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <Private>True</Private>\n      <HintPath>..\\packages\\Microsoft.AspNet.Mvc.4.0.20710.0\\lib\\net40\\System.Web.Mvc.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Web.Optimization\">\n      <HintPath>..\\packages\\Microsoft.AspNet.Web.Optimization.1.0.0\\lib\\net40\\System.Web.Optimization.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Web.Providers\">\n      <HintPath>..\\packages\\Microsoft.AspNet.Providers.Core.1.2\\lib\\net40\\System.Web.Providers.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <Private>True</Private>\n      <HintPath>..\\packages\\Microsoft.AspNet.Razor.2.0.20715.0\\lib\\net40\\System.Web.Razor.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <Private>True</Private>\n      <HintPath>..\\packages\\Microsoft.AspNet.WebPages.2.0.20710.0\\lib\\net40\\System.Web.WebPages.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <Private>True</Private>\n      <HintPath>..\\packages\\Microsoft.AspNet.WebPages.2.0.20710.0\\lib\\net40\\System.Web.WebPages.Deployment.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <Private>True</Private>\n      <HintPath>..\\packages\\Microsoft.AspNet.WebPages.2.0.20710.0\\lib\\net40\\System.Web.WebPages.Razor.dll</HintPath>\n    </Reference>\n    <Reference Include=\"WebGrease\">\n      <Private>True</Private>\n      <HintPath>..\\packages\\WebGrease.1.3.0\\lib\\WebGrease.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Antlr3.Runtime\">\n      <Private>True</Private>\n      <HintPath>..\\packages\\WebGrease.1.3.0\\lib\\Antlr3.Runtime.dll</HintPath>\n    </Reference>\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"App_Start\\BundleConfig.cs\" />\n    <Compile Include=\"App_Start\\FilterConfig.cs\" />\n    <Compile Include=\"App_Start\\RouteConfig.cs\" />\n    <Compile Include=\"App_Start\\WebApiConfig.cs\" />\n    <Compile Include=\"Controllers\\HomeController.cs\" />\n    <Compile Include=\"Events\\QuickStartEventSource.cs\" />\n    <Compile Include=\"Global.asax.cs\">\n      <DependentUpon>Global.asax</DependentUpon>\n    </Compile>\n    <Compile Include=\"Global.asax.slab.cs\" />\n    <Compile Include=\"Messaging\\FakeMessageSender.cs\" />\n    <Compile Include=\"Messaging\\IMessageSender.cs\" />\n    <Compile Include=\"Models\\MessageModel.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n    <Compile Include=\"WebRole.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Content Include=\"Content\\themes\\base\\images\\ui-bg_flat_0_aaaaaa_40x100.png\" />\n    <Content Include=\"Content\\themes\\base\\images\\ui-bg_flat_75_ffffff_40x100.png\" />\n    <Content Include=\"Content\\themes\\base\\images\\ui-bg_glass_55_fbf9ee_1x400.png\" />\n    <Content Include=\"Content\\themes\\base\\images\\ui-bg_glass_65_ffffff_1x400.png\" />\n    <Content Include=\"Content\\themes\\base\\images\\ui-bg_glass_75_dadada_1x400.png\" />\n    <Content Include=\"Content\\themes\\base\\images\\ui-bg_glass_75_e6e6e6_1x400.png\" />\n    <Content Include=\"Content\\themes\\base\\images\\ui-bg_glass_95_fef1ec_1x400.png\" />\n    <Content Include=\"Content\\themes\\base\\images\\ui-bg_highlight-soft_75_cccccc_1x100.png\" />\n    <Content Include=\"Content\\themes\\base\\images\\ui-icons_222222_256x240.png\" />\n    <Content Include=\"Content\\themes\\base\\images\\ui-icons_2e83ff_256x240.png\" />\n    <Content Include=\"Content\\themes\\base\\images\\ui-icons_454545_256x240.png\" />\n    <Content Include=\"Content\\themes\\base\\images\\ui-icons_888888_256x240.png\" />\n    <Content Include=\"Content\\themes\\base\\images\\ui-icons_cd0a0a_256x240.png\" />\n    <Content Include=\"Content\\themes\\base\\jquery-ui.css\" />\n    <Content Include=\"Content\\themes\\base\\jquery.ui.accordion.css\" />\n    <Content Include=\"Content\\themes\\base\\jquery.ui.all.css\" />\n    <Content Include=\"Content\\themes\\base\\jquery.ui.autocomplete.css\" />\n    <Content Include=\"Content\\themes\\base\\jquery.ui.base.css\" />\n    <Content Include=\"Content\\themes\\base\\jquery.ui.button.css\" />\n    <Content Include=\"Content\\themes\\base\\jquery.ui.core.css\" />\n    <Content Include=\"Content\\themes\\base\\jquery.ui.datepicker.css\" />\n    <Content Include=\"Content\\themes\\base\\jquery.ui.dialog.css\" />\n    <Content Include=\"Content\\themes\\base\\jquery.ui.progressbar.css\" />\n    <Content Include=\"Content\\themes\\base\\jquery.ui.resizable.css\" />\n    <Content Include=\"Content\\themes\\base\\jquery.ui.selectable.css\" />\n    <Content Include=\"Content\\themes\\base\\jquery.ui.slider.css\" />\n    <Content Include=\"Content\\themes\\base\\jquery.ui.tabs.css\" />\n    <Content Include=\"Content\\themes\\base\\jquery.ui.theme.css\" />\n    <Content Include=\"Content\\themes\\base\\minified\\images\\ui-bg_flat_0_aaaaaa_40x100.png\" />\n    <Content Include=\"Content\\themes\\base\\minified\\images\\ui-bg_flat_75_ffffff_40x100.png\" />\n    <Content Include=\"Content\\themes\\base\\minified\\images\\ui-bg_glass_55_fbf9ee_1x400.png\" />\n    <Content Include=\"Content\\themes\\base\\minified\\images\\ui-bg_glass_65_ffffff_1x400.png\" />\n    <Content Include=\"Content\\themes\\base\\minified\\images\\ui-bg_glass_75_dadada_1x400.png\" />\n    <Content Include=\"Content\\themes\\base\\minified\\images\\ui-bg_glass_75_e6e6e6_1x400.png\" />\n    <Content Include=\"Content\\themes\\base\\minified\\images\\ui-bg_glass_95_fef1ec_1x400.png\" />\n    <Content Include=\"Content\\themes\\base\\minified\\images\\ui-bg_highlight-soft_75_cccccc_1x100.png\" />\n    <Content Include=\"Content\\themes\\base\\minified\\images\\ui-icons_222222_256x240.png\" />\n    <Content Include=\"Content\\themes\\base\\minified\\images\\ui-icons_2e83ff_256x240.png\" />\n    <Content Include=\"Content\\themes\\base\\minified\\images\\ui-icons_454545_256x240.png\" />\n    <Content Include=\"Content\\themes\\base\\minified\\images\\ui-icons_888888_256x240.png\" />\n    <Content Include=\"Content\\themes\\base\\minified\\images\\ui-icons_cd0a0a_256x240.png\" />\n    <Content Include=\"Content\\themes\\base\\minified\\jquery-ui.min.css\" />\n    <Content Include=\"Content\\themes\\base\\minified\\jquery.ui.accordion.min.css\" />\n    <Content Include=\"Content\\themes\\base\\minified\\jquery.ui.autocomplete.min.css\" />\n    <Content Include=\"Content\\themes\\base\\minified\\jquery.ui.button.min.css\" />\n    <Content Include=\"Content\\themes\\base\\minified\\jquery.ui.core.min.css\" />\n    <Content Include=\"Content\\themes\\base\\minified\\jquery.ui.datepicker.min.css\" />\n    <Content Include=\"Content\\themes\\base\\minified\\jquery.ui.dialog.min.css\" />\n    <Content Include=\"Content\\themes\\base\\minified\\jquery.ui.progressbar.min.css\" />\n    <Content Include=\"Content\\themes\\base\\minified\\jquery.ui.resizable.min.css\" />\n    <Content Include=\"Content\\themes\\base\\minified\\jquery.ui.selectable.min.css\" />\n    <Content Include=\"Content\\themes\\base\\minified\\jquery.ui.slider.min.css\" />\n    <Content Include=\"Content\\themes\\base\\minified\\jquery.ui.tabs.min.css\" />\n    <Content Include=\"Content\\themes\\base\\minified\\jquery.ui.theme.min.css\" />\n    <Content Include=\"Global.asax\" />\n    <Content Include=\"Content\\Site.css\" />\n    <Content Include=\"EntLib.licenseheader\" />\n    <Content Include=\"diagnostics.wadcfg\">\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"SlabReconfigurationWebRole.dll.config\">\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <None Include=\"Scripts\\jquery-1.8.2.intellisense.js\" />\n    <Content Include=\"Scripts\\jquery-1.8.2.js\" />\n    <Content Include=\"Scripts\\jquery-1.8.2.min.js\" />\n    <None Include=\"Scripts\\jquery.validate-vsdoc.js\" />\n    <Content Include=\"Scripts\\jquery-ui-1.8.24.js\" />\n    <Content Include=\"Scripts\\jquery-ui-1.8.24.min.js\" />\n    <Content Include=\"Scripts\\jquery.unobtrusive-ajax.js\" />\n    <Content Include=\"Scripts\\jquery.unobtrusive-ajax.min.js\" />\n    <Content Include=\"Scripts\\jquery.validate.js\" />\n    <Content Include=\"Scripts\\jquery.validate.min.js\" />\n    <Content Include=\"Scripts\\jquery.validate.unobtrusive.js\" />\n    <Content Include=\"Scripts\\jquery.validate.unobtrusive.min.js\" />\n    <Content Include=\"Scripts\\knockout-2.2.0.debug.js\" />\n    <Content Include=\"Scripts\\knockout-2.2.0.js\" />\n    <Content Include=\"Scripts\\modernizr-2.6.2.js\" />\n    <Content Include=\"Scripts\\_references.js\" />\n    <Content Include=\"Web.config\" />\n    <Content Include=\"Web.Debug.config\">\n      <DependentUpon>Web.config</DependentUpon>\n    </Content>\n    <Content Include=\"Web.Release.config\">\n      <DependentUpon>Web.config</DependentUpon>\n    </Content>\n    <Content Include=\"Views\\Web.config\" />\n    <Content Include=\"Views\\_ViewStart.cshtml\" />\n    <Content Include=\"Views\\Shared\\Error.cshtml\" />\n    <Content Include=\"Views\\Shared\\_Layout.cshtml\" />\n    <Content Include=\"Views\\Home\\Index.cshtml\" />\n    <Content Include=\"Views\\Home\\Error.cshtml\" />\n    <Content Include=\"Views\\Home\\Success.cshtml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Folder Include=\"App_Data\\\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Content Include=\"packages.config\">\n      <SubType>Designer</SubType>\n    </Content>\n  </ItemGroup>\n  <ItemGroup>\n    <WCFMetadata Include=\"Service References\\\" />\n  </ItemGroup>\n  <PropertyGroup>\n    <VisualStudioVersion Condition=\"'$(VisualStudioVersion)' == ''\">10.0</VisualStudioVersion>\n    <VSToolsPath Condition=\"'$(VSToolsPath)' == ''\">$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)</VSToolsPath>\n  </PropertyGroup>\n  <Import Project=\"$(MSBuildBinPath)\\Microsoft.CSharp.targets\" />\n  <Import Project=\"$(VSToolsPath)\\WebApplications\\Microsoft.WebApplication.targets\" Condition=\"'$(VSToolsPath)' != ''\" />\n  <Import Project=\"$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v10.0\\WebApplications\\Microsoft.WebApplication.targets\" Condition=\"false\" />\n  <Target Name=\"MvcBuildViews\" AfterTargets=\"AfterBuild\" Condition=\"'$(MvcBuildViews)'=='true'\">\n    <AspNetCompiler VirtualPath=\"temp\" PhysicalPath=\"$(WebProjectOutputDir)\" />\n  </Target>\n  <ProjectExtensions>\n    <VisualStudio>\n      <FlavorProperties GUID=\"{349c5851-65df-11da-9384-00065b846f21}\">\n        <WebProjectProperties>\n          <UseIIS>True</UseIIS>\n          <AutoAssignPort>True</AutoAssignPort>\n          <DevelopmentServerPort>0</DevelopmentServerPort>\n          <DevelopmentServerVPath>/</DevelopmentServerVPath>\n          <IISUrl>http://localhost:11444/</IISUrl>\n          <NTLMAuthentication>False</NTLMAuthentication>\n          <UseCustomServer>False</UseCustomServer>\n          <CustomServerUrl>\n          </CustomServerUrl>\n          <SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>\n        </WebProjectProperties>\n      </FlavorProperties>\n    </VisualStudio>\n  </ProjectExtensions>\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target> -->\n</Project>"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/SlabReconfigurationWebRole.dll.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n  <system.diagnostics>\n    <trace>\n      <listeners>\n        <add type=\"Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\" name=\"AzureDiagnostics\">\n        </add>\n      </listeners>\n    </trace>\n  </system.diagnostics>\n</configuration>"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Views/Home/Error.cshtml",
    "content": "﻿@model string\n\n@{\n    ViewBag.Title = \"Error\";\n}\n\n<h2>An error occurred</h2>\n\n@Model\n\nPlease check your logs\n\n<br />\n\n@Html.ActionLink(\"Continue\", \"Index\")\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Views/Home/Index.cshtml",
    "content": "﻿@model SlabReconfigurationWebRole.Models.MessageModel\n\n@{\n    ViewBag.Title = \"Send a message!\";\n}\n\n<h2>Send a message</h2>\n@using (Html.BeginForm(\"SendMessage\", \"Home\"))\n{\n    @Html.ValidationSummary(true)\n\n    <fieldset>\n        <div class=\"editor-label\">\n            @Html.LabelFor(model => model.Recipient)\n        </div>\n        <div class=\"editor-field\">\n            @Html.EditorFor(model => model.Recipient)\n            @Html.ValidationMessageFor(model => model.Recipient)\n        </div>\n\n        <div class=\"editor-label\">\n            @Html.LabelFor(model => model.Message)\n        </div>\n        <div class=\"editor-field\">\n            @Html.EditorFor(model => model.Message)\n            @Html.ValidationMessageFor(model => model.Message)\n        </div>\n\n        <p>\n            <input id=\"Send\" type=\"submit\" value=\"Send!\" />\n        </p>\n    </fieldset>\n}\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Views/Home/Success.cshtml",
    "content": "﻿@{\n    ViewBag.Title = \"Success\";\n}\n\n<h2>The message was successfully sent</h2>\n\n@Html.ActionLink(\"Continue\", \"Index\")\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Views/Shared/Error.cshtml",
    "content": "﻿@{\n    Layout = null;\n}\n\n<!DOCTYPE html>\n<html>\n<head>\n    <meta name=\"viewport\" content=\"width=device-width\" />\n    <title>Error</title>\n</head>\n<body>\n    <hgroup>\n        <h1>Error.</h1>\n        <h2>An error occurred while processing your request.</h2>\n    </hgroup>\n</body>\n</html>"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Views/Shared/_Layout.cshtml",
    "content": "﻿<!DOCTYPE html>\n<html>\n<head>\n    <meta charset=\"utf-8\" />\n    <meta name=\"viewport\" content=\"width=device-width\" />\n    <title>@ViewBag.Title</title>\n    @Styles.Render(\"~/Content/css\")\n    @Scripts.Render(\"~/bundles/modernizr\")\n</head>\n<body>\n    <header>\n        <div>\n            <h1>Semantic Logging Application Block</h1>\n            <h1>Reconfiguration Quick Start</h1>\n        </div>\n    </header>\n    @RenderBody()\n\n    @Scripts.Render(\"~/bundles/jquery\")\n    @RenderSection(\"scripts\", required: false)\n</body>\n</html>\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Views/Web.config",
    "content": "﻿<?xml version=\"1.0\"?>\n\n<configuration>\n  <configSections>\n    <sectionGroup name=\"system.web.webPages.razor\" type=\"System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\">\n      <section name=\"host\" type=\"System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" requirePermission=\"false\" />\n      <section name=\"pages\" type=\"System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" requirePermission=\"false\" />\n    </sectionGroup>\n  </configSections>\n\n  <system.web.webPages.razor>\n    <host factoryType=\"System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" />\n    <pages pageBaseType=\"System.Web.Mvc.WebViewPage\">\n      <namespaces>\n        <add namespace=\"System.Web.Mvc\" />\n        <add namespace=\"System.Web.Mvc.Ajax\" />\n        <add namespace=\"System.Web.Mvc.Html\" />\n        <add namespace=\"System.Web.Optimization\"/>\n        <add namespace=\"System.Web.Routing\" />\n      </namespaces>\n    </pages>\n  </system.web.webPages.razor>\n\n  <appSettings>\n    <add key=\"webpages:Enabled\" value=\"false\" />\n  </appSettings>\n\n  <system.web>\n    <httpHandlers>\n      <add path=\"*\" verb=\"*\" type=\"System.Web.HttpNotFoundHandler\"/>\n    </httpHandlers>\n\n    <!--\n        Enabling request validation in view pages would cause validation to occur\n        after the input has already been processed by the controller. By default\n        MVC performs request validation before a controller processes the input.\n        To change this behavior apply the ValidateInputAttribute to a\n        controller or action.\n    -->\n    <pages\n        validateRequest=\"false\"\n        pageParserFilterType=\"System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\"\n        pageBaseType=\"System.Web.Mvc.ViewPage, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\"\n        userControlBaseType=\"System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\">\n      <controls>\n        <add assembly=\"System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35\" namespace=\"System.Web.Mvc\" tagPrefix=\"mvc\" />\n      </controls>\n    </pages>\n  </system.web>\n\n  <system.webServer>\n    <validation validateIntegratedModeConfiguration=\"false\" />\n\n    <handlers>\n      <remove name=\"BlockViewHandler\"/>\n      <add name=\"BlockViewHandler\" path=\"*\" verb=\"*\" preCondition=\"integratedMode\" type=\"System.Web.HttpNotFoundHandler\" />\n    </handlers>\n  </system.webServer>\n</configuration>\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Views/_ViewStart.cshtml",
    "content": "﻿@{\n    Layout = \"~/Views/Shared/_Layout.cshtml\";\n}"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Web.Debug.config",
    "content": "﻿<?xml version=\"1.0\"?>\n\n<!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->\n\n<configuration xmlns:xdt=\"http://schemas.microsoft.com/XML-Document-Transform\">\n  <!--\n    In the example below, the \"SetAttributes\" transform will change the value of \n    \"connectionString\" to use \"ReleaseSQLServer\" only when the \"Match\" locator \n    finds an atrribute \"name\" that has a value of \"MyDB\".\n    \n    <connectionStrings>\n      <add name=\"MyDB\" \n        connectionString=\"Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True\" \n        xdt:Transform=\"SetAttributes\" xdt:Locator=\"Match(name)\"/>\n    </connectionStrings>\n  -->\n  <system.web>\n    <!--\n      In the example below, the \"Replace\" transform will replace the entire \n      <customErrors> section of your Web.config file.\n      Note that because there is only one customErrors section under the \n      <system.web> node, there is no need to use the \"xdt:Locator\" attribute.\n      \n      <customErrors defaultRedirect=\"GenericError.htm\"\n        mode=\"RemoteOnly\" xdt:Transform=\"Replace\">\n        <error statusCode=\"500\" redirect=\"InternalError.htm\"/>\n      </customErrors>\n    -->\n  </system.web>\n</configuration>"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Web.Release.config",
    "content": "﻿<?xml version=\"1.0\"?>\n\n<!-- For more information on using Web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->\n\n<configuration xmlns:xdt=\"http://schemas.microsoft.com/XML-Document-Transform\">\n  <!--\n    In the example below, the \"SetAttributes\" transform will change the value of \n    \"connectionString\" to use \"ReleaseSQLServer\" only when the \"Match\" locator \n    finds an atrribute \"name\" that has a value of \"MyDB\".\n    \n    <connectionStrings>\n      <add name=\"MyDB\" \n        connectionString=\"Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True\" \n        xdt:Transform=\"SetAttributes\" xdt:Locator=\"Match(name)\"/>\n    </connectionStrings>\n  -->\n  <system.web>\n    <compilation xdt:Transform=\"RemoveAttributes(debug)\" />\n    <!--\n      In the example below, the \"Replace\" transform will replace the entire \n      <customErrors> section of your Web.config file.\n      Note that because there is only one customErrors section under the \n      <system.web> node, there is no need to use the \"xdt:Locator\" attribute.\n      \n      <customErrors defaultRedirect=\"GenericError.htm\"\n        mode=\"RemoteOnly\" xdt:Transform=\"Replace\">\n        <error statusCode=\"500\" redirect=\"InternalError.htm\"/>\n      </customErrors>\n    -->\n  </system.web>\n</configuration>"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/Web.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  For more information on how to configure your ASP.NET application, please visit\n  http://go.microsoft.com/fwlink/?LinkId=152368\n  -->\n<configuration>\n  <configSections>\n    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->\n    <section name=\"entityFramework\" type=\"System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" requirePermission=\"false\" />\n  </configSections>\n  <system.diagnostics>\n    <trace>\n      <listeners>\n        <add type=\"Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\" name=\"AzureDiagnostics\">\n        </add>\n      </listeners>\n    </trace>\n  </system.diagnostics>\n  <connectionStrings>\n    <add name=\"DefaultConnection\" providerName=\"System.Data.SqlClient\" connectionString=\"Data Source=(LocalDb)\\v11.0;Initial Catalog=aspnet-SlabReconfigurationWebRole-20130429162346;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\\aspnet-SlabReconfigurationWebRole-20130429162346.mdf\" />\n  </connectionStrings>\n  <appSettings>\n    <add key=\"webpages:Version\" value=\"2.0.0.0\" />\n    <add key=\"webpages:Enabled\" value=\"false\" />\n    <add key=\"PreserveLoginUrl\" value=\"true\" />\n    <add key=\"ClientValidationEnabled\" value=\"true\" />\n    <add key=\"UnobtrusiveJavaScriptEnabled\" value=\"true\" />\n  </appSettings>\n  <system.web>\n    <httpRuntime targetFramework=\"4.5\" />\n    <compilation debug=\"true\" targetFramework=\"4.5\" />\n    <authentication mode=\"Forms\">\n      <forms loginUrl=\"~/Account/Login\" timeout=\"2880\" />\n    </authentication>\n    <pages>\n      <namespaces>\n        <add namespace=\"System.Web.Helpers\" />\n        <add namespace=\"System.Web.Mvc\" />\n        <add namespace=\"System.Web.Mvc.Ajax\" />\n        <add namespace=\"System.Web.Mvc.Html\" />\n        <add namespace=\"System.Web.Optimization\" />\n        <add namespace=\"System.Web.Routing\" />\n        <add namespace=\"System.Web.WebPages\" />\n      </namespaces>\n    </pages>\n    <profile defaultProvider=\"DefaultProfileProvider\">\n      <providers>\n        <add name=\"DefaultProfileProvider\" type=\"System.Web.Providers.DefaultProfileProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\" connectionStringName=\"DefaultConnection\" applicationName=\"/\" />\n      </providers>\n    </profile>\n    <membership defaultProvider=\"DefaultMembershipProvider\">\n      <providers>\n        <add name=\"DefaultMembershipProvider\" type=\"System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\" connectionStringName=\"DefaultConnection\" enablePasswordRetrieval=\"false\" enablePasswordReset=\"true\" requiresQuestionAndAnswer=\"false\" requiresUniqueEmail=\"false\" maxInvalidPasswordAttempts=\"5\" minRequiredPasswordLength=\"6\" minRequiredNonalphanumericCharacters=\"0\" passwordAttemptWindow=\"10\" applicationName=\"/\" />\n      </providers>\n    </membership>\n    <roleManager defaultProvider=\"DefaultRoleProvider\">\n      <providers>\n        <add name=\"DefaultRoleProvider\" type=\"System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\" connectionStringName=\"DefaultConnection\" applicationName=\"/\" />\n      </providers>\n    </roleManager>\n    <!--\n            If you are deploying to a cloud environment that has multiple web server instances,\n            you should change session state mode from \"InProc\" to \"Custom\". In addition,\n            change the connection string named \"DefaultConnection\" to connect to an instance\n            of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express.\n      -->\n    <sessionState mode=\"InProc\" customProvider=\"DefaultSessionProvider\">\n      <providers>\n        <add name=\"DefaultSessionProvider\" type=\"System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\" connectionStringName=\"DefaultConnection\" />\n      </providers>\n    </sessionState>\n  </system.web>\n  <system.webServer>\n    <validation validateIntegratedModeConfiguration=\"false\" />\n    <handlers>\n      <remove name=\"ExtensionlessUrlHandler-ISAPI-4.0_32bit\" />\n      <remove name=\"ExtensionlessUrlHandler-ISAPI-4.0_64bit\" />\n      <remove name=\"ExtensionlessUrlHandler-Integrated-4.0\" />\n      <add name=\"ExtensionlessUrlHandler-ISAPI-4.0_32bit\" path=\"*.\" verb=\"GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS\" modules=\"IsapiModule\" scriptProcessor=\"%windir%\\Microsoft.NET\\Framework\\v4.0.30319\\aspnet_isapi.dll\" preCondition=\"classicMode,runtimeVersionv4.0,bitness32\" responseBufferLimit=\"0\" />\n      <add name=\"ExtensionlessUrlHandler-ISAPI-4.0_64bit\" path=\"*.\" verb=\"GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS\" modules=\"IsapiModule\" scriptProcessor=\"%windir%\\Microsoft.NET\\Framework64\\v4.0.30319\\aspnet_isapi.dll\" preCondition=\"classicMode,runtimeVersionv4.0,bitness64\" responseBufferLimit=\"0\" />\n      <add name=\"ExtensionlessUrlHandler-Integrated-4.0\" path=\"*.\" verb=\"GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS\" type=\"System.Web.Handlers.TransferRequestHandler\" preCondition=\"integratedMode,runtimeVersionv4.0\" />\n    </handlers>\n  </system.webServer>\n  <runtime>\n    <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">\n      <dependentAssembly>\n        <assemblyIdentity name=\"System.Web.Helpers\" publicKeyToken=\"31bf3856ad364e35\" />\n        <bindingRedirect oldVersion=\"1.0.0.0-2.0.0.0\" newVersion=\"2.0.0.0\" />\n      </dependentAssembly>\n      <dependentAssembly>\n        <assemblyIdentity name=\"System.Web.Mvc\" publicKeyToken=\"31bf3856ad364e35\" />\n        <bindingRedirect oldVersion=\"1.0.0.0-4.0.0.0\" newVersion=\"4.0.0.0\" />\n      </dependentAssembly>\n      <dependentAssembly>\n        <assemblyIdentity name=\"System.Web.WebPages\" publicKeyToken=\"31bf3856ad364e35\" />\n        <bindingRedirect oldVersion=\"1.0.0.0-2.0.0.0\" newVersion=\"2.0.0.0\" />\n      </dependentAssembly>\n      <dependentAssembly>\n        <assemblyIdentity name=\"EntityFramework\" publicKeyToken=\"b77a5c561934e089\" />\n        <bindingRedirect oldVersion=\"0.0.0.0-5.0.0.0\" newVersion=\"5.0.0.0\" />\n      </dependentAssembly>\n      <dependentAssembly>\n        <assemblyIdentity name=\"WebGrease\" publicKeyToken=\"31bf3856ad364e35\" />\n        <bindingRedirect oldVersion=\"0.0.0.0-1.3.0.0\" newVersion=\"1.3.0.0\" />\n      </dependentAssembly>\n      <dependentAssembly>\n        <assemblyIdentity name=\"Microsoft.Data.OData\" publicKeyToken=\"31bf3856ad364e35\" culture=\"neutral\" />\n        <bindingRedirect oldVersion=\"0.0.0.0-5.2.0.0\" newVersion=\"5.2.0.0\" />\n      </dependentAssembly>\n    </assemblyBinding>\n  </runtime>\n  <entityFramework>\n    <defaultConnectionFactory type=\"System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework\">\n      <parameters>\n        <parameter value=\"v11.0\" />\n      </parameters>\n    </defaultConnectionFactory>\n  </entityFramework>\n</configuration>"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/WebRole.cs",
    "content": "// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics;\nusing System.Linq;\nusing Microsoft.WindowsAzure.ServiceRuntime;\n\nnamespace SlabReconfigurationWebRole\n{\n    public class WebRole : RoleEntryPoint\n    {\n        public override bool OnStart()\n        {\n            Trace.TraceInformation(\"Initializing role\");\n\n            RoleEnvironment.Changing += RoleEnvironment_Changing;\n\n            return base.OnStart();\n        }\n\n        public override void Run()\n        {\n            Trace.TraceInformation(\"Running role\");\n\n            base.Run();\n        }\n\n        void RoleEnvironment_Changing(object sender, RoleEnvironmentChangingEventArgs e)\n        {\n            Trace.TraceInformation(\"Change notification\");\n\n            if (e.Changes.OfType<RoleEnvironmentConfigurationSettingChange>()\n                .Any(c => !string.Equals(c.ConfigurationSettingName, MvcApplication.AzureLoggingVerbositySettingName, StringComparison.Ordinal)))\n            {\n                Trace.TraceInformation(\"Cancelling instance\");\n                e.Cancel = true;\n            }\n            else\n            {\n                Trace.TraceInformation(\"Handling change without recycle\");\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/diagnostics.wadcfg",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<DiagnosticMonitorConfiguration xmlns=\"http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration\" configurationChangePollInterval=\"PT15M\" overallQuotaInMB=\"4096\">\n  <Logs bufferQuotaInMB=\"1024\"\n        scheduledTransferLogLevelFilter=\"Verbose\"\n        scheduledTransferPeriod=\"PT1M\" />\n</DiagnosticMonitorConfiguration>"
  },
  {
    "path": "quickstarts/SLAB Reconfiguration/CS/SlabReconfigurationWebRole/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"EnterpriseLibrary.SemanticLogging\" version=\"1.0.1304.0\" targetFramework=\"net45\" />\n  <package id=\"EnterpriseLibrary.SemanticLogging.WindowsAzure\" version=\"1.0.1304.1\" targetFramework=\"net45\" />\n  <package id=\"EntityFramework\" version=\"5.0.0\" targetFramework=\"net45\" />\n  <package id=\"jQuery\" version=\"1.8.2\" targetFramework=\"net45\" />\n  <package id=\"jQuery.UI.Combined\" version=\"1.8.24\" targetFramework=\"net45\" />\n  <package id=\"jQuery.Validation\" version=\"1.10.0\" targetFramework=\"net45\" />\n  <package id=\"knockoutjs\" version=\"2.2.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.Mvc\" version=\"4.0.20710.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.Mvc.FixedDisplayModes\" version=\"1.0.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.Providers.Core\" version=\"1.2\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.Providers.LocalDB\" version=\"1.1\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.Razor\" version=\"2.0.20715.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.Web.Optimization\" version=\"1.0.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.WebApi\" version=\"4.0.20710.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.WebApi.Client\" version=\"4.0.20710.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.WebApi.Core\" version=\"4.0.20710.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.WebApi.WebHost\" version=\"4.0.20710.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.AspNet.WebPages\" version=\"2.0.20710.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Data.Edm\" version=\"5.2.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Data.OData\" version=\"5.2.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.jQuery.Unobtrusive.Ajax\" version=\"2.0.30116.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.jQuery.Unobtrusive.Validation\" version=\"2.0.30116.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Net.Http\" version=\"2.0.20710.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Web.Infrastructure\" version=\"1.0.0.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.WindowsAzure.ConfigurationManager\" version=\"1.8.0.0\" targetFramework=\"net45\" />\n  <package id=\"Modernizr\" version=\"2.6.2\" targetFramework=\"net45\" />\n  <package id=\"Newtonsoft.Json\" version=\"4.5.11\" targetFramework=\"net45\" />\n  <package id=\"System.Spatial\" version=\"5.2.0\" targetFramework=\"net45\" />\n  <package id=\"WebGrease\" version=\"1.3.0\" targetFramework=\"net45\" />\n  <package id=\"WindowsAzure.Storage\" version=\"2.0.5.1\" targetFramework=\"net45\" />\n</packages>"
  },
  {
    "path": "quickstarts/SLAB RxFloodThrottle/CS/EntLib.licenseheader",
    "content": "﻿extensions: designer.cs generated.cs\nextensions: .cs .cpp .h\n// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\n\nextensions: .aspx .ascx"
  },
  {
    "path": "quickstarts/SLAB RxFloodThrottle/CS/Program.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Data;\nusing System.Diagnostics.Tracing;\nusing System.Net;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\n\nnamespace QuickStart\n{\n    class Program\n    {\n        private const int ThrottledEventId = 4;\n\n        // this formatter makes all entries with a level higher than Critical to be single-line, so several entries fit in the console screen for the demo.\n        private static readonly IEventTextFormatter SingleLineFormatter = new EventTextFormatter(verbosityThreshold: EventLevel.Critical);\n\n        static void Main(string[] args)\n        {\n            var listener = new ObservableEventListener();\n            listener.EnableEvents(RxFloodQuickStartEventSource.Log, EventLevel.LogAlways, Keywords.All);\n\n            // ThrottleEventsWithEventId is a custom extension method that shows how you can leverage the power of Reactive Extensions (Rx) \n            // to perform filtering (or transformation) of the event stream before it is sent to the underlying sink.\n            // In this case, ThrottleEventsWithEventId will throttle entries with EventID=4 and mute additional occurrences for 15 seconds.\n            // This prevents a particular event from flooding the log sink, making it difficult to diagnose other issues.\n            // This can be useful in the case that a high-throughput event does not have a keyword or verbosity setting that makes it easy\n            // to exclude it in the call to listener.EnableEvents(EventSource, EventLevel, EventKeywords).\n\n            // Note: For basic scenarios without this extra filtering, you DO NOT need to use Rx, and SLAB does not depend on it.\n\n            var subscription = listener\n                                .ThrottleEventsWithEventId(TimeSpan.FromSeconds(15), ThrottledEventId)\n                                .LogToConsole(SingleLineFormatter);\n\n            // The previous custom extension method (ThrottleEventsWithEventId) is all that is needed to call to throttle\n            // an event that is flooding the log. \n            // The rest of the code in this QuickStart is here to show an interactive demo of how it looks if this filter is turned on or off.\n            bool currentlyThrottling = true;\n\n            var cts = new CancellationTokenSource();\n\n            Console.WriteLine(\"This program simulates the scenario of a particular event being logged multiple times in succession when a certain condition occurs,\");\n            Console.WriteLine(\"such as when there is a transient or expected connectivity error during system upgrades.\");\n            Console.WriteLine();\n            Console.WriteLine(\"While the application is logging messages, use the following commands:\");\n            Console.WriteLine(\" [ESC]      Exists the application.\");\n            Console.WriteLine(\" [Spacebar] Toggles the throttling filter.\");\n            Console.WriteLine();\n            Console.WriteLine();\n            Console.WriteLine(\"Press any key to start doing background work.\");\n\n            var key = Console.ReadKey(false);\n            if (key.Key == ConsoleKey.Escape)\n            {\n                return;\n            }\n\n            DoBackgroundWork(cts.Token);\n\n            while (!cts.IsCancellationRequested)\n            {\n                key = Console.ReadKey(false);\n                switch (key.Key)\n                {\n                    case ConsoleKey.Spacebar:\n                        subscription.Dispose();\n                        if (currentlyThrottling)\n                        {\n                            Console.WriteLine(\"Filter toggled: event entries will not be throttled. In this scenario, if there is no post-filtering of events, important messages could go unnoticed.\");\n                            Thread.Sleep(TimeSpan.FromSeconds(3));\n                            currentlyThrottling = false;\n\n                            // Note that the events are sent directly to the console, without using Reactive Extensions.\n                            subscription = listener\n                                                .LogToConsole(SingleLineFormatter);\n                        }\n                        else\n                        {\n                            Console.WriteLine(\"Filter toggled: event entries with ID {0} will be throttled for 15 seconds to prevent that type of entry to flood the log.\", ThrottledEventId);\n                            Thread.Sleep(TimeSpan.FromSeconds(3));\n                            currentlyThrottling = true;\n\n                            // Note that the events are filtered first and then sent to the console, using Reactive Extensions.\n                            subscription = listener\n                                                .ThrottleEventsWithEventId(TimeSpan.FromSeconds(15), ThrottledEventId)\n                                                .LogToConsole(SingleLineFormatter);\n                        }\n                        \n                        break;\n\n                    case ConsoleKey.Escape:\n                        cts.Cancel();\n                        break;\n                }\n            }\n\n            listener.Dispose();\n        }\n\n\n        private static void DoBackgroundWork(CancellationToken token)\n        {\n            Task.Run(() => RefreshDisplayData(token)).ContinueWith(t => { }, TaskContinuationOptions.OnlyOnCanceled);\n            Task.Run(() => DoImportantWork(token)).ContinueWith(t => { }, TaskContinuationOptions.OnlyOnCanceled);\n        }\n\n        private static void RefreshDisplayData(CancellationToken token)\n        {\n            // simulate very frequent errors that could flood an unfiltered log sink.\n            Thread.Sleep(TimeSpan.FromSeconds(1));\n            var random = new Random();\n\n            while (!token.IsCancellationRequested)\n            {\n                try\n                {\n                    throw new WebException(\"Error connecting to the back-end service.\");\n                }\n                catch (Exception ex)\n                {\n                    RxFloodQuickStartEventSource.Log.UnknownError(ex.ToString());\n                }\n\n                // sleep between poll retries.\n                Thread.Sleep(TimeSpan.FromMilliseconds(random.Next(1500)));\n            }\n        }\n\n        private static void DoImportantWork(CancellationToken token)\n        {\n            Thread.Sleep(TimeSpan.FromSeconds(2));\n            var random = new Random();\n\n            while (!token.IsCancellationRequested)\n            {\n                int customerId = random.Next(100000);\n\n                try\n                {\n                    // simulate very infrequent important errors that might get \"lost\" (or go unnoticed) in a flooded log file.\n                    RxFloodQuickStartEventSource.Log.UpdatingAccountBalance(customerId);\n\n                    if (random.Next(100) < 15)\n                    {\n                        throw new DataException(\"Error updating account balance information. Something unexpected happened and needs to be fixed. Do not ignore this error!\");\n                    }\n                }\n                catch (Exception ex)\n                {\n                    RxFloodQuickStartEventSource.Log.UpdateAccountBalanceFailed(customerId, ex.ToString());\n                }\n\n                // sleep between work iterations.\n                Thread.Sleep(TimeSpan.FromSeconds(5));\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "quickstarts/SLAB RxFloodThrottle/CS/QuickStart.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{603B9C54-38BD-4C3B-BA2D-4679433E8ABD}</ProjectGuid>\n    <OutputType>Exe</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>QuickStart</RootNamespace>\n    <AssemblyName>QuickStart</AssemblyName>\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging\">\n      <HintPath>packages\\EnterpriseLibrary.SemanticLogging.1.0.1304.0\\lib\\NET45\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Newtonsoft.Json\">\n      <HintPath>packages\\Newtonsoft.Json.4.5.11\\lib\\net40\\Newtonsoft.Json.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Reactive.Core\">\n      <HintPath>packages\\Rx-Core.2.1.30214.0\\lib\\Net45\\System.Reactive.Core.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Reactive.Interfaces\">\n      <HintPath>packages\\Rx-Interfaces.2.1.30214.0\\lib\\Net45\\System.Reactive.Interfaces.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Reactive.Linq\">\n      <HintPath>packages\\Rx-Linq.2.1.30214.0\\lib\\Net45\\System.Reactive.Linq.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Reactive.PlatformServices\">\n      <HintPath>packages\\Rx-PlatformServices.2.1.30214.0\\lib\\Net45\\System.Reactive.PlatformServices.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"Program.cs\" />\n    <Compile Include=\"RxFloodQuickStartEventSource.cs\" />\n    <Compile Include=\"ThrottleObservableExtensions.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"EntLib.licenseheader\" />\n    <None Include=\"packages.config\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Folder Include=\"Properties\\\" />\n  </ItemGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "quickstarts/SLAB RxFloodThrottle/CS/QuickStart.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2012\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"QuickStart\", \"QuickStart.csproj\", \"{603B9C54-38BD-4C3B-BA2D-4679433E8ABD}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{603B9C54-38BD-4C3B-BA2D-4679433E8ABD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{603B9C54-38BD-4C3B-BA2D-4679433E8ABD}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{603B9C54-38BD-4C3B-BA2D-4679433E8ABD}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{603B9C54-38BD-4C3B-BA2D-4679433E8ABD}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "quickstarts/SLAB RxFloodThrottle/CS/RxFloodQuickStartEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace QuickStart\n{\n    [EventSource(Name = \"RxFloodQuickStart\")]\n    public class RxFloodQuickStartEventSource : EventSource\n    {\n        private static readonly Lazy<RxFloodQuickStartEventSource> log = new Lazy<RxFloodQuickStartEventSource>(() => new RxFloodQuickStartEventSource());\n\n        public static RxFloodQuickStartEventSource Log\n        {\n            get { return log.Value; }\n        }\n\n        [Event(4, Level = EventLevel.Error)]\n        internal void UnknownError(string errorMessage)\n        {\n            if (this.IsEnabled()) this.WriteEvent(4, errorMessage);\n        }\n\n        [Event(5, Level = EventLevel.Error)]\n        internal void UpdateAccountBalanceFailed(int customerId, string errorMessage)\n        {\n            if (this.IsEnabled()) this.WriteEvent(5, customerId, errorMessage);\n        }\n\n        [Event(6, Level = EventLevel.Informational, Message = \"Updating account balance for customer with id {0}.\")]\n        internal void UpdatingAccountBalance(int customerId)\n        {\n            if (this.IsEnabled()) this.WriteEvent(6, customerId);\n        }\n    }\n}\n"
  },
  {
    "path": "quickstarts/SLAB RxFloodThrottle/CS/ThrottleObservableExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Reactive.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging\n{\n    /// <summary>\n    /// Demo extensions on how you can leverage the power of Rx to perform some filtering (or transformation) of the event stream\n    /// before it is sent to the underlying sink.\n    /// </summary>\n    public static class ThrottleObservableExtensions\n    {\n        /// <summary>\n        /// Throttles entries with the specified <paramref name=\"eventId\"/>. The first occurrence of the event with ID <paramref name=\"eventId\"/>\n        /// is sent to the output stream and then muted for a time interval specified by <paramref name=\"throttleInterval\"/>.\n        /// All other events with a different ID are sent to the output stream without filtering.\n        /// </summary>\n        /// <param name=\"stream\">The original stream of events.</param>\n        /// <param name=\"throttleInterval\">The time interval to mute additional occurrences of the event after one is sent to the output stream.</param>\n        /// <param name=\"eventId\">The event id that will be throttled.</param>\n        /// <returns>An observable that has this filtering capability.</returns>\n        public static IObservable<EventEntry> ThrottleEventsWithEventId(this IObservable<EventEntry> stream, TimeSpan throttleInterval, int eventId)\n        {\n            return ThrottleByCondition(stream, throttleInterval, x => x.EventId == eventId);\n        }\n\n        private static IObservable<T> ThrottleByCondition<T>(this IObservable<T> stream, TimeSpan throttleInterval, Func<T, bool> throttleCondition)\n        {\n            if (stream == null) throw new ArgumentNullException(\"stream\");\n            if (throttleInterval < TimeSpan.Zero) throw new ArgumentOutOfRangeException(\"throttleInterval\");\n            if (throttleCondition == null) throw new ArgumentNullException(\"throttleCondition\");\n            \n            return System.Reactive.Linq.Observable.Create<T>(observer =>\n            {\n                var nextPublishingTime = DateTimeOffset.MinValue;\n                var subscription = stream.Timestamp().Subscribe(\n                    newItem =>\n                        {\n                            bool shouldThrottle;\n                            try\n                            {\n                                shouldThrottle = throttleCondition(newItem.Value);\n                            }\n                            catch (Exception ex)\n                            {\n                                observer.OnError(ex);\n                                return;\n                            }\n\n                            if (shouldThrottle)\n                            {\n                                if (newItem.Timestamp >= nextPublishingTime)\n                                {\n                                    nextPublishingTime = newItem.Timestamp.Add(throttleInterval);\n                                    observer.OnNext(newItem.Value);\n                                }\n                            }\n                            else\n                            {\n                                observer.OnNext(newItem.Value);\n                            }\n                        },\n                    observer.OnError,\n                    observer.OnCompleted);\n\n                return subscription;\n            });\n        }\n    }\n}\n"
  },
  {
    "path": "quickstarts/SLAB RxFloodThrottle/CS/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"EnterpriseLibrary.SemanticLogging\" version=\"1.0.1304.0\" targetFramework=\"net45\" />\n  <package id=\"Newtonsoft.Json\" version=\"4.5.11\" targetFramework=\"net45\" />\n  <package id=\"Rx-Core\" version=\"2.1.30214.0\" targetFramework=\"net45\" />\n  <package id=\"Rx-Interfaces\" version=\"2.1.30214.0\" targetFramework=\"net45\" />\n  <package id=\"Rx-Linq\" version=\"2.1.30214.0\" targetFramework=\"net45\" />\n  <package id=\"Rx-Main\" version=\"2.1.30214.0\" targetFramework=\"net45\" />\n  <package id=\"Rx-PlatformServices\" version=\"2.1.30214.0\" targetFramework=\"net45\" />\n</packages>"
  },
  {
    "path": "quickstarts/SLAB RxFlushOnError/CS/ApplicationDemo/App.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.Windows;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging;\n\nnamespace ApplicationDemo\n{\n    public class App : Application\n    {\n        private ObservableEventListener listener;\n\n        protected override void OnStartup(StartupEventArgs e)\n        {\n            base.OnStartup(e);\n\n            this.listener = new ObservableEventListener();\n\n            // Note: Enable Informational messages (and not just errors), even though not all of them will be flushed to the log file.\n            listener.EnableEvents(RxFlushQuickStartEventSource.Log, EventLevel.Informational);\n\n            // FlushOnTrigger is a custom extension method that shows how you can leverage the power of Reactive Extensions (Rx) \n            // to perform filtering (or transformation) of the event stream before it is sent to the underlying sink.\n            // In this case, FlushOnTrigger buffers the last 3 event entries that are > EventLevel.Error (such as informational \n            // entries), and only if an error occurs afterwards, then these informational entries are flushed to the sink,\n            // so the admin has some additional diagnostics information, without the need of logging absolutely every message\n            // even when the application is behaving correctly.\n\n            // Note: For basic scenarios, you DO NOT need to use Rx, and SLAB does not depend on it.\n\n            listener\n                .FlushOnEventLevel(EventLevel.Error, bufferSize: 3)\n                .LogToFlatFile(\"RxQuickStart-log.txt\");\n        }\n\n        protected override void OnExit(ExitEventArgs e)\n        {\n            base.OnExit(e);\n            \n            listener.Dispose();\n        }\n\n\n        [STAThread]\n        public static void Main()\n        {\n            App app = new App();\n            app.StartupUri = new Uri(\"MainWindow.xaml\", UriKind.Relative);\n            app.Run();\n        }\n    }\n}\n"
  },
  {
    "path": "quickstarts/SLAB RxFlushOnError/CS/ApplicationDemo/ApplicationDemo.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{763AC440-5878-4A62-ACC2-E93EAEC9205B}</ProjectGuid>\n    <OutputType>WinExe</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>ApplicationDemo</RootNamespace>\n    <AssemblyName>ApplicationDemo</AssemblyName>\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\packages\\EnterpriseLibrary.SemanticLogging.1.0.1304.0\\lib\\NET45\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\packages\\Newtonsoft.Json.4.5.11\\lib\\net40\\Newtonsoft.Json.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Data.Services.Client\" />\n    <Reference Include=\"System.Reactive.Core\">\n      <HintPath>..\\packages\\Rx-Core.2.1.30214.0\\lib\\Net45\\System.Reactive.Core.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Reactive.Interfaces\">\n      <HintPath>..\\packages\\Rx-Interfaces.2.1.30214.0\\lib\\Net45\\System.Reactive.Interfaces.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Reactive.Linq\">\n      <HintPath>..\\packages\\Rx-Linq.2.1.30214.0\\lib\\Net45\\System.Reactive.Linq.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Reactive.PlatformServices\">\n      <HintPath>..\\packages\\Rx-PlatformServices.2.1.30214.0\\lib\\Net45\\System.Reactive.PlatformServices.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System.Xml\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n    <Reference Include=\"System.Xaml\">\n      <RequiredTargetFramework>4.0</RequiredTargetFramework>\n    </Reference>\n    <Reference Include=\"WindowsBase\" />\n    <Reference Include=\"PresentationCore\" />\n    <Reference Include=\"PresentationFramework\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"App.cs\" />\n    <Compile Include=\"FlushObservableExtensions.cs\" />\n    <Compile Include=\"RxFlushQuickStartEventSource.cs\" />\n    <Page Include=\"MainWindow.xaml\">\n      <Generator>MSBuild:Compile</Generator>\n      <SubType>Designer</SubType>\n    </Page>\n    <Compile Include=\"MainWindow.xaml.cs\">\n      <DependentUpon>MainWindow.xaml</DependentUpon>\n      <SubType>Code</SubType>\n    </Compile>\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"EntLib.licenseheader\" />\n    <None Include=\"packages.config\" />\n    <AppDesigner Include=\"Properties\\\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Folder Include=\"Properties\\\" />\n  </ItemGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "quickstarts/SLAB RxFlushOnError/CS/ApplicationDemo/EntLib.licenseheader",
    "content": "﻿extensions: designer.cs generated.cs\nextensions: .cs .cpp .h\n// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\n\nextensions: .aspx .ascx"
  },
  {
    "path": "quickstarts/SLAB RxFlushOnError/CS/ApplicationDemo/FlushObservableExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging\n{\n    /// <summary>\n    /// Demo extensions on how you can leverage the power of Rx to perform some filtering (or transformation) of the event stream\n    /// before it is sent to the underlying sink.\n    /// </summary>\n    public static class FlushObservableExtensions\n    {\n        /// <summary>\n        /// Buffers entries that do no satisfy the <paramref name=\"shouldFlush\"/> condition, using a circular buffer with a max\n        /// capacity. When an entry that satisfies the condition ocurrs, then it flushes the circular buffer and the new entry,\n        /// and starts buffering again.\n        /// </summary>\n        /// <typeparam name=\"T\">The type of entry.</typeparam>\n        /// <param name=\"stream\">The original stream of events.</param>\n        /// <param name=\"shouldFlush\">The condition that defines whether the item and the buffered entries are flushed.</param>\n        /// <param name=\"bufferSize\">The buffer size for accumulated entries.</param>\n        /// <returns>An observable that has this filtering capability.</returns>\n        public static IObservable<T> FlushOnTrigger<T>(this IObservable<T> stream, Func<T, bool> shouldFlush, int bufferSize)\n        {\n            if (stream == null) throw new ArgumentNullException(\"stream\");\n            if (shouldFlush == null) throw new ArgumentNullException(\"shouldFlush\");\n            if (bufferSize < 1) throw new ArgumentOutOfRangeException(\"bufferSize\");\n\n            return System.Reactive.Linq.Observable.Create<T>(observer =>\n            {\n                var buffer = new CircularBuffer<T>(bufferSize);\n                var subscription = stream.Subscribe(\n                    newItem =>\n                        {\n                            bool result;\n                            try\n                            {\n                                result = shouldFlush(newItem);\n                            }\n                            catch (Exception ex)\n                            {\n                                observer.OnError(ex);\n                                return;\n                            }\n\n                            if (result)\n                            {\n                                foreach (var buffered in buffer.TakeAll())\n                                {\n                                    observer.OnNext(buffered);\n                                }\n\n                                observer.OnNext(newItem);\n                            }\n                            else\n                            {\n                                buffer.Add(newItem);\n                            }\n                        },\n                    observer.OnError,\n                    observer.OnCompleted);\n\n                return subscription;\n            });\n        }\n\n        /// <summary>\n        /// Buffers entries that are of an <see cref=\"EventLevel\"/> value larger than <paramref name=\"level\"/>, using a circular buffer with a max\n        /// capacity. When an entry that has a value of <paramref name=\"level\"/> or lower, then it flushes the circular buffer and the new entry,\n        /// and starts buffering again.\n        /// </summary>\n        /// <param name=\"stream\">The original stream of events.</param>\n        /// <param name=\"level\">The minimum level that defines whether the item and the buffered entries are flushed.</param>\n        /// <param name=\"bufferSize\">The buffer size for accumulated entries.</param>\n        /// <returns>An observable that has this filtering capability.</returns>\n        public static IObservable<EventEntry> FlushOnEventLevel(this IObservable<EventEntry> stream, EventLevel level, int bufferSize)\n        {\n            return FlushOnTrigger(stream, entry => entry.Schema.Level <= level, bufferSize);\n        }\n\n        /// <summary>\n        /// Very basic implemantation of a circular buffer.\n        /// </summary>\n        /// <typeparam name=\"T\">The contained type.</typeparam>\n        /// <remarks>This class is not thread safe.</remarks>\n        private class CircularBuffer<T>\n        {\n            private readonly int size;\n            private Queue<T> queue;\n\n            public CircularBuffer(int size)\n            {\n                this.queue = new Queue<T>(size);\n                this.size = size;\n            }\n\n            public void Add(T obj)\n            {\n                if (this.queue.Count >= this.size)\n                {\n                    this.queue.Dequeue();\n                    this.queue.Enqueue(obj);\n                }\n                else\n                {\n                    this.queue.Enqueue(obj);\n                }\n            }\n\n            public IEnumerable<T> TakeAll()\n            {\n                var list = new List<T>(this.queue.Count);\n                while (this.queue.Count > 0)\n                {\n                    list.Add(this.queue.Dequeue());\n                }\n\n                return list;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "quickstarts/SLAB RxFlushOnError/CS/ApplicationDemo/MainWindow.xaml",
    "content": "﻿<Window x:Class=\"ApplicationDemo.MainWindow\"\n        xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n        xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n        Title=\"Semantic Logging using Reactive Extensions\" Height=\"350\" Width=\"525\">\n    <Window.Resources>\n        <Style x:Key=\"LinkButtonStyle\" TargetType=\"{x:Type Button}\">\n            <Setter Property=\"Template\">\n                <Setter.Value>\n                    <ControlTemplate TargetType=\"{x:Type Button}\">\n                        <TextBlock TextDecorations=\"Underline\">\n                        <ContentPresenter />\n                        </TextBlock>\n                    </ControlTemplate>\n                </Setter.Value>\n            </Setter>\n            <Setter Property=\"HorizontalContentAlignment\" Value=\"Center\"/>\n            <Setter Property=\"VerticalContentAlignment\" Value=\"Center\"/>\n            <Setter Property=\"Foreground\" Value=\"Blue\" />\n            <Setter Property=\"Cursor\" Value=\"Hand\" />\n            <Style.Triggers>\n                <Trigger Property=\"IsMouseOver\" Value=\"true\">\n                    <Setter Property=\"Foreground\" Value=\"Red\" />\n                </Trigger>\n            </Style.Triggers>\n        </Style>\n    </Window.Resources>\n    <Grid>\n        <Grid.RowDefinitions>\n            <RowDefinition />\n            <RowDefinition />\n            <RowDefinition />\n            <RowDefinition Height=\"40\" />\n        </Grid.RowDefinitions>\n        <Button Grid.Row=\"0\" Content=\"Log Informational\" Click=\"InformationalClick\" Margin=\"10\"/>\n        <Button Grid.Row=\"1\" Content=\"Log Warning\" Click=\"WarningClick\" Margin=\"10\"/>\n        <Button Grid.Row=\"2\" Content=\"Log Error\" Click=\"ErrorClick\" Margin=\"10\"/>\n        <Button Grid.Row=\"3\" Content=\"Open log file\" Click=\"OpenLogFile\" Margin=\"10\" Style=\"{StaticResource LinkButtonStyle}\" />\n    </Grid>\n</Window>\n"
  },
  {
    "path": "quickstarts/SLAB RxFlushOnError/CS/ApplicationDemo/MainWindow.xaml.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Windows;\n\nnamespace ApplicationDemo\n{\n    public partial class MainWindow : Window\n    {\n        private int retryCount;\n\n        public MainWindow()\n        {\n            InitializeComponent();\n        }\n\n        private void InformationalClick(object sender, RoutedEventArgs e)\n        {\n            // simulate some work with a trace event being published.\n            var customerId = new Random().Next();\n            RxFlushQuickStartEventSource.Log.NewCustomerSelected(customerId);\n        }\n\n        private void WarningClick(object sender, RoutedEventArgs e)\n        {\n            // simulate some work with a warning event being published.\n            var customerId = new Random().Next();\n            RxFlushQuickStartEventSource.Log.TransientErrorWhileRefreshingCustomerData(customerId, ++this.retryCount);\n        }\n\n        private void ErrorClick(object sender, RoutedEventArgs e)\n        {\n            // simulate an unexpected failure.\n            try\n            {\n                throw new UnauthorizedAccessException(\"User is not authorized to access customer information.\");\n            }\n            catch (Exception ex)\n            {\n                RxFlushQuickStartEventSource.Log.UnknownError(ex.ToString());\n            }\n        }\n\n        private void OpenLogFile(object sender, RoutedEventArgs e)\n        {\n            var logFile = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, \"RxQuickStart-log.txt\");\n            var process = new Process();\n            process.StartInfo = new ProcessStartInfo(\"notepad.exe\", logFile);\n            process.Start();\n        }\n    }\n}\n"
  },
  {
    "path": "quickstarts/SLAB RxFlushOnError/CS/ApplicationDemo/RxFlushQuickStartEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace ApplicationDemo\n{\n    [EventSource(Name = \"RxFlushQuickStart\")]\n    public class RxFlushQuickStartEventSource : EventSource\n    {\n        private static readonly Lazy<RxFlushQuickStartEventSource> log = new Lazy<RxFlushQuickStartEventSource>(() => new RxFlushQuickStartEventSource());\n\n        public static RxFlushQuickStartEventSource Log\n        {\n            get { return log.Value; }\n        }\n\n        [Event(1, Level = EventLevel.Informational, Message = \"Customer with customer id {0} was selected.\")]\n        public void NewCustomerSelected(int customerId)\n        {\n            if (IsEnabled()) WriteEvent(1, customerId);\n        }\n\n        [Event(2, Level = EventLevel.Warning, Message = \"Transient error while accessing backend service. Number of transient errors in current session: {1}. Currently accessing customer {0}. The call will be retried later.\")]\n        public void TransientErrorWhileRefreshingCustomerData(int customerId, int retryCount)\n        {\n            if (IsEnabled()) WriteEvent(2, customerId, retryCount);\n        }\n\n        [Event(3, Level = EventLevel.Error, Message = \"Oops, something happened here! Go figure out how we reached this invalid state! Check the informational messages.\\r\\n{0}\")]\n        public void UnknownError(string errorMessage)\n        {\n            if (IsEnabled()) WriteEvent(3, errorMessage);\n        }\n    }\n}\n"
  },
  {
    "path": "quickstarts/SLAB RxFlushOnError/CS/ApplicationDemo/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"EnterpriseLibrary.SemanticLogging\" version=\"1.0.1304.0\" targetFramework=\"net45\" />\n  <package id=\"Newtonsoft.Json\" version=\"4.5.11\" targetFramework=\"net45\" />\n  <package id=\"Rx-Core\" version=\"2.1.30214.0\" targetFramework=\"net45\" />\n  <package id=\"Rx-Interfaces\" version=\"2.1.30214.0\" targetFramework=\"net45\" />\n  <package id=\"Rx-Linq\" version=\"2.1.30214.0\" targetFramework=\"net45\" />\n  <package id=\"Rx-Main\" version=\"2.1.30214.0\" targetFramework=\"net45\" />\n  <package id=\"Rx-PlatformServices\" version=\"2.1.30214.0\" targetFramework=\"net45\" />\n</packages>"
  },
  {
    "path": "quickstarts/SLAB RxFlushOnError/CS/FlushOnTrigger.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 2012\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"ApplicationDemo\", \"ApplicationDemo\\ApplicationDemo.csproj\", \"{763AC440-5878-4A62-ACC2-E93EAEC9205B}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{763AC440-5878-4A62-ACC2-E93EAEC9205B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{763AC440-5878-4A62-ACC2-E93EAEC9205B}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{763AC440-5878-4A62-ACC2-E93EAEC9205B}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{763AC440-5878-4A62-ACC2-E93EAEC9205B}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "source/EnterpriseLibrary.ruleset",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RuleSet Name=\"EnterpriseLibrary\" ToolsVersion=\"11.0\">\n  <Include Path=\"globalizationrules.ruleset\" Action=\"Default\" />\n  <Include Path=\"minimumrecommendedrules.ruleset\" Action=\"Default\" />\n</RuleSet>"
  },
  {
    "path": "source/GlobalAssemblyInfo.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Reflection;\n\n[assembly: CLSCompliant(true)]\n[assembly: AssemblyProduct(\"Microsoft Enterprise Library\")]\n[assembly: AssemblyCompany(\"Microsoft Corporation\")]\n\n#if DEBUG\n[assembly: AssemblyConfiguration(\"Debug\")]\n#else\n[assembly: AssemblyConfiguration(\"Release\")]\n#endif\n[assembly: AssemblyCopyright(\"\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]"
  },
  {
    "path": "source/NuGet/Readme-Database.txt",
    "content": "﻿SEMANTIC LOGGING APPLICATION BLOCK (SLAB)\nhttp://slab.codeplex.com\n\nThe Semantic Logging Application Block provides a set of destinations (sinks) to persist application events published using a subclass of the EventSource class from the System.Diagnostics.Tracing namespace. Sinks include Azure table storage, SQL Server databases, and rolling files with several formats and you can extend the block by creating your own custom formatters and sinks. For the sinks that can store structured data, the block preserves the full structure of the event payload in order to facilitate analysing or processing the logged data.\n\nAn out-of-proc Windows Service is available as a separate NuGet package (EnterpriseLibrary.SemanticLogging.Service).\n\nThe SQL Server setup scripts for using with the SQL Server sink is available inside this package at: $(SolutionDir)\\packages\\EnterpriseLibrary.SemanticLogging.Database.2.0.1406.0\\scripts\\\n\nUpdated release notes are available at http://slab.codeplex.com/wikipage?title=SLAB2.0ReleaseNotes\n\nMicrosoft patterns & practices\nhttp://microsoft.com/practices\n"
  },
  {
    "path": "source/NuGet/Readme-Service.txt",
    "content": "﻿SEMANTIC LOGGING APPLICATION BLOCK (SLAB)\nhttp://slab.codeplex.com\n\nThe Semantic Logging Application Block provides a set of destinations (sinks) to persist application events published using a subclass of the EventSource class from the System.Diagnostics.Tracing namespace. Sinks include Azure table storage, SQL Server databases, and rolling files with several formats and you can extend the block by creating your own custom formatters and sinks. For the sinks that can store structured data, the block preserves the full structure of the event payload in order to facilitate analysing or processing the logged data.\n\nThis out-of-process Windows Service logs events using the Event Tracing for Windows (ETW) infrastructure that is part of the Windows operating system.\n\nIn order to install the required dependencies for the service, run the install-packages.ps1 script.\n\nUpdated release notes are available at http://slab.codeplex.com/wikipage?title=SLAB2.0ReleaseNotes\n\nMicrosoft patterns & practices\nhttp://microsoft.com/practices\n"
  },
  {
    "path": "source/NuGet/Readme.txt",
    "content": "﻿SEMANTIC LOGGING APPLICATION BLOCK (SLAB)\nhttp://slab.codeplex.com\n\nThe Semantic Logging Application Block provides a set of destinations (sinks) to persist application events published using a subclass of the EventSource class from the System.Diagnostics.Tracing namespace. Sinks include Azure table storage, SQL Server databases, and rolling files with several formats and you can extend the block by creating your own custom formatters and sinks. For the sinks that can store structured data, the block preserves the full structure of the event payload in order to facilitate analysing or processing the logged data.\n\nAn out-of-proc Windows Service is available as a separate NuGet package (EnterpriseLibrary.SemanticLogging.Service).\n\nUpdated release notes are available at http://slab.codeplex.com/wikipage?title=SLAB2.0ReleaseNotes\n\nMicrosoft patterns & practices\nhttp://microsoft.com/practices\n"
  },
  {
    "path": "source/NuGet/SemanticLogging.Service.nuspec",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<package xmlns=\"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd\">\n  <metadata schemaVersion=\"2\">\n    <id>EnterpriseLibrary.SemanticLogging.Service</id>\n    <version>$SemanticLogging_svc_Version$</version>\n    <title>Semantic Logging Application Block - Out-of-process Service</title>\n    <authors>Microsoft</authors>\n    <owners>Microsoft; patterns-and-practices</owners>\n    <licenseUrl>http://opensource.org/licenses/Apache-2.0</licenseUrl>\n    <projectUrl>http://slab.codeplex.com</projectUrl>\n    <iconUrl>http://nuget.org/Media/Default/Packages/Unity/2.0/entlib_new_icon_100x100.png</iconUrl>\n    <requireLicenseAcceptance>true</requireLicenseAcceptance>\n    <summary>The Semantic Logging Application Block provides a set of destinations (sinks) to persist application events published using a subclass of the EventSource class.</summary>\n    <description>\n       The Semantic Logging Application Block provides a set of destinations (sinks) to persist application events published using a subclass of the EventSource class from the System.Diagnostics.Tracing namespace. Sinks include Azure table storage, SQL Server databases, file, console and rolling files with several formats and you can extend the block by creating your own custom formatters and sinks. The console sink is part of this nuget package. Other Sinks mentioned above are available as separate nuget packages. For the sinks that can store structured data, the block preserves the full structure of the event payload in order to facilitate analysing or processing the logged data. \n      This package contains an out-of-proc Windows Service for SLAB.\n    </description>\n    <copyright>© 2014 Microsoft Corporation</copyright>\n    <tags>entlib entlib6 slab enterprise library ETW semantic logging EventSource event listener structured strongly-typed block OSS</tags>\n  </metadata>\n  <files>\n    <file src=\"NuGet\\Readme-service.txt\" target=\"Readme.txt\" />\n    <file src=\"NuGet\\install-packages.ps1\" target=\"tools\" />\n    <file src=\"..\\bin\\$Configuration$\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.dll\" target=\"tools\" />\n    <file src=\"..\\bin\\$Configuration$\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.pdb\" target=\"tools\" />\n    <file src=\"..\\bin\\$Configuration$\\SemanticLogging-svc.exe\" target=\"tools\" />\n    <file src=\"..\\bin\\$Configuration$\\SemanticLogging-svc.exe.config\" target=\"tools\" />\n    <file src=\"..\\bin\\$Configuration$\\SemanticLogging-svc.pdb\" target=\"tools\" />\n    <file src=\"..\\bin\\$Configuration$\\SemanticLogging-svc.xml\" target=\"tools\" />\n    <file src=\"..\\bin\\$Configuration$\\SemanticLogging-svc.xsd\" target=\"tools\" />\n    <file src=\"..\\build\\bin\\nuget.exe\" target=\"tools\\.nuget\" />\n    <file src=\"NuGet\\packages-service.config\" target=\"tools\\.nuget\\packages.config\" />\n  </files>\n</package>"
  },
  {
    "path": "source/NuGet/install-packages.ps1",
    "content": "# ==============================================================================\n# Microsoft patterns & practices Enterprise Library\n# ==============================================================================\n# Copyright  Microsoft Corporation.  All rights reserved.\n# THIS CODE AND INFORMATION IS PROVIDED \"AS IS\" WITHOUT WARRANTY\n# OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT\n# LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND\n# FITNESS FOR A PARTICULAR PURPOSE.\n# ==============================================================================\n\nparam (\n    [switch] $autoAcceptTerms,\n    [string] $packagesFolder=\"packages\"\n)\n\n# list all the solution folders where the \"packages\" folder will be placed.\n$solutionRelativePaths = @('.nuget')\n\n\n$scriptPath = Split-Path (Get-Variable MyInvocation -Scope 0).Value.MyCommand.Path \n\n$solutionFolders = New-Object object[] $solutionRelativePaths.Length\n$allPackagesFiles = New-Object object[] $solutionRelativePaths.Length\nfor($i=0; $i -lt $solutionRelativePaths.Length; $i++)\n{\n    $solutionFolder = Join-Path $scriptPath $solutionRelativePaths[$i]\n    $solutionFolders[$i] = $solutionFolder\n    $allPackagesFiles[$i] = Get-ChildItem $solutionFolder -Include \"packages.config\" -Recurse\n}\n\n\n# get all the packages to install\n$packages = @()\nforeach ($packageFilesForSolution in $allPackagesFiles)\n{\n    $packageFilesForSolution | ForEach-Object { \n        $xml = New-Object \"System.Xml.XmlDocument\"\n        $xml.Load($_.FullName)\n        $xml | Select-Xml -XPath '//packages/package' | \n            Foreach { $packages += \" - \"+ $_.Node.id + \" v\" + $_.Node.version }\n    }\n}\n\n$packages = $packages | Select -uniq | Sort-Object\n$packages = [system.string]::Join(\"`r`n\", $packages)\n\n# prompt to continue\n$caption = \"DOWNLOADING NUGET PACKAGE DEPENDENCIES\";\n$packageInformation = \"You are about to automatically download the following NuGet package dependencies required to run the service:\n\" + $packages + \"\n \nMicrosoft grants you no rights for third party software.  You are responsible for and must locate and read the license terms for each of the above packages. The owners of the above packages are solely responsible for their content and behavior. Microsoft gives no express warranties, guarantees or conditions.\n\";\n\nif ($autoAcceptTerms)\n{\n    Write-Host $caption\n    Write-Host $packageInformation\n}\nelse\n{\n    $message = $packageInformation + \"Do you want to proceed?\";\n\n    $yes = New-Object System.Management.Automation.Host.ChoiceDescription \"&Yes\",\"I agree to download the NuGet packages dependencies.\";\n    $no = New-Object System.Management.Automation.Host.ChoiceDescription \"&No\",\"I do not agree to download the NuGet packages dependencies.\";\n    $choices = [System.Management.Automation.Host.ChoiceDescription[]]($yes,$no);\n    $answer = $host.ui.PromptForChoice($caption,$message,$choices,1) \n\n    switch ($answer){\n        0 { break }\n        1 { exit; break }\n    } \n}\n\n# copy NuGet.exe bootstrapper to a temp folder if it's not there (this is to avoid distributing the full version of NuGet, and avoiding source control issues with updates).\n$nuget = Join-Path $scriptPath '.nuget\\NuGet.exe'\n\n$env:EnableNuGetPackageRestore=$true\n\nfor($i=0; $i -lt $solutionFolders.Length; $i++)\n{\n    pushd $solutionFolders[$i]\n\n    # install the packages\n    $allPackagesFiles[$i] | ForEach-Object { & $nuget install $_.FullName -o $packagesFolder }\n\n    $dependencies = @(\n\t\t'*NET45\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.dll',\n\t\t'*NET45\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.*.dll',\n        '*portable*\\Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.dll',\n        '*NET45\\Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.*.dll',\n        '*\\EnterpriseLibrary.SemanticLogging.Database.*\\scripts\\*.*'\n        '*NET40\\Microsoft.Data.Edm.dll',\n        '*NET40\\Microsoft.Data.OData.dll',\n        '*NET40\\Microsoft.Data.Services.Client.dll',\n        '*Microsoft.WindowsAzure.Configuration.dll',\n        '*NET40\\System.Spatial.dll',\n        '*NET40\\Microsoft.WindowsAzure.Storage.dll',\n        '*NET40\\Newtonsoft.Json.dll'\n        '*net40\\Microsoft.Diagnostics.Tracing.TraceEvent.dll'\n        )\n\n    \n    foreach ($dependency in $dependencies)\n    {\n        Get-ChildItem $packagesFolder -Recurse | Where { $_.FullName -like $dependency } | Copy-Item -Destination $scriptPath\n    }\n\n    popd\n}\n\nif (-not $autoAcceptTerms)\n{\n    Write-Host \"\nYou can now edit the configuration file to log events from your own application by opening 'SemanticLogging-svc.xml'.\nTo get IntelliSense from the XML schema file, you can open the configuration in Microsoft Visual Studio.\nAfter the configuration is updated, start the Windows service by executing 'SemanticLogging-svc.exe -start' from an elevated command prompt.\n\nPress ENTER key to finish...\"\n    $x = $host.UI.ReadLine()\n}\n# SIG # Begin signature block\n# MIIatwYJKoZIhvcNAQcCoIIaqDCCGqQCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB\n# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR\n# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQU4UQMMjfMr1jg2lBqZVuS6x9p\n# /wigghWCMIIEwzCCA6ugAwIBAgITMwAAAEyh6E3MtHR7OwAAAAAATDANBgkqhkiG\n# 9w0BAQUFADB3MQswCQYDVQQGEwJVUzETMBEGA1UECBMKV2FzaGluZ3RvbjEQMA4G\n# A1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMSEw\n# HwYDVQQDExhNaWNyb3NvZnQgVGltZS1TdGFtcCBQQ0EwHhcNMTMxMTExMjIxMTMx\n# WhcNMTUwMjExMjIxMTMxWjCBszELMAkGA1UEBhMCVVMxEzARBgNVBAgTCldhc2hp\n# bmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoTFU1pY3Jvc29mdCBDb3Jw\n# b3JhdGlvbjENMAsGA1UECxMETU9QUjEnMCUGA1UECxMebkNpcGhlciBEU0UgRVNO\n# OkMwRjQtMzA4Ni1ERUY4MSUwIwYDVQQDExxNaWNyb3NvZnQgVGltZS1TdGFtcCBT\n# ZXJ2aWNlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsdj6GwYrd6jk\n# lF18D+Z6ppLuilQdpPmEdYWXzMtcltDXdS3ZCPtb0u4tJcY3PvWrfhpT5Ve+a+i/\n# ypYK3EbxWh4+AtKy4CaOAGR7vjyT+FgyeYfSGl0jvJxRxA8Q+gRYtRZ2buy8xuW+\n# /K2swUHbqs559RyymUGneiUr/6t4DVg6sV5Q3mRM4MoVKt+m6f6kZi9bEAkJJiHU\n# Pw0vbdL4d5ADbN4UEqWM5zYf9IelsEEXb+NNdGbC/aJxRjVRzGsXUWP6FZSSml9L\n# KLrmFkVJ6Sy1/ouHr/ylbUPcpjD6KSjvmw0sXIPeEo1qtNtx71wUWiojKP+BcFfx\n# jAeaE9gqUwIDAQABo4IBCTCCAQUwHQYDVR0OBBYEFLkNrbNN9NqfGrInJlUNIETY\n# mOL0MB8GA1UdIwQYMBaAFCM0+NlSRnAK7UD7dvuzK7DDNbMPMFQGA1UdHwRNMEsw\n# SaBHoEWGQ2h0dHA6Ly9jcmwubWljcm9zb2Z0LmNvbS9wa2kvY3JsL3Byb2R1Y3Rz\n# L01pY3Jvc29mdFRpbWVTdGFtcFBDQS5jcmwwWAYIKwYBBQUHAQEETDBKMEgGCCsG\n# AQUFBzAChjxodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2NlcnRzL01pY3Jv\n# c29mdFRpbWVTdGFtcFBDQS5jcnQwEwYDVR0lBAwwCgYIKwYBBQUHAwgwDQYJKoZI\n# hvcNAQEFBQADggEBAAmKTgav6O2Czx0HftcqpyQLLa+aWyR/lHEMVYgkGlIVY+KQ\n# TQVKmEqc++GnbWhVgrkp6mmpstXjDNrR1nolN3hnHAz72ylaGpc4KjlWRvs1gbnk\n# PUZajuT8dTdYWUmLTts8FZ1zUkvreww6wi3Bs5tSLeA1xbnBV7PoPaE8RPIjFh4K\n# qlk3J9CVUl6ofz9U8IHh3Jq9ZdV49vdMObvd4NY3DpGah4xz53FkUvc+A9jGzXK4\n# NDSYW4zT9Qim63jGUaANDm/0azxAGmAWLKkGUp0cE5DObwIe6nucs/b4l2DyZdHR\n# H4c6wXXwQo167Yxysnv7LIq0kUdU4i5pzBZUGlkwggTsMIID1KADAgECAhMzAAAA\n# ymzVMhI1xOFVAAEAAADKMA0GCSqGSIb3DQEBBQUAMHkxCzAJBgNVBAYTAlVTMRMw\n# EQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25kMR4wHAYDVQQKExVN\n# aWNyb3NvZnQgQ29ycG9yYXRpb24xIzAhBgNVBAMTGk1pY3Jvc29mdCBDb2RlIFNp\n# Z25pbmcgUENBMB4XDTE0MDQyMjE3MzkwMFoXDTE1MDcyMjE3MzkwMFowgYMxCzAJ\n# BgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYDVQQHEwdSZWRtb25k\n# MR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xDTALBgNVBAsTBE1PUFIx\n# HjAcBgNVBAMTFU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjCCASIwDQYJKoZIhvcNAQEB\n# BQADggEPADCCAQoCggEBAJZxXe0GRvqEy51bt0bHsOG0ETkDrbEVc2Cc66e2bho8\n# P/9l4zTxpqUhXlaZbFjkkqEKXMLT3FIvDGWaIGFAUzGcbI8hfbr5/hNQUmCVOlu5\n# WKV0YUGplOCtJk5MoZdwSSdefGfKTx5xhEa8HUu24g/FxifJB+Z6CqUXABlMcEU4\n# LYG0UKrFZ9H6ebzFzKFym/QlNJj4VN8SOTgSL6RrpZp+x2LR3M/tPTT4ud81MLrs\n# eTKp4amsVU1Mf0xWwxMLdvEH+cxHrPuI1VKlHij6PS3Pz4SYhnFlEc+FyQlEhuFv\n# 57H8rEBEpamLIz+CSZ3VlllQE1kYc/9DDK0r1H8wQGcCAwEAAaOCAWAwggFcMBMG\n# A1UdJQQMMAoGCCsGAQUFBwMDMB0GA1UdDgQWBBQfXuJdUI1Whr5KPM8E6KeHtcu/\n# gzBRBgNVHREESjBIpEYwRDENMAsGA1UECxMETU9QUjEzMDEGA1UEBRMqMzE1OTUr\n# YjQyMThmMTMtNmZjYS00OTBmLTljNDctM2ZjNTU3ZGZjNDQwMB8GA1UdIwQYMBaA\n# FMsR6MrStBZYAck3LjMWFrlMmgofMFYGA1UdHwRPME0wS6BJoEeGRWh0dHA6Ly9j\n# cmwubWljcm9zb2Z0LmNvbS9wa2kvY3JsL3Byb2R1Y3RzL01pY0NvZFNpZ1BDQV8w\n# OC0zMS0yMDEwLmNybDBaBggrBgEFBQcBAQROMEwwSgYIKwYBBQUHMAKGPmh0dHA6\n# Ly93d3cubWljcm9zb2Z0LmNvbS9wa2kvY2VydHMvTWljQ29kU2lnUENBXzA4LTMx\n# LTIwMTAuY3J0MA0GCSqGSIb3DQEBBQUAA4IBAQB3XOvXkT3NvXuD2YWpsEOdc3wX\n# yQ/tNtvHtSwbXvtUBTqDcUCBCaK3cSZe1n22bDvJql9dAxgqHSd+B+nFZR+1zw23\n# VMcoOFqI53vBGbZWMrrizMuT269uD11E9dSw7xvVTsGvDu8gm/Lh/idd6MX/YfYZ\n# 0igKIp3fzXCCnhhy2CPMeixD7v/qwODmHaqelzMAUm8HuNOIbN6kBjWnwlOGZRF3\n# CY81WbnYhqgA/vgxfSz0jAWdwMHVd3Js6U1ZJoPxwrKIV5M1AHxQK7xZ/P4cKTiC\n# 095Sl0UpGE6WW526Xxuj8SdQ6geV6G00DThX3DcoNZU6OJzU7WqFXQ4iEV57MIIF\n# vDCCA6SgAwIBAgIKYTMmGgAAAAAAMTANBgkqhkiG9w0BAQUFADBfMRMwEQYKCZIm\n# iZPyLGQBGRYDY29tMRkwFwYKCZImiZPyLGQBGRYJbWljcm9zb2Z0MS0wKwYDVQQD\n# EyRNaWNyb3NvZnQgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMTAwODMx\n# MjIxOTMyWhcNMjAwODMxMjIyOTMyWjB5MQswCQYDVQQGEwJVUzETMBEGA1UECBMK\n# V2FzaGluZ3RvbjEQMA4GA1UEBxMHUmVkbW9uZDEeMBwGA1UEChMVTWljcm9zb2Z0\n# IENvcnBvcmF0aW9uMSMwIQYDVQQDExpNaWNyb3NvZnQgQ29kZSBTaWduaW5nIFBD\n# QTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALJyWVwZMGS/HZpgICBC\n# mXZTbD4b1m/My/Hqa/6XFhDg3zp0gxq3L6Ay7P/ewkJOI9VyANs1VwqJyq4gSfTw\n# aKxNS42lvXlLcZtHB9r9Jd+ddYjPqnNEf9eB2/O98jakyVxF3K+tPeAoaJcap6Vy\n# c1bxF5Tk/TWUcqDWdl8ed0WDhTgW0HNbBbpnUo2lsmkv2hkL/pJ0KeJ2L1TdFDBZ\n# +NKNYv3LyV9GMVC5JxPkQDDPcikQKCLHN049oDI9kM2hOAaFXE5WgigqBTK3S9dP\n# Y+fSLWLxRT3nrAgA9kahntFbjCZT6HqqSvJGzzc8OJ60d1ylF56NyxGPVjzBrAlf\n# A9MCAwEAAaOCAV4wggFaMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMsR6MrS\n# tBZYAck3LjMWFrlMmgofMAsGA1UdDwQEAwIBhjASBgkrBgEEAYI3FQEEBQIDAQAB\n# MCMGCSsGAQQBgjcVAgQWBBT90TFO0yaKleGYYDuoMW+mPLzYLTAZBgkrBgEEAYI3\n# FAIEDB4KAFMAdQBiAEMAQTAfBgNVHSMEGDAWgBQOrIJgQFYnl+UlE/wq4QpTlVnk\n# pDBQBgNVHR8ESTBHMEWgQ6BBhj9odHRwOi8vY3JsLm1pY3Jvc29mdC5jb20vcGtp\n# L2NybC9wcm9kdWN0cy9taWNyb3NvZnRyb290Y2VydC5jcmwwVAYIKwYBBQUHAQEE\n# SDBGMEQGCCsGAQUFBzAChjhodHRwOi8vd3d3Lm1pY3Jvc29mdC5jb20vcGtpL2Nl\n# cnRzL01pY3Jvc29mdFJvb3RDZXJ0LmNydDANBgkqhkiG9w0BAQUFAAOCAgEAWTk+\n# fyZGr+tvQLEytWrrDi9uqEn361917Uw7LddDrQv+y+ktMaMjzHxQmIAhXaw9L0y6\n# oqhWnONwu7i0+Hm1SXL3PupBf8rhDBdpy6WcIC36C1DEVs0t40rSvHDnqA2iA6VW\n# 4LiKS1fylUKc8fPv7uOGHzQ8uFaa8FMjhSqkghyT4pQHHfLiTviMocroE6WRTsgb\n# 0o9ylSpxbZsa+BzwU9ZnzCL/XB3Nooy9J7J5Y1ZEolHN+emjWFbdmwJFRC9f9Nqu\n# 1IIybvyklRPk62nnqaIsvsgrEA5ljpnb9aL6EiYJZTiU8XofSrvR4Vbo0HiWGFzJ\n# NRZf3ZMdSY4tvq00RBzuEBUaAF3dNVshzpjHCe6FDoxPbQ4TTj18KUicctHzbMrB\n# 7HCjV5JXfZSNoBtIA1r3z6NnCnSlNu0tLxfI5nI3EvRvsTxngvlSso0zFmUeDord\n# EN5k9G/ORtTTF+l5xAS00/ss3x+KnqwK+xMnQK3k+eGpf0a7B2BHZWBATrBC7E7t\n# s3Z52Ao0CW0cgDEf4g5U3eWh++VHEK1kmP9QFi58vwUheuKVQSdpw5OPlcmN2Jsh\n# rg1cnPCiroZogwxqLbt2awAdlq3yFnv2FoMkuYjPaqhHMS+a3ONxPdcAfmJH0c6I\n# ybgY+g5yjcGjPa8CQGr/aZuW4hCoELQ3UAjWwz0wggYHMIID76ADAgECAgphFmg0\n# AAAAAAAcMA0GCSqGSIb3DQEBBQUAMF8xEzARBgoJkiaJk/IsZAEZFgNjb20xGTAX\n# BgoJkiaJk/IsZAEZFgltaWNyb3NvZnQxLTArBgNVBAMTJE1pY3Jvc29mdCBSb290\n# IENlcnRpZmljYXRlIEF1dGhvcml0eTAeFw0wNzA0MDMxMjUzMDlaFw0yMTA0MDMx\n# MzAzMDlaMHcxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYD\n# VQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xITAf\n# BgNVBAMTGE1pY3Jvc29mdCBUaW1lLVN0YW1wIFBDQTCCASIwDQYJKoZIhvcNAQEB\n# BQADggEPADCCAQoCggEBAJ+hbLHf20iSKnxrLhnhveLjxZlRI1Ctzt0YTiQP7tGn\n# 0UytdDAgEesH1VSVFUmUG0KSrphcMCbaAGvoe73siQcP9w4EmPCJzB/LMySHnfL0\n# Zxws/HvniB3q506jocEjU8qN+kXPCdBer9CwQgSi+aZsk2fXKNxGU7CG0OUoRi4n\n# rIZPVVIM5AMs+2qQkDBuh/NZMJ36ftaXs+ghl3740hPzCLdTbVK0RZCfSABKR2YR\n# JylmqJfk0waBSqL5hKcRRxQJgp+E7VV4/gGaHVAIhQAQMEbtt94jRrvELVSfrx54\n# QTF3zJvfO4OToWECtR0Nsfz3m7IBziJLVP/5BcPCIAsCAwEAAaOCAaswggGnMA8G\n# A1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFCM0+NlSRnAK7UD7dvuzK7DDNbMPMAsG\n# A1UdDwQEAwIBhjAQBgkrBgEEAYI3FQEEAwIBADCBmAYDVR0jBIGQMIGNgBQOrIJg\n# QFYnl+UlE/wq4QpTlVnkpKFjpGEwXzETMBEGCgmSJomT8ixkARkWA2NvbTEZMBcG\n# CgmSJomT8ixkARkWCW1pY3Jvc29mdDEtMCsGA1UEAxMkTWljcm9zb2Z0IFJvb3Qg\n# Q2VydGlmaWNhdGUgQXV0aG9yaXR5ghB5rRahSqClrUxzWPQHEy5lMFAGA1UdHwRJ\n# MEcwRaBDoEGGP2h0dHA6Ly9jcmwubWljcm9zb2Z0LmNvbS9wa2kvY3JsL3Byb2R1\n# Y3RzL21pY3Jvc29mdHJvb3RjZXJ0LmNybDBUBggrBgEFBQcBAQRIMEYwRAYIKwYB\n# BQUHMAKGOGh0dHA6Ly93d3cubWljcm9zb2Z0LmNvbS9wa2kvY2VydHMvTWljcm9z\n# b2Z0Um9vdENlcnQuY3J0MBMGA1UdJQQMMAoGCCsGAQUFBwMIMA0GCSqGSIb3DQEB\n# BQUAA4ICAQAQl4rDXANENt3ptK132855UU0BsS50cVttDBOrzr57j7gu1BKijG1i\n# uFcCy04gE1CZ3XpA4le7r1iaHOEdAYasu3jyi9DsOwHu4r6PCgXIjUji8FMV3U+r\n# kuTnjWrVgMHmlPIGL4UD6ZEqJCJw+/b85HiZLg33B+JwvBhOnY5rCnKVuKE5nGct\n# xVEO6mJcPxaYiyA/4gcaMvnMMUp2MT0rcgvI6nA9/4UKE9/CCmGO8Ne4F+tOi3/F\n# NSteo7/rvH0LQnvUU3Ih7jDKu3hlXFsBFwoUDtLaFJj1PLlmWLMtL+f5hYbMUVbo\n# nXCUbKw5TNT2eb+qGHpiKe+imyk0BncaYsk9Hm0fgvALxyy7z0Oz5fnsfbXjpKh0\n# NbhOxXEjEiZ2CzxSjHFaRkMUvLOzsE1nyJ9C/4B5IYCeFTBm6EISXhrIniIh0EPp\n# K+m79EjMLNTYMoBMJipIJF9a6lbvpt6Znco6b72BJ3QGEe52Ib+bgsEnVLaxaj2J\n# oXZhtG6hE6a/qkfwEm/9ijJssv7fUciMI8lmvZ0dhxJkAj0tr1mPuOQh5bWwymO0\n# eFQF1EEuUKyUsKV4q7OglnUa2ZKHE3UiLzKoCG6gW4wlv6DvhMoh1useT8ma7kng\n# 9wFlb4kLfchpyOZu6qeXzjEp/w7FW1zYTRuh2Povnj8uVRZryROj/TGCBJ8wggSb\n# AgEBMIGQMHkxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpXYXNoaW5ndG9uMRAwDgYD\n# VQQHEwdSZWRtb25kMR4wHAYDVQQKExVNaWNyb3NvZnQgQ29ycG9yYXRpb24xIzAh\n# BgNVBAMTGk1pY3Jvc29mdCBDb2RlIFNpZ25pbmcgUENBAhMzAAAAymzVMhI1xOFV\n# AAEAAADKMAkGBSsOAwIaBQCggbgwGQYJKoZIhvcNAQkDMQwGCisGAQQBgjcCAQQw\n# HAYKKwYBBAGCNwIBCzEOMAwGCisGAQQBgjcCARUwIwYJKoZIhvcNAQkEMRYEFPYD\n# nPTcOiR7TxH9mg9EDFRmv37uMFgGCisGAQQBgjcCAQwxSjBIoCqAKABpAG4AcwB0\n# AGEAbABsAC0AcABhAGMAawBhAGcAZQBzAC4AcABzADGhGoAYaHR0cDovL3d3dy5t\n# aWNyb3NvZnQuY29tMA0GCSqGSIb3DQEBAQUABIIBAChhO3nTSkgqKUBwPiRElUgG\n# eQjHDV37hPcFMfO4ot1jsej9Wrunowxx80qFLKVE/oQssdiz7hIF2xgC7j0SGr4d\n# hYK13TLKd8Cq/YqWkZNxqKh8/hqKhh7vUsE44lcuAtet9aTiNDEaMsCApMNg7bQu\n# 6igr6CIgFY2Kayxt+PgYZ/5XVwMyj9qad7+KPtZYylblOztNVaAJKtjtoqjCgfDN\n# gnxTOqh0Hnlg2hWnu3o2co4pnoKLlEUYMsVagaBYI5SwLzC0qIYWjdSJIeLTf76j\n# 6/ha6yWsHh0VcJWBYY5oAwQLHDUY1dDvWIAe7ti5jwieghAmz00VLt3126VpEWSh\n# ggIoMIICJAYJKoZIhvcNAQkGMYICFTCCAhECAQEwgY4wdzELMAkGA1UEBhMCVVMx\n# EzARBgNVBAgTCldhc2hpbmd0b24xEDAOBgNVBAcTB1JlZG1vbmQxHjAcBgNVBAoT\n# FU1pY3Jvc29mdCBDb3Jwb3JhdGlvbjEhMB8GA1UEAxMYTWljcm9zb2Z0IFRpbWUt\n# U3RhbXAgUENBAhMzAAAATKHoTcy0dHs7AAAAAABMMAkGBSsOAwIaBQCgXTAYBgkq\n# hkiG9w0BCQMxCwYJKoZIhvcNAQcBMBwGCSqGSIb3DQEJBTEPFw0xNDA2MzAxODMx\n# NTVaMCMGCSqGSIb3DQEJBDEWBBSSnN79Re1aYxM+I+PUgXG+LmRIMjANBgkqhkiG\n# 9w0BAQUFAASCAQCjxkPDafGeMvDZI1gjvk4Dj6rv2002o/LhJd6TYwiFsHCa2zZD\n# LRmXgXz7203Hq/nOOSb7fBGMEkgP2Z0rcEbookMBwzONLDIkv3PEZwU4mPG1x4zS\n# PuGMHdSQ4lqkYFU6FcDGv3SikfY8E0QuCv4yytqUY8EkOoBwSgDLbRhda5aPKDAx\n# LINhMLXQJVXbzWf/oCSJLJJit3CN2lHo1sG3JNtUCQHs1MTr7w6/9J/xonEJpctc\n# BzkQXXS015jVkCylK4LAn/KysdSPFmVElAPMO2MLSu+nSyVR/HpGiu8NmKzCVsOa\n# 4fEriV8pCUTBu5XXLRfElsHYnUGp8v3TxpTf\n# SIG # End signature block\n"
  },
  {
    "path": "source/NuGet/packages-service.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"EnterpriseLibrary.SemanticLogging\" version=\"2.0.1406.1\" />\n  <package id=\"EnterpriseLibrary.SemanticLogging.Database\" version=\"2.0.1406.1\" />\n  <package id=\"EnterpriseLibrary.SemanticLogging.TextFile\" version=\"2.0.1406.1\" />\n  <package id=\"EnterpriseLibrary.SemanticLogging.WindowsAzure\" version=\"2.0.1406.1\" />\n  <package id=\"EnterpriseLibrary.TransientFaultHandling\" version=\"6.0.1304.0\" />\n  <package id=\"EnterpriseLibrary.TransientFaultHandling.Data\" version=\"6.0.1304.1\" />\n  <package id=\"Newtonsoft.Json\" version=\"5.0.8\" />\n  <package id=\"WindowsAzure.Storage\" version=\"3.0.2.0\" />\n  <package id=\"Microsoft.WindowsAzure.ConfigurationManager\" version=\"2.0.3\" />\n  <package id=\"Microsoft.Data.OData\" version=\"5.6.0\" />\n  <package id=\"Microsoft.Data.Edm\" version=\"5.6.0\" />\n  <package id=\"Microsoft.Data.Services.Client\" version=\"5.6.0\" />\n  <package id=\"System.Spatial\" version=\"5.6.0\" />\n  <package id=\"Microsoft.Diagnostics.Tracing.TraceEvent\" version=\"1.0.15\" />\n</packages>"
  },
  {
    "path": "source/Readme.txt",
    "content": "﻿SEMANTIC LOGGING APPLICATION BLOCK (SLAB)\nhttp://slab.codeplex.com\n\nThe Semantic Logging Application Block provides a set of destinations (sinks) to persist application events published using a subclass of the EventSource class from the System.Diagnostics.Tracing namespace. Sinks include Azure table storage, SQL Server databases, and rolling files with several formats and you can extend the block by creating your own custom formatters and sinks. For the sinks that can store structured data, the block preserves the full structure of the event payload in order to facilitate analysing or processing the logged data.\n\nAn out-of-proc Windows Service is available as a separate NuGet package (EnterpriseLibrary.SemanticLogging.Service).\n\nUpdated release notes are available at http://slab.codeplex.com/wikipage?title=SLAB2.0ReleaseNotes\n\nMicrosoft patterns & practices\nhttp://microsoft.com/practices\n"
  },
  {
    "path": "source/Scripts/CreateSemanticLoggingDatabase.sql",
    "content": "﻿/* NOT SUPPORTED IN SQL AZURE: Both the CREATE DATABASE and DROP DATABASE statements must be in a seperate file.\nIF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = N'Logging')\n\tDROP DATABASE [Logging]\nGO\n*/\n\nCREATE DATABASE [Logging]\n/* NOT SUPPORTED IN SQL AZURE\n COLLATE SQL_Latin1_General_CP1_CI_AS\n*/\nGO"
  },
  {
    "path": "source/Scripts/CreateSemanticLoggingDatabaseObjects.sql",
    "content": "﻿SET ANSI_NULLS ON\nGO\nSET QUOTED_IDENTIFIER ON\nGO\n\nCREATE TYPE TracesType AS TABLE\n(\n\t[InstanceName] [nvarchar](1000),\n\t[ProviderId] [uniqueidentifier],\n\t[ProviderName] [nvarchar](500),\n\t[EventId] [int],\n\t[EventKeywords] [bigint],\n\t[Level] [int],\n\t[Opcode] [int],\n\t[Task] [int],\n\t[Timestamp] [datetimeoffset](7),\n\t[Version] [int],\n\t[FormattedMessage] [nvarchar](4000),\n\t[Payload] [nvarchar](4000),\n\t[ActivityId] [uniqueidentifier], \n\t[RelatedActivityId] [uniqueidentifier],\n\t[ProcessId] [int],\n\t[ThreadId] [int]\n);\n\nGO\n\n-- The name of this stored procedure should match to the storedProcedureName parameter when creating the sink\nCREATE PROCEDURE [dbo].[WriteTraces]\n(\n  @InsertTraces TracesType READONLY\n)\nAS\nBEGIN\n  INSERT INTO [Traces] (\n\t\t[InstanceName],\n\t\t[ProviderId],\n\t\t[ProviderName],\n\t\t[EventId],\n\t\t[EventKeywords],\n\t\t[Level],\n\t\t[Opcode],\n\t\t[Task],\n\t\t[Timestamp],\n\t\t[Version],\n\t\t[FormattedMessage],\n\t\t[Payload],\n\t\t[ActivityId],\n\t\t[RelatedActivityId],\n\t\t[ProcessId],\n\t\t[ThreadId]\n\t)\n  SELECT * FROM @InsertTraces;\nEND\n\nGO\n\n-- The name of this table should match to the tableName parameter when creating the sink\nCREATE TABLE [dbo].[Traces](\n\t[id] [bigint] IDENTITY(1,1) NOT NULL,\n\t[InstanceName] [nvarchar](1000) NOT NULL,\n\t[ProviderId] [uniqueidentifier] NOT NULL,\n\t[ProviderName] [nvarchar](500) NOT NULL,\n\t[EventId] [int] NOT NULL,\n\t[EventKeywords] [bigint] NOT NULL,\n\t[Level] [int] NOT NULL,\n\t[Opcode] [int] NOT NULL,\n\t[Task] [int] NOT NULL,\n\t[Timestamp] [datetimeoffset](7) NOT NULL,\n\t[Version] [int] NOT NULL,\n\t[FormattedMessage] [nvarchar](4000) NULL,\n\t[Payload] [nvarchar](4000) NULL,\n\t[ActivityId] [uniqueidentifier],\n\t[RelatedActivityId] [uniqueidentifier],\n\t[ProcessId] [int],\n\t[ThreadId] [int],\n CONSTRAINT [PK_Traces] PRIMARY KEY CLUSTERED \n(\n\t[id] ASC\n)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF)\n)\n\nGO\n\n"
  },
  {
    "path": "source/Scripts/CreateSemanticLoggingDb.cmd",
    "content": "sqlcmd -S (localdb)\\v11.0 -E -i CreateSemanticLoggingDatabase.sql\nsqlcmd -S (localdb)\\v11.0 -E -i CreateSemanticLoggingDatabaseObjects.sql -d Logging"
  },
  {
    "path": "source/SemanticLogging.licenseheader",
    "content": "﻿extensions: designer.cs generated.cs\nextensions: .cs .cpp .h\n// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\n\nextensions: .aspx .ascx"
  },
  {
    "path": "source/SemanticLogging.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 14\nVisualStudioVersion = 14.0.25420.1\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging\", \"Src\\SemanticLogging\\SemanticLogging.csproj\", \"{2CD4105B-0DD6-4C18-9B37-05D8E8F57303}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging.Tests\", \"Tests\\SemanticLogging.Tests\\SemanticLogging.Tests.csproj\", \"{1735E7F3-65BA-4E29-B319-6C2CA03659D1}\"\n\tProjectSection(ProjectDependencies) = postProject\n\t\t{4B187511-187B-48B1-A593-18BA835B49C3} = {4B187511-187B-48B1-A593-18BA835B49C3}\n\t\t{27EACC2A-EE11-420B-8760-4945412B0C4A} = {27EACC2A-EE11-420B-8760-4945412B0C4A}\n\t\t{D7979E9B-7978-48FE-B345-3C767A20F9A1} = {D7979E9B-7978-48FE-B345-3C767A20F9A1}\n\t\t{8440AEA2-CD55-42A0-8724-2ECCE2B32374} = {8440AEA2-CD55-42A0-8724-2ECCE2B32374}\n\t\t{AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569} = {AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569}\n\tEndProjectSection\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging.Etw\", \"Src\\SemanticLogging.Etw\\SemanticLogging.Etw.csproj\", \"{8440AEA2-CD55-42A0-8724-2ECCE2B32374}\"\n\tProjectSection(ProjectDependencies) = postProject\n\t\t{4B187511-187B-48B1-A593-18BA835B49C3} = {4B187511-187B-48B1-A593-18BA835B49C3}\n\t\t{AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569} = {AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569}\n\tEndProjectSection\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging.Etw.WindowsService\", \"Src\\SemanticLogging.Etw.WindowsService\\SemanticLogging.Etw.WindowsService.csproj\", \"{0EBF89E7-D2B2-4968-BC17-0DA066029C46}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging.WindowsAzure\", \"Src\\SemanticLogging.WindowsAzure\\SemanticLogging.WindowsAzure.csproj\", \"{D7979E9B-7978-48FE-B345-3C767A20F9A1}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging.Database\", \"Src\\SemanticLogging.Database\\SemanticLogging.Database.csproj\", \"{AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569}\"\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Solution Items\", \"Solution Items\", \"{6A93313C-F04A-4623-BD8C-2C314116A782}\"\n\tProjectSection(SolutionItems) = preProject\n\t\tEnterpriseLibrary.ruleset = EnterpriseLibrary.ruleset\n\t\tNuGet\\install-packages.ps1 = NuGet\\install-packages.ps1\n\t\tNuGet\\packages-service.config = NuGet\\packages-service.config\n\t\tSettings.StyleCop = Settings.StyleCop\n\tEndProjectSection\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging.TextFile\", \"Src\\SemanticLogging.TextFile\\SemanticLogging.TextFile.csproj\", \"{4B187511-187B-48B1-A593-18BA835B49C3}\"\nEndProject\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"SemanticLogging.EventSourceAnalyzer\", \"Src\\SemanticLogging.EventSourceAnalyzer\\SemanticLogging.EventSourceAnalyzer.csproj\", \"{27EACC2A-EE11-420B-8760-4945412B0C4A}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{2CD4105B-0DD6-4C18-9B37-05D8E8F57303}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{2CD4105B-0DD6-4C18-9B37-05D8E8F57303}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{2CD4105B-0DD6-4C18-9B37-05D8E8F57303}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{2CD4105B-0DD6-4C18-9B37-05D8E8F57303}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{1735E7F3-65BA-4E29-B319-6C2CA03659D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{1735E7F3-65BA-4E29-B319-6C2CA03659D1}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{1735E7F3-65BA-4E29-B319-6C2CA03659D1}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{1735E7F3-65BA-4E29-B319-6C2CA03659D1}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{8440AEA2-CD55-42A0-8724-2ECCE2B32374}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{8440AEA2-CD55-42A0-8724-2ECCE2B32374}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{8440AEA2-CD55-42A0-8724-2ECCE2B32374}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{8440AEA2-CD55-42A0-8724-2ECCE2B32374}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{0EBF89E7-D2B2-4968-BC17-0DA066029C46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{0EBF89E7-D2B2-4968-BC17-0DA066029C46}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{0EBF89E7-D2B2-4968-BC17-0DA066029C46}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{0EBF89E7-D2B2-4968-BC17-0DA066029C46}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{D7979E9B-7978-48FE-B345-3C767A20F9A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{D7979E9B-7978-48FE-B345-3C767A20F9A1}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{D7979E9B-7978-48FE-B345-3C767A20F9A1}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{D7979E9B-7978-48FE-B345-3C767A20F9A1}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{4B187511-187B-48B1-A593-18BA835B49C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{4B187511-187B-48B1-A593-18BA835B49C3}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{4B187511-187B-48B1-A593-18BA835B49C3}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{4B187511-187B-48B1-A593-18BA835B49C3}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{27EACC2A-EE11-420B-8760-4945412B0C4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{27EACC2A-EE11-420B-8760-4945412B0C4A}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{27EACC2A-EE11-420B-8760-4945412B0C4A}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{27EACC2A-EE11-420B-8760-4945412B0C4A}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tEnterpriseLibraryConfigurationToolBinariesPathV6 = packages\\EnterpriseLibrary.TransientFaultHandling.6.0.1304.0\\lib\\portable-net45+win+wp8;packages\\EnterpriseLibrary.TransientFaultHandling.Data.6.0.1304.1\\lib\\NET45\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "source/Settings.StyleCop",
    "content": "<StyleCopSettings Version=\"105\">\n  <GlobalSettings>\n    <StringProperty Name=\"MergeSettingsFiles\">NoMerge</StringProperty>\n    <BooleanProperty Name=\"ViolationsAsErrors\">True</BooleanProperty>\n  </GlobalSettings>\n  <Parsers>\n    <Parser ParserId=\"StyleCop.CSharp.CsParser\">\n      <ParserSettings>\n        <BooleanProperty Name=\"AnalyzeDesignerFiles\">False</BooleanProperty>\n      </ParserSettings>\n    </Parser>\n  </Parsers>\n  <Analyzers>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.NamingRules\">\n      <Rules>\n        <Rule Name=\"FieldNamesMustNotBeginWithUnderscore\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings>\n        <CollectionProperty Name=\"Hungarian\">\n          <Value>as</Value>\n          <Value>db</Value>\n          <Value>dc</Value>\n          <Value>do</Value>\n          <Value>ef</Value>\n          <Value>id</Value>\n          <Value>if</Value>\n          <Value>in</Value>\n          <Value>is</Value>\n          <Value>my</Value>\n          <Value>no</Value>\n          <Value>on</Value>\n          <Value>sl</Value>\n          <Value>to</Value>\n          <Value>ui</Value>\n          <Value>vs</Value>\n        </CollectionProperty>\n      </AnalyzerSettings>\n    </Analyzer>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.DocumentationRules\">\n      <Rules>\n        <Rule Name=\"FileMustHaveHeader\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"FileHeaderMustContainFileName\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"FileHeaderFileNameDocumentationMustMatchFileName\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"FileHeaderMustHaveValidCompanyText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ConstructorSummaryDocumentationMustBeginWithStandardText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"DestructorSummaryDocumentationMustBeginWithStandardText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"DocumentationHeadersMustNotContainBlankLines\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementsMustBeDocumented\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"PartialElementsMustBeDocumented\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"EnumerationItemsMustBeDocumented\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"DocumentationMustContainValidXml\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementDocumentationMustHaveSummary\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"PartialElementDocumentationMustHaveSummary\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementDocumentationMustHaveSummaryText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"PartialElementDocumentationMustHaveSummaryText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementDocumentationMustNotHaveDefaultSummary\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementParametersMustBeDocumented\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementParameterDocumentationMustMatchElementParameters\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementParameterDocumentationMustDeclareParameterName\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementParameterDocumentationMustHaveText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementReturnValueMustBeDocumented\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementReturnValueDocumentationMustHaveText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"VoidReturnValueMustNotBeDocumented\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"GenericTypeParametersMustBeDocumented\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"GenericTypeParametersMustBeDocumentedPartialClass\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"GenericTypeParameterDocumentationMustMatchTypeParameters\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"GenericTypeParameterDocumentationMustDeclareParameterName\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"GenericTypeParameterDocumentationMustHaveText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"PropertySummaryDocumentationMustMatchAccessors\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"PropertySummaryDocumentationMustOmitSetAccessorWithRestrictedAccess\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementDocumentationMustNotBeCopiedAndPasted\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"SingleLineCommentsMustNotUseDocumentationStyleSlashes\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"DocumentationTextMustNotBeEmpty\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"DocumentationTextMustContainWhitespace\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"DocumentationMustMeetCharacterPercentage\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"IncludedDocumentationXPathDoesNotExist\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"IncludeNodeDoesNotContainValidFileAndPath\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"InheritDocMustBeUsedWithInheritingClass\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"FileHeaderMustShowCopyright\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"FileHeaderMustHaveCopyrightText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"FileHeaderFileNameDocumentationMustMatchTypeName\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings>\n        <BooleanProperty Name=\"IgnorePrivates\">True</BooleanProperty>\n        <BooleanProperty Name=\"IgnoreInternals\">True</BooleanProperty>\n      </AnalyzerSettings>\n    </Analyzer>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.ReadabilityRules\">\n      <Rules>\n        <Rule Name=\"ParameterMustNotSpanMultipleLines\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"PrefixLocalCallsWithThis\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ParameterMustFollowComma\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"SplitParametersMustStartOnLineAfterDeclaration\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ParametersMustBeOnSameLineOrSeparateLines\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"UseBuiltInTypeAlias\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings />\n    </Analyzer>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.LayoutRules\">\n      <Rules>\n        <Rule Name=\"AllAccessorsMustBeMultiLineOrSingleLine\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"SingleLineCommentsMustNotBeFollowedByBlankLine\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ClosingCurlyBracketMustBeFollowedByBlankLine\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"SingleLineCommentMustBePrecededByBlankLine\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementsMustBeSeparatedByBlankLine\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"StatementMustNotBeOnSingleLine\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementMustNotBeOnSingleLine\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings />\n    </Analyzer>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.MaintainabilityRules\">\n      <Rules>\n        <Rule Name=\"FieldsMustBePrivate\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"DebugAssertMustProvideMessageText\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"StatementMustNotUseUnnecessaryParenthesis\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"FileMayOnlyContainASingleClass\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings />\n    </Analyzer>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.OrderingRules\">\n      <Rules>\n        <Rule Name=\"UsingDirectivesMustBePlacedWithinNamespace\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementsMustAppearInTheCorrectOrder\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ElementsMustBeOrderedByAccess\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"ConstantsMustAppearBeforeFields\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"StaticElementsMustAppearBeforeInstanceElements\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"SystemUsingDirectivesMustBePlacedBeforeOtherUsingDirectives\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings />\n    </Analyzer>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.SpacingRules\">\n      <Rules>\n        <Rule Name=\"SingleLineCommentsMustBeginWithSingleSpace\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n        <Rule Name=\"MemberAccessSymbolsMustBeSpacedCorrectly\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings />\n    </Analyzer>\n  </Analyzers>\n</StyleCopSettings>"
  },
  {
    "path": "source/Src/SemanticLogging/Configuration/ConsoleSinkElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Utility;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration\n{\n    /// <summary>\n    /// Represents a console configuration element that can create an instance of a console sink.\n    /// </summary>\n    internal class ConsoleSinkElement : ISinkElement\n    {\n        private readonly XName sinkName = XName.Get(\"consoleSink\", Constants.Namespace);\n\n        /// <summary>\n        /// Determines whether this instance can create the specified configuration element.\n        /// </summary>\n        /// <param name=\"element\">The configuration element.</param>\n        /// <returns>\n        ///   <c>True</c> if this instance can create the specified element; otherwise, <c>false</c>.\n        /// </returns>\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Validated with Guard class\")]\n        public bool CanCreateSink(XElement element)\n        {\n            Guard.ArgumentNotNull(element, \"element\");\n\n            return element.Name == this.sinkName;\n        }\n\n        /// <summary>\n        /// Creates the <see cref=\"IObserver{EventEntry}\" /> instance for this sink.\n        /// </summary>\n        /// <param name=\"element\">The configuration element.</param>\n        /// <returns>\n        /// The sink instance.\n        /// </returns>\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Validated with Guard class\")]\n        public IObserver<EventEntry> CreateSink(XElement element)\n        {\n            Guard.ArgumentNotNull(element, \"element\");\n\n            var subject = new EventEntrySubject();\n            subject.LogToConsole(FormatterElementFactory.Get(element), XmlUtil.CreateInstance<IConsoleColorMapper>(element.Attribute(\"colorMapperType\")));\n            return subject;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Configuration/Constants.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration\n{\n    /// <summary>\n    /// Configuration constants and default values.\n    /// </summary>\n    public static class Constants\n    {\n        /// <summary>\n        /// The configuration namespace.\n        /// </summary>\n        public const string Namespace = \"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\";\n\n        /// <summary>\n        /// The default session name prefix.\n        /// </summary>\n        public const string DefaultSessionNamePrefix = \"Microsoft-SemanticLogging-Etw\";\n\n        /// <summary>\n        /// The default max timeout for flushing all pending events in the buffer.\n        /// </summary>\n        public static readonly TimeSpan DefaultBufferingFlushAllTimeout = TimeSpan.FromSeconds(5);\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Configuration/CustomFormatterElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Utility;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    internal class CustomFormatterElement : IFormatterElement\n    {\n        private readonly XName formatterName = XName.Get(\"customEventTextFormatter\", Constants.Namespace);\n\n        public bool CanCreateFormatter(XElement element)\n        {\n            return this.GetFormatterElement(element) != null;\n        }\n\n        public IEventTextFormatter CreateFormatter(XElement element)\n        {\n            return XmlUtil.CreateInstance<IEventTextFormatter>(this.GetFormatterElement(element));\n        }\n\n        private XElement GetFormatterElement(XElement element)\n        {\n            return element.Element(this.formatterName);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Configuration/CustomSinkElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Utility;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    internal class CustomSinkElement : ISinkElement\n    {\n        private readonly XName sinkName = XName.Get(\"customSink\", Constants.Namespace);\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Validated with Guard class\")]\n        public bool CanCreateSink(XElement element)\n        {\n            Guard.ArgumentNotNull(element, \"element\");\n\n            return element.Name == this.sinkName;\n        }\n\n        public IObserver<EventEntry> CreateSink(XElement element)\n        {\n            Guard.ArgumentNotNull(element, \"element\");\n\n            var subject = new EventEntrySubject();\n            var sink = XmlUtil.CreateInstance<IObserver<EventEntry>>(element);\n            subject.Subscribe(sink);\n            return subject;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Configuration/EventTextFormatterElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    /// <summary>\n    /// Represents a configuration element that can create an instance of <see cref=\"EventTextFormatter\"/>.\n    /// </summary>\n    internal class EventTextFormatterElement : IFormatterElement\n    {\n        private readonly XName formatterName = XName.Get(\"eventTextFormatter\", Constants.Namespace);\n\n        /// <summary>\n        /// Determines whether this instance [can create sink] the specified element.\n        /// </summary>\n        /// <param name=\"element\">The element.</param>\n        /// <returns>\n        ///   <c>true</c> if this instance [can create sink] the specified element; otherwise, <c>false</c>.\n        /// </returns>\n        public bool CanCreateFormatter(XElement element)\n        {\n            return this.GetFormatterElement(element) != null;\n        }\n\n        /// <summary>\n        /// Creates the <see cref=\"IEventTextFormatter\" /> instance.\n        /// </summary>\n        /// <param name=\"element\">The configuration element.</param>\n        /// <returns>\n        /// The formatter instance.\n        /// </returns>\n        public IEventTextFormatter CreateFormatter(XElement element)\n        {\n            var formatter = this.GetFormatterElement(element);\n\n            EventLevel verbosityThreshold = (EventLevel)Enum.Parse(typeof(EventLevel), (string)formatter.Attribute(\"verbosityThreshold\") ?? EventTextFormatter.DefaultVerbosityThreshold.ToString());\n\n            return new EventTextFormatter(\n                (string)formatter.Attribute(\"header\"),\n                (string)formatter.Attribute(\"footer\"),\n                verbosityThreshold,\n                (string)formatter.Attribute(\"dateTimeFormat\"));\n        }\n\n        private XElement GetFormatterElement(XElement element)\n        {\n            return element.Element(this.formatterName);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Configuration/FormatterElementFactory.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration\n{\n    /// <summary>\n    /// Creates formatter instances from configuration.\n    /// </summary>\n    public static class FormatterElementFactory\n    {\n        internal static IEnumerable<Lazy<IFormatterElement>> FormatterElements { get; set; }\n\n        /// <summary>\n        /// Creates the specified formatter name.\n        /// </summary>\n        /// <param name=\"element\">The configuration element.</param>\n        /// <returns>The formatter instance.</returns>\n        public static IEventTextFormatter Get(XElement element)\n        {\n            Guard.ArgumentNotNull(element, \"element\");\n\n            // If we only have a single child (sources element), \n            // there are no formatters so return null \n            // Or we are in testing env and FormatterElements is null\n            if (element.Elements().Count() <= 1 || FormatterElements == null)\n            {\n                return null;\n            }\n\n            var instance = FormatterElements.FirstOrDefault(f => f.Value.CanCreateFormatter(element));\n            if (instance == null)\n            {\n                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.FormatterElementNotResolvedError, element.Name.LocalName));\n            }\n\n            return instance.Value.CreateFormatter(element);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Configuration/IFormatterElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration\n{\n    /// <summary>\n    /// Represents the contract for creating formatters from configuration elements.\n    /// </summary>\n    public interface IFormatterElement\n    {\n        /// <summary>\n        /// Determines whether this instance can create the specified configuration element.\n        /// </summary>\n        /// <param name=\"element\">The configuration element.</param>\n        /// <returns>\n        ///   <c>True</c> if this instance can create formatter the specified element; otherwise, <c>false</c>.\n        /// </returns>\n        bool CanCreateFormatter(XElement element);\n\n        /// <summary>\n        /// Creates the <see cref=\"IEventTextFormatter\" /> instance.\n        /// </summary>\n        /// <param name=\"element\">The configuration element.</param>\n        /// <returns>\n        /// The formatter instance.\n        /// </returns>\n        IEventTextFormatter CreateFormatter(XElement element);\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Configuration/ISinkElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Xml.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration\n{\n    /// <summary>\n    /// Represents the contract for a sink configuration element.\n    /// </summary>\n    public interface ISinkElement\n    {\n        /// <summary>\n        /// Determines whether this instance can create the specified configuration element.\n        /// </summary>\n        /// <param name=\"element\">The configuration element.</param>\n        /// <returns>\n        ///   <c>True</c> if this instance can create the specified element; otherwise, <c>false</c>.\n        /// </returns>\n        bool CanCreateSink(XElement element);\n\n        /// <summary>\n        /// Creates the <see cref=\"IObserver{EventEntry}\" /> instance for this sink.\n        /// </summary>\n        /// <param name=\"element\">The configuration element.</param>\n        /// <returns>\n        /// The observer instance.\n        /// </returns>\n        IObserver<EventEntry> CreateSink(XElement element);\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Configuration/JsonEventTextFormatterElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    /// <summary>\n    /// Represents a configuration element that can create an instance of <see cref=\"JsonEventTextFormatter\"/>.\n    /// </summary>\n    internal class JsonEventTextFormatterElement : IFormatterElement\n    {\n        private readonly XName formatterName = XName.Get(\"jsonEventTextFormatter\", Constants.Namespace);\n\n        /// <summary>\n        /// Determines whether this instance [can create sink] the specified element.\n        /// </summary>\n        /// <param name=\"element\">The element.</param>\n        /// <returns>\n        ///   <c>true</c> if this instance [can create sink] the specified element; otherwise, <c>false</c>.\n        /// </returns>\n        public bool CanCreateFormatter(XElement element)\n        {\n            return this.GetFormatterElement(element) != null;\n        }\n\n        /// <summary>\n        /// Creates the <see cref=\"IEventTextFormatter\" /> instance.\n        /// </summary>\n        /// <param name=\"element\">The configuration element.</param>\n        /// <returns>\n        /// The formatter instance.\n        /// </returns>\n        public IEventTextFormatter CreateFormatter(XElement element)\n        {\n            var formatter = this.GetFormatterElement(element);\n\n            EventTextFormatting formatting = (EventTextFormatting)Enum.Parse(typeof(EventTextFormatting), (string)formatter.Attribute(\"formatting\") ?? JsonEventTextFormatter.DefaultEventTextFormatting.ToString());\n\n            var includeSeparator = formatter.Attribute(\"includeEntrySeparator\");\n\n            var jsonFormatter = new JsonEventTextFormatter(formatting, (string)formatter.Attribute(\"dateTimeFormat\"));\n            if (includeSeparator != null)\n            {\n                jsonFormatter.IncludeEntrySeparator = (bool)includeSeparator;\n            }\n\n            return jsonFormatter;\n        }\n\n        private XElement GetFormatterElement(XElement element)\n        {\n            return element.Element(this.formatterName);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Configuration/ParameterElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Collections.Generic;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    internal class ParameterElement\n    {\n        private static readonly XName ParametersName = XName.Get(\"parameters\", Constants.Namespace);\n\n        public string Name { get; set; }\n\n        public string Type { get; set; }\n\n        public string Value { get; set; }\n\n        public IEnumerable<ParameterElement> Parameters { get; set; }\n\n        internal static ParameterElement Read(XElement element)\n        {\n            return new ParameterElement()\n            {\n                Name = (string)element.Attribute(\"name\"),\n                Type = (string)element.Attribute(\"type\"),\n                Value = (string)element.Attribute(\"value\"),\n                Parameters = GetChildParameters(element)\n            };\n        }\n\n        private static IEnumerable<ParameterElement> GetChildParameters(XElement element)\n        {\n            foreach (var e in element.Elements(ParametersName).Elements())\n            {\n                yield return ParameterElement.Read(e);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Configuration/XmlEventTextFormatterElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    /// <summary>\n    /// Represents a configuration element that can create an instance of <see cref=\"XmlEventTextFormatter\"/>.\n    /// </summary>\n    internal class XmlEventTextFormatterElement : IFormatterElement\n    {\n        private readonly XName formatterName = XName.Get(\"xmlEventTextFormatter\", Constants.Namespace);\n\n        /// <summary>\n        /// Determines whether this instance [can create sink] the specified element.\n        /// </summary>\n        /// <param name=\"element\">The element.</param>\n        /// <returns>\n        ///   <c>true</c> if this instance [can create sink] the specified element; otherwise, <c>false</c>.\n        /// </returns>\n        public bool CanCreateFormatter(XElement element)\n        {\n            return this.GetFormatterElement(element) != null;\n        }\n\n        /// <summary>\n        /// Creates the <see cref=\"IEventTextFormatter\" /> instance.\n        /// </summary>\n        /// <param name=\"element\">The configuration element.</param>\n        /// <returns>\n        /// The formatter instance.\n        /// </returns>\n        public IEventTextFormatter CreateFormatter(XElement element)\n        {\n            var formatter = this.GetFormatterElement(element);\n\n            EventTextFormatting formatting = (EventTextFormatting)Enum.Parse(typeof(EventTextFormatting), (string)formatter.Attribute(\"formatting\") ?? XmlEventTextFormatter.DefaultEventTextFormatting.ToString());\n\n            return new XmlEventTextFormatter(formatting, (string)formatter.Attribute(\"dateTimeFormat\"));\n        }\n\n        private XElement GetFormatterElement(XElement element)\n        {\n            return element.Element(this.formatterName);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/ConsoleLog.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging\n{\n    /// <summary>\n    /// Factories and helpers for using the <see cref=\"ConsoleSink\"/>.\n    /// </summary>\n    public static class ConsoleLog\n    {\n        /// <summary>\n        /// Subscribes to an <see cref=\"IObservable{EventEntry}\"/> using a <see cref=\"ConsoleSink\"/>.\n        /// </summary>\n        /// <param name=\"eventStream\">The event stream. Typically this is an instance of <see cref=\"ObservableEventListener\"/>.</param>\n        /// <param name=\"formatter\">The formatter.</param>\n        /// <param name=\"colorMapper\">The color mapper instance.</param>\n        /// <returns>A subscription to the sink that can be disposed to unsubscribe the sink, or to get access to the sink instance.</returns>\n        public static SinkSubscription<ConsoleSink> LogToConsole(this IObservable<EventEntry> eventStream, IEventTextFormatter formatter = null, IConsoleColorMapper colorMapper = null)\n        {\n            formatter = formatter ?? new EventTextFormatter();\n            colorMapper = colorMapper ?? new DefaultConsoleColorMapper();\n\n            var sink = new ConsoleSink(formatter, colorMapper);\n\n            var subscription = eventStream.Subscribe(sink);\n\n            return new SinkSubscription<ConsoleSink>(subscription, sink);\n        }\n\n        /// <summary>\n        /// Creates an event listener that logs using a <see cref=\"ConsoleSink\"/>.\n        /// </summary>\n        /// <param name=\"formatter\">The formatter.</param>\n        /// <param name=\"colorMapper\">The color mapper instance.</param>\n        /// <returns>An event listener that uses <see cref=\"ConsoleSink\"/> to display events.</returns>\n        public static EventListener CreateListener(IEventTextFormatter formatter = null, IConsoleColorMapper colorMapper = null)\n        {\n            var listener = new ObservableEventListener();\n            listener.LogToConsole(formatter, colorMapper);\n            return listener;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/EventEntry.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.ObjectModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Diagnostics.Tracing;\nusing System.Globalization;\nusing System.Linq;\nusing System.Linq.Expressions;\nusing System.Reflection;\nusing System.Runtime.InteropServices;\nusing System.Security;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging\n{\n    /// <summary>\n    /// Represents a entry to log, with additional context information.\n    /// </summary>\n    public class EventEntry\n    {\n        /// <summary>\n        /// The default date time format for a formatter date values. \n        /// Default as Round-trip value; \"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffffffzzz\".\n        /// </summary>\n        [SuppressMessage(\"StyleCop.CSharp.DocumentationRules\", \"SA1650:ElementDocumentationMustBeSpelledCorrectly\", Justification = \"Reviewed.\")]\n        internal const string DefaultDateTimeFormat = \"O\";\n\n        private static readonly int CurrentProcessId = ProcessPropertyAccess.GetCurrentProcessId();\n\n        private readonly Guid providerId;\n        private readonly int eventId;\n        private readonly string formattedMessage;\n        private readonly ReadOnlyCollection<object> payload;\n        private readonly DateTimeOffset timestamp;\n        private readonly EventSchema schema;\n        private readonly int processId;\n        private readonly int threadId;\n        private readonly Guid activityId;\n        private readonly Guid relatedActivityId;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventEntry\" /> class.\n        /// </summary>\n        /// <param name=\"sourceId\">The source id.</param>\n        /// <param name=\"eventId\">The event id.</param>\n        /// <param name=\"formattedMessage\">The message.</param>\n        /// <param name=\"payload\">The payload.</param>\n        /// <param name=\"timestamp\">The timestamp.</param>\n        /// <param name=\"schema\">The schema.</param>\n        public EventEntry(Guid sourceId, int eventId, string formattedMessage, ReadOnlyCollection<object> payload, DateTimeOffset timestamp, EventSchema schema)\n            : this(sourceId, eventId, formattedMessage, payload, timestamp, Guid.Empty, Guid.Empty, schema)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventEntry\" /> class.\n        /// </summary>\n        /// <param name=\"sourceId\">The source id.</param>\n        /// <param name=\"eventId\">The event id.</param>\n        /// <param name=\"formattedMessage\">The message.</param>\n        /// <param name=\"payload\">The payload.</param>\n        /// <param name=\"timestamp\">The timestamp.</param>\n        /// <param name=\"activityId\">The activity id.</param>\n        /// <param name=\"relatedActivityId\">The related activity id.</param>\n        /// <param name=\"schema\">The schema.</param>\n        public EventEntry(Guid sourceId, int eventId, string formattedMessage, ReadOnlyCollection<object> payload, DateTimeOffset timestamp, Guid activityId, Guid relatedActivityId, EventSchema schema)\n            : this(sourceId, eventId, formattedMessage, payload, timestamp, 0, 0, activityId, relatedActivityId, schema)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventEntry\" /> class.\n        /// </summary>\n        /// <param name=\"sourceId\">The source id.</param>\n        /// <param name=\"eventId\">The event id.</param>\n        /// <param name=\"formattedMessage\">The message.</param>\n        /// <param name=\"payload\">The payload.</param>\n        /// <param name=\"timestamp\">The timestamp.</param>\n        /// <param name=\"processId\">The process id.</param>\n        /// <param name=\"threadId\">The thread id.</param>\n        /// <param name=\"activityId\">The activity id.</param>\n        /// <param name=\"relatedActivityId\">The related activity id.</param>\n        /// <param name=\"schema\">The schema.</param>\n        public EventEntry(Guid sourceId, int eventId, string formattedMessage, ReadOnlyCollection<object> payload, DateTimeOffset timestamp, int processId, int threadId, Guid activityId, Guid relatedActivityId, EventSchema schema)\n        {\n            this.providerId = sourceId;\n            this.eventId = eventId;\n            this.formattedMessage = formattedMessage;\n            this.payload = payload;\n            this.timestamp = timestamp;\n            this.processId = processId;\n            this.threadId = threadId;\n            this.activityId = activityId;\n            this.relatedActivityId = relatedActivityId;\n            this.schema = schema;\n        }\n\n        /// <summary>\n        /// Gets the id of the source originating the event.\n        /// </summary>\n        /// <value>The provider id.</value>\n        public Guid ProviderId\n        {\n            get { return this.providerId; }\n        }\n\n        /// <summary>\n        /// Gets the event id.\n        /// </summary>\n        /// <value>The event id.</value>\n        public int EventId\n        {\n            get { return this.eventId; }\n        }\n\n        /// <summary>\n        /// Gets the event payload.\n        /// </summary>\n        /// <value>The event payload.</value>\n        public ReadOnlyCollection<object> Payload\n        {\n            get { return this.payload; }\n        }\n\n        /// <summary>\n        /// Gets the timestamp of the event.\n        /// </summary>\n        /// <value>The timestamp of the event.</value>\n        public DateTimeOffset Timestamp\n        {\n            get { return this.timestamp; }\n        }\n\n        /// <summary>\n        /// Gets the event schema.\n        /// </summary>\n        /// <value>The event schema.</value>\n        public EventSchema Schema\n        {\n            get { return this.schema; }\n        }\n\n        /// <summary>\n        /// Gets the formatted message.\n        /// </summary>\n        /// <value>\n        /// The formatted message.\n        /// </value>\n        public string FormattedMessage\n        {\n            get { return this.formattedMessage; }\n        }\n\n        /// <summary>\n        /// Gets the process id.\n        /// </summary>\n        /// <value>\n        /// The process id.\n        /// </value>\n        public int ProcessId\n        {\n            get { return this.processId; }\n        }\n\n        /// <summary>\n        /// Gets the thread id.\n        /// </summary>\n        /// <value>\n        /// The thread id.\n        /// </value>\n        public int ThreadId\n        {\n            get { return this.threadId; }\n        }\n\n        /// <summary>\n        /// Gets the activity id.\n        /// </summary>\n        /// <value>\n        /// The activity id.\n        /// </value>\n        public Guid ActivityId\n        {\n            get { return this.activityId; }\n        }\n\n        /// <summary>\n        /// Gets the related activity id.\n        /// </summary>\n        /// <value>\n        /// The related activity id.\n        /// </value>\n        public Guid RelatedActivityId\n        {\n            get { return this.relatedActivityId; }\n        }\n\n        /// <summary>\n        /// Creates a new <see cref=\"EventEntry\"/> instance based on the <paramref name=\"args\"/> and the <paramref name=\"schema\"/>.\n        /// </summary>\n        /// <param name=\"args\">The <see cref=\"EventWrittenEventArgs\"/> representing the event to log.</param>\n        /// <param name=\"schema\">The <see cref=\"EventSchema\"/> for the source originating the event.</param>\n        /// <returns>An entry describing the event.</returns>\n        public static EventEntry Create(EventWrittenEventArgs args, EventSchema schema)\n        {\n            Guard.ArgumentNotNull(args, \"args\");\n            Guard.ArgumentNotNull(schema, \"schema\");\n\n            var timestamp = DateTimeOffset.Now;\n\n            // TODO: validate whether we want to do this pro-actively or should we wait until the\n            // last possible moment (as the formatted message might not be used in a sink).\n            string formattedMessage = null;\n            if (args.Message != null)\n            {\n                formattedMessage = string.Format(CultureInfo.InvariantCulture, args.Message, args.Payload.ToArray());\n            }\n\n            return new EventEntry(\n                args.EventSource.Guid,\n                args.EventId,\n                formattedMessage,\n                args.Payload,\n                timestamp,\n                CurrentProcessId,\n                ProcessPropertyAccess.GetCurrentThreadId(),\n                ActivityIdPropertyAccess.GetActivityId(args),\n                ActivityIdPropertyAccess.GetRelatedActivityId(args),\n                schema);\n        }\n\n        /// <summary>\n        /// Gets the formatted timestamp.\n        /// </summary>\n        /// <param name=\"format\">The format.</param>\n        /// <returns>The formatted string.</returns>\n        public string GetFormattedTimestamp(string format)\n        {\n            return this.timestamp.UtcDateTime.ToString(string.IsNullOrWhiteSpace(format) ? DefaultDateTimeFormat : format, CultureInfo.InvariantCulture);\n        }\n\n        private static class ActivityIdPropertyAccess\n        {\n            private static readonly Func<EventWrittenEventArgs, Guid> ActivityIdAccessor;\n            private static readonly Func<EventWrittenEventArgs, Guid> RelatedActivityIdAccessor;\n\n            static ActivityIdPropertyAccess()\n            {\n                var eventArgsType = typeof(EventWrittenEventArgs);\n\n                ActivityIdAccessor = BuildAccessor(eventArgsType.GetProperty(\"ActivityId\"));\n                RelatedActivityIdAccessor = BuildAccessor(eventArgsType.GetProperty(\"RelatedActivityId\"));\n            }\n\n            public static Guid GetActivityId(EventWrittenEventArgs args)\n            {\n                return ActivityIdAccessor(args);\n            }\n\n            public static Guid GetRelatedActivityId(EventWrittenEventArgs args)\n            {\n                return RelatedActivityIdAccessor(args);\n            }\n\n            private static Func<EventWrittenEventArgs, Guid> BuildAccessor(PropertyInfo property)\n            {\n                if (property != null && property.PropertyType == typeof(Guid))\n                {\n                    var parameter = Expression.Parameter(typeof(EventWrittenEventArgs), \"args\");\n\n                    try\n                    {\n                        return\n                            Expression.Lambda<Func<EventWrittenEventArgs, Guid>>(\n                                Expression.Property(parameter, property),\n                                parameter).Compile();\n                    }\n                    catch (SecurityException)\n                    {\n                        // fall back to no access to the properties\n                    }\n                }\n\n                return args => Guid.Empty;\n            }\n        }\n\n        private static class ProcessPropertyAccess\n        {\n            private static readonly Func<int> ProcessIdAccessor;\n            private static readonly Func<int> CurrentThreadIdAccessor;\n\n            static ProcessPropertyAccess()\n            {\n                if (AppDomain.CurrentDomain.IsHomogenous && AppDomain.CurrentDomain.IsFullyTrusted)\n                {\n                    ProcessIdAccessor = GetCurrentProcessIdSafe;\n                    CurrentThreadIdAccessor = GetCurrentThreadIdSafe;\n                }\n                else\n                {\n                    ProcessIdAccessor = null;\n                    CurrentThreadIdAccessor = null;\n                }\n            }\n\n            public static int GetCurrentProcessId()\n            {\n                return ProcessIdAccessor != null ? ProcessIdAccessor() : 0;\n            }\n\n            public static int GetCurrentThreadId()\n            {\n                return CurrentThreadIdAccessor != null ? CurrentThreadIdAccessor() : 0;\n            }\n\n            [SecuritySafeCritical]\n            private static int GetCurrentProcessIdSafe()\n            {\n                try\n                {\n                    return SafeNativeMethods.GetCurrentProcessId();\n                }\n                catch (SecurityException)\n                {\n                    return 0;\n                }\n            }\n\n            [SecuritySafeCritical]\n            private static int GetCurrentThreadIdSafe()\n            {\n                try\n                {\n                    return SafeNativeMethods.GetCurrentThreadId();\n                }\n                catch (SecurityException)\n                {\n                    return 0;\n                }\n            }\n\n            [SuppressUnmanagedCodeSecurity]\n            [SecurityCritical]\n            private static class SafeNativeMethods\n            {\n                [DllImport(\"kernel32.dll\")]\n                public static extern int GetCurrentProcessId();\n\n                [DllImport(\"kernel32.dll\")]\n                public static extern int GetCurrentThreadId();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/EventListenerExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Properties;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging\n{\n    /// <summary>\n    /// Extension methods to enable and disable events based on <see cref=\"EventSource\"/> names rather than actual instances.\n    /// </summary>\n    public static class EventListenerExtensions\n    {\n        /// <summary>\n        /// Disables all events for the specified event source.\n        /// </summary>\n        /// <param name=\"eventListener\">The event listener.</param>\n        /// <param name=\"eventSourceName\">The name of the event source to enable events for.</param>\n        /// <remarks>\n        /// If the event source with the supplied name has already been created the request is processed immediately. Otherwise the request\n        /// is deferred until the event source is created.\n        /// </remarks>\n        public static void DisableEvents(this EventListener eventListener, string eventSourceName)\n        {\n            CastToObservableEventListener(eventListener).DisableEvents(eventSourceName);\n        }\n\n        /// <summary>\n        /// Enables events for the event source with the specified name that have the specified verbosity level or lower.\n        /// </summary>\n        /// <param name=\"eventListener\">The event listener.</param>\n        /// <param name=\"eventSourceName\">The name of the event source to enable events for.</param>\n        /// <param name=\"level\">The level of events to enable.</param>\n        /// <returns>\n        ///   <see langword=\"false\" /> if the request was deferred; otherwise, <see langword=\"true\" />.\n        /// </returns>\n        /// <remarks>\n        /// If the event source with the supplied name has already been created the request is processed immediately. Otherwise the request\n        /// is deferred until the event source is created.\n        /// </remarks>\n        public static bool EnableEvents(this EventListener eventListener, string eventSourceName, EventLevel level)\n        {\n            return CastToObservableEventListener(eventListener).EnableEvents(eventSourceName, level);\n        }\n\n        /// <summary>\n        /// Enables events for the specified event source that has the specified verbosity level or lower, and matching keyword flags.\n        /// </summary>\n        /// <param name=\"eventListener\">The event listener.</param>\n        /// <param name=\"eventSourceName\">The name of the event source to enable events for.</param>\n        /// <param name=\"level\">The level of events to enable.</param>\n        /// <param name=\"matchAnyKeyword\">The keyword flags necessary to enable the events.</param>\n        /// <returns>\n        ///   <see langword=\"false\" /> if the request was deferred; otherwise, <see langword=\"true\" />.\n        /// </returns>\n        /// <remarks>\n        /// If the event source with the supplied name has already been created the request is processed immediately. Otherwise the request\n        /// is deferred until the event source is created.\n        /// </remarks>\n        public static bool EnableEvents(this EventListener eventListener, string eventSourceName, EventLevel level, EventKeywords matchAnyKeyword)\n        {\n            return CastToObservableEventListener(eventListener).EnableEvents(eventSourceName, level, matchAnyKeyword);\n        }\n\n        /// <summary>\n        /// Enables events for the specified event source that has the specified verbosity level or lower, and matching keyword flags.\n        /// </summary>\n        /// <param name=\"eventListener\">The event listener.</param>\n        /// <param name=\"eventSourceName\">The name of the event source to enable events for.</param>\n        /// <param name=\"level\">The level of events to enable.</param>\n        /// <param name=\"matchAnyKeyword\">The keyword flags necessary to enable the events.</param>\n        /// <param name=\"arguments\">The arguments to be matched to enable the events.</param>\n        /// <returns>\n        ///   <see langword=\"false\" /> if the request was deferred; otherwise, <see langword=\"true\" />.\n        /// </returns>\n        /// <remarks>\n        /// If the event source with the supplied name has already been created the request is processed immediately. Otherwise the request\n        /// is deferred until the event source is created.\n        /// </remarks>\n        public static bool EnableEvents(this EventListener eventListener, string eventSourceName, EventLevel level, EventKeywords matchAnyKeyword, IDictionary<string, string> arguments)\n        {\n            return CastToObservableEventListener(eventListener).EnableEvents(eventSourceName, level, matchAnyKeyword, arguments);\n        }\n\n        private static ObservableEventListener CastToObservableEventListener(EventListener eventListener)\n        {\n            Guard.ArgumentNotNull(eventListener, \"eventListener\");\n\n            var observableEventListener = eventListener as ObservableEventListener;\n\n            if (observableEventListener == null)\n            {\n                throw new ArgumentException(Resources.ArgumentMustBeObservableEventListener, \"eventListener\");\n            }\n\n            return observableEventListener;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Formatters/DefaultConsoleColorMapper.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters\n{\n    /// <summary>\n    /// Default console color mapper class.\n    /// </summary>\n    public class DefaultConsoleColorMapper : IConsoleColorMapper\n    {\n        /// <summary>\n        /// Default color value for when displaying events of level <see cref=\"EventLevel.LogAlways\"/>.\n        /// </summary>\n        public const ConsoleColor LogAlways = ConsoleColor.White;\n\n        /// <summary>\n        /// Default color value for when displaying events of level <see cref=\"EventLevel.Critical\"/>.\n        /// </summary>\n        public const ConsoleColor Critical = ConsoleColor.Magenta;\n\n        /// <summary>\n        /// Default color value for when displaying events of level <see cref=\"EventLevel.Error\"/>.\n        /// </summary>\n        public const ConsoleColor Error = ConsoleColor.Red;\n\n        /// <summary>\n        /// Default color value for when displaying events of level <see cref=\"EventLevel.Warning\"/>.\n        /// </summary>\n        public const ConsoleColor Warning = ConsoleColor.Yellow;\n\n        /// <summary>\n        /// Default color value for when displaying events of level <see cref=\"EventLevel.Verbose\"/>.\n        /// </summary>\n        public const ConsoleColor Verbose = ConsoleColor.Green;\n\n        /// <summary>\n        /// Default color value for when displaying events of level <see cref=\"EventLevel.Informational\"/>.\n        /// </summary>\n        public const ConsoleColor Informational = ConsoleColor.Gray;\n\n        /// <summary>\n        /// Maps the specified <see cref=\"System.Diagnostics.Tracing.EventLevel\"/> to a <see cref=\"System.ConsoleColor\"/>.\n        /// </summary>\n        /// <param name=\"eventLevel\">The event level.</param>\n        /// <returns>The console color.</returns>\n        public virtual ConsoleColor? Map(EventLevel eventLevel)\n        {\n            switch (eventLevel)\n            {\n                case EventLevel.Critical:\n                    return Critical;\n                case EventLevel.Error:\n                    return Error;\n                case EventLevel.Warning:\n                    return Warning;\n                case EventLevel.Verbose:\n                    return Verbose;\n                case EventLevel.LogAlways:\n                    return LogAlways;\n                case EventLevel.Informational:\n                    return Informational;\n                default:\n                    return null;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Formatters/EventTextFormatter.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters\n{\n    /// <summary>\n    /// A <see cref=\"IEventTextFormatter\"/> implementation that writes out formatted text.\n    /// </summary>\n    /// <remarks>This class is not thread-safe.</remarks>\n    public class EventTextFormatter : IEventTextFormatter\n    {\n        /// <summary>\n        /// The dash separator.\n        /// </summary>\n        public const string DashSeparator = \"----------------------------------------\";\n\n        /// <summary>\n        /// The default <see cref=\"VerbosityThreshold\"/>.\n        /// </summary>\n        public const EventLevel DefaultVerbosityThreshold = EventLevel.Error;\n\n        private string dateTimeFormat;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventTextFormatter\" /> class.\n        /// </summary>\n        /// <param name=\"header\">The header.</param>\n        /// <param name=\"footer\">The footer.</param>\n        /// <param name=\"verbosityThreshold\">The verbosity threshold.</param>\n        /// <param name=\"dateTimeFormat\">The date time format used for timestamp value.</param>\n        public EventTextFormatter(string header = null, string footer = null, EventLevel verbosityThreshold = DefaultVerbosityThreshold, string dateTimeFormat = null)\n        {\n            this.Header = header;\n            this.Footer = footer;\n            this.VerbosityThreshold = verbosityThreshold;\n            this.DateTimeFormat = dateTimeFormat;\n        }\n\n        /// <summary>\n        /// Gets or sets the header.\n        /// </summary>\n        /// <value>The header of the text formatter.</value>\n        public string Header { get; set; }\n\n        /// <summary>\n        /// Gets or sets the footer.\n        /// </summary>\n        /// <value>The footer of the text formatter.</value>\n        public string Footer { get; set; }\n\n        /// <summary>\n        /// Gets or sets the lowest <see cref=\"System.Diagnostics.Tracing.EventLevel\" /> value where the formatted output provides all the event entry information.\n        /// Otherwise a summarized content of the event entry will be written.\n        /// </summary>\n        /// <value>The EventLevel.</value>\n        public EventLevel VerbosityThreshold { get; set; }\n\n        /// <summary>\n        /// Gets or sets the date time format used for timestamp value.\n        /// </summary>\n        /// <value>The date time format value.</value>\n        public string DateTimeFormat\n        {\n            get\n            {\n                return this.dateTimeFormat;\n            }\n\n            set\n            {\n                Guard.ValidDateTimeFormat(value, \"DateTimeFormat\");\n                this.dateTimeFormat = value;\n            }\n        }\n\n        /// <summary>\n        /// Writes the event.\n        /// </summary>\n        /// <param name=\"eventEntry\">The <see cref=\"EventEntry\" /> instance containing the event data.</param>\n        /// <param name=\"writer\">The writer.</param>\n        public void WriteEvent(EventEntry eventEntry, TextWriter writer)\n        {\n            Guard.ArgumentNotNull(eventEntry, \"eventEntry\");\n            Guard.ArgumentNotNull(writer, \"writer\");\n\n            // Write header\n            if (!string.IsNullOrWhiteSpace(this.Header))\n            {\n                writer.WriteLine(this.Header);\n            }\n\n            if (eventEntry.Schema.Level <= this.VerbosityThreshold || this.VerbosityThreshold == EventLevel.LogAlways)\n            {\n                const string Format = \"{0} : {1}\";\n\n                // Write with verbosityThreshold format \n                writer.WriteLine(Format, PropertyNames.ProviderId, eventEntry.ProviderId);\n                writer.WriteLine(Format, PropertyNames.EventId, eventEntry.EventId);\n                writer.WriteLine(Format, PropertyNames.Keywords, eventEntry.Schema.Keywords);\n                writer.WriteLine(Format, PropertyNames.Level, eventEntry.Schema.Level);\n                writer.WriteLine(Format, PropertyNames.Message, eventEntry.FormattedMessage);\n                writer.WriteLine(Format, PropertyNames.Opcode, eventEntry.Schema.Opcode);\n                writer.WriteLine(Format, PropertyNames.Task, eventEntry.Schema.Task);\n                writer.WriteLine(Format, PropertyNames.Version, eventEntry.Schema.Version);\n                writer.WriteLine(Format, PropertyNames.Payload, FormatPayload(eventEntry));\n                writer.WriteLine(Format, PropertyNames.EventName, eventEntry.Schema.EventName);\n                writer.WriteLine(Format, PropertyNames.Timestamp, eventEntry.GetFormattedTimestamp(this.DateTimeFormat));\n                writer.WriteLine(Format, PropertyNames.ProcessId, eventEntry.ProcessId);\n                writer.WriteLine(Format, PropertyNames.ThreadId, eventEntry.ThreadId);\n\n                if (eventEntry.ActivityId != Guid.Empty)\n                {\n                    writer.WriteLine(Format, PropertyNames.ActivityId, eventEntry.ActivityId);\n                }\n\n                if (eventEntry.RelatedActivityId != Guid.Empty)\n                {\n                    writer.WriteLine(Format, PropertyNames.RelatedActivityId, eventEntry.RelatedActivityId);\n                }\n            }\n            else\n            {\n                // Write with summary format\n                writer.Write(\n                    \"{0} : {1}, {2} : {3}, {4} : {5}, {6} : {7}, {8} : {9}, {10} : {11}, {12} : {13}, {14} : {15}\",\n                    PropertyNames.EventId,\n                    eventEntry.EventId,\n                    PropertyNames.Level,\n                    eventEntry.Schema.Level,\n                    PropertyNames.Message,\n                    eventEntry.FormattedMessage,\n                    PropertyNames.Payload,\n                    FormatPayload(eventEntry),\n                    PropertyNames.EventName,\n                    eventEntry.Schema.EventName,\n                    PropertyNames.Timestamp,\n                    eventEntry.GetFormattedTimestamp(this.DateTimeFormat),\n                    PropertyNames.ProcessId,\n                    eventEntry.ProcessId,\n                    PropertyNames.ThreadId,\n                    eventEntry.ThreadId);\n\n                if (eventEntry.ActivityId != Guid.Empty)\n                {\n                    writer.Write(\", {0} : {1}\", PropertyNames.ActivityId, eventEntry.ActivityId);\n                }\n\n                if (eventEntry.RelatedActivityId != Guid.Empty)\n                {\n                    writer.Write(\", {0} : {1}\", PropertyNames.RelatedActivityId, eventEntry.RelatedActivityId);\n                }\n\n                writer.WriteLine();\n            }\n\n            // Write footer\n            if (!string.IsNullOrWhiteSpace(this.Footer))\n            {\n                writer.WriteLine(this.Footer);\n            }\n\n            writer.WriteLine();\n        }\n\n        private static string FormatPayload(EventEntry entry)\n        {\n            var eventSchema = entry.Schema;\n            var sb = new StringBuilder();\n\n            for (int i = 0; i < entry.Payload.Count; i++)\n            {\n                try\n                {\n                    sb.AppendFormat(\"[{0} : {1}] \", eventSchema.Payload[i], entry.Payload[i]);\n                }\n                catch (Exception e)\n                {\n                    SemanticLoggingEventSource.Log.EventEntryTextWriterFailed(e.ToString());\n                    sb.AppendFormat(\"[{0} : {1}] \", \"Exception\", string.Format(CultureInfo.CurrentCulture, Properties.Resources.TextSerializationError, e.Message));\n                }\n            }\n\n            return sb.ToString();\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Formatters/EventTextFormatting.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters\n{\n    /// <summary>\n    /// Specifies formatting options .\n    /// </summary>\n    public enum EventTextFormatting\n    {\n        /// <summary>\n        /// No special formatting applied. This is the default.\n        /// </summary>\n        None,\n\n        /// <summary>\n        /// Causes child objects to be indented.\n        /// </summary>\n        Indented\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Formatters/IConsoleColorMapper.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters\n{\n    /// <summary>\n    /// Provides mapping between an <see cref=\"EventLevel\"/> and a console foreground color.\n    /// </summary>\n    public interface IConsoleColorMapper\n    {\n        /// <summary>\n        /// Maps the specified <see cref=\"System.Diagnostics.Tracing.EventLevel\"/> to a <see cref=\"System.ConsoleColor\"/>\n        /// </summary>\n        /// <param name=\"eventLevel\">The <see cref=\"System.Diagnostics.Tracing.EventLevel\"/>.</param>\n        /// <returns>The <see cref=\"System.ConsoleColor\"/>.</returns>\n        ConsoleColor? Map(EventLevel eventLevel);\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Formatters/IEventTextFormatter.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.IO;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters\n{\n    /// <summary>\n    /// Provides a generic interface for an event text formatter used \n    /// whenever an event has been written by an event source for which the event listener has enabled events.\n    /// </summary>\n    public interface IEventTextFormatter\n    {\n        /// <summary>\n        /// Writes the event.\n        /// </summary>\n        /// <param name=\"eventEntry\">The event entry.</param>\n        /// <param name=\"writer\">The writer.</param>\n        void WriteEvent(EventEntry eventEntry, TextWriter writer);\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Formatters/JsonEventTextFormatter.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing Newtonsoft.Json;\nusing System;\nusing System.IO;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters\n{\n    /// <summary>\n    /// A <see cref=\"IEventTextFormatter\"/> implementation that writes out text formatted as JSON.\n    /// </summary>\n    /// <remarks>This class is not thread-safe.</remarks>\n    public class JsonEventTextFormatter : IEventTextFormatter\n    {\n        /// <summary>\n        /// The default event text formatting.\n        /// </summary>\n        public const EventTextFormatting DefaultEventTextFormatting = EventTextFormatting.None;\n\n        private const string EntrySeparator = \",\";\n        private Newtonsoft.Json.Formatting formatting;\n        private string dateTimeFormat;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"JsonEventTextFormatter\" /> class.\n        /// </summary>\n        /// <param name=\"formatting\">The <see cref=\"EventTextFormatting\" /> formatting.</param>\n        /// <param name=\"dateTimeFormat\">The date time format used for timestamp value.</param>\n        public JsonEventTextFormatter(EventTextFormatting formatting = DefaultEventTextFormatting, string dateTimeFormat = null)\n        {\n            this.formatting = (Newtonsoft.Json.Formatting)formatting;\n            this.DateTimeFormat = dateTimeFormat;\n            this.IncludeEntrySeparator = true;\n        }\n\n        /// <summary>\n        /// Gets or sets the date time format used for timestamp value.\n        /// </summary>\n        /// <value>\n        /// The date time format.\n        /// </value>\n        public string DateTimeFormat\n        {\n            get\n            {\n                return this.dateTimeFormat;\n            }\n\n            set\n            {\n                Guard.ValidDateTimeFormat(value, \"DateTimeFormat\");\n                this.dateTimeFormat = value;\n            }\n        }\n\n        /// <summary>\n        /// Gets or sets a flag indicating whether the <see cref=\"JsonEventTextFormatter\"/> will append a separator (\",\") at the end of each event\n        /// </summary>\n        /// <value>The flag indicating whether to append a separator.</value>\n        public bool IncludeEntrySeparator { get; set; }\n\n        /// <summary>\n        /// Gets the <see cref=\"EventTextFormatting\"/>.\n        /// </summary>\n        /// <value>The <see cref=\"EventTextFormatting\"/>.</value>\n        public EventTextFormatting Formatting\n        {\n            get { return (EventTextFormatting)this.formatting; }\n        }\n\n        /// <summary>\n        /// Write the formatted event output.\n        /// </summary>\n        /// <param name=\"eventEntry\">The event data to be formatted.</param>\n        /// <param name=\"writer\">The writer to receive the formatted output.</param>\n        public void WriteEvent(EventEntry eventEntry, TextWriter writer)\n        {\n            Guard.ArgumentNotNull(eventEntry, \"eventEntry\");\n\n            using (var jsonWriter = new JsonTextWriter(writer) { CloseOutput = false, Formatting = this.formatting })\n            {\n                jsonWriter.WriteStartObject();\n                jsonWriter.WritePropertyName(PropertyNames.ProviderId);\n                jsonWriter.WriteValue(eventEntry.ProviderId);\n                jsonWriter.WritePropertyName(PropertyNames.EventId);\n                jsonWriter.WriteValue(eventEntry.EventId);\n                jsonWriter.WritePropertyName(PropertyNames.Keywords);\n                jsonWriter.WriteValue((long)eventEntry.Schema.Keywords);\n                jsonWriter.WritePropertyName(PropertyNames.Level);\n                jsonWriter.WriteValue((int)eventEntry.Schema.Level);\n                jsonWriter.WritePropertyName(PropertyNames.Message);\n                jsonWriter.WriteValue(eventEntry.FormattedMessage);\n                jsonWriter.WritePropertyName(PropertyNames.Opcode);\n                jsonWriter.WriteValue((int)eventEntry.Schema.Opcode);\n                jsonWriter.WritePropertyName(PropertyNames.Task);\n                jsonWriter.WriteValue((int)eventEntry.Schema.Task);\n                jsonWriter.WritePropertyName(PropertyNames.Version);\n                jsonWriter.WriteValue(eventEntry.Schema.Version);\n                jsonWriter.WritePropertyName(PropertyNames.Payload);\n                EventEntryUtil.JsonWritePayload(jsonWriter, eventEntry);\n                jsonWriter.WritePropertyName(PropertyNames.EventName);\n                jsonWriter.WriteValue(eventEntry.Schema.EventName);\n                jsonWriter.WritePropertyName(PropertyNames.Timestamp);\n                jsonWriter.WriteValue(eventEntry.GetFormattedTimestamp(this.DateTimeFormat));\n                jsonWriter.WritePropertyName(PropertyNames.ProcessId);\n                jsonWriter.WriteValue(eventEntry.ProcessId);\n                jsonWriter.WritePropertyName(PropertyNames.ThreadId);\n                jsonWriter.WriteValue(eventEntry.ThreadId);\n\n                if (eventEntry.ActivityId != Guid.Empty)\n                {\n                    jsonWriter.WritePropertyName(PropertyNames.ActivityId);\n                    jsonWriter.WriteValue(eventEntry.ActivityId);\n                }\n\n                if (eventEntry.RelatedActivityId != Guid.Empty)\n                {\n                    jsonWriter.WritePropertyName(PropertyNames.RelatedActivityId);\n                    jsonWriter.WriteValue(eventEntry.RelatedActivityId);\n                }\n\n                jsonWriter.WriteEndObject();\n\n                if (IncludeEntrySeparator)\n                {\n                    // Write an entry separator so all the logs can be read as an array, \n                    // adding the [] chars to the raw written data ( i.e: \"[\" + raw + \"]\" )\n                    // where raw = {log1},{log2}, ... {logN},\n                    jsonWriter.WriteRaw(EntrySeparator);\n                }\n\n                // Writes new line when indented\n                if (jsonWriter.Formatting == Newtonsoft.Json.Formatting.Indented)\n                {\n                    jsonWriter.WriteRaw(\"\\r\\n\");\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Formatters/PropertyNames.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters\n{\n    internal static class PropertyNames\n    {\n        internal const string ProviderId = \"ProviderId\";\n        internal const string EventId = \"EventId\";\n        internal const string Keywords = \"Keywords\";\n        internal const string Level = \"Level\";\n        internal const string Message = \"Message\";\n        internal const string Opcode = \"Opcode\";\n        internal const string Task = \"Task\";\n        internal const string Version = \"Version\";\n        internal const string Payload = \"Payload\";\n        internal const string EventName = \"EventName\";\n        internal const string Timestamp = \"Timestamp\";\n        internal const string ActivityId = \"ActivityId\";\n        internal const string RelatedActivityId = \"RelatedActivityId\";\n        internal const string ProcessId = \"ProcessId\";\n        internal const string ThreadId = \"ThreadId\";\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Formatters/XmlEventTextFormatter.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.Globalization;\nusing System.IO;\nusing System.Xml;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters\n{\n    /// <summary>\n    /// A <see cref=\"IEventTextFormatter\"/> implementation that writes out text formatted as XML compliant with the \n    /// <a href=\"http://msdn.microsoft.com/en-us/library/windows/desktop/aa385201(v=vs.85).aspx\">Event Schema</a>.\n    /// </summary>\n    /// <remarks>This class is not thread-safe.</remarks>\n    public class XmlEventTextFormatter : IEventTextFormatter\n    {\n        /// <summary>\n        /// The default event text formatting.\n        /// </summary>\n        public const EventTextFormatting DefaultEventTextFormatting = EventTextFormatting.None;\n\n        private const string EventNS = \"http://schemas.microsoft.com/win/2004/08/events/event\";\n        private readonly string machine = Environment.MachineName;\n        private readonly string culture = CultureInfo.CurrentCulture.Name.ToLowerInvariant();\n        private XmlWriterSettings settings;\n        private string dateTimeFormat;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"XmlEventTextFormatter\" /> class.\n        /// </summary>\n        /// <param name=\"formatting\">The <see cref=\"EventTextFormatting\" /> formatting.</param>\n        /// <param name=\"dateTimeFormat\">The date time format used for timestamp value.</param>\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Globalization\", \"CA1308:NormalizeStringsToUppercase\", Justification = \"Normalized string is standard locale code\")]\n        public XmlEventTextFormatter(EventTextFormatting formatting = DefaultEventTextFormatting, string dateTimeFormat = null)\n        {\n            this.Formatting = formatting;\n            this.DateTimeFormat = dateTimeFormat;\n            this.settings = new XmlWriterSettings()\n            {\n                Indent = formatting == EventTextFormatting.Indented,  // Indent on formatting setting\n                OmitXmlDeclaration = true,                            // Do not add xml declaration\n            };\n        }\n\n        /// <summary>\n        /// Gets or sets the date time format used for timestamp value.\n        /// </summary>\n        /// <value>\n        /// The date time format.\n        /// </value>\n        public string DateTimeFormat\n        {\n            get\n            {\n                return this.dateTimeFormat;\n            }\n\n            set\n            {\n                Guard.ValidDateTimeFormat(value, \"DateTimeFormat\");\n                this.dateTimeFormat = value;\n            }\n        }\n\n        /// <summary>\n        /// Gets the <see cref=\"EventTextFormatting\"/>.\n        /// </summary>\n        /// <value>The <see cref=\"EventTextFormatting\"/>.</value>\n        public EventTextFormatting Formatting { get; private set; }\n\n        /// <summary>\n        /// Writes the event.\n        /// </summary>\n        /// <param name=\"eventEntry\">The <see cref=\"EventWrittenEventArgs\" /> instance containing the event data.</param>\n        /// <param name=\"writer\">The writer.</param>\n        public void WriteEvent(EventEntry eventEntry, TextWriter writer)\n        {\n            Guard.ArgumentNotNull(eventEntry, \"eventEntry\");\n\n            using (var xmlWriter = XmlWriter.Create(writer, this.settings))\n            {\n                xmlWriter.WriteStartElement(\"Event\", EventNS);\n\n                xmlWriter.WriteStartElement(\"System\");\n                xmlWriter.WriteStartElement(\"Provider\");\n                xmlWriter.WriteAttributeString(\"Guid\", eventEntry.ProviderId.ToString(\"B\"));\n                xmlWriter.WriteEndElement();\n                xmlWriter.WriteStartElement(\"EventID\");\n                xmlWriter.WriteValue(eventEntry.EventId);\n                xmlWriter.WriteEndElement();\n                xmlWriter.WriteStartElement(\"Version\");\n                xmlWriter.WriteValue(eventEntry.Schema.Version);\n                xmlWriter.WriteEndElement();\n                xmlWriter.WriteStartElement(\"Level\");\n                xmlWriter.WriteValue((int)eventEntry.Schema.Level);\n                xmlWriter.WriteEndElement();\n                xmlWriter.WriteStartElement(\"Task\");\n                xmlWriter.WriteValue((int)eventEntry.Schema.Task);\n                xmlWriter.WriteEndElement();\n                xmlWriter.WriteStartElement(\"Opcode\");\n                xmlWriter.WriteValue((int)eventEntry.Schema.Opcode);\n                xmlWriter.WriteEndElement();\n                xmlWriter.WriteElementString(\"Keywords\", ToHex(eventEntry.Schema.Keywords));\n                xmlWriter.WriteStartElement(\"TimeCreated\");\n                xmlWriter.WriteAttributeString(\"SystemTime\", eventEntry.GetFormattedTimestamp(this.DateTimeFormat));\n                xmlWriter.WriteEndElement();\n\n                if (eventEntry.ActivityId != Guid.Empty || eventEntry.RelatedActivityId != Guid.Empty)\n                {\n                    xmlWriter.WriteStartElement(\"Correlation\");\n                    xmlWriter.WriteAttributeString(\"ActivityID\", eventEntry.ActivityId.ToString(\"B\"));\n                    if (eventEntry.RelatedActivityId != Guid.Empty)\n                    {\n                        xmlWriter.WriteAttributeString(\"RelatedActivityID\", eventEntry.RelatedActivityId.ToString(\"B\"));\n                    }\n\n                    xmlWriter.WriteEndElement();\n                }\n\n                xmlWriter.WriteStartElement(\"Execution\");\n                xmlWriter.WriteAttributeString(\"ProcessID\", eventEntry.ProcessId.ToString(CultureInfo.InvariantCulture));\n                xmlWriter.WriteAttributeString(\"ThreadID\", eventEntry.ThreadId.ToString(CultureInfo.InvariantCulture));\n                xmlWriter.WriteEndElement();\n\n                xmlWriter.WriteElementString(\"Computer\", this.machine);\n                xmlWriter.WriteEndElement(); // System\n\n                xmlWriter.WriteStartElement(\"EventData\");\n                XmlWritePayload(xmlWriter, eventEntry);\n                xmlWriter.WriteEndElement();\n\n                xmlWriter.WriteStartElement(\"RenderingInfo\");\n                xmlWriter.WriteAttributeString(\"Culture\", this.culture);\n                xmlWriter.WriteElementString(\"Message\", (eventEntry != null) ? eventEntry.FormattedMessage : null);\n                xmlWriter.WriteEndElement();\n\n                xmlWriter.WriteEndElement(); // Event                  \n\n                // Writes out a new line when Indented because WriteEndElement\n                // does not add it after closing the root element (Event)\n                if (this.Formatting == EventTextFormatting.Indented)\n                {\n                    xmlWriter.WriteRaw(xmlWriter.Settings.NewLineChars);\n                }\n            }\n        }\n\n        private static string ToHex(EventKeywords value)\n        {\n            return string.Format(CultureInfo.InvariantCulture, \"0x{0:X}\", (long)value);\n        }\n\n        private static void XmlWritePayload(XmlWriter writer, EventEntry entry)\n        {\n            var eventSchema = entry.Schema;\n\n            for (int i = 0; i < entry.Payload.Count; i++)\n            {\n                try\n                {\n                    writer.WriteStartElement(\"Data\");\n                    writer.WriteAttributeString(\"Name\", eventSchema.Payload[i]);\n\n                    if (entry.Payload[i] != null)\n                    {\n                        SanitizeAndWritePayload(entry.Payload[i], writer);\n                    }\n\n                    writer.WriteEndElement();\n                }\n                catch (Exception e)\n                {\n                    SemanticLoggingEventSource.Log.EventEntryXmlWriterFailed(e.ToString());\n\n                    // We are in Error state so abort the write operation\n                    throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.XmlSerializationError, e.Message), e);\n                }\n            }\n        }\n\n        private static void SanitizeAndWritePayload(object value, XmlWriter writer)\n        {\n            var valueType = value.GetType();\n            if (valueType == typeof(Guid))\n            {\n                writer.WriteValue(XmlConvert.ToString((Guid)value));\n            }\n            else if (valueType.IsEnum)\n            {\n                writer.WriteValue(((Enum)value).ToString(\"D\"));\n            }\n            else\n            {\n                writer.WriteValue(value);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/GlobalSuppressions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\n// This file is used by Code Analysis to maintain SuppressMessage \n// attributes that are applied to this project.\n// Project-level suppressions either have no target or are given \n// a specific target and scoped to a namespace, type, member, etc.\n//\n// To add a suppression to this file, right-click the message in the \n// Code Analysis results, point to \"Suppress Message\", and click \n// \"In Suppression File\".\n// You do not need to add suppressions to this file manually.\n\n// Suppressions for general exceptions caught and logged\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.EventTextFormatter.#FormatPayload(Microsoft.Practices.EnterpriseLibrary.SemanticLogging.EventEntry)\", Justification = \"Exceptions are logged\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.ObservableEventListener.#OnEventWritten(System.Diagnostics.Tracing.EventWrittenEventArgs)\", Justification = \"Exceptions are logged\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.ConsoleSink.#OnNext(System.String,System.Nullable`1<System.ConsoleColor>)\", Justification = \"Exceptions are logged\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.FlatFileSink.#OnSingleEventWritten(System.String)\", Justification = \"Exceptions are logged\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.FlatFileSink.#WriteEntries()\", Justification = \"Exceptions are logged\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.RollingFlatFileSink.#OnSingleEventWritten(System.String)\", Justification = \"Exceptions are logged\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.RollingFlatFileSink.#WriteEntries()\", Justification = \"Exceptions are logged\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility.EventEntryExtensions.#TryFormatAsString(Microsoft.Practices.EnterpriseLibrary.SemanticLogging.EventEntry,Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.IEventTextFormatter)\", Justification = \"Exceptions are logged\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility.EventEntryExtensions.#TryFormatAsStringAndColor(Microsoft.Practices.EnterpriseLibrary.SemanticLogging.EventEntry,Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.IEventTextFormatter,Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.IConsoleColorMapper)\", Justification = \"Exceptions are logged\")]\n\n// Suppressions for casing of Opcode\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Opcode\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema.EventSchema.#OpcodeName\", Justification = \"Uses casing from EventWrittenEventArgs.Opcode\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"opcode\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema.EventSchema.#.ctor(System.Int32,System.Guid,System.String,System.Diagnostics.Tracing.EventLevel,System.Diagnostics.Tracing.EventTask,System.String,System.Diagnostics.Tracing.EventOpcode,System.String,System.Diagnostics.Tracing.EventKeywords,System.String,System.Int32,System.Collections.Generic.IEnumerable`1<System.String>)\", Justification = \"Uses casing from EventWrittenEventArgs.Opcode\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Opcode\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema.EventSchema.#Opcode\", Justification = \"Uses casing from EventWrittenEventArgs.Opcode\")]\n\n// Suppressions for default parameters\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1026:DefaultParametersShouldNotBeUsed\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.ConsoleLog.#LogToConsole(System.IObservable`1<Microsoft.Practices.EnterpriseLibrary.SemanticLogging.EventEntry>,Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.IEventTextFormatter,Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.IConsoleColorMapper)\", Justification = \"As designed.\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1026:DefaultParametersShouldNotBeUsed\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.ConsoleLog.#CreateListener(Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.IEventTextFormatter,Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.IConsoleColorMapper)\", Justification = \"As designed.\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1026:DefaultParametersShouldNotBeUsed\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.EventTextFormatter.#.ctor(System.String,System.String,System.Diagnostics.Tracing.EventLevel,System.String)\", Justification = \"As designed.\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1026:DefaultParametersShouldNotBeUsed\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.FlatFileLog.#LogToFlatFile(System.IObservable`1<Microsoft.Practices.EnterpriseLibrary.SemanticLogging.EventEntry>,System.String,Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.IEventTextFormatter,System.Boolean)\", Justification = \"As designed.\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1026:DefaultParametersShouldNotBeUsed\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.FlatFileLog.#CreateListener(System.String,Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.IEventTextFormatter,System.Boolean)\", Justification = \"As designed.\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1026:DefaultParametersShouldNotBeUsed\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.JsonEventTextFormatter.#.ctor(Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.EventTextFormatting,System.String)\", Justification = \"As designed.\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1026:DefaultParametersShouldNotBeUsed\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.RollingFlatFileLog.#LogToRollingFlatFile(System.IObservable`1<Microsoft.Practices.EnterpriseLibrary.SemanticLogging.EventEntry>,System.String,System.Int32,System.String,Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.RollFileExistsBehavior,Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.RollInterval,Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.IEventTextFormatter,System.Int32,System.Boolean)\", Justification = \"As designed.\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1026:DefaultParametersShouldNotBeUsed\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.RollingFlatFileLog.#CreateListener(System.String,System.Int32,System.String,Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.RollFileExistsBehavior,Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.RollInterval,Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.IEventTextFormatter,System.Int32,System.Boolean)\", Justification = \"As designed.\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1026:DefaultParametersShouldNotBeUsed\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.XmlEventTextFormatter.#.ctor(Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters.EventTextFormatting,System.String)\", Justification = \"As designed.\")]\n"
  },
  {
    "path": "source/Src/SemanticLogging/Keywords.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging\n{\n    /// <summary>\n    /// EventKeywords additional constants for <see cref=\"System.Diagnostics.Tracing.EventKeywords\"/>.\n    /// </summary>\n    public static class Keywords\n    {\n        /// <summary>\n        /// Keyword flags to enable all the events. \n        /// </summary>\n        public const EventKeywords All = (EventKeywords)(-1);\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Observable/EventEntrySubject.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable\n{\n    /// <summary>\n    /// A subject that can be observed and publish events.\n    /// </summary>    \n    /// <remarks>\n    /// This is a very basic implementation of a subject to avoid references to Rx when the\n    /// end user might not want to do advanced filtering and projection of event streams.\n    /// </remarks>\n    internal sealed class EventEntrySubject : IObservable<EventEntry>, IObserver<EventEntry>, IDisposable\n    {\n        private readonly object lockObject = new object();\n        private volatile ReadOnlyCollection<IObserver<EventEntry>> observers = new List<IObserver<EventEntry>>().AsReadOnly();\n        private volatile bool isFrozen = false;\n\n        /// <summary>\n        /// Releases all resources used by the current instance and unsubscribes all the observers.\n        /// </summary>\n        public void Dispose()\n        {\n            this.OnCompleted();\n        }\n\n        /// <summary>\n        /// Notifies the provider that an observer is to receive notifications.\n        /// </summary>\n        /// <param name=\"observer\">The object that is to receive notifications.</param>\n        /// <returns>A reference to an interface that allows observers to stop receiving notifications\n        /// before the provider has finished sending them.</returns>\n        public IDisposable Subscribe(IObserver<EventEntry> observer)\n        {\n            Guard.ArgumentNotNull(observer, \"observer\");\n\n            lock (this.lockObject)\n            {\n                if (!this.isFrozen)\n                {\n                    var copy = this.observers.ToList();\n                    copy.Add(observer);\n                    this.observers = copy.AsReadOnly();\n                    return new Subscription(this, observer);\n                }\n            }\n\n            observer.OnCompleted();\n            return new EmptyDisposable();\n        }\n\n        private void Unsubscribe(IObserver<EventEntry> observer)\n        {\n            lock (this.lockObject)\n            {\n                this.observers = this.observers.Where(x => !observer.Equals(x)).ToList().AsReadOnly();\n            }\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has finished sending push-based notifications.\n        /// </summary>\n        public void OnCompleted()\n        {\n            var currentObservers = this.TakeObserversAndFreeze();\n\n            if (currentObservers != null)\n            {\n                Parallel.ForEach(currentObservers, observer => observer.OnCompleted());\n            }\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has experienced an error condition.\n        /// </summary>\n        /// <param name=\"error\">An object that provides additional information about the error.</param>\n        public void OnError(Exception error)\n        {\n            var currentObservers = TakeObserversAndFreeze();\n\n            if (currentObservers != null)\n            {\n                Parallel.ForEach(currentObservers, observer => observer.OnError(error));\n            }\n        }\n\n        /// <summary>\n        /// Provides the observers with new data.\n        /// </summary>\n        /// <param name=\"value\">The current notification information.</param>\n        public void OnNext(EventEntry value)\n        {\n            foreach (var observer in this.observers)\n            {\n                // TODO: should I isolate errors (i.e: try/catch around each OnNext call)?\n                observer.OnNext(value);\n            }\n        }\n\n        private ReadOnlyCollection<IObserver<EventEntry>> TakeObserversAndFreeze()\n        {\n            lock (this.lockObject)\n            {\n                if (!this.isFrozen)\n                {\n                    this.isFrozen = true;\n                    var copy = this.observers;\n                    this.observers = new List<IObserver<EventEntry>>().AsReadOnly();\n\n                    return copy;\n                }\n\n                return null;\n            }\n        }\n\n        private sealed class Subscription : IDisposable\n        {\n            private IObserver<EventEntry> observer;\n            private EventEntrySubject subject;\n\n            public Subscription(EventEntrySubject subject, IObserver<EventEntry> observer)\n            {\n                this.subject = subject;\n                this.observer = observer;\n            }\n\n            public void Dispose()\n            {\n                var current = Interlocked.Exchange<IObserver<EventEntry>>(ref this.observer, null);\n                if (current != null)\n                {\n                    this.subject.Unsubscribe(current);\n                    this.subject = null;\n                }\n            }\n        }\n\n        private sealed class EmptyDisposable : IDisposable\n        {\n            public void Dispose()\n            {\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Observable/ObservableProjection.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Threading;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable\n{\n    /// <summary>\n    /// Very basic implementation of a projection of IObservable to avoid references to Rx when the\n    /// end user might not want to do advanced filtering and projection of event streams.\n    /// </summary>\n    internal static class ObservableProjection\n    {\n        /// <summary>\n        /// Creates a subscription to the source, where in every occurrence of the source stream, it transforms the input\n        /// item using the <paramref name=\"selector\"/> and pushes the result to the <paramref name=\"observer\"/>.\n        /// </summary>\n        /// <param name=\"source\">The original source stream.</param>\n        /// <param name=\"observer\">The observer of the output stream.</param>\n        /// <param name=\"selector\">The conversion delegate to convert from the original type to the destination.</param>\n        /// <typeparam name=\"Tin\">The type of the original source stream.</typeparam>\n        /// <typeparam name=\"Tout\">The type of the observer and output stream.</typeparam>\n        /// <returns>Returns a subscription token used to unsubscribe to the original source.</returns>\n        /// <remarks>This method is behaviorally equivalent to doing the following using Rx: source.Select(selector).Subscribe(observer).</remarks>\n        public static IDisposable CreateSubscription<Tin, Tout>(this IObservable<Tin> source, IObserver<Tout> observer, Func<Tin, Tout> selector)\n            where Tin : class\n        {\n            var projection = new Projection<Tin, Tout>(observer, selector);\n            return projection.Connect(source);\n        }\n\n        [SuppressMessage(\"Microsoft.Design\", \"CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable\", Justification = \"The lifetime is managed by the subscription that is returned to the user.\")]\n        private sealed class Projection<Tin, Tout> : IObserver<Tin>\n            where Tin : class\n        {\n            private readonly Func<Tin, Tout> selector;\n            private IObserver<Tout> observer;\n            private ProjectionSubscription subscription;\n\n            public Projection(IObserver<Tout> observer, Func<Tin, Tout> selector)\n            {\n                this.observer = observer;\n                this.selector = selector;\n            }\n\n            public IDisposable Connect(IObservable<Tin> source)\n            {\n                this.subscription = new ProjectionSubscription(this, source.Subscribe(this));\n                return this.subscription;\n            }\n\n            void IObserver<Tin>.OnCompleted()\n            {\n                this.observer.OnCompleted();\n                using (this.subscription) { }\n            }\n\n            void IObserver<Tin>.OnError(Exception error)\n            {\n                this.observer.OnError(error);\n                using (this.subscription) { }\n            }\n\n            void IObserver<Tin>.OnNext(Tin value)\n            {\n                if (value != null)\n                {\n                    this.observer.OnNext(selector(value));\n                }\n            }\n\n            private class NoOpObserver : IObserver<Tout>\n            {\n                void IObserver<Tout>.OnCompleted() { }\n                void IObserver<Tout>.OnError(Exception error) { }\n                void IObserver<Tout>.OnNext(Tout value) { }\n            }\n\n            private sealed class ProjectionSubscription : IDisposable\n            {\n                private Projection<Tin, Tout> parent;\n                private IDisposable subscription;\n\n                public ProjectionSubscription(Projection<Tin, Tout> parent, IDisposable subscription)\n                {\n                    this.parent = parent;\n                    this.subscription = subscription;\n                }\n\n                public void Dispose()\n                {\n                    var currentParent = Interlocked.Exchange<Projection<Tin, Tout>>(ref this.parent, null);\n                    if (currentParent != null)\n                    {\n                        this.subscription.Dispose();\n                        currentParent.observer = new NoOpObserver();\n                        this.subscription = null;\n                    }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/ObservableEventListener.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging\n{\n    /// <summary>\n    /// An <see cref=\"EventListener\" /> that can be observed.\n    /// </summary>\n    /// <remarks>\n    /// This class is thread-safe.\n    /// </remarks>\n    public sealed class ObservableEventListener : EventListener, IObservable<EventEntry>\n    {\n        private EventSourceSchemaCache schemaCache = EventSourceSchemaCache.Instance;\n        private EventEntrySubject subject = new EventEntrySubject();\n        private object deferredEnablePadlock = new object();\n        private DeferredEnable deferredEnables;\n\n        /// <summary>\n        /// Releases all resources used by the current instance and unsubscribes all the observers.\n        /// </summary>\n        [SuppressMessage(\"Microsoft.Design\", \"CA1063:ImplementIDisposableCorrectly\", Justification = \"Incorrect implementation is inherited from base class\")]\n        [SuppressMessage(\"Microsoft.Usage\", \"CA2202:Do not dispose objects multiple times\", Justification = \"Calls the base class Dispose() and the local class Dispose(bool)\")]\n        public override void Dispose()\n        {\n            base.Dispose();\n            this.subject.Dispose();\n        }\n\n        /// <summary>\n        /// Disables all events for the specified event source.\n        /// </summary>\n        /// <param name=\"eventSourceName\">The name of the event source to enable events for.</param>\n        /// <remarks>\n        /// If the event source with the supplied name has already been created the request is processed immediately. Otherwise the request\n        /// is deferred until the event source is created.\n        /// </remarks>\n        public void DisableEvents(string eventSourceName)\n        {\n            lock (this.deferredEnablePadlock)\n            {\n                Guard.ArgumentNotNullOrEmpty(eventSourceName, \"eventSourceName\");\n\n                lock (this.deferredEnablePadlock)\n                {\n                    foreach (var eventSource in EventSource.GetSources())\n                    {\n                        if (string.Equals(eventSource.Name, eventSourceName, StringComparison.Ordinal))\n                        {\n                            this.DisableEvents(eventSource);\n\n                            break;\n                        }\n                    }\n\n                    // cleanup deferred enables\n                    this.ConsumeDeferredEnable(eventSourceName, _ => { });\n                }\n            }\n        }\n\n        /// <summary>\n        /// Enables events for the event source with the specified name that have the specified verbosity level or lower.\n        /// </summary>\n        /// <param name=\"eventSourceName\">The name of the event source to enable events for.</param>\n        /// <param name=\"level\">The level of events to enable.</param>\n        /// <returns>\n        ///   <see langword=\"false\" /> if the request was deferred; otherwise, <see langword=\"true\" />.\n        /// </returns>\n        /// <remarks>\n        /// If the event source with the supplied name has already been created the request is processed immediately. Otherwise the request\n        /// is deferred until the event source is created.\n        /// </remarks>\n        public bool EnableEvents(string eventSourceName, EventLevel level)\n        {\n            return this.EnableEvents(eventSourceName, level, EventKeywords.None);\n        }\n\n        /// <summary>\n        /// Enables events for the specified event source that has the specified verbosity level or lower, and matching keyword flags.\n        /// </summary>\n        /// <param name=\"eventSourceName\">The name of the event source to enable events for.</param>\n        /// <param name=\"level\">The level of events to enable.</param>\n        /// <param name=\"matchAnyKeyword\">The keyword flags necessary to enable the events.</param>\n        /// <returns>\n        ///   <see langword=\"false\" /> if the request was deferred; otherwise, <see langword=\"true\" />.\n        /// </returns>\n        /// <remarks>\n        /// If the event source with the supplied name has already been created the request is processed immediately. Otherwise the request\n        /// is deferred until the event source is created.\n        /// </remarks>\n        public bool EnableEvents(string eventSourceName, EventLevel level, EventKeywords matchAnyKeyword)\n        {\n            return this.EnableEvents(eventSourceName, level, matchAnyKeyword, null);\n        }\n\n        /// <summary>\n        /// Enables events for the specified event source that has the specified verbosity level or lower, and matching keyword flags.\n        /// </summary>\n        /// <param name=\"eventSourceName\">The name of the event source to enable events for.</param>\n        /// <param name=\"level\">The level of events to enable.</param>\n        /// <param name=\"matchAnyKeyword\">The keyword flags necessary to enable the events.</param>\n        /// <param name=\"arguments\">The arguments to be matched to enable the events.</param>\n        /// <returns>\n        ///   <see langword=\"false\" /> if the request was deferred; otherwise, <see langword=\"true\" />.\n        /// </returns>\n        /// <remarks>\n        /// If the event source with the supplied name has already been created the request is processed immediately. Otherwise the request\n        /// is deferred until the event source is created.\n        /// </remarks>\n        public bool EnableEvents(string eventSourceName, EventLevel level, EventKeywords matchAnyKeyword, IDictionary<string, string> arguments)\n        {\n            Guard.ArgumentNotNullOrEmpty(eventSourceName, \"eventSourceName\");\n\n            lock (this.deferredEnablePadlock)\n            {\n                foreach (var eventSource in EventSource.GetSources())\n                {\n                    if (string.Equals(eventSource.Name, eventSourceName, StringComparison.Ordinal))\n                    {\n                        this.EnableEvents(eventSource, level, matchAnyKeyword, arguments);\n\n                        return true;\n                    }\n                }\n\n                // remove any previous deferred enable for the same source name and add a new one\n                this.ConsumeDeferredEnable(eventSourceName, _ => { });\n                this.deferredEnables =\n                    new DeferredEnable\n                    {\n                        EventSourceName = eventSourceName,\n                        Level = level,\n                        MatchAnyKeyword = matchAnyKeyword,\n                        Arguments = arguments != null ? new Dictionary<string, string>(arguments) : null,\n                        Next = this.deferredEnables\n                    };\n\n                return false;\n            }\n        }\n\n        /// <summary>\n        /// Notifies the provider that an observer is to receive notifications.\n        /// </summary>\n        /// <param name=\"observer\">The object that is to receive notifications.</param>\n        /// <returns>A reference to an interface that allows observers to stop receiving notifications\n        /// before the provider has finished sending them.</returns>\n        public IDisposable Subscribe(IObserver<EventEntry> observer)\n        {\n            return this.subject.Subscribe(observer);\n        }\n\n        /// <summary>\n        /// Called whenever an event has been written by an event source for which the event listener has enabled events.\n        /// </summary>\n        /// <param name=\"eventData\">The event arguments that describe the event.</param>\n        protected override void OnEventWritten(EventWrittenEventArgs eventData)\n        {\n            Guard.ArgumentNotNull(eventData, \"eventData\");\n\n            EventSchema schema = null;\n            try\n            {\n                schema = this.schemaCache.GetSchema(eventData.EventId, eventData.EventSource);\n            }\n            catch (Exception ex)\n            {\n                // TODO: should I notify all the observers or should I just publish a non-transient\n                // error and not notify the rest of the listeners?\n                // this.subject.OnError(ex);\n\n                SemanticLoggingEventSource.Log.ParsingEventSourceManifestFailed(eventData.EventSource.Name, eventData.EventId, ex.ToString());\n                return;\n            }\n\n            var entry = EventEntry.Create(eventData, schema);\n\n            this.subject.OnNext(entry);\n        }\n\n        /// <summary>\n        /// Called for all existing event sources when the event listener is created and when a new event source is attached to the listener.\n        /// </summary>\n        /// <param name=\"eventSource\">The event source.</param>\n        /// <remarks>\n        /// The listener processes any deferred enable events requests associated to the <paramref name=\"eventSource\"/>.\n        /// </remarks>\n        protected override void OnEventSourceCreated(EventSource eventSource)\n        {\n            base.OnEventSourceCreated(eventSource);\n\n            lock (this.deferredEnablePadlock)\n            {\n                this.ConsumeDeferredEnable(\n                    eventSource.Name,\n                    deferredEnable => this.EnableEvents(eventSource, deferredEnable.Level, deferredEnable.MatchAnyKeyword, deferredEnable.Arguments));\n            }\n        }\n\n        private void ConsumeDeferredEnable(string eventSourceName, Action<DeferredEnable> action)\n        {\n            DeferredEnable previousEnable = null;\n            for (var currentDeferredEnable = this.deferredEnables; currentDeferredEnable != null; currentDeferredEnable = currentDeferredEnable.Next)\n            {\n                if (string.Equals(currentDeferredEnable.EventSourceName, eventSourceName, StringComparison.Ordinal))\n                {\n                    // consume the deferred enable\n                    action(currentDeferredEnable);\n\n                    // remove the entry\n                    if (previousEnable == null)\n                    {\n                        this.deferredEnables = currentDeferredEnable.Next;\n                    }\n                    else\n                    {\n                        previousEnable.Next = currentDeferredEnable.Next;\n                    }\n\n                    return;\n                }\n\n                previousEnable = currentDeferredEnable;\n            }\n        }\n\n        private class DeferredEnable\n        {\n            public string EventSourceName;\n            public EventLevel Level;\n            public EventKeywords MatchAnyKeyword;\n            public IDictionary<string, string> Arguments;\n            public DeferredEnable Next;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Properties/AssemblyInfo.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Reflection;\nusing System.Resources;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Security;\n\n[assembly: AssemblyTitle(\"Enterprise Library Semantic Logging Application Block\")]\n[assembly: AssemblyDescription(\"Enterprise Library Semantic Logging Application Block\")]\n\n[assembly: AllowPartiallyTrustedCallers]\n\n[assembly: AssemblyVersion(\"2.0.0.0\")]\n[assembly: AssemblyFileVersion(\"2.0.1406.1\")]\n[assembly: AssemblyInformationalVersion(\"2.0.1406.1\")]\n\n[assembly: ComVisible(false)]\n[assembly: NeutralResourcesLanguage(\"en-US\")]\n\n#if SIGN\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.WindowsAzure, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Database, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Elasticsearch, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.TextFile, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.EventSourceAnalyzer, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n#else\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.WindowsAzure\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Database\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Elasticsearch\")] \n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.TextFile\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.EventSourceAnalyzer\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Shared\")]\n#endif"
  },
  {
    "path": "source/Src/SemanticLogging/Properties/Resources.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\n// <auto-generated>\n//     This code was generated by a tool.\n//     Runtime Version:4.0.30319.34209\n//\n//     Changes to this file may cause incorrect behavior and will be lost if\n//     the code is regenerated.\n// </auto-generated>\n//------------------------------------------------------------------------------\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Properties {\n    using System;\n    \n    \n    /// <summary>\n    ///   A strongly-typed resource class, for looking up localized strings, etc.\n    /// </summary>\n    // This class was auto-generated by the StronglyTypedResourceBuilder\n    // class via a tool like ResGen or Visual Studio.\n    // To add or remove a member, edit your .ResX file then rerun ResGen\n    // with the /str option, or rebuild your VS project.\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Resources.Tools.StronglyTypedResourceBuilder\", \"4.0.0.0\")]\n    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\n    internal class Resources {\n        \n        private static global::System.Resources.ResourceManager resourceMan;\n        \n        private static global::System.Globalization.CultureInfo resourceCulture;\n        \n        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"Microsoft.Performance\", \"CA1811:AvoidUncalledPrivateCode\")]\n        internal Resources() {\n        }\n        \n        /// <summary>\n        ///   Returns the cached ResourceManager instance used by this class.\n        /// </summary>\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\n        internal static global::System.Resources.ResourceManager ResourceManager {\n            get {\n                if (object.ReferenceEquals(resourceMan, null)) {\n                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Properties.Resources\", typeof(Resources).Assembly);\n                    resourceMan = temp;\n                }\n                return resourceMan;\n            }\n        }\n        \n        /// <summary>\n        ///   Overrides the current thread's CurrentUICulture property for all\n        ///   resource lookups using this strongly typed resource class.\n        /// </summary>\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\n        internal static global::System.Globalization.CultureInfo Culture {\n            get {\n                return resourceCulture;\n            }\n            set {\n                resourceCulture = value;\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Argument is empty.\n        /// </summary>\n        internal static string ArgumentIsEmptyError {\n            get {\n                return ResourceManager.GetString(\"ArgumentIsEmptyError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The argument must be an instance of ObservableEventListener..\n        /// </summary>\n        internal static string ArgumentMustBeObservableEventListener {\n            get {\n                return ResourceManager.GetString(\"ArgumentMustBeObservableEventListener\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The size of &apos;{0}&apos; should be greater or equal to &apos;{1}&apos;..\n        /// </summary>\n        internal static string ArgumentNotGreaterOrEqualTo {\n            get {\n                return ResourceManager.GetString(\"ArgumentNotGreaterOrEqualTo\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The size of &apos;{0}&apos; should be lower or equal to &apos;{1}&apos;..\n        /// </summary>\n        internal static string ArgumentNotLowerOrEqualTo {\n            get {\n                return ResourceManager.GetString(\"ArgumentNotLowerOrEqualTo\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to An event type argument could not be properly serialized into an event source manifest. Verify any use of Enums whose base type is other than Int32 or Int64 and replace it with any of these allowed types. For more infromation about issues using Enums read: http://connect.microsoft.com/VisualStudio/feedback/details/785409/eventsource-manifest-generation-creates-wrong-map-values-for-enum-types-other-than-int32-or-int64.\n        /// </summary>\n        internal static string EventSourceAnalyzerBadFormedManifestError {\n            get {\n                return ResourceManager.GetString(\"EventSourceAnalyzerBadFormedManifestError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The number of WriteEvent arguments and event parameters are different in event name &apos;{0}&apos;..\n        /// </summary>\n        internal static string EventSourceAnalyzerDifferentParameterCount {\n            get {\n                return ResourceManager.GetString(\"EventSourceAnalyzerDifferentParameterCount\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to EventSource manifest generation failure.\n        ///{0}\n        ///Manifest:\n        ///{1}.\n        /// </summary>\n        internal static string EventSourceAnalyzerManifestGenerationError {\n            get {\n                return ResourceManager.GetString(\"EventSourceAnalyzerManifestGenerationError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A call to method &apos;{0}&apos; threw an exception..\n        /// </summary>\n        internal static string EventSourceAnalyzerMethodCallError {\n            get {\n                return ResourceManager.GetString(\"EventSourceAnalyzerMethodCallError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The parameter name &apos;{0}&apos; defined in the event &apos;{1}&apos; does not match the order in WriteEvent function..\n        /// </summary>\n        internal static string EventSourceAnalyzerMismatchParametersOrder {\n            get {\n                return ResourceManager.GetString(\"EventSourceAnalyzerMismatchParametersOrder\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The parameter name &apos;{0}&apos; with type &apos;{1}&apos; does not match the payload type &apos;{2}&apos; in method &apos;{3}&apos;. Check the parameter type in WriteEvent and assign a type that matches the same event arguement type . .\n        /// </summary>\n        internal static string EventSourceAnalyzerMismatchParametersType {\n            get {\n                return ResourceManager.GetString(\"EventSourceAnalyzerMismatchParametersType\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Event method &apos;{0}&apos; does not call WriteEvent() or the call is bypassed due to incorrect filtering before the WriteEvent call..\n        /// </summary>\n        internal static string EventSourceAnalyzerMissingWriteEventCallError {\n            get {\n                return ResourceManager.GetString(\"EventSourceAnalyzerMissingWriteEventCallError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The specified EventSource does not have any method decorated with EventAttribute..\n        /// </summary>\n        internal static string EventSourceAnalyzerNoEventsError {\n            get {\n                return ResourceManager.GetString(\"EventSourceAnalyzerNoEventsError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The payload argument in position &apos;{0}&apos; is sending a null value which may not map to the parameter &apos;{1}&apos; in event &apos;{2}&apos;..\n        /// </summary>\n        internal static string EventSourceAnalyzerNullPayloadValue {\n            get {\n                return ResourceManager.GetString(\"EventSourceAnalyzerNullPayloadValue\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Environment Variables access denied..\n        /// </summary>\n        internal static string ExceptionReadEnvironmentVariablesDenied {\n            get {\n                return ResourceManager.GetString(\"ExceptionReadEnvironmentVariablesDenied\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to An error occurred while flushing the event entries..\n        /// </summary>\n        internal static string FlushFailedException {\n            get {\n                return ResourceManager.GetString(\"FlushFailedException\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Could not created the formatter specified in configuration element name &apos;{0}&apos;..\n        /// </summary>\n        internal static string FormatterElementNotResolvedError {\n            get {\n                return ResourceManager.GetString(\"FormatterElementNotResolvedError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The parameters specified in this element does not map to an existing type member. All paramters are required in the same order of the defined type member. .\n        /// </summary>\n        internal static string IncompleteArgumentsError {\n            get {\n                return ResourceManager.GetString(\"IncompleteArgumentsError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Invalid arguments combination for buffering interval and count. Please specify valid range values for count and interval parameters..\n        /// </summary>\n        internal static string InvalidBufferingArguments {\n            get {\n                return ResourceManager.GetString(\"InvalidBufferingArguments\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The value does not represent a connection string.\n        /// </summary>\n        internal static string InvalidConnectionStringError {\n            get {\n                return ResourceManager.GetString(\"InvalidConnectionStringError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The date time format is invalid..\n        /// </summary>\n        internal static string InvalidDateTimeFormatError {\n            get {\n                return ResourceManager.GetString(\"InvalidDateTimeFormatError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A file name with a relative path is not allowed. Provide only the file name or the full path of the file..\n        /// </summary>\n        internal static string InvalidNavigationPathInFileNameError {\n            get {\n                return ResourceManager.GetString(\"InvalidNavigationPathInFileNameError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A file name with a relative path after replacing environment variables is not allowed. Provide only the file name or the full path of the file..\n        /// </summary>\n        internal static string InvalidNavigationPathInReplacedFileNameError {\n            get {\n                return ResourceManager.GetString(\"InvalidNavigationPathInReplacedFileNameError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Cannot serialize to JSON format the payload: {0}.\n        /// </summary>\n        internal static string JsonSerializationError {\n            get {\n                return ResourceManager.GetString(\"JsonSerializationError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The maxBufferSize argument has to be at least 3 times larger than the bufferingCount argument. Current values are maxBufferSize={0} and bufferingCount={1}..\n        /// </summary>\n        internal static string MaxBufferSizeShouldBeLargerThanBufferingCount {\n            get {\n                return ResourceManager.GetString(\"MaxBufferSizeShouldBeLargerThanBufferingCount\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Cannot serialize the payload: {0}.\n        /// </summary>\n        internal static string TextSerializationError {\n            get {\n                return ResourceManager.GetString(\"TextSerializationError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The valid range for &apos;{0}&apos; is from 0 to 24.20:31:23.647.\n        /// </summary>\n        internal static string TimeSpanOutOfRangeError {\n            get {\n                return ResourceManager.GetString(\"TimeSpanOutOfRangeError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Cannot serialize to XML format the payload: {0}.\n        /// </summary>\n        internal static string XmlSerializationError {\n            get {\n                return ResourceManager.GetString(\"XmlSerializationError\", resourceCulture);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Properties/Resources.resx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The primary goals of this format is to allow a simple XML format \n    that is mostly human readable. The generation and parsing of the \n    various data types are done through the TypeConverter classes \n    associated with the data types.\n    \n    Example:\n    \n    ... ado.net/XML headers & schema ...\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\n    <resheader name=\"version\">2.0</resheader>\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\n    </data>\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\n        <comment>This is a comment</comment>\n    </data>\n                \n    There are any number of \"resheader\" rows that contain simple \n    name/value pairs.\n    \n    Each data row contains a name, and value. The row also contains a \n    type or mimetype. Type corresponds to a .NET class that support \n    text/value conversion through the TypeConverter architecture. \n    Classes that don't support this are serialized and stored with the \n    mimetype set.\n    \n    The mimetype is used for serialized objects, and tells the \n    ResXResourceReader how to depersist the object. This is currently not \n    extensible. For a given mimetype the value must be set accordingly:\n    \n    Note - application/x-microsoft.net.object.binary.base64 is the format \n    that the ResXResourceWriter will generate, however the reader can \n    read any of the formats listed below.\n    \n    mimetype: application/x-microsoft.net.object.binary.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\n            : and then encoded with base64 encoding.\n    \n    mimetype: application/x-microsoft.net.object.soap.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.bytearray.base64\n    value   : The object must be serialized into a byte array \n            : using a System.ComponentModel.TypeConverter\n            : and then encoded with base64 encoding.\n    -->\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\n      <xsd:complexType>\n        <xsd:choice maxOccurs=\"unbounded\">\n          <xsd:element name=\"metadata\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"assembly\">\n            <xsd:complexType>\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"data\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"resheader\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\n            </xsd:complexType>\n          </xsd:element>\n        </xsd:choice>\n      </xsd:complexType>\n    </xsd:element>\n  </xsd:schema>\n  <resheader name=\"resmimetype\">\n    <value>text/microsoft-resx</value>\n  </resheader>\n  <resheader name=\"version\">\n    <value>2.0</value>\n  </resheader>\n  <resheader name=\"reader\">\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <resheader name=\"writer\">\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <data name=\"ArgumentIsEmptyError\" xml:space=\"preserve\">\n    <value>Argument is empty</value>\n  </data>\n  <data name=\"ArgumentNotGreaterOrEqualTo\" xml:space=\"preserve\">\n    <value>The size of '{0}' should be greater or equal to '{1}'.</value>\n  </data>\n  <data name=\"ExceptionReadEnvironmentVariablesDenied\" xml:space=\"preserve\">\n    <value>Environment Variables access denied.</value>\n  </data>\n  <data name=\"FlushFailedException\" xml:space=\"preserve\">\n    <value>An error occurred while flushing the event entries.</value>\n  </data>\n  <data name=\"InvalidBufferingArguments\" xml:space=\"preserve\">\n    <value>Invalid arguments combination for buffering interval and count. Please specify valid range values for count and interval parameters.</value>\n  </data>\n  <data name=\"InvalidConnectionStringError\" xml:space=\"preserve\">\n    <value>The value does not represent a connection string</value>\n  </data>\n  <data name=\"InvalidDateTimeFormatError\" xml:space=\"preserve\">\n    <value>The date time format is invalid.</value>\n  </data>\n  <data name=\"InvalidNavigationPathInFileNameError\" xml:space=\"preserve\">\n    <value>A file name with a relative path is not allowed. Provide only the file name or the full path of the file.</value>\n  </data>\n  <data name=\"JsonSerializationError\" xml:space=\"preserve\">\n    <value>Cannot serialize to JSON format the payload: {0}</value>\n  </data>\n  <data name=\"TextSerializationError\" xml:space=\"preserve\">\n    <value>Cannot serialize the payload: {0}</value>\n  </data>\n  <data name=\"TimeSpanOutOfRangeError\" xml:space=\"preserve\">\n    <value>The valid range for '{0}' is from 0 to 24.20:31:23.647</value>\n  </data>\n  <data name=\"EventSourceAnalyzerManifestGenerationError\" xml:space=\"preserve\">\n    <value>EventSource manifest generation failure.\n{0}\nManifest:\n{1}</value>\n  </data>\n  <data name=\"EventSourceAnalyzerMethodCallError\" xml:space=\"preserve\">\n    <value>A call to method '{0}' threw an exception.</value>\n  </data>\n  <data name=\"EventSourceAnalyzerMissingWriteEventCallError\" xml:space=\"preserve\">\n    <value>Event method '{0}' does not call WriteEvent() or the call is bypassed due to incorrect filtering before the WriteEvent call.</value>\n  </data>\n  <data name=\"EventSourceAnalyzerNoEventsError\" xml:space=\"preserve\">\n    <value>The specified EventSource does not have any method decorated with EventAttribute.</value>\n  </data>\n  <data name=\"XmlSerializationError\" xml:space=\"preserve\">\n    <value>Cannot serialize to XML format the payload: {0}</value>\n  </data>\n  <data name=\"MaxBufferSizeShouldBeLargerThanBufferingCount\" xml:space=\"preserve\">\n    <value>The maxBufferSize argument has to be at least 3 times larger than the bufferingCount argument. Current values are maxBufferSize={0} and bufferingCount={1}.</value>\n  </data>\n  <data name=\"EventSourceAnalyzerMismatchParametersType\" xml:space=\"preserve\">\n    <value>The parameter name '{0}' with type '{1}' does not match the payload type '{2}' in method '{3}'. Check the parameter type in WriteEvent and assign a type that matches the same event arguement type . </value>\n  </data>\n  <data name=\"EventSourceAnalyzerMismatchParametersOrder\" xml:space=\"preserve\">\n    <value>The parameter name '{0}' defined in the event '{1}' does not match the order in WriteEvent function.</value>\n  </data>\n  <data name=\"EventSourceAnalyzerDifferentParameterCount\" xml:space=\"preserve\">\n    <value>The number of WriteEvent arguments and event parameters are different in event name '{0}'.</value>\n  </data>\n  <data name=\"EventSourceAnalyzerNullPayloadValue\" xml:space=\"preserve\">\n    <value>The payload argument in position '{0}' is sending a null value which may not map to the parameter '{1}' in event '{2}'.</value>\n  </data>\n  <data name=\"ArgumentNotLowerOrEqualTo\" xml:space=\"preserve\">\n    <value>The size of '{0}' should be lower or equal to '{1}'.</value>\n  </data>\n  <data name=\"InvalidNavigationPathInReplacedFileNameError\" xml:space=\"preserve\">\n    <value>A file name with a relative path after replacing environment variables is not allowed. Provide only the file name or the full path of the file.</value>\n  </data>\n  <data name=\"EventSourceAnalyzerBadFormedManifestError\" xml:space=\"preserve\">\n    <value>An event type argument could not be properly serialized into an event source manifest. Verify any use of Enums whose base type is other than Int32 or Int64 and replace it with any of these allowed types. For more infromation about issues using Enums read: http://connect.microsoft.com/VisualStudio/feedback/details/785409/eventsource-manifest-generation-creates-wrong-map-values-for-enum-types-other-than-int32-or-int64</value>\n  </data>\n  <data name=\"ArgumentMustBeObservableEventListener\" xml:space=\"preserve\">\n    <value>The argument must be an instance of ObservableEventListener.</value>\n  </data>\n  <data name=\"FormatterElementNotResolvedError\" xml:space=\"preserve\">\n    <value>Could not created the formatter specified in configuration element name '{0}'.</value>\n  </data>\n  <data name=\"IncompleteArgumentsError\" xml:space=\"preserve\">\n    <value>The parameters specified in this element does not map to an existing type member. All paramters are required in the same order of the defined type member. </value>\n  </data>\n</root>"
  },
  {
    "path": "source/Src/SemanticLogging/Schema/EventSchema.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema\n{\n    /// <summary>\n    /// Represents an <see cref=\"EventSource\"/> schema.\n    /// </summary>\n    public sealed class EventSchema\n    {\n        private readonly int id;\n        private readonly Guid providerId;\n        private readonly string providerName;\n        private readonly string[] payload;\n        private readonly EventTask task;\n        private readonly string taskName;\n        private readonly EventLevel level;\n        private readonly int version;\n        private readonly EventKeywords keywords;\n        private readonly string keywordsDescription;\n        private readonly EventOpcode opcode;\n        private readonly string opcodeName;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema.EventSchema\"/> class with the specified values.\n        /// </summary>\n        /// <param name=\"id\">The event id.</param>\n        /// <param name=\"providerId\">The provider GUID.</param>\n        /// <param name=\"providerName\">The provider name.</param>\n        /// <param name=\"level\">The event level.</param>\n        /// <param name=\"task\">The event task.</param>\n        /// <param name=\"taskName\">The event task name.</param>\n        /// <param name=\"opcode\">The event operation code.</param>\n        /// <param name=\"opcodeName\">The event operation code name.</param>\n        /// <param name=\"keywords\">The event keywords.</param>\n        /// <param name=\"keywordsDescription\">The event keywords description.</param>\n        /// <param name=\"version\">The event version.</param>\n        /// <param name=\"payload\">The event payload.</param>\n        public EventSchema(int id, Guid providerId, string providerName, EventLevel level, EventTask task, string taskName, EventOpcode opcode, string opcodeName, EventKeywords keywords, string keywordsDescription, int version, IEnumerable<string> payload)\n        {\n            this.id = id;\n            this.providerId = providerId;\n            this.providerName = providerName;\n            this.level = level;\n            this.task = task;\n            this.taskName = taskName;\n            this.opcode = opcode;\n            this.opcodeName = opcodeName;\n            this.keywords = keywords;\n            this.keywordsDescription = keywordsDescription;\n            this.version = version;\n            this.payload = payload.ToArray();\n        }\n\n        /// <summary>\n        /// Gets the event ID.\n        /// </summary>\n        /// <value>The event ID.</value>\n        public int Id\n        {\n            get { return this.id; }\n        }\n\n        /// <summary>\n        /// Gets the provider id.\n        /// </summary>        \n        /// <remarks>\n        /// Provider GUID can be <see cref=\"Guid.Empty\"/> for pre-Vista ETW providers.  \n        /// </remarks>\n        /// <value>The provider id.</value>\n        public Guid ProviderId\n        {\n            get { return this.providerId; }\n        }\n\n        /// <summary>\n        /// Gets the provider name.\n        /// </summary>\n        /// <value>The provider name.</value>\n        public string ProviderName\n        {\n            get { return this.providerName; }\n        }\n\n        /// <summary>\n        /// Gets the event task.\n        /// </summary>\n        /// <remarks>\n        /// Events for a given provider can be given a group identifier called a Task that indicates the\n        /// broad area within the provider that the event pertains to (for example the Kernel provider has\n        /// Tasks for Process, Threads, etc). \n        /// </remarks>\n        /// <value>The event task.</value>\n        public EventTask Task\n        {\n            get { return this.task; }\n        } // TODO: ushort?\n\n        /// <summary>\n        /// Gets the task name.\n        /// </summary>\n        /// <value>The task name.</value>\n        public string TaskName\n        {\n            get { return this.taskName; }\n        }\n\n        /// <summary>\n        /// Gets the payload names that maps to the event signature parameter names.\n        /// </summary>\n        /// <value>The event payload.</value>\n        public string[] Payload\n        {\n            get { return this.payload; }\n        }\n\n        /// <summary>\n        /// Gets the operation code.\n        /// </summary>\n        /// <remarks>\n        /// Each event has a Type identifier that indicates what kind of an event is being logged. Note that\n        /// providers are free to extend this set, so the id may not be just the value in <see cref=\"Opcode\"/>.\n        /// </remarks>\n        /// <value>The operation code.</value>\n        public EventOpcode Opcode\n        {\n            get { return this.opcode; }\n        }\n\n        /// <summary>\n        /// Gets the human-readable string name for the <see cref=\"EventSchema.Opcode\"/> property. \n        /// </summary>\n        /// <value>The operation code name.</value>\n        public string OpcodeName\n        {\n            get { return this.opcodeName; }\n        }\n\n        /// <summary>\n        /// Gets the event level.\n        /// </summary>\n        /// <value>The event level.</value>\n        public EventLevel Level\n        {\n            get { return this.level; }\n        }\n\n        /// <summary>\n        /// Gets the event version.\n        /// </summary>\n        /// <value>The event version.</value>\n        public int Version\n        {\n            get { return this.version; }\n        }\n\n        /// <summary>\n        /// Gets the event keywords.\n        /// </summary>\n        /// <value>The event keywords.</value>\n        public EventKeywords Keywords\n        {\n            get { return this.keywords; }\n        }\n\n        /// <summary>\n        /// Gets the human-readable string name for the <see cref=\"EventSchema.Keywords\"/> property. \n        /// </summary>\n        /// <value>The keyword description.</value>\n        public string KeywordsDescription\n        {\n            get { return this.keywordsDescription; }\n        }\n\n        /// <summary>\n        /// Gets the name for the event.\n        /// </summary>\n        /// <remarks>\n        /// This is simply the concatenation of the task and operation code names.\n        /// </remarks>\n        /// <value>The event name.</value>\n        public string EventName\n        {\n            get { return this.TaskName + this.OpcodeName; }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Schema/EventSourceSchemaCache.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.Diagnostics.Tracing;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema\n{\n    /// <summary>\n    /// Used for caching <see cref=\"EventSchema\"/>.\n    /// </summary>\n    public class EventSourceSchemaCache\n    {\n        private readonly ConcurrentDictionary<Guid, IReadOnlyDictionary<int, EventSchema>> schemas = new ConcurrentDictionary<Guid, IReadOnlyDictionary<int, EventSchema>>();\n        private readonly EventSourceSchemaReader schemaReader = new EventSourceSchemaReader();\n\n        static EventSourceSchemaCache()\n        {\n            Instance = new EventSourceSchemaCache();\n        }\n\n        /// <summary>\n        /// Gets the singleton instance of <see cref=\"EventSourceSchemaCache\"/>.\n        /// </summary>\n        /// <value>The instance of EventSourceSchemaCache.</value>\n        public static EventSourceSchemaCache Instance { get; private set; }\n\n        /// <summary>\n        /// Gets the <see cref=\"EventSchema\"/> for the specified eventId and eventSource.\n        /// </summary>\n        /// <param name=\"eventId\">The ID of the event.</param>\n        /// <param name=\"eventSource\">The event source.</param>\n        /// <returns>The EventSchema.</returns>\n        public EventSchema GetSchema(int eventId, EventSource eventSource)\n        {\n            Guard.ArgumentNotNull(eventSource, \"eventSource\");\n\n            IReadOnlyDictionary<int, EventSchema> events;\n\n            if (!this.schemas.TryGetValue(eventSource.Guid, out events))\n            {\n                events = new ReadOnlyDictionary<int, EventSchema>(this.schemaReader.GetSchema(eventSource));\n                this.schemas[eventSource.Guid] = events;\n            }\n\n            return events[eventId];\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Schema/EventSourceSchemaReader.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Text.RegularExpressions;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema\n{\n    /// <summary>\n    /// Parses the ETW manifest generated by the <see cref=\"EventSource\"/> class.\n    /// </summary>\n    public class EventSourceSchemaReader\n    {\n        private static readonly XNamespace Ns = \"http://schemas.microsoft.com/win/2004/08/events\";\n        private static readonly XName Root = Ns + \"instrumentationManifest\";\n        private static readonly XName Instrumentation = Ns + \"instrumentation\";\n        private static readonly XName Events = Ns + \"events\";\n        private static readonly XName Provider = Ns + \"provider\";\n        private static readonly XName Tasks = Ns + \"tasks\";\n        private static readonly XName Task = Ns + \"task\";\n        private static readonly XName Keywords = Ns + \"keywords\";\n        private static readonly XName Keyword = Ns + \"keyword\";\n        private static readonly XName Opcodes = Ns + \"opcodes\";\n        private static readonly XName Opcode = Ns + \"opcode\";\n        private static readonly XName Event = Ns + \"event\";\n        private static readonly XName Templates = Ns + \"templates\";\n        private static readonly XName Template = Ns + \"template\";\n\n        private static readonly Regex DotNetTokensRegex = new Regex(@\"%(\\d+)\", RegexOptions.Compiled);\n        private static readonly Regex StringIdRegex = new Regex(@\"\\$\\(string\\.(.+?)\\)\", RegexOptions.Compiled);\n\n        /// <summary>\n        /// Gets the schema for the specified event source.\n        /// </summary>\n        /// <param name=\"eventSource\">The event source.</param>\n        /// <returns>The event schema.</returns>\n        public IDictionary<int, EventSchema> GetSchema(EventSource eventSource)\n        {\n            Guard.ArgumentNotNull(eventSource, \"eventSource\");\n\n            return this.GetSchema(EventSource.GenerateManifest(eventSource.GetType(), null));\n        }\n\n        internal IDictionary<int, EventSchema> GetSchema(string manifest)\n        {\n            var doc = XDocument.Parse(manifest);\n\n            var provider = doc.Root.Element(Instrumentation).Element(Events).Element(Provider);\n            var templates = provider.Element(Templates);\n            var tasks = provider.Element(Tasks);\n            var opcodes = provider.Element(Opcodes);\n            var keywords = provider.Element(Keywords);\n            ////var stringTable = GetStringTable(doc.Root);\n\n            var providerGuid = (Guid)provider.Attribute(\"guid\");\n            var providerName = (string)provider.Attribute(\"name\");\n            var events = new Dictionary<int, EventSchema>();\n\n            foreach (var @event in provider.Element(Events).Elements(Event))\n            {\n                var eventId = (int)@event.Attribute(\"value\");\n                var templateRef = @event.Attribute(\"template\");\n                var taskName = (string)@event.Attribute(\"task\");\n\n                int taskId = 0;\n                if (!string.IsNullOrWhiteSpace(taskName))\n                {\n                    taskId = (int)tasks\n                        .Elements(Task)\n                        .First(t => (string)t.Attribute(\"name\") == taskName)\n                        .Attribute(\"value\");\n                }\n\n                var level = this.ParseLevel((string)@event.Attribute(\"level\"));\n                var opcode = this.ParseOpcode((string)@event.Attribute(\"opcode\"), opcodes);\n                ////var message = GetLocalizedString((string)@event.Attribute(\"message\"), stringTable);\n\n                var keywordNames = (string)@event.Attribute(\"keywords\");\n\n                long keywordsMask = 0;\n                if (!string.IsNullOrWhiteSpace(keywordNames))\n                {\n                    foreach (var keywordName in keywordNames.Split())\n                    {\n                        var keywordsMaskAtt = keywords\n                            .Elements(Keyword)\n                            .Where(k => (string)k.Attribute(\"name\") == keywordName)\n                            .Select(k => k.Attribute(\"mask\"))\n                            .FirstOrDefault();\n\n                        if (keywordsMaskAtt != null)\n                        {\n                            keywordsMask |= Convert.ToInt64(keywordsMaskAtt.Value, 16);\n                        }\n                    }\n                }\n\n                int version = @event.Attribute(\"version\") != null ? (int)@event.Attribute(\"version\") : 0;\n\n                IEnumerable<string> paramList;\n                if (templateRef == null)\n                {\n                    // Event has no parameters/payload\n                    paramList = Enumerable.Empty<string>();\n                }\n                else\n                {\n                    paramList = templates\n                                        .Elements(Template)\n                                        .First(t => (string)t.Attribute(\"tid\") == templateRef.Value)\n                                            .Elements(Ns + \"data\")\n                                            .Select(d => (string)d.Attribute(\"name\")).ToList();\n                }\n\n                events.Add(eventId,\n                        new EventSchema(\n                            eventId,\n                            providerGuid,\n                            providerName,\n                            level,\n                            (EventTask)taskId,\n                            taskName,\n                            opcode.Item2,\n                            opcode.Item1,\n                            ////message,\n                            (EventKeywords)keywordsMask,\n                            keywordNames,\n                            version,\n                            paramList));\n            }\n\n            return events;\n        }\n\n        private EventLevel ParseLevel(string level)\n        {\n            switch (level)\n            {\n                case \"win:Critical\":\n                    return EventLevel.Critical;\n                case \"win:Error\":\n                    return EventLevel.Error;\n                case \"win:Warning\":\n                    return EventLevel.Warning;\n                case \"win:Informational\":\n                    return EventLevel.Informational;\n                case \"win:Verbose\":\n                    return EventLevel.Verbose;\n                case \"win:LogAlways\":\n                default:\n                    return EventLevel.LogAlways;\n            }\n        }\n\n        ////private static string GetLocalizedString(string format, XElement stringTable)\n        ////{\n        ////    if (string.IsNullOrWhiteSpace(format) || stringTable == null)\n        ////    {\n        ////        return format;\n        ////    }\n\n        ////    return stringIdRegex.Replace(format, match =>\n        ////    {\n        ////        if (match.Groups.Count == 2)\n        ////        {\n        ////            var stringValue = FindString(stringTable, match.Groups[1].Value);\n        ////            if (stringValue != null)\n        ////            {\n        ////                stringValue = ReplaceTokens(stringValue);\n        ////                return stringValue;\n        ////            }\n        ////        }\n\n        ////        return match.Value;\n        ////    });\n        ////}\n\n        ////private static string ReplaceTokens(string format)\n        ////{\n        ////    return dotNetTokensRegex.Replace(format, ReplaceDotNetToken);\n        ////}\n\n        ////private static string ReplaceDotNetToken(Match match)\n        ////{\n        ////    if (match.Groups.Count == 2)\n        ////    {\n        ////        var position = int.Parse(match.Groups[1].Value);\n        ////        return \"{\" + (position - 1) + \"}\";\n        ////    }\n\n        ////    return match.Value;\n        ////}\n\n        ////private static string FindString(XElement stringTable, string id)\n        ////{\n        ////    var stringElement = stringTable.Elements(ns + \"string\")\n        ////        .FirstOrDefault(s => (string)s.Attribute(\"id\") == id);\n        ////    if (stringElement != null)\n        ////    {\n        ////        return (string)stringElement.Attribute(\"value\");\n        ////    }\n\n        ////    return null;\n        ////}\n\n        ////private static XElement GetStringTable(XElement instrumentation)\n        ////{\n        ////    var element = instrumentation.Element(ns + \"localization\");\n        ////    if (element != null)\n        ////    {\n        ////        element = element.Element(ns + \"resources\"); // TODO: filter by language?\n        ////        if (element != null)\n        ////        {\n        ////            return element.Element(ns + \"stringTable\");\n        ////        }\n        ////    }\n\n        ////    return null;\n        ////}\n\n        private Tuple<string, EventOpcode> ParseOpcode(string opcode, XElement opcodes)\n        {\n            switch (opcode)\n            {\n                case null:\n                case \"win:Info\":\n                    return Tuple.Create(\"Info\", EventOpcode.Info);\n                case \"win:Start\":\n                    return Tuple.Create(\"Start\", EventOpcode.Start);\n                case \"win:Stop\":\n                    return Tuple.Create(\"Stop\", EventOpcode.Stop);\n                case \"win:DC_Start\":\n                    return Tuple.Create(\"DC_Start\", EventOpcode.DataCollectionStart);\n                case \"win:DC_Stop\":\n                    return Tuple.Create(\"DC_Stop\", EventOpcode.DataCollectionStop);\n                case \"win:Extension\":\n                    return Tuple.Create(\"Extension\", EventOpcode.Extension);\n                case \"win:Reply\":\n                    return Tuple.Create(\"Reply\", EventOpcode.Reply);\n                case \"win:Resume\":\n                    return Tuple.Create(\"Resume\", EventOpcode.Resume);\n                case \"win:Suspend\":\n                    return Tuple.Create(\"Suspend\", EventOpcode.Suspend);\n                case \"win:Send\":\n                    return Tuple.Create(\"Send\", EventOpcode.Send);\n                case \"win:Receive\":\n                    return Tuple.Create(\"Receive\", EventOpcode.Receive);\n            }\n\n            if (!string.IsNullOrWhiteSpace(opcode))\n            {\n                var opcodeElement = opcodes.Elements(Opcode).FirstOrDefault(o => (string)o.Attribute(\"name\") == opcode);\n                if (opcodeElement != null)\n                {\n                    int opcodeId = (int)opcodeElement.Attribute(\"value\");\n                    return Tuple.Create(opcode, (EventOpcode)opcodeId);\n                }\n            }\n\n            return Tuple.Create(\"Info\", EventOpcode.Info);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/SemanticLogging.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{2CD4105B-0DD6-4C18-9B37-05D8E8F57303}</ProjectGuid>\n    <OutputType>Library</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>Microsoft.Practices.EnterpriseLibrary.SemanticLogging</RootNamespace>\n    <AssemblyName>Microsoft.Practices.EnterpriseLibrary.SemanticLogging</AssemblyName>\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>..\\..\\..\\bin\\Debug\\</OutputPath>\n    <DefineConstants>TRACE;DEBUG</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n    <DocumentationFile>..\\..\\..\\bin\\Debug\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.XML</DocumentationFile>\n    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>\n    <CodeAnalysisRuleSet>..\\..\\EnterpriseLibrary.ruleset</CodeAnalysisRuleSet>\n    <UseVSHostingProcess>true</UseVSHostingProcess>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>..\\..\\..\\bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n    <DocumentationFile>..\\..\\..\\bin\\Release\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.XML</DocumentationFile>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Newtonsoft.Json.6.0.8\\lib\\net45\\Newtonsoft.Json.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Configuration\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Data.Services.Client\" />\n    <Reference Include=\"System.Transactions\" />\n    <Reference Include=\"System.Web.Extensions\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"..\\..\\GlobalAssemblyInfo.cs\">\n      <Link>GlobalAssemblyInfo.cs</Link>\n    </Compile>\n    <Compile Include=\"Configuration\\ConsoleSinkElement.cs\" />\n    <Compile Include=\"Configuration\\Constants.cs\" />\n    <Compile Include=\"Configuration\\CustomFormatterElement.cs\" />\n    <Compile Include=\"Configuration\\CustomSinkElement.cs\" />\n    <Compile Include=\"Configuration\\EventTextFormatterElement.cs\" />\n    <Compile Include=\"Configuration\\FormatterElementFactory.cs\" />\n    <Compile Include=\"Configuration\\IFormatterElement.cs\" />\n    <Compile Include=\"Configuration\\ISinkElement.cs\" />\n    <Compile Include=\"Configuration\\JsonEventTextFormatterElement.cs\" />\n    <Compile Include=\"Configuration\\ParameterElement.cs\" />\n    <Compile Include=\"Configuration\\XmlEventTextFormatterElement.cs\" />\n    <Compile Include=\"ConsoleLog.cs\" />\n    <Compile Include=\"EventListenerExtensions.cs\" />\n    <Compile Include=\"GlobalSuppressions.cs\" />\n    <Compile Include=\"SemanticLoggingEventSourceResources.Designer.cs\">\n      <AutoGen>True</AutoGen>\n      <DesignTime>True</DesignTime>\n      <DependentUpon>SemanticLoggingEventSourceResources.resx</DependentUpon>\n    </Compile>\n    <Compile Include=\"Sinks\\ConsoleSink.cs\" />\n    <Compile Include=\"Sinks\\FlushFailedException.cs\" />\n    <Compile Include=\"Formatters\\DefaultConsoleColorMapper.cs\" />\n    <Compile Include=\"Formatters\\IConsoleColorMapper.cs\" />\n    <Compile Include=\"ObservableEventListener.cs\" />\n    <Compile Include=\"SinkSubscription.cs\" />\n    <Compile Include=\"Observable\\EventEntrySubject.cs\" />\n    <Compile Include=\"Utility\\BufferedEventPublisher.cs\" />\n    <Compile Include=\"EventEntry.cs\" />\n    <Compile Include=\"Formatters\\PropertyNames.cs\" />\n    <Compile Include=\"Formatters\\XmlEventTextFormatter.cs\" />\n    <Compile Include=\"Keywords.cs\" />\n    <Compile Include=\"Formatters\\JsonEventTextFormatter.cs\" />\n    <Compile Include=\"Formatters\\EventTextFormatting.cs\" />\n    <Compile Include=\"Schema\\EventSchema.cs\" />\n    <Compile Include=\"SemanticLoggingEventSource.cs\" />\n    <Compile Include=\"Properties\\Resources.Designer.cs\">\n      <AutoGen>True</AutoGen>\n      <DesignTime>True</DesignTime>\n      <DependentUpon>Resources.resx</DependentUpon>\n    </Compile>\n    <Compile Include=\"Schema\\EventSourceSchemaCache.cs\" />\n    <Compile Include=\"Schema\\EventSourceSchemaReader.cs\" />\n    <Compile Include=\"Formatters\\IEventTextFormatter.cs\" />\n    <Compile Include=\"Formatters\\EventTextFormatter.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n    <Compile Include=\"Utility\\Buffering.cs\" />\n    <Compile Include=\"Utility\\EventEntryExtensions.cs\" />\n    <Compile Include=\"Observable\\ObservableProjection.cs\" />\n    <Compile Include=\"Utility\\FileUtil.cs\" />\n    <Compile Include=\"Utility\\TextFormatterExtensions.cs\" />\n    <Compile Include=\"Utility\\Guard.cs\" />\n    <Compile Include=\"Utility\\EventEntryUtil.cs\" />\n    <Compile Include=\"Utility\\TypeExtensions.cs\" />\n    <Compile Include=\"Utility\\XmlExtensions.cs\" />\n    <Compile Include=\"Utility\\XmlUtil.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"..\\..\\SemanticLogging.licenseheader\">\n      <Link>SemanticLogging.licenseheader</Link>\n    </None>\n    <None Include=\"packages.config\" />\n    <None Include=\"SemanticLogging.nuspec\" />\n  </ItemGroup>\n  <ItemGroup>\n    <EmbeddedResource Include=\"Properties\\Resources.resx\">\n      <Generator>ResXFileCodeGenerator</Generator>\n      <LastGenOutput>Resources.Designer.cs</LastGenOutput>\n    </EmbeddedResource>\n    <EmbeddedResource Include=\"SemanticLoggingEventSourceResources.resx\">\n      <Generator>ResXFileCodeGenerator</Generator>\n      <LastGenOutput>SemanticLoggingEventSourceResources.Designer.cs</LastGenOutput>\n    </EmbeddedResource>\n  </ItemGroup>\n  <ItemGroup />\n  <PropertyGroup>\n    <DefineConstants Condition=\" '$(SignAssembly)' == 'true' \">$(DefineConstants);SIGN</DefineConstants>\n  </PropertyGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <Import Project=\"..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets\" Condition=\"Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets'))\" />\n  </Target>\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "source/Src/SemanticLogging/SemanticLogging.nuspec",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<package xmlns=\"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd\">\n  <metadata schemaVersion=\"2\">\n    <id>EnterpriseLibrary.SemanticLogging</id>\n    <version>$Microsoft_Practices_EnterpriseLibrary_SemanticLogging_Version$</version>\n    <title>Semantic Logging Application Block</title>\n    <authors>Microsoft</authors>\n    <owners>Microsoft; patterns-and-practices</owners>\n    <licenseUrl>http://opensource.org/licenses/Apache-2.0</licenseUrl>\n    <projectUrl>http://slab.codeplex.com</projectUrl>    \n    <iconUrl>http://nuget.org/Media/Default/Packages/Unity/2.0/entlib_new_icon_100x100.png</iconUrl>\n    <requireLicenseAcceptance>true</requireLicenseAcceptance>\n    <summary>The Semantic Logging Application Block provides a set of destinations (sinks) to persist application events published using a subclass of the EventSource class.</summary>\n    <description>\n      The Semantic Logging Application Block provides a set of destinations (sinks) to persist application events published using a subclass of the EventSource class from the System.Diagnostics.Tracing namespace. Sinks include Azure table storage, SQL Server databases, file, console and rolling files with several formats and you can extend the block by creating your own custom formatters and sinks. The console sink is part of this nuget package. Other Sinks mentioned above are available as separate nuget packages. For the sinks that can store structured data, the block preserves the full structure of the event payload in order to facilitate analysing or processing the logged data. \n      An out-of-proc Windows Service is available as a separate NuGet package (EnterpriseLibrary.SemanticLogging.Service).      \n    </description>\n    <copyright>© 2014 Microsoft Corporation</copyright>\n    <tags>entlib entlib6 slab enterprise library ETW semantic logging EventSource event listener structured strongly-typed block futures OSS</tags>\n    <frameworkAssemblies>\n      <frameworkAssembly assemblyName=\"mscorlib\" targetFramework=\".NETFramework4.5\" />\n    </frameworkAssemblies>\n  </metadata>\n  <files>\n    <file src=\"NuGet\\Readme.txt\" target=\"\" />\n  </files>\n</package>"
  },
  {
    "path": "source/Src/SemanticLogging/SemanticLoggingEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging\n{\n    /// <summary>\n    /// An <see cref=\"EventSource\"/> class to notify non-transient faults and internal trace information.\n    /// </summary>\n    [EventSource(Name = \"Microsoft-SemanticLogging\", LocalizationResources = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.SemanticLoggingEventSourceResources\")]\n    public sealed class SemanticLoggingEventSource : EventSource\n    {\n        private static readonly Lazy<SemanticLoggingEventSource> Instance = new Lazy<SemanticLoggingEventSource>(() => new SemanticLoggingEventSource());\n\n        private SemanticLoggingEventSource()\n        {\n        }\n\n        /// <summary>\n        /// Gets the singleton instance of <see cref=\"SemanticLoggingEventSource\"/>.\n        /// </summary>\n        /// <value>The singleton instance.</value>\n        public static SemanticLoggingEventSource Log\n        {\n            get { return Instance.Value; }\n        }\n\n        /// <summary>\n        /// Trace event that may be used for logging any unhandled exception that occurs in a custom sink.\n        /// </summary>\n        /// <param name=\"message\">The exception message.</param>\n        [Event(1, Level = EventLevel.Error, Keywords = Keywords.Sink, Message = \"Unhandled fault in a custom sink. Message: {0}\")]\n        public void CustomSinkUnhandledFault(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(1, message);\n            }\n        }\n\n        /// <summary>\n        /// Trace event that may be used for logging any unhandled exception that occurs in a custom formatter.\n        /// </summary>\n        /// <param name=\"message\">The exception message.</param>\n        [Event(2, Level = EventLevel.Error, Keywords = Keywords.Formatting, Message = \"Unhandled fault in a custom formatter. Message: {0}\")]\n        public void CustomFormatterUnhandledFault(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(2, message);\n            }\n        }\n\n        [Event(100, Level = EventLevel.Warning, Keywords = Keywords.Sink, Message = \"A transient fault occurred in a database sink. Message: {0}\")]\n        internal void DatabaseSinkPublishEventsTransientError(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(100, message);\n            }\n        }\n\n        [Event(101, Level = EventLevel.Error, Keywords = Keywords.Sink, Message = \"A database sink failed to publish events. Message: {0}\")]\n        internal void DatabaseSinkPublishEventsFailed(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(101, message);\n            }\n        }\n\n        [Event(102, Level = EventLevel.Warning, Keywords = Keywords.Sink, Message = \"A database sink discarded {0} events due to failures while attempting to publish a batch.\")]\n        internal void DatabaseSinkPublishEventsFailedAndDiscardsEntries(int numberOfEntries)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(102, numberOfEntries);\n            }\n        }\n\n        [Event(103, Level = EventLevel.Warning, Keywords = Keywords.Sink, Message = \"A database sink discarded an event with index {1} due to a failure while attempting to publish a batch. Message: {0}\")]\n        internal void DatabaseSinkPublishEventsFailedAndDiscardSingleEntry(string message, int entryOrder)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(103, message, entryOrder);\n            }\n        }\n\n        [Event(200, Level = EventLevel.Critical, Keywords = Keywords.Sink, Message = \"The console sink failed to write an event. Message: {0}\")]\n        internal void ConsoleSinkWriteFailed(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(200, message);\n            }\n        }\n\n        [Event(300, Level = EventLevel.Critical, Keywords = Keywords.Sink, Message = \"A flat file sink failed to write an event. Message: {0}\")]\n        internal void FlatFileSinkWriteFailed(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(300, message);\n            }\n        }\n\n        [Event(400, Level = EventLevel.Critical, Keywords = Keywords.Sink, Message = \"A rolling flat file sink failed to write an event. Message: {0}\")]\n        internal void RollingFlatFileSinkWriteFailed(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(400, message);\n            }\n        }\n\n        [Event(500, Level = EventLevel.Critical, Keywords = Keywords.Sink, Message = \"An Azure Table sink failed to write a batch of events. Message: {0}\")]\n        internal void WindowsAzureTableSinkPublishEventsFailed(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(500, message);\n            }\n        }\n\n        [Event(501, Level = EventLevel.Critical, Keywords = Keywords.Sink, Message = \"An Azure Table sink failed to create a table. Message: {0}\")]\n        internal void WindowsAzureTableSinkTableCreationFailed(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(501, message);\n            }\n        }\n\n        [Event(502, Level = EventLevel.Warning, Keywords = Keywords.Sink, Message = \"A transient fault occurred in an Azure Table sink. Message: {0}\")]\n        internal void WindowsAzureTableSinkTransientError(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(502, message);\n            }\n        }\n\n        [Event(503, Level = EventLevel.Critical, Keywords = Keywords.Sink, Message = \"An Azure Table sink failed to create an entity. Message: {0}\")]\n        internal void WindowsAzureTableSinkEntityCreationFailed(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(503, message);\n            }\n        }\n\n        [Event(504, Level = EventLevel.Error, Keywords = Keywords.Sink, Message = \"An Azure Table sink discarded {0} events due to failures while attempting to publish a batch.\")]\n        internal void WindowsAzureTableSinkPublishEventsFailedAndDiscardsEntries(int numberOfEntries)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(504, numberOfEntries);\n            }\n        }\n\n        [Event(600, Level = EventLevel.Critical, Keywords = Keywords.Sink, Message = \"An Elasticsearch sink failed to create payload for an entity. Message: {0}\")]\n        internal void ElasticsearchSinkEntityPayloadCreationFailed(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(600, message);\n            }\n        }\n\n        [Event(601, Level = EventLevel.Critical, Keywords = Keywords.Sink, Message = \"An Elasticsearch sink failed to write a batch of events. Message: {0}\")]\n        internal void ElasticsearchSinkWriteEventsFailed(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(601, message);\n            }\n        }\n\n        [Event(602, Level = EventLevel.Error, Keywords = Keywords.Sink, Message = \"An Elasticsearch sink discarded {0} events due to failures while attempting to write a batch.\")]\n        internal void ElasticsearchSinkWriteEventsFailedAndDiscardsEntries(int numberOfEntries, string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(602, numberOfEntries, message);\n            }\n        }\n\n        [Event(700, Level = EventLevel.Warning, Keywords = Keywords.Formatting, Message = \"The payload for an event could not be serialized. Message: {0}\")]\n        internal void EventEntrySerializePayloadFailed(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(700, message);\n            }\n        }\n\n        [Event(701, Level = EventLevel.Warning, Keywords = Keywords.Formatting, Message = \"The JSON writer failed to handle an event. Message: {0}\")]\n        internal void EventEntryJsonWriterFailed(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(701, message);\n            }\n        }\n\n        [Event(702, Level = EventLevel.Warning, Keywords = Keywords.Formatting, Message = \"The XML formatter failed to format an event. Message: {0}\")]\n        internal void EventEntryXmlWriterFailed(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(702, message);\n            }\n        }\n\n        [Event(703, Level = EventLevel.Warning, Keywords = Keywords.Formatting, Message = \"The text formatter failed to format an event. Message: {0}\")]\n        internal void EventEntryTextWriterFailed(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(703, message);\n            }\n        }\n\n        [Event(800, Level = EventLevel.Error, Keywords = Keywords.TraceEvent, Message = \"An unhandled exception occurred for the trace session '{0}'. Message: {1}\")]\n        internal void TraceEventServiceSinkUnhandledFault(string sessionName, string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(800, sessionName, message);\n            }\n        }\n\n        [Event(801, Level = EventLevel.Critical, Keywords = Keywords.TraceEvent, Message = \"An unhandled fault was detected in the processing task for the trace session '{0}'. Message: {1}\")]\n        internal void TraceEventServiceProcessTaskFault(string sessionName, string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(801, sessionName, message);\n            }\n        }\n\n        [Event(802, Level = EventLevel.Informational, Keywords = Keywords.TraceEvent, Message = \"The trace session with the name '{0}' was removed.\")]\n        internal void TraceEventServiceSessionRemoved(string sessionName)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(802, sessionName);\n            }\n        }\n\n        [Event(803, Level = EventLevel.Error, Keywords = Keywords.TraceEvent, Message = \"A fault was detected while processing the configuration for the element '{0}'. Message: {1}\")]\n        internal void TraceEventServiceConfigurationFault(string faultedElement, string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(803, faultedElement, message);\n            }\n        }\n\n        [Event(804, Level = EventLevel.Informational, Keywords = Keywords.TraceEvent, Message = \"The configuration changed for the element '{0}'. Message: {1}\")]\n        internal void TraceEventServiceConfigurationChanged(string changedElement, string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(804, changedElement, message);\n            }\n        }\n\n        [Event(805, Level = EventLevel.Warning, Keywords = Keywords.TraceEvent, Message = \"The configuration was partially successfully loaded. Check logs for further error details.\")]\n        internal void TraceEventServiceConfigurationWithFaults()\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(805);\n            }\n        }\n\n        [Event(806, Level = EventLevel.Warning, Keywords = Keywords.TraceEvent, Message = \"Some events will be lost because of buffer overruns or schema synchronization delays in trace session: {0}.\")]\n        internal void TraceEventServiceEventsWillBeLost(string sessionName)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(806, sessionName);\n            }\n        }\n\n        [Event(807, Level = EventLevel.Warning, Keywords = Keywords.TraceEvent, Message = \"The loss of {1} events was detected in trace session '{0}'.\")]\n        internal void TraceEventServiceProcessEventsLost(string sessionName, int eventsLost)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(807, sessionName, eventsLost);\n            }\n        }\n\n        [Event(808, Level = EventLevel.Error, Keywords = Keywords.TraceEvent, Message = \"A fault was detected while shutting down the configured listeners. Message: {0}\")]\n        internal void TraceEventServiceConfigurationShutdownFault(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(808, message);\n            }\n        }\n\n        [Event(809, Level = EventLevel.Error, Keywords = Keywords.TraceEvent, Message = \"A fault was detected while loading the configuration file. Message: {0}\")]\n        internal void TraceEventServiceConfigurationFileLoadFault(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(809, message);\n            }\n        }\n\n        [Event(810, Level = EventLevel.Critical, Keywords = Keywords.TraceEvent, Message = \"An improperly generated manifest was received for provider {0}. Message: {1}\")]\n        internal void TraceEventServiceManifestGenerationFault(Guid providerId, string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(810, providerId, message);\n            }\n        }\n\n        [Event(811, Level = EventLevel.LogAlways, Keywords = Keywords.TraceEvent, Message = \"Out of band event level {2} for provider {1} on session {0}. Message: {4}\")]\n        internal void TraceEventServiceOutOfBandEvent(string sessionName, Guid providerId, EventLevel eventLevel, EventKeywords eventKeywords, string eventMessage)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(811, sessionName, providerId, eventLevel, eventKeywords, eventMessage);\n            }\n        }\n\n        [Event(900, Level = EventLevel.Warning, Keywords = Keywords.Sink, Message = \"The buffering capacity of {0} events for the sink {1} has been reached. New entries will be discarded.\")]\n        internal void BufferedEventPublisherCapacityOverloaded(int bufferBoundedCapacity, string sinkId)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(900, bufferBoundedCapacity, sinkId);\n            }\n        }\n\n        [Event(901, Level = EventLevel.Informational, Keywords = Keywords.Sink, Message = \"The buffering capacity for the sink {0} was restored.\")]\n        internal void BufferedEventPublisherCapacityRestored(string sinkId)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(901, sinkId);\n            }\n        }\n\n        [Event(902, Level = EventLevel.Warning, Keywords = Keywords.Sink, Message = \"{0} events could not be sent to the sink {1} and will be lost.\")]\n        internal void BufferedEventPublisherEventsLostWhileDisposing(int eventsLost, string sinkId)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(902, eventsLost, sinkId);\n            }\n        }\n\n        [Event(903, Level = EventLevel.Critical, Keywords = Keywords.Sink, Message = \"An unobserved fault was detected in the sink {0}. Message: {1}\")]\n        internal void BufferedEventPublisherUnobservedTaskFault(string sinkId, string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(903, sinkId, message);\n            }\n        }\n\n        [Event(1000, Level = EventLevel.Error, Keywords = Keywords.Sink, Message = \"Parsing the manifest for provider '{0}' to handle the event with ID {1} failed. Message: {2}\")]\n        internal void ParsingEventSourceManifestFailed(string providerName, int eventId, string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(1000, providerName, eventId, message);\n            }\n        }\n\n        [Event(1100, Level = EventLevel.Critical, Keywords = Keywords.Sink, Message = \"Formatting an entry failed. Message: {0}\")]\n        internal void FormatEntryAsStringFailed(string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(1100, message);\n            }\n        }\n\n        [Event(1101, Level = EventLevel.Warning, Keywords = Keywords.Sink, Message = \"Mapping the event level {0} to a color failed. Message: {0}\")]\n        internal void MapEntryLevelToColorFailed(int eventLevel, string message)\n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(1101, eventLevel, message);\n            }\n        }\n\n        /// <summary>\n        /// Custom defined event keywords.\n        /// </summary>\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1034:NestedTypesShouldNotBeVisible\", Justification = \"As designed, part of the code pattern to author an event source.\")]\n        public static class Keywords\n        {\n            /// <summary>\n            /// Keyword for sink.\n            /// </summary>\n            public const EventKeywords Sink = (EventKeywords)0x0001;\n\n            /// <summary>\n            /// Keyword for formatting.\n            /// </summary>\n            public const EventKeywords Formatting = (EventKeywords)0x0002;\n\n            /// <summary>\n            /// Keyword for trace event.\n            /// </summary>\n            public const EventKeywords TraceEvent = (EventKeywords)0x0004;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/SemanticLoggingEventSourceResources.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\n// <auto-generated>\n//     This code was generated by a tool.\n//     Runtime Version:4.0.30319.18033\n//\n//     Changes to this file may cause incorrect behavior and will be lost if\n//     the code is regenerated.\n// </auto-generated>\n//------------------------------------------------------------------------------\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging {\n    using System;\n    \n    \n    /// <summary>\n    ///   A strongly-typed resource class, for looking up localized strings, etc.\n    /// </summary>\n    // This class was auto-generated by the StronglyTypedResourceBuilder\n    // class via a tool like ResGen or Visual Studio.\n    // To add or remove a member, edit your .ResX file then rerun ResGen\n    // with the /str option, or rebuild your VS project.\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Resources.Tools.StronglyTypedResourceBuilder\", \"4.0.0.0\")]\n    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\n    internal class SemanticLoggingEventSourceResources {\n        \n        private static global::System.Resources.ResourceManager resourceMan;\n        \n        private static global::System.Globalization.CultureInfo resourceCulture;\n        \n        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"Microsoft.Performance\", \"CA1811:AvoidUncalledPrivateCode\")]\n        internal SemanticLoggingEventSourceResources() {\n        }\n        \n        /// <summary>\n        ///   Returns the cached ResourceManager instance used by this class.\n        /// </summary>\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\n        internal static global::System.Resources.ResourceManager ResourceManager {\n            get {\n                if (object.ReferenceEquals(resourceMan, null)) {\n                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.SemanticLoggingEventSourceR\" +\n                            \"esources\", typeof(SemanticLoggingEventSourceResources).Assembly);\n                    resourceMan = temp;\n                }\n                return resourceMan;\n            }\n        }\n        \n        /// <summary>\n        ///   Overrides the current thread's CurrentUICulture property for all\n        ///   resource lookups using this strongly typed resource class.\n        /// </summary>\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\n        internal static global::System.Globalization.CultureInfo Culture {\n            get {\n                return resourceCulture;\n            }\n            set {\n                resourceCulture = value;\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The buffering capacity of {0} events for the sink {1} has been reached. New entries will be discarded..\n        /// </summary>\n        internal static string event_BufferedEventPublisherCapacityOverloaded {\n            get {\n                return ResourceManager.GetString(\"event_BufferedEventPublisherCapacityOverloaded\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The buffering capacity for the sink {0} was restored..\n        /// </summary>\n        internal static string event_BufferedEventPublisherCapacityRestored {\n            get {\n                return ResourceManager.GetString(\"event_BufferedEventPublisherCapacityRestored\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to {0} events could not be sent to the sink {1} and will be lost..\n        /// </summary>\n        internal static string event_BufferedEventPublisherEventsLostWhileDisposing {\n            get {\n                return ResourceManager.GetString(\"event_BufferedEventPublisherEventsLostWhileDisposing\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to An unobserved fault was detected in the sink {0}. Message: {1}.\n        /// </summary>\n        internal static string event_BufferedEventPublisherUnobservedTaskFault {\n            get {\n                return ResourceManager.GetString(\"event_BufferedEventPublisherUnobservedTaskFault\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The console sink failed to write an event. Message: {0}.\n        /// </summary>\n        internal static string event_ConsoleSinkWriteFailed {\n            get {\n                return ResourceManager.GetString(\"event_ConsoleSinkWriteFailed\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Unhandled fault in a custom formatter. Message: {0}.\n        /// </summary>\n        internal static string event_CustomFormatterUnhandledFault {\n            get {\n                return ResourceManager.GetString(\"event_CustomFormatterUnhandledFault\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Unhandled fault in a custom sink. Message: {0}.\n        /// </summary>\n        internal static string event_CustomSinkUnhandledFault {\n            get {\n                return ResourceManager.GetString(\"event_CustomSinkUnhandledFault\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A database sink failed to publish events. Message: {0}.\n        /// </summary>\n        internal static string event_DatabaseSinkPublishEventsFailed {\n            get {\n                return ResourceManager.GetString(\"event_DatabaseSinkPublishEventsFailed\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A database sink discarded {0} events due to failures while attempting to publish a batch..\n        /// </summary>\n        internal static string event_DatabaseSinkPublishEventsFailedAndDiscardsEntries {\n            get {\n                return ResourceManager.GetString(\"event_DatabaseSinkPublishEventsFailedAndDiscardsEntries\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A database sink discarded an event with index {1} due to a failure while attempting to publish a batch. Message: {0}.\n        /// </summary>\n        internal static string event_DatabaseSinkPublishEventsFailedAndDiscardSingleEntry {\n            get {\n                return ResourceManager.GetString(\"event_DatabaseSinkPublishEventsFailedAndDiscardSingleEntry\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A transient fault occurred in a database sink. Message: {0}.\n        /// </summary>\n        internal static string event_DatabaseSinkPublishEventsTransientError {\n            get {\n                return ResourceManager.GetString(\"event_DatabaseSinkPublishEventsTransientError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The JSON writer failed to handle an event. Message: {0}.\n        /// </summary>\n        internal static string event_EventEntryJsonWriterFailed {\n            get {\n                return ResourceManager.GetString(\"event_EventEntryJsonWriterFailed\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The payload for an event could not be serialized. Message: {0}.\n        /// </summary>\n        internal static string event_EventEntrySerializePayloadFailed {\n            get {\n                return ResourceManager.GetString(\"event_EventEntrySerializePayloadFailed\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The text formatter failed to format an event. Message: {0}.\n        /// </summary>\n        internal static string event_EventEntryTextWriterFailed {\n            get {\n                return ResourceManager.GetString(\"event_EventEntryTextWriterFailed\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The XML formatter failed to format an event. Message: {0}.\n        /// </summary>\n        internal static string event_EventEntryXmlWriterFailed {\n            get {\n                return ResourceManager.GetString(\"event_EventEntryXmlWriterFailed\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A flat file sink failed to write an event. Message: {0}.\n        /// </summary>\n        internal static string event_FlatFileSinkWriteFailed {\n            get {\n                return ResourceManager.GetString(\"event_FlatFileSinkWriteFailed\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Formatting an entry failed. Message: {0}.\n        /// </summary>\n        internal static string event_FormatEntryAsStringFailed {\n            get {\n                return ResourceManager.GetString(\"event_FormatEntryAsStringFailed\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Mapping the event level {0} to a color failed. Message: {0}.\n        /// </summary>\n        internal static string event_MapEntryLevelToColorFailed {\n            get {\n                return ResourceManager.GetString(\"event_MapEntryLevelToColorFailed\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Parsing the manifest for provider &apos;{0}&apos; to handle the event with ID {1} failed. Message: {2}.\n        /// </summary>\n        internal static string event_ParsingEventSourceManifestFailed {\n            get {\n                return ResourceManager.GetString(\"event_ParsingEventSourceManifestFailed\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A rolling flat file sink failed to write an event. Message: {0}.\n        /// </summary>\n        internal static string event_RollingFlatFileSinkWriteFailed {\n            get {\n                return ResourceManager.GetString(\"event_RollingFlatFileSinkWriteFailed\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The configuration changed for the element &apos;{0}&apos;. Message: {1}.\n        /// </summary>\n        internal static string event_TraceEventServiceConfigurationChanged {\n            get {\n                return ResourceManager.GetString(\"event_TraceEventServiceConfigurationChanged\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A fault was detected while processing the configuration for the element &apos;{0}&apos;. Message: {1}.\n        /// </summary>\n        internal static string event_TraceEventServiceConfigurationFault {\n            get {\n                return ResourceManager.GetString(\"event_TraceEventServiceConfigurationFault\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A fault was detected while loading the configuration file. Message: {0}.\n        /// </summary>\n        internal static string event_TraceEventServiceConfigurationFileLoadFault {\n            get {\n                return ResourceManager.GetString(\"event_TraceEventServiceConfigurationFileLoadFault\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A fault was detected while shutting down the configured listeners. Message: {0}.\n        /// </summary>\n        internal static string event_TraceEventServiceConfigurationShutdownFault {\n            get {\n                return ResourceManager.GetString(\"event_TraceEventServiceConfigurationShutdownFault\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The configuration was partially successfully loaded. Check logs for further error details..\n        /// </summary>\n        internal static string event_TraceEventServiceConfigurationWithFaults {\n            get {\n                return ResourceManager.GetString(\"event_TraceEventServiceConfigurationWithFaults\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Some events will be lost because of buffer overruns or schema synchronization delays in trace session: {0}..\n        /// </summary>\n        internal static string event_TraceEventServiceEventsWillBeLost {\n            get {\n                return ResourceManager.GetString(\"event_TraceEventServiceEventsWillBeLost\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to An improperly generated manifest was received for provider {0}. Message: {1}.\n        /// </summary>\n        internal static string event_TraceEventServiceManifestGenerationFault {\n            get {\n                return ResourceManager.GetString(\"event_TraceEventServiceManifestGenerationFault\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The loss of {1} events was detected in trace session &apos;{0}&apos;..\n        /// </summary>\n        internal static string event_TraceEventServiceProcessEventsLost {\n            get {\n                return ResourceManager.GetString(\"event_TraceEventServiceProcessEventsLost\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to An unhandled fault was detected in the processing task for the trace session &apos;{0}&apos;. Message: {1}.\n        /// </summary>\n        internal static string event_TraceEventServiceProcessTaskFault {\n            get {\n                return ResourceManager.GetString(\"event_TraceEventServiceProcessTaskFault\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The trace session with the name &apos;{0}&apos; was removed..\n        /// </summary>\n        internal static string event_TraceEventServiceSessionRemoved {\n            get {\n                return ResourceManager.GetString(\"event_TraceEventServiceSessionRemoved\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to An unhandled exception occurred for the trace session &apos;{0}&apos;. Message: {1}.\n        /// </summary>\n        internal static string event_TraceEventServiceSinkUnhandledFault {\n            get {\n                return ResourceManager.GetString(\"event_TraceEventServiceSinkUnhandledFault\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A Windows Azure Table sink failed to create an entity. Message: {0}.\n        /// </summary>\n        internal static string event_WindowsAzureTableSinkEntityCreationFailed {\n            get {\n                return ResourceManager.GetString(\"event_WindowsAzureTableSinkEntityCreationFailed\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A Windows Azure Table sink failed to write a batch of events. Message: {0}.\n        /// </summary>\n        internal static string event_WindowsAzureTableSinkPublishEventsFailed {\n            get {\n                return ResourceManager.GetString(\"event_WindowsAzureTableSinkPublishEventsFailed\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A Windows Azure Table sink discarded {0} events due to failures while attempting to publish a batch..\n        /// </summary>\n        internal static string event_WindowsAzureTableSinkPublishEventsFailedAndDiscardsEntries {\n            get {\n                return ResourceManager.GetString(\"event_WindowsAzureTableSinkPublishEventsFailedAndDiscardsEntries\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A Windows Azure Table sink failed to create a table. Message: {0}.\n        /// </summary>\n        internal static string event_WindowsAzureTableSinkTableCreationFailed {\n            get {\n                return ResourceManager.GetString(\"event_WindowsAzureTableSinkTableCreationFailed\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A transient fault occurred in a Windows Azure Table sink. Message: {0}.\n        /// </summary>\n        internal static string event_WindowsAzureTableSinkTransientError {\n            get {\n                return ResourceManager.GetString(\"event_WindowsAzureTableSinkTransientError\", resourceCulture);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/SemanticLoggingEventSourceResources.resx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The primary goals of this format is to allow a simple XML format \n    that is mostly human readable. The generation and parsing of the \n    various data types are done through the TypeConverter classes \n    associated with the data types.\n    \n    Example:\n    \n    ... ado.net/XML headers & schema ...\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\n    <resheader name=\"version\">2.0</resheader>\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\n    </data>\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\n        <comment>This is a comment</comment>\n    </data>\n                \n    There are any number of \"resheader\" rows that contain simple \n    name/value pairs.\n    \n    Each data row contains a name, and value. The row also contains a \n    type or mimetype. Type corresponds to a .NET class that support \n    text/value conversion through the TypeConverter architecture. \n    Classes that don't support this are serialized and stored with the \n    mimetype set.\n    \n    The mimetype is used for serialized objects, and tells the \n    ResXResourceReader how to depersist the object. This is currently not \n    extensible. For a given mimetype the value must be set accordingly:\n    \n    Note - application/x-microsoft.net.object.binary.base64 is the format \n    that the ResXResourceWriter will generate, however the reader can \n    read any of the formats listed below.\n    \n    mimetype: application/x-microsoft.net.object.binary.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\n            : and then encoded with base64 encoding.\n    \n    mimetype: application/x-microsoft.net.object.soap.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.bytearray.base64\n    value   : The object must be serialized into a byte array \n            : using a System.ComponentModel.TypeConverter\n            : and then encoded with base64 encoding.\n    -->\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\n      <xsd:complexType>\n        <xsd:choice maxOccurs=\"unbounded\">\n          <xsd:element name=\"metadata\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"assembly\">\n            <xsd:complexType>\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"data\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"resheader\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\n            </xsd:complexType>\n          </xsd:element>\n        </xsd:choice>\n      </xsd:complexType>\n    </xsd:element>\n  </xsd:schema>\n  <resheader name=\"resmimetype\">\n    <value>text/microsoft-resx</value>\n  </resheader>\n  <resheader name=\"version\">\n    <value>2.0</value>\n  </resheader>\n  <resheader name=\"reader\">\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <resheader name=\"writer\">\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <data name=\"event_BufferedEventPublisherCapacityOverloaded\" xml:space=\"preserve\">\n    <value>The buffering capacity of {0} events for the sink {1} has been reached. New entries will be discarded.</value>\n  </data>\n  <data name=\"event_BufferedEventPublisherCapacityRestored\" xml:space=\"preserve\">\n    <value>The buffering capacity for the sink {0} was restored.</value>\n  </data>\n  <data name=\"event_BufferedEventPublisherEventsLostWhileDisposing\" xml:space=\"preserve\">\n    <value>{0} events could not be sent to the sink {1} and will be lost.</value>\n  </data>\n  <data name=\"event_BufferedEventPublisherUnobservedTaskFault\" xml:space=\"preserve\">\n    <value>An unobserved fault was detected in the sink {0}. Message: {1}</value>\n  </data>\n  <data name=\"event_ConsoleSinkWriteFailed\" xml:space=\"preserve\">\n    <value>The console sink failed to write an event. Message: {0}</value>\n  </data>\n  <data name=\"event_CustomFormatterUnhandledFault\" xml:space=\"preserve\">\n    <value>Unhandled fault in a custom formatter. Message: {0}</value>\n  </data>\n  <data name=\"event_CustomSinkUnhandledFault\" xml:space=\"preserve\">\n    <value>Unhandled fault in a custom sink. Message: {0}</value>\n  </data>\n  <data name=\"event_DatabaseSinkPublishEventsFailed\" xml:space=\"preserve\">\n    <value>A database sink failed to publish events. Message: {0}</value>\n  </data>\n  <data name=\"event_DatabaseSinkPublishEventsFailedAndDiscardsEntries\" xml:space=\"preserve\">\n    <value>A database sink discarded {0} events due to failures while attempting to publish a batch.</value>\n  </data>\n  <data name=\"event_DatabaseSinkPublishEventsFailedAndDiscardSingleEntry\" xml:space=\"preserve\">\n    <value>A database sink discarded an event with index {1} due to a failure while attempting to publish a batch. Message: {0}</value>\n  </data>\n  <data name=\"event_DatabaseSinkPublishEventsTransientError\" xml:space=\"preserve\">\n    <value>A transient fault occurred in a database sink. Message: {0}</value>\n  </data>\n  <data name=\"event_EventEntryJsonWriterFailed\" xml:space=\"preserve\">\n    <value>The JSON writer failed to handle an event. Message: {0}</value>\n  </data>\n  <data name=\"event_EventEntrySerializePayloadFailed\" xml:space=\"preserve\">\n    <value>The payload for an event could not be serialized. Message: {0}</value>\n  </data>\n  <data name=\"event_EventEntryTextWriterFailed\" xml:space=\"preserve\">\n    <value>The text formatter failed to format an event. Message: {0}</value>\n  </data>\n  <data name=\"event_EventEntryXmlWriterFailed\" xml:space=\"preserve\">\n    <value>The XML formatter failed to format an event. Message: {0}</value>\n  </data>\n  <data name=\"event_FlatFileSinkWriteFailed\" xml:space=\"preserve\">\n    <value>A flat file sink failed to write an event. Message: {0}</value>\n  </data>\n  <data name=\"event_FormatEntryAsStringFailed\" xml:space=\"preserve\">\n    <value>Formatting an entry failed. Message: {0}</value>\n  </data>\n  <data name=\"event_MapEntryLevelToColorFailed\" xml:space=\"preserve\">\n    <value>Mapping the event level {0} to a color failed. Message: {0}</value>\n  </data>\n  <data name=\"event_ParsingEventSourceManifestFailed\" xml:space=\"preserve\">\n    <value>Parsing the manifest for provider '{0}' to handle the event with ID {1} failed. Message: {2}</value>\n  </data>\n  <data name=\"event_RollingFlatFileSinkWriteFailed\" xml:space=\"preserve\">\n    <value>A rolling flat file sink failed to write an event. Message: {0}</value>\n  </data>\n  <data name=\"event_TraceEventServiceConfigurationChanged\" xml:space=\"preserve\">\n    <value>The configuration changed for the element '{0}'. Message: {1}</value>\n  </data>\n  <data name=\"event_TraceEventServiceConfigurationFault\" xml:space=\"preserve\">\n    <value>A fault was detected while processing the configuration for the element '{0}'. Message: {1}</value>\n  </data>\n  <data name=\"event_TraceEventServiceConfigurationFileLoadFault\" xml:space=\"preserve\">\n    <value>A fault was detected while loading the configuration file. Message: {0}</value>\n  </data>\n  <data name=\"event_TraceEventServiceConfigurationShutdownFault\" xml:space=\"preserve\">\n    <value>A fault was detected while shutting down the configured listeners. Message: {0}</value>\n  </data>\n  <data name=\"event_TraceEventServiceConfigurationWithFaults\" xml:space=\"preserve\">\n    <value>The configuration was partially successfully loaded. Check logs for further error details.</value>\n  </data>\n  <data name=\"event_TraceEventServiceEventsWillBeLost\" xml:space=\"preserve\">\n    <value>Some events will be lost because of buffer overruns or schema synchronization delays in trace session: {0}.</value>\n  </data>\n  <data name=\"event_TraceEventServiceManifestGenerationFault\" xml:space=\"preserve\">\n    <value>An improperly generated manifest was received for provider {0}. Message: {1}</value>\n  </data>\n  <data name=\"event_TraceEventServiceProcessEventsLost\" xml:space=\"preserve\">\n    <value>The loss of {1} events was detected in trace session '{0}'.</value>\n  </data>\n  <data name=\"event_TraceEventServiceProcessTaskFault\" xml:space=\"preserve\">\n    <value>An unhandled fault was detected in the processing task for the trace session '{0}'. Message: {1}</value>\n  </data>\n  <data name=\"event_TraceEventServiceSessionRemoved\" xml:space=\"preserve\">\n    <value>The trace session with the name '{0}' was removed.</value>\n  </data>\n  <data name=\"event_TraceEventServiceSinkUnhandledFault\" xml:space=\"preserve\">\n    <value>An unhandled exception occurred for the trace session '{0}'. Message: {1}</value>\n  </data>\n  <data name=\"event_WindowsAzureTableSinkEntityCreationFailed\" xml:space=\"preserve\">\n    <value>A Microsoft Azure Table sink failed to create an entity. Message: {0}</value>\n  </data>\n  <data name=\"event_WindowsAzureTableSinkPublishEventsFailed\" xml:space=\"preserve\">\n    <value>A Microsoft Azure Table sink failed to write a batch of events. Message: {0}</value>\n  </data>\n  <data name=\"event_WindowsAzureTableSinkPublishEventsFailedAndDiscardsEntries\" xml:space=\"preserve\">\n    <value>A Microsoft Azure Table sink discarded {0} events due to failures while attempting to publish a batch.</value>\n  </data>\n  <data name=\"event_WindowsAzureTableSinkTableCreationFailed\" xml:space=\"preserve\">\n    <value>A Microsoft Azure Table sink failed to create a table. Message: {0}</value>\n  </data>\n  <data name=\"event_WindowsAzureTableSinkTransientError\" xml:space=\"preserve\">\n    <value>A transient fault occurred in a Microsoft Azure Table sink. Message: {0}</value>\n  </data>\n</root>"
  },
  {
    "path": "source/Src/SemanticLogging/SinkSubscription.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging\n{\n    /// <summary>\n    /// This map or container class holds a reference to an instance of a logging sink\n    /// and a subscription token to an IObservable{EventEntry}, both of which will be disposed by this container\n    /// if the container itself is explicitly disposed.\n    /// </summary>\n    public class SinkSubscription : IDisposable\n    {\n        private IDisposable subscription;\n        private object sink;\n\n        /// <summary>\n        /// Initializes a new instance of <see cref=\"SinkSubscription\"/>.\n        /// It holds references to a logging sink an a subscription, both\n        /// of which will be disposed by this container if the container itself is explicitly disposed.\n        /// </summary>\n        /// <param name=\"subscription\">The subscription that is used to connect to an <see cref=\"IObservable{EventEntry}\"/>.</param>\n        /// <param name=\"sink\">The logging sink.</param>\n        public SinkSubscription(IDisposable subscription, object sink)\n        {\n            this.subscription = subscription;\n            this.sink = sink;\n        }\n\n        /// <summary>\n        /// A reference to the underlying subscription token.\n        /// </summary>\n        public IDisposable Subscription\n        {\n            get { return this.subscription; }\n        }\n\n        /// <summary>\n        /// A reference to the underlying log sink.\n        /// </summary>\n        public object Sink\n        {\n            get { return this.sink; }\n        }\n\n        /// <summary>\n        /// Disposes both the <see cref=\"Subscription\"/> and the <see cref=\"Sink\"/> if it implements <see cref=\"IDisposable\"/>\n        /// </summary>\n        public void Dispose()\n        {\n            this.Dispose(true);\n            GC.SuppressFinalize(this);\n        }\n\n        /// <summary>\n        /// Disposes both the <see cref=\"Subscription\"/> and the <see cref=\"Sink\"/> if it implements <see cref=\"IDisposable\"/>\n        /// </summary>\n        /// <param name=\"disposing\">True if explicitly disposing the instance.</param>\n        protected virtual void Dispose(bool disposing)\n        {\n            if (disposing)\n            {\n                // Only disposes subscription and sink if explicitly disposed.\n                using (this.subscription) { }\n                using (this.sink as IDisposable) { }\n            }\n        }\n    }\n\n    /// <summary>\n    /// This map or container class holds a reference to an instance of a logging sink\n    /// and a subscription token to an IObservable{EventEntry}, both of which will be disposed by this container\n    /// when the container itself is disposed.\n    /// </summary>\n    public sealed class SinkSubscription<T> : SinkSubscription\n    {\n        /// <summary>\n        /// Initializes a new instance of <see cref=\"SinkSubscription\"/>.\n        /// It holds references to a logging sink an a subscription, both\n        /// of which will be disposed by this container when the container itself is disposed.\n        /// </summary>\n        /// <param name=\"subscription\">The subscription that is used to connect to an <see cref=\"IObservable{EventEntry}\"/>.</param>\n        /// <param name=\"sink\">The logging sink.</param>\n        public SinkSubscription(IDisposable subscription, T sink)\n            : base(subscription, sink)\n        {\n        }\n\n        /// <summary>\n        /// A reference to the underlying log sink.\n        /// </summary>\n        public new T Sink\n        {\n            get { return (T)base.Sink; }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Sinks/ConsoleSink.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks\n{\n    /// <summary>\n    /// A sink that writes to the Console.\n    /// </summary>\n    /// <remarks>This class is thread-safe.</remarks>\n    public class ConsoleSink : IObserver<EventEntry>\n    {\n        private readonly IEventTextFormatter formatter;\n        private readonly IConsoleColorMapper colorMapper;\n\n        // lock on static because Console.Out is shared across all threads and sink instances\n        private static readonly object LockObject = new object();\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"ConsoleSink\" /> class.\n        /// </summary>\n        public ConsoleSink(IEventTextFormatter formatter, IConsoleColorMapper colorMapper)\n        {\n            this.formatter = formatter;\n            this.colorMapper = colorMapper;\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has finished sending push-based notifications.\n        /// </summary>\n        public void OnCompleted()\n        {\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has experienced an error condition.\n        /// </summary>\n        /// <param name=\"error\">An object that provides additional information about the error.</param>\n        public void OnError(Exception error)\n        {\n        }\n\n        /// <summary>\n        /// Provides the sink with new data to write.\n        /// </summary>\n        /// <param name=\"value\">The current entry and its color to write to the console.</param>\n        public void OnNext(EventEntry value)\n        {\n            var convertedValue = value.TryFormatAsStringAndColor(this.formatter, this.colorMapper);\n            if (convertedValue != null)\n            {\n                OnNext(convertedValue.Item1, convertedValue.Item2);\n            }\n        }\n\n        private static void OnNext(string entry, ConsoleColor? color)\n        {\n            lock (LockObject)\n            {\n                ConsoleColor? currentColor = null;\n                try\n                {\n                    if (color.HasValue)\n                    {\n                        currentColor = Console.ForegroundColor;\n                        Console.ForegroundColor = color.Value;\n                    }\n\n                    Console.Out.Write(entry);\n                    Console.Out.Flush();\n                }\n                catch (Exception e)\n                {\n                    SemanticLoggingEventSource.Log.ConsoleSinkWriteFailed(e.ToString());\n                }\n                finally\n                {\n                    if (currentColor.HasValue)\n                    {\n                        Console.ForegroundColor = currentColor.Value;\n                    }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Sinks/FlushFailedException.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Runtime.Serialization;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Properties;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks\n{\n    /// <summary>\n    /// Represents an error while doing a flush operation.\n    /// </summary>\n    [Serializable]\n    public class FlushFailedException : Exception\n    {\n        /// <summary>Initializes a new instance of the <see cref=\"FlushFailedException\" /> class.</summary>\n        public FlushFailedException()\n            : this(Resources.FlushFailedException)\n        {\n        }\n\n        /// <summary>Initializes a new instance of the <see cref=\"FlushFailedException\" /> class.</summary>\n        /// <param name=\"message\">The exception message.</param>\n        public FlushFailedException(string message)\n            : base(message)\n        {\n        }\n\n        /// <summary>Initializes a new instance of the <see cref=\"FlushFailedException\" /> class.</summary>\n        /// <param name=\"innerException\">The references to the inner exception that is the cause of this exception.</param>\n        public FlushFailedException(Exception innerException)\n            : this(Resources.FlushFailedException, innerException)\n        {\n        }\n\n        /// <summary>Initializes a new instance of the <see cref=\"FlushFailedException\" /> class.</summary>\n        /// <param name=\"message\">The exception message.</param>\n        /// <param name=\"innerException\">The references to the inner exception that is the cause of this exception.</param>\n        public FlushFailedException(string message, Exception innerException)\n            : base(message, innerException)\n        {\n        }\n\n        /// <summary>Initializes a new instance of the System.Exception class with serialized data.</summary>\n        /// <param name=\"info\">The SerializationInfo that holds the serialized object data about the exception being thrown.</param>\n        /// <param name=\"context\">The StreamingContext that contains contextual information about the source or destination.</param>\n        protected FlushFailedException(SerializationInfo info, StreamingContext context)\n            : base(info, context) \n        {\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Utility/BufferedEventPublisher.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Properties;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility\n{\n    /// <summary>\n    /// Buffering and batching utility for sinks that can benefit from batched writes\n    /// </summary>\n    /// <typeparam name=\"TEntry\">The type of the entry to buffer.</typeparam>\n    public sealed class BufferedEventPublisher<TEntry> : IDisposable\n    {\n        private static readonly TimeSpan MinimumInterval = TimeSpan.FromMilliseconds(500);\n        private readonly string sinkId;\n        private readonly Func<IList<TEntry>, Task<int>> eventPublisher;\n        private readonly TimeSpan bufferingInterval;\n        private readonly int bufferingCount;\n        private readonly int maxBufferSize;\n        private readonly BlockingCollection<TEntry> buffer;\n        private readonly object lockObject = new object();\n        private readonly int maxBatchSize;\n        private readonly Lazy<Task> cachedCompletedTask = new Lazy<Task>(() =>\n        {\n            var tcs = new TaskCompletionSource<bool>();\n            tcs.SetResult(true);\n            return tcs.Task;\n        });\n\n        private ExponentialBackoff nonTransientErrorWait = new ExponentialBackoff(TimeSpan.FromSeconds(45), TimeSpan.FromHours(1), TimeSpan.FromSeconds(30));\n        private bool autoFlushByCountDisabled;\n        private volatile bool disposed;\n        private CancellationTokenSource flushTokenSource = new CancellationTokenSource();\n        private CancellationTokenSource cancellationTokenSource;\n        private TaskCompletionSource<bool> flushCompletionSource;\n        private int isBufferFull;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"BufferedEventPublisher{TEntry}\" /> class.\n        /// </summary>\n        /// <param name=\"sinkId\">An identifier for the sink.</param>\n        /// <param name=\"eventPublisher\">The event publisher.</param>\n        /// <param name=\"bufferingInterval\">The buffering interval.</param>\n        /// <param name=\"bufferingCount\">The buffering count.</param>\n        /// <param name=\"maxBufferSize\">The maximum number of entries that can be buffered before the sink starts dropping entries.</param>\n        /// <param name=\"cancellationToken\">Cancels any pending operation.</param>\n        /// <exception cref=\"System.ArgumentOutOfRangeException\">BufferingCount out of range.</exception>\n        /// <exception cref=\"System.ArgumentException\">Argument valdation error.</exception>\n        private BufferedEventPublisher(string sinkId, Func<IList<TEntry>, Task<int>> eventPublisher, TimeSpan bufferingInterval, int bufferingCount, int maxBufferSize, CancellationToken cancellationToken)\n        {\n            Guard.ArgumentNotNullOrEmpty(sinkId, \"sinkId\");\n            Guard.ArgumentNotNull(eventPublisher, \"eventPublisherAction\");\n            Guard.ArgumentGreaterOrEqualThan(500, maxBufferSize, \"maxBufferSize\");\n            Guard.ArgumentNotNull(cancellationToken, \"cancellationToken\");\n            Guard.ArgumentGreaterOrEqualThan(0, bufferingCount, \"bufferingCount\");\n            Guard.ArgumentIsValidTimeout(bufferingInterval, \"bufferingInterval\");\n\n            if (maxBufferSize < (bufferingCount * 3) && bufferingCount != int.MaxValue)\n            {\n                throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.MaxBufferSizeShouldBeLargerThanBufferingCount, maxBufferSize, bufferingCount), \"maxBufferSize\");\n            }\n\n            // throw if not auto flush parameter was supplied\n            if (bufferingInterval == Timeout.InfiniteTimeSpan && bufferingCount == 0)\n            {\n                throw new ArgumentException(Resources.InvalidBufferingArguments);\n            }\n\n            this.sinkId = sinkId;\n            this.eventPublisher = eventPublisher;\n            this.bufferingCount = bufferingCount;\n            //// set minimal interval if less than default value (MinimumInterval).\n            this.bufferingInterval = (bufferingInterval < MinimumInterval && bufferingInterval != Timeout.InfiniteTimeSpan) ? MinimumInterval : bufferingInterval;\n            this.maxBufferSize = maxBufferSize;\n            this.maxBatchSize = this.bufferingCount == 0 ? this.maxBufferSize : this.bufferingCount;\n            this.cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(new[] { cancellationToken });\n\n            this.buffer = new BlockingCollection<TEntry>(this.maxBufferSize);\n        }\n\n        /// <summary>\n        /// Initializes and starts a new instance of the <see cref=\"BufferedEventPublisher{TEntry}\" /> class.\n        /// </summary>\n        /// <param name=\"sinkId\">An identifier for the sink.</param>\n        /// <param name=\"eventPublisher\">The event publisher.</param>\n        /// <param name=\"bufferingInterval\">The buffering interval.</param>\n        /// <param name=\"bufferingCount\">The buffering count.</param>\n        /// <param name=\"maxBufferSize\">The maximum number of entries that can be buffered before the sink starts dropping entries.</param>\n        /// <param name=\"cancellationToken\">Cancels any pending operation.</param>\n        /// <exception cref=\"System.ArgumentOutOfRangeException\">BufferingCount out of range.</exception>\n        /// <exception cref=\"System.ArgumentException\">Argument valdation error.</exception>\n        /// <returns>An instance of BufferedEventPublisher{TEntry}.</returns>\n        public static BufferedEventPublisher<TEntry> CreateAndStart(string sinkId, Func<IList<TEntry>, Task<int>> eventPublisher, TimeSpan bufferingInterval, int bufferingCount, int maxBufferSize, CancellationToken cancellationToken)\n        {\n            var publisher = new BufferedEventPublisher<TEntry>(sinkId, eventPublisher, bufferingInterval, bufferingCount, maxBufferSize, cancellationToken);\n            publisher.StartBackgroundTask();\n            return publisher;\n        }\n\n        /// <summary>\n        /// Tries posting the specified entry.\n        /// </summary>\n        /// <param name=\"entry\">The entry.</param>\n        /// <returns>True on successful post, false otherwise.</returns>\n        public bool TryPost(TEntry entry)\n        {\n            var bufferInstance = this.buffer;\n            if (bufferInstance.TryAdd(entry))\n            {\n                if (!this.autoFlushByCountDisabled && this.bufferingCount > 0 && bufferInstance.Count >= this.bufferingCount)\n                {\n                    this.TriggerFlush();\n                }\n\n                return true;\n            }\n            else\n            {\n                if (Interlocked.Exchange(ref this.isBufferFull, 1) == 0)\n                {\n                    // log only if we are switching from normal buffering state\n                    SemanticLoggingEventSource.Log.BufferedEventPublisherCapacityOverloaded(bufferInstance.BoundedCapacity, this.sinkId);\n                }\n            }\n\n            return false;\n        }\n\n        /// <summary>\n        /// Flushes all the buffered entries.\n        /// </summary>\n        /// <returns>The task to wait for flush completion.</returns>\n        public Task FlushAsync()\n        {\n            // if there are no entries in the buffer, just return a completed operation\n            if (this.buffer.Count == 0)\n            {\n                return this.cachedCompletedTask.Value;\n            }\n\n            // create an awaitable task to know when the Flush operation finished.\n            var completionSource = this.flushCompletionSource;\n            if (completionSource == null)\n            {\n                lock (this.lockObject)\n                {\n                    if (this.flushCompletionSource == null)\n                    {\n                        this.flushCompletionSource = new TaskCompletionSource<bool>();\n                    }\n\n                    completionSource = this.flushCompletionSource;\n                }\n            }\n\n            this.TriggerFlush();\n\n            return completionSource.Task;\n        }\n\n        /// <summary>\n        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.\n        /// </summary>\n        public void Dispose()\n        {\n            if (!this.disposed)\n            {\n                this.disposed = true;\n\n                this.cancellationTokenSource.Cancel();\n                this.flushTokenSource.Cancel();\n                this.NotifyOnBufferNotEmpty();\n            }\n        }\n\n        private void StartBackgroundTask()\n        {\n            Task.Factory.StartNew((Func<Task>)this.TransferEntries, CancellationToken.None, TaskCreationOptions.HideScheduler, TaskScheduler.Default)\n                .Unwrap()\n                .ContinueWith(this.RestartBackgroundTask);\n        }\n\n        // Logs any unobserved exception and restarts the background task.\n        private void RestartBackgroundTask(Task predecesor)\n        {\n            if (predecesor.Exception != null)\n            {\n                SemanticLoggingEventSource.Log.BufferedEventPublisherUnobservedTaskFault(this.sinkId, predecesor.Exception.ToString());\n            }\n\n            if (!this.cancellationTokenSource.IsCancellationRequested)\n            {\n                // Restart background task\n                this.StartBackgroundTask();\n            }\n        }\n\n        //// Main processing loop for publishing entries based on time interval, buffer count and explicit flush triggers.\n        private async Task TransferEntries()\n        {\n            var token = this.cancellationTokenSource.Token;\n\n            var bufferInstance = this.buffer;\n            while (true)\n            {\n                if (token.IsCancellationRequested)\n                {\n                    // if cancelled, break the processing loop.\n                    this.SetAsFlushed();\n                    return;\n                }\n\n                var count = bufferInstance.Count;\n                if (count == 0 || count < this.bufferingCount)\n                {\n                    if (count == 0)\n                    {\n                        // if all entries were published, mark as flushed.\n                        this.SetAsFlushed();\n                    }\n\n                    if (this.flushCompletionSource == null)\n                    {\n                        // if no consumers triggered an explicit flush operation, then\n                        // wait for the buffering interval.\n                        await this.WaitForIntervalAsync(this.bufferingInterval).ConfigureAwait(false);\n\n                        if (token.IsCancellationRequested || bufferInstance.Count == 0)\n                        {\n                            // if there are no new entries yet, restart the loop that will\n                            // normally cause a new waiting interval.\n                            continue;\n                        }\n                    }\n                }\n\n                var entries = this.GetBatch();\n\n                int entriesSent = 0;\n                try\n                {\n                    entriesSent = await this.eventPublisher(entries).ConfigureAwait(false);\n                    if (entriesSent > 0)\n                    {\n                        // if entries were successfully published, remove them from the queue.\n                        for (int i = 0; i < entriesSent; i++)\n                        {\n                            var deleted = bufferInstance.Take();\n\n                            // System.Diagnostics.Debug.Assert(typeof(TEntry).IsValueType ? object.Equals(entries[i], deleted) : object.ReferenceEquals(entries[i], deleted), \"Elements in the queue were removed outside of the main loop.\");\n                        }\n\n                        if (Interlocked.Exchange(ref this.isBufferFull, 0) == 1)\n                        {\n                            // log only if we are switching from overload state\n                            SemanticLoggingEventSource.Log.BufferedEventPublisherCapacityRestored(this.sinkId);\n                        }\n\n                        this.nonTransientErrorWait.Reset();\n                        this.autoFlushByCountDisabled = false;\n                    }\n                }\n                catch (Exception ex)\n                {\n                    // There are non-transient errors, so return error in flush calls.\n                    this.FailFlushOperation(ex);\n                }\n\n                if (entriesSent == 0 && !token.IsCancellationRequested)\n                {\n                    this.autoFlushByCountDisabled = true;\n\n                    // if there are errors that are non transient, wait and retry later, but don't ever break the loop.\n                    await this.WaitForIntervalAsync(this.nonTransientErrorWait.GetNextDelay());\n                }\n            }\n        }\n\n        /// <summary>\n        /// If there are consumers waiting for the flush operation to finish, it completes the operation.\n        /// </summary>\n        private void SetAsFlushed()\n        {\n            lock (this.lockObject)\n            {\n                if (this.flushCompletionSource != null)\n                {\n                    // TODO: notify that the Flush operation was terminated, as the process is stopping.\n                    this.flushCompletionSource.TrySetResult(true);\n                    this.flushCompletionSource = null;\n                }\n            }\n        }\n\n        // If there are consumers waiting for the flush operation to finish, it returns a failed task.\n        private void FailFlushOperation(Exception exception)\n        {\n            AggregateException aggregateException = exception as AggregateException;\n            if (aggregateException != null)\n            {\n                exception = aggregateException.Flatten().InnerException;\n            }\n\n            lock (this.lockObject)\n            {\n                if (this.flushCompletionSource != null)\n                {\n                    this.flushCompletionSource.TrySetException(new FlushFailedException(exception));\n                    this.flushCompletionSource = null;\n                }\n            }\n        }\n\n        private void TriggerFlush()\n        {\n            // notify to stop waiting for polling interval\n            var tokenSource = this.flushTokenSource;\n            if (!tokenSource.IsCancellationRequested)\n            {\n                tokenSource.Cancel();\n            }\n        }\n\n        /// <summary>\n        /// Waits for the polling interval or until a flush operation occurs.\n        /// </summary>\n        /// <param name=\"interval\">The interval to wait.</param>\n        /// <returns>Returns a task that will run completion when the time expires, and will reset the flush cancellation token.</returns>\n        private async Task WaitForIntervalAsync(TimeSpan interval)\n        {\n            lock (this.lockObject)\n            {\n                if (this.flushCompletionSource != null || this.disposed)\n                {\n                    return;\n                }\n\n                this.flushTokenSource = new CancellationTokenSource();\n            }\n\n            // any call to flush will terminate the Delay task early.\n            await\n                Task.Delay(interval, this.flushTokenSource.Token)\n                    .ContinueWith(IgnoreTaskCancelation, TaskContinuationOptions.ExecuteSynchronously)\n                    .ConfigureAwait(false);\n        }\n\n        private static void IgnoreTaskCancelation(Task task)\n        {\n        }\n\n        private IList<TEntry> GetBatch()\n        {\n            return Enumerable.Take(this.buffer, this.maxBatchSize).ToList();\n        }\n\n        private void NotifyOnBufferNotEmpty()\n        {\n            if (this.buffer.Count > 0)\n            {\n                SemanticLoggingEventSource.Log.BufferedEventPublisherEventsLostWhileDisposing(this.buffer.Count, this.sinkId);\n            }\n        }\n\n        private class ExponentialBackoff\n        {\n            private readonly double minBackoffMilliseconds;\n            private readonly double maxBackoffMilliseconds;\n            private readonly double deltaBackoffMilliseconds;\n\n            private int currentPower;\n\n            public ExponentialBackoff(TimeSpan minBackoff, TimeSpan maxBackoff, TimeSpan deltaBackoff)\n            {\n                Guard.ArgumentGreaterOrEqualThan(0, minBackoff.TotalMilliseconds, \"minBackoff\");\n                Guard.ArgumentGreaterOrEqualThan(0, maxBackoff.TotalMilliseconds, \"maxBackoff\");\n                Guard.ArgumentGreaterOrEqualThan(0, deltaBackoff.TotalMilliseconds, \"deltaBackoff\");\n                Guard.ArgumentGreaterOrEqualThan(minBackoff.TotalMilliseconds, maxBackoff.TotalMilliseconds, \"maxBackoff\");\n\n                this.minBackoffMilliseconds = minBackoff.TotalMilliseconds;\n                this.maxBackoffMilliseconds = maxBackoff.TotalMilliseconds;\n                this.deltaBackoffMilliseconds = deltaBackoff.TotalMilliseconds;\n            }\n\n            public TimeSpan GetNextDelay()\n            {\n                var random = new Random();\n\n                int delta = (int)((Math.Pow(2.0, this.currentPower) - 1.0) * random.Next((int)(this.deltaBackoffMilliseconds * 0.8), (int)(this.deltaBackoffMilliseconds * 1.2)));\n                int interval = (int)Math.Min(checked(this.minBackoffMilliseconds + delta), this.maxBackoffMilliseconds);\n\n                if (interval < this.maxBackoffMilliseconds)\n                {\n                    this.currentPower++;\n                }\n\n                return TimeSpan.FromMilliseconds(interval);\n            }\n\n            public void Reset()\n            {\n                this.currentPower = 0;\n            }\n        }\n    }\n}"
  },
  {
    "path": "source/Src/SemanticLogging/Utility/Buffering.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility\n{\n    /// <summary>\n    /// Buffering constants.\n    /// </summary>\n    public static class Buffering\n    {\n        /// <summary>\n        /// The default buffering count.\n        /// </summary>\n        public const int DefaultBufferingCount = 1000;\n\n        /// <summary>\n        /// The default buffering interval.\n        /// </summary>\n        public static readonly TimeSpan DefaultBufferingInterval = TimeSpan.FromSeconds(30);\n\n        /// <summary>\n        /// The maximum number of entries that can be buffered while it's sending to database before the sink starts dropping entries.\n        /// </summary>\n        public const int DefaultMaxBufferSize = 30000;\n    }\n}"
  },
  {
    "path": "source/Src/SemanticLogging/Utility/EventEntryExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility\n{\n    /// <summary>\n    /// Extensions for <see cref=\"EventEntry\"/>.\n    /// </summary>\n    public static class EventEntryExtensions\n    {\n        /// <summary>\n        /// Subscribes an <see cref=\"IObserver{String}\"/> sink by doing a straight projection of a sequence of <see cref=\"EventEntry\"/> and applying\n        /// a format using a <see cref=\"IEventTextFormatter\"/> instance to convert it to a <see cref=\"string\"/> message.\n        /// </summary>\n        /// <param name=\"source\">The original stream of events.</param>\n        /// <param name=\"formatter\">The formatter to use.</param>\n        /// <param name=\"sink\">The underlying sink.</param>\n        /// <returns>A subscription token to unsubscribe to the event stream.</returns>\n        /// <remarks>When using Reactive Extensions (Rx), this is equivalent to doing a Select statement on the <paramref name=\"source\"/> to convert it to <see cref=\"IObservable{String}\"/> and then\n        /// calling Subscribe on it.\n        /// </remarks>\n        public static IDisposable SubscribeWithFormatter(this IObservable<EventEntry> source, IEventTextFormatter formatter, IObserver<string> sink)\n        {\n            return source.CreateSubscription(sink, entry => entry.TryFormatAsString(formatter));\n        }\n\n        /// <summary>\n        /// Subscribes a sink by doing a straight projection of a sequence of <see cref=\"EventEntry\"/> and applying\n        /// a format using a <see cref=\"IEventTextFormatter\"/> and a <see cref=\"IConsoleColorMapper\"/> instances to convert it \n        /// to a sequence of entries for that sink.\n        /// </summary>\n        /// <param name=\"source\">The original stream of events.</param>\n        /// <param name=\"formatter\">The formatter to use.</param>\n        /// <param name=\"colorMapper\">The color mapper.</param>\n        /// <param name=\"sink\">The underlying sink.</param>\n        /// <returns>A subscription token to unsubscribe to the event stream.</returns>\n        /// <remarks>When using Reactive Extensions (Rx), this is equivalent to doing a Select statement on the <paramref name=\"source\"/> to convert it to a <see cref=\"Tuple\"/> and then\n        /// calling Subscribe on it.\n        /// </remarks>\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1006:DoNotNestGenericTypesInMemberSignatures\", Justification = \"By design\")]\n        public static IDisposable SubscribeWithFormatterAndColor(this IObservable<EventEntry> source, IEventTextFormatter formatter, IConsoleColorMapper colorMapper, IObserver<Tuple<string, ConsoleColor?>> sink)\n        {\n            return source.CreateSubscription(sink, entry => entry.TryFormatAsStringAndColor(formatter, colorMapper));\n        }\n\n        /// <summary>\n        /// Formats an <see cref=\"EventEntry\"/> as a string using an <see cref=\"IEventTextFormatter\"/>.\n        /// </summary>\n        /// <param name=\"entry\">The entry to format.</param>\n        /// <param name=\"formatter\">The formatter to use.</param>\n        /// <returns>A formatted entry, or <see langword=\"null\"/> if an exception is thrown by the <paramref name=\"formatter\"/>.</returns>\n        public static string TryFormatAsString(this EventEntry entry, IEventTextFormatter formatter)\n        {\n            try\n            {\n                return formatter.WriteEvent(entry);\n            }\n            catch (Exception e)\n            {\n                SemanticLoggingEventSource.Log.FormatEntryAsStringFailed(e.ToString());\n            }\n\n            return null;\n        }\n\n        /// <summary>\n        /// Formats an <see cref=\"EventEntry\"/> as a string using an <see cref=\"IEventTextFormatter\"/>, and\n        /// assigns a <see cref=\"ConsoleColor\"/> depending on the event level.\n        /// </summary>\n        /// <param name=\"entry\">The entry to format.</param>\n        /// <param name=\"formatter\">The formatter to use.</param>\n        /// <param name=\"colorMapper\">The color mapper to user.</param>\n        /// <returns>A formatted entry with its color, or <see langword=\"null\"/> if an exception is thrown by the <paramref name=\"formatter\"/>.</returns>\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1006:DoNotNestGenericTypesInMemberSignatures\", Justification = \"By design\")]\n        public static Tuple<string, ConsoleColor?> TryFormatAsStringAndColor(this EventEntry entry, IEventTextFormatter formatter, IConsoleColorMapper colorMapper)\n        {\n            Guard.ArgumentNotNull(entry, \"entry\");\n            Guard.ArgumentNotNull(formatter, \"formatter\");\n            Guard.ArgumentNotNull(colorMapper, \"colorMapper\");\n\n            var message = TryFormatAsString(entry, formatter);\n            if (message != null)\n            {\n                try\n                {\n                    var color = colorMapper.Map(entry.Schema.Level);\n                    return Tuple.Create(message, color);\n                }\n                catch (Exception e)\n                {\n                    SemanticLoggingEventSource.Log.MapEntryLevelToColorFailed((int)entry.Schema.Level, e.ToString());\n                    return Tuple.Create(message, (ConsoleColor?)null);\n                }\n            }\n\n            return null;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Utility/EventEntryUtil.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing Newtonsoft.Json;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility\n{\n    internal static class EventEntryUtil\n    {\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Usage\", \"CA2202:Do not dispose objects multiple times\", Justification = \"Opt out for closing output\")]\n        internal static string JsonSerializePayload(EventEntry entry)\n        {\n            try\n            {\n                using (var writer = new StringWriter(CultureInfo.InvariantCulture))\n                using (var jsonWriter = new JsonTextWriter(writer) { Formatting = Newtonsoft.Json.Formatting.Indented, CloseOutput = false })\n                {\n                    EventEntryUtil.JsonWritePayload(jsonWriter, entry);\n                    jsonWriter.Flush();\n                    return writer.ToString();\n                }\n            }\n            catch (JsonWriterException jwe)\n            {\n                SemanticLoggingEventSource.Log.EventEntrySerializePayloadFailed(jwe.ToString());\n\n                var errorDictionary = new Dictionary<string, object>\n                { \n                    {\n                        \"Error\",\n                        string.Format(CultureInfo.CurrentCulture, Properties.Resources.JsonSerializationError, jwe.Message)\n                    }\n                };\n\n                return JsonConvert.SerializeObject(errorDictionary, Newtonsoft.Json.Formatting.Indented);\n            }\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Usage\", \"CA2202:Do not dispose objects multiple times\", Justification = \"jsonWriter does not close output\")]\n        internal static string JsonSerializePayload(IEnumerable<KeyValuePair<string, object>> payload)\n        {\n            try\n            {\n                using (var writer = new StringWriter(CultureInfo.InvariantCulture))\n                using (var jsonWriter = new JsonTextWriter(writer) { Formatting = Newtonsoft.Json.Formatting.Indented, CloseOutput = false })\n                {\n                    jsonWriter.WriteStartObject();\n\n                    foreach (var item in payload)\n                    {\n                        JsonWriteProperty(jsonWriter, item.Key, item.Value);\n                    }\n\n                    jsonWriter.WriteEndObject();\n                    jsonWriter.Flush();\n                    return writer.ToString();\n                }\n            }\n            catch (JsonWriterException jwe)\n            {\n                SemanticLoggingEventSource.Log.EventEntrySerializePayloadFailed(jwe.ToString());\n\n                var errorDictionary = new Dictionary<string, object>\n                { \n                    {\n                        \"Error\",\n                        string.Format(CultureInfo.CurrentCulture, Properties.Resources.JsonSerializationError, jwe.Message)\n                    }\n                };\n\n                return JsonConvert.SerializeObject(errorDictionary, Newtonsoft.Json.Formatting.Indented);\n            }\n        }\n\n        internal static void JsonWritePayload(JsonWriter writer, EventEntry entry)\n        {\n            writer.WriteStartObject();\n\n            var eventSchema = entry.Schema;\n\n            for (int i = 0; i < entry.Payload.Count; i++)\n            {\n                JsonWriteProperty(writer, eventSchema.Payload[i], entry.Payload[i]);\n            }\n\n            writer.WriteEndObject();\n        }\n\n        private static void JsonWriteProperty(JsonWriter writer, string propertyName, object value)\n        {\n            try\n            {\n                writer.WritePropertyName(propertyName);\n                writer.WriteValue(value);\n            }\n            catch (JsonWriterException jwe)\n            {\n                SemanticLoggingEventSource.Log.EventEntryJsonWriterFailed(jwe.ToString());\n\n                // We are in Error state so abort the write operation\n                throw new InvalidOperationException(\n                    string.Format(CultureInfo.CurrentCulture, Properties.Resources.JsonSerializationError, jwe.Message), jwe);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Utility/FileUtil.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.IO;\nusing System.Security;\nusing System.Text.RegularExpressions;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Properties;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility\n{\n    internal class FileUtil\n    {\n        /// <summary>\n        /// This method will replace environment variables and root the filename to the base directory while ensuring the path exists.\n        /// </summary>\n        /// <param name=\"fileName\">The name of the file.</param>\n        /// <returns>A FileInfo instance.</returns>\n        public static FileInfo ProcessFileNameForLogging(string fileName)\n        {\n            ValidFile(fileName, \"fileName\");\n\n            var s = ReplaceEnvironmentVariables(fileName);\n\n            if (!string.Equals(fileName, s, StringComparison.OrdinalIgnoreCase))\n            {\n                ValidFile(s, \"fileName\", true);\n            }\n\n            return new FileInfo(RootFileNameAndEnsureTargetFolderExists(s));\n        }\n\n        /// <summary>\n        /// Validate the file name or throws an exception.\n        /// </summary>\n        /// <param name=\"fileName\">Name of the file.</param>\n        /// <param name=\"argumentName\">Name of argument being checked.</param>\n        /// <param name=\"replaced\"><see langword=\"true\"/> if the file name is the result of replacing environment variables; otherwise, <see langword=\"false\"/>.</param>\n        /// <exception cref=\"System.ArgumentException\">The file name is invalid.</exception>\n        public static void ValidFile(string fileName, string argumentName = \"fileName\", bool replaced = false)\n        {\n            Guard.ArgumentNotNullOrEmpty(fileName, argumentName);\n\n            // FileInfo will perform extra validations (chars, path length, etc)\n            var file = new FileInfo(fileName);\n\n            // Check for relative file path expansions and the actual file name.\n            // Samples of invalid entries (without quotes):\n            // \".\", \"..\\..\", \"C:\\Test\\..\"  \n            if (string.IsNullOrWhiteSpace(file.Name) ||\n                Path.GetFileName(file.FullName) != file.Name)\n            {\n                if (!replaced)\n                {\n                    throw new ArgumentException(Properties.Resources.InvalidNavigationPathInFileNameError);\n                }\n                else\n                {\n                    throw new ArgumentException(Properties.Resources.InvalidNavigationPathInReplacedFileNameError);\n                }\n            }\n        }\n\n        public static string CreateRandomFileName()\n        {\n            return Path.ChangeExtension(Path.GetRandomFileName(), \".log\");\n        }\n\n        private static string RootFileNameAndEnsureTargetFolderExists(string fileName)\n        {\n            string rootedFileName = fileName;\n            if (!Path.IsPathRooted(rootedFileName))\n            {\n                // GetFullPath will resolve any relative path in rootedFileName\n                // AppDomain.CurrentDomain.BaseDirectory will be used as root to decouple from Environment.CurrentDirectory value.                \n                rootedFileName = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, rootedFileName));\n            }\n\n            string directory = Path.GetDirectoryName(rootedFileName);\n            if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))\n            {\n                Directory.CreateDirectory(directory);\n            }\n\n            return rootedFileName;\n        }\n\n        private static string ReplaceEnvironmentVariables(string fileName)\n        {\n            // Check EnvironmentPermission for the ability to access the environment variables.\n            try\n            {\n                string variables = Environment.ExpandEnvironmentVariables(fileName);\n\n                // If an Environment Variable is not found then remove any invalid tokens\n                Regex filter = new Regex(\"%(.*?)%\", RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);\n\n                string filePath = filter.Replace(variables, string.Empty);\n\n                if (Path.GetDirectoryName(filePath) == null)\n                {\n                    filePath = Path.GetFileName(filePath);\n                }\n\n                return filePath;\n            }\n            catch (SecurityException)\n            {\n                throw new InvalidOperationException(Resources.ExceptionReadEnvironmentVariablesDenied);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Utility/Guard.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility\n{\n    internal static class Guard\n    {\n        private static readonly char[] InvalidFileNameChars = Path.GetInvalidFileNameChars();\n\n        /// <summary>\n        /// Throws <see cref=\"ArgumentNullException\"/> if the given argument is null.\n        /// </summary>\n        /// <exception cref=\"ArgumentNullException\"> If tested value if null.</exception>\n        /// <param name=\"argumentValue\">Argument value to test.</param>\n        /// <param name=\"argumentName\">Name of the argument being tested.</param>\n        public static void ArgumentNotNull(object argumentValue, string argumentName)\n        {\n            if (argumentValue == null)\n            {\n                throw new ArgumentNullException(argumentName);\n            }\n        }\n\n        /// <summary>\n        /// Throws an exception if the tested string argument is null or the empty string.\n        /// </summary>\n        /// <exception cref=\"ArgumentNullException\">Thrown if string value is null.</exception>\n        /// <exception cref=\"ArgumentException\">Thrown if the string is empty</exception>\n        /// <param name=\"argumentValue\">Argument value to check.</param>\n        /// <param name=\"argumentName\">Name of argument being checked.</param>\n        public static void ArgumentNotNullOrEmpty(string argumentValue, string argumentName)\n        {\n            if (argumentValue == null)\n            {\n                throw new ArgumentNullException(argumentName);\n            }\n\n            if (argumentValue.Length == 0)\n            {\n                throw new ArgumentException(Properties.Resources.ArgumentIsEmptyError, argumentName);\n            }\n        }\n\n        /// <summary>\n        /// Throws an exception if the argumentValue is less than lowerValue.\n        /// </summary>\n        /// <typeparam name=\"T\">A type that implements <see cref=\"IComparable\"/>.</typeparam>\n        /// <param name=\"lowerValue\">The lower value accepted as valid.</param>\n        /// <param name=\"argumentValue\">The argument value to test.</param>\n        /// <param name=\"argumentName\">Name of the argument.</param>\n        /// <exception cref=\"System.ArgumentOutOfRangeException\">Validation error.</exception>\n        public static void ArgumentGreaterOrEqualThan<T>(T lowerValue, T argumentValue, string argumentName) where T : struct, IComparable\n        {\n            if (argumentValue.CompareTo((T)lowerValue) < 0)\n            {\n                throw new ArgumentOutOfRangeException(argumentName, argumentValue, string.Format(CultureInfo.CurrentCulture, Properties.Resources.ArgumentNotGreaterOrEqualTo, argumentName, lowerValue));\n            }\n        }\n\n        /// <summary>\n        /// Throws an exception if the argumentValue is great than higherValue.\n        /// </summary>\n        /// <typeparam name=\"T\">A type that implements <see cref=\"IComparable\"/>.</typeparam>\n        /// <param name=\"higherValue\">The higher value accepted as valid.</param>\n        /// <param name=\"argumentValue\">The argument value to test.</param>\n        /// <param name=\"argumentName\">Name of the argument.</param>\n        /// <exception cref=\"System.ArgumentOutOfRangeException\">Validation error.</exception>\n        public static void ArgumentLowerOrEqualThan<T>(T higherValue, T argumentValue, string argumentName) where T : struct, IComparable\n        {\n            if (argumentValue.CompareTo((T)higherValue) > 0)\n            {\n                throw new ArgumentOutOfRangeException(argumentName, argumentValue, string.Format(CultureInfo.CurrentCulture, Properties.Resources.ArgumentNotLowerOrEqualTo, argumentName, higherValue));\n            }\n        }\n\n        /// <summary>\n        /// Throws an exception if the tested TimeSpam argument is not a valid timeout value.\n        /// </summary>\n        /// <exception cref=\"ArgumentOutOfRangeException\">Thrown if the argument is not null and is not a valid timeout value.</exception>\n        /// <param name=\"argumentValue\">Argument value to check.</param>\n        /// <param name=\"argumentName\">Name of argument being checked.</param>\n        public static void ArgumentIsValidTimeout(TimeSpan? argumentValue, string argumentName)\n        {\n            if (argumentValue.HasValue)\n            {\n                long totalMilliseconds = (long)argumentValue.Value.TotalMilliseconds;\n                if (totalMilliseconds < (long)-1 || totalMilliseconds > (long)2147483647)\n                {\n                    throw new ArgumentOutOfRangeException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.TimeSpanOutOfRangeError, argumentName));\n                }\n            }\n        }\n\n        public static void ValidateTimestampPattern(string timestampPattern, string argumentName)\n        {\n            Guard.ArgumentNotNullOrEmpty(timestampPattern, argumentName);\n\n            foreach (var item in timestampPattern.ToCharArray())\n            {\n                if (InvalidFileNameChars.Contains(item))\n                {\n                    throw new ArgumentException(\"Timestamp contains invalid characters\", argumentName);\n                }\n            }\n        }\n\n        /// <summary>\n        /// Validate the date time format.\n        /// </summary>\n        /// <param name=\"format\">The format.</param>\n        /// <param name=\"argumentName\">Name of the argument.</param>\n        public static void ValidDateTimeFormat(string format, string argumentName)\n        {\n            if (format == null)\n            {\n                return;\n            }\n\n            try\n            {\n                DateTime.Now.ToString(format, CultureInfo.InvariantCulture);\n            }\n            catch (FormatException e)\n            {\n                throw new ArgumentException(argumentName, Properties.Resources.InvalidDateTimeFormatError, e);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Utility/TextFormatterExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Globalization;\nusing System.IO;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility\n{\n    /// <summary>\n    /// Extensions for <see cref=\"IEventTextFormatter\"/>.\n    /// </summary>\n    public static class EventTextFormatterExtensions\n    {\n        /// <summary>\n        /// Formats the event as a string.\n        /// </summary>\n        /// <param name=\"entry\">The entry to format.</param>\n        /// <param name=\"formatter\">The formatter to use.</param>\n        /// <returns>A formatted entry.</returns>\n        public static string WriteEvent(this IEventTextFormatter formatter, EventEntry entry)\n        {\n            Guard.ArgumentNotNull(formatter, \"formatter\");\n\n            using (var writer = new StringWriter(CultureInfo.CurrentCulture))\n            {\n                formatter.WriteEvent(entry, writer);\n                return writer.ToString();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Utility/TypeExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.ComponentModel;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility\n{\n    internal static class TypeExtensions\n    {\n        public static object Default(this Type type)\n        {\n            if (type == typeof(string))\n            {\n                return string.Empty;\n            }\n\n            if (type == typeof(byte[]))\n            {\n                return new byte[] { };\n            }\n\n            return Activator.CreateInstance(type);\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Globalization\", \"CA1303:Do not pass literals as localized parameters\", MessageId = \"System.ComponentModel.TypeConverter.ConvertFromInvariantString(System.String)\", Justification = \"Converting numeric value\")]\n        public static object NotDefault(this Type type)\n        {\n            if (type == typeof(string))\n            {\n                return \"1\";\n            }\n\n            if (type == typeof(Guid))\n            {\n                return Guid.NewGuid();\n            }\n\n            if (type == typeof(bool))\n            {\n                return true;\n            }\n            \n            if (type == typeof(DateTime))\n            {\n                return DateTime.MaxValue;\n            }\n\n            if (type == typeof(byte[]))\n            {\n                return new byte[] { 1, 2, 3 };\n            }\n\n            TypeConverter tc = TypeDescriptor.GetConverter(type);\n            if (tc != null && tc.CanConvertFrom(typeof(string)))\n            {\n                return tc.ConvertFromInvariantString(\"1\");\n            }\n\n            return Activator.CreateInstance(type);\n        }\n\n        public static bool IsDefault(this object value)\n        {\n            if (value == null)\n            {\n                return true;\n            }\n\n            return value.Equals(value.GetType().Default());\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Utility/XmlExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Threading;\nusing System.Xml.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility\n{\n    /// <summary>\n    /// Xml extensions for configuration extensibility support\n    /// </summary>\n    public static class XmlExtensions\n    {\n        /// <summary>\n        /// XAttribute configuration extension to convert seconds to a TimeSpan format\n        /// </summary>\n        /// <param name=\"attribute\"></param>\n        /// <returns></returns>\n        public static TimeSpan? ToTimeSpan(this XAttribute attribute)\n        {\n            int? bufferingIntervalInSeconds = (int?)attribute;\n            if (!bufferingIntervalInSeconds.HasValue)\n            {\n                return (TimeSpan?)null;\n            }\n\n            return bufferingIntervalInSeconds.Value == -1 ? Timeout.InfiniteTimeSpan : TimeSpan.FromSeconds(bufferingIntervalInSeconds.Value);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/Utility/XmlUtil.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Utility\n{\n    internal static class XmlUtil\n    {\n        private static readonly XName ParametersName = XName.Get(\"parameters\", Constants.Namespace);\n\n        //// Recreates the element structure in a ordered way (attributes and child elements) to get accurate element comparisons \n        internal static XElement DeepNormalization(this XElement element)\n        {\n            if (element.HasElements)\n            {\n                return new XElement(\n                    element.Name,\n                    element.Attributes().OrderBy(a => a.Name.ToString()),\n                    element.Elements().OrderBy(a => a.Name.ToString()).Select(e => DeepNormalization(e)));\n            }\n\n            return new XElement(element.Name, element.Attributes().OrderBy(a => a.Name.ToString()), element.IsEmpty ? null : element.Value);\n        }\n\n        internal static T CreateInstance<T>(XAttribute attribute)\n        {\n            string attributeValue = (string)attribute;\n            if (!string.IsNullOrWhiteSpace(attributeValue))\n            {\n                return (T)Activator.CreateInstance(Type.GetType(attributeValue, true));\n            }\n\n            return default(T);\n        }\n\n        internal static T CreateInstance<T>(XElement element)\n        {\n            Guard.ArgumentNotNull(element, \"element\");\n            string type = (string)element.Attribute(\"type\");\n            Guard.ArgumentNotNullOrEmpty(type, \"type\");\n\n            try\n            {\n                return (T)Activator.CreateInstance(Type.GetType(type, true), BuildArgs(element));\n            }\n            catch (MissingMethodException e)\n            {\n                throw new ArgumentException(Properties.Resources.IncompleteArgumentsError, e);\n            }\n        }\n\n        internal static object[] BuildArgs(XElement element)\n        {\n            List<ParameterElement> parameters = new List<ParameterElement>();\n\n            foreach (var e in element.Elements(ParametersName).Elements())\n            {\n                parameters.Add(ParameterElement.Read(e));\n            }\n\n            return BuildArgs(parameters);\n        }\n\n        private static object[] BuildArgs(IEnumerable<ParameterElement> parameters)\n        {\n            var args = new List<object>();\n\n            foreach (var parameter in parameters)\n            {\n                var type = System.Type.GetType(parameter.Type, true);\n\n                if (parameter.Value != null)\n                {\n                    args.Add(TypeDescriptor.GetConverter(type).ConvertFromString(parameter.Value));\n                    continue;\n                }\n\n                args.Add(parameter.Parameters.Count() > 0 ?\n                    Activator.CreateInstance(type, BuildArgs(parameter.Parameters)) :\n                    Activator.CreateInstance(type));\n            }\n\n            return args.ToArray();\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"Newtonsoft.Json\" version=\"6.0.8\" targetFramework=\"net45\" />\n  <package id=\"StyleCop.MSBuild\" version=\"4.7.49.0\" targetFramework=\"net45\" developmentDependency=\"true\" />\n</packages>"
  },
  {
    "path": "source/Src/SemanticLogging.Database/Configuration/SqlDatabaseSinkElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration\n{\n    internal class SqlDatabaseSinkElement : ISinkElement\n    {\n        private readonly XName sinkName = XName.Get(\"sqlDatabaseSink\", Constants.Namespace);\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Validated with Guard class\")]\n        public bool CanCreateSink(XElement element)\n        {\n            Guard.ArgumentNotNull(element, \"element\");\n\n            return element.Name == this.sinkName;\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Validated with Guard class\")]\n        public IObserver<EventEntry> CreateSink(XElement element)\n        {\n            Guard.ArgumentNotNull(element, \"element\");\n\n            var subject = new EventEntrySubject();\n            subject.LogToSqlDatabase(\n                (string)element.Attribute(\"instanceName\"),\n                (string)element.Attribute(\"connectionString\"),\n                (string)element.Attribute(\"tableName\") ?? SqlDatabaseLog.DefaultTableName,\n                (string)element.Attribute(\"storedProcedureName\") ?? SqlDatabaseLog.DefaultStoredProcedureName,\n                element.Attribute(\"bufferingIntervalInSeconds\").ToTimeSpan(),\n                (int?)element.Attribute(\"bufferingCount\") ?? Buffering.DefaultBufferingCount,\n                element.Attribute(\"bufferingFlushAllTimeoutInSeconds\").ToTimeSpan() ?? Constants.DefaultBufferingFlushAllTimeout,\n                (int?)element.Attribute(\"maxBufferSize\") ?? Buffering.DefaultMaxBufferSize);\n\n            return subject;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Database/GlobalSuppressions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\n// This file is used by Code Analysis to maintain SuppressMessage \n// attributes that are applied to this project.\n// Project-level suppressions either have no target or are given \n// a specific target and scoped to a namespace, type, member, etc.\n//\n// To add a suppression to this file, right-click the message in the \n// Code Analysis results, point to \"Suppress Message\", and click \n// \"In Suppression File\".\n// You do not need to add suppressions to this file manually.\n\n// suppressions for \"few types\"\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1020:AvoidNamespacesWithFewTypes\", Scope = \"namespace\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging\", Justification = \"As designed\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1020:AvoidNamespacesWithFewTypes\", Scope = \"namespace\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks\", Justification = \"As designed\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1020:AvoidNamespacesWithFewTypes\", Scope = \"namespace\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.Database\", Justification = \"As designed\")]\n"
  },
  {
    "path": "source/Src/SemanticLogging.Database/Properties/AssemblyInfo.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Security;\n\n[assembly: AssemblyTitle(\"Enterprise Library Semantic Logging Application Block\")]\n[assembly: AssemblyDescription(\"Enterprise Library Semantic Logging Application Block\")]\n\n[assembly: SecurityTransparent]\n\n[assembly: AssemblyVersion(\"2.0.0.0\")]\n[assembly: AssemblyFileVersion(\"2.0.1406.1\")]\n[assembly: AssemblyInformationalVersion(\"2.0.1406.1\")]\n\n[assembly: ComVisible(false)]\n\n#if SIGN\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n#else\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\")]\n#endif"
  },
  {
    "path": "source/Src/SemanticLogging.Database/SemanticLogging.Database.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{AC34C8E7-2A5B-412C-AFF7-CF7F52EE4569}</ProjectGuid>\n    <OutputType>Library</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>Microsoft.Practices.EnterpriseLibrary.SemanticLogging</RootNamespace>\n    <AssemblyName>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Database</AssemblyName>\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>..\\..\\..\\bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>\n    <DocumentationFile>..\\..\\..\\bin\\Debug\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Database.XML</DocumentationFile>\n    <CodeAnalysisRuleSet>..\\..\\EnterpriseLibrary.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>..\\..\\..\\bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n    <DocumentationFile>..\\..\\..\\bin\\Release\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Database.XML</DocumentationFile>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling\">\n      <HintPath>..\\..\\packages\\EnterpriseLibrary.TransientFaultHandling.6.0.1304.0\\lib\\portable-net45+win+wp8\\Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.Data\">\n      <HintPath>..\\..\\packages\\EnterpriseLibrary.TransientFaultHandling.Data.6.0.1304.1\\lib\\NET45\\Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.Data.dll</HintPath>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Transactions\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"..\\..\\GlobalAssemblyInfo.cs\">\n      <Link>GlobalAssemblyInfo.cs</Link>\n    </Compile>\n    <Compile Include=\"Configuration\\SqlDatabaseSinkElement.cs\" />\n    <Compile Include=\"GlobalSuppressions.cs\" />\n    <Compile Include=\"Sinks\\SqlDatabaseSink.cs\" />\n    <Compile Include=\"Utility\\EventRecordDataReader.cs\" />\n    <Compile Include=\"SqlDatabaseLog.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n    <Compile Include=\"Utility\\EventEntryExtensions.cs\" />\n    <Compile Include=\"Utility\\DbConnectionExtensions.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\SemanticLogging\\SemanticLogging.csproj\">\n      <Project>{2cd4105b-0dd6-4c18-9b37-05d8e8f57303}</Project>\n      <Name>SemanticLogging</Name>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"..\\..\\Scripts\\CreateSemanticLoggingDb.cmd\">\n      <Link>Scripts\\CreateSemanticLoggingDb.cmd</Link>\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </None>\n    <None Include=\"..\\..\\SemanticLogging.licenseheader\">\n      <Link>SemanticLogging.licenseheader</Link>\n    </None>\n    <None Include=\"packages.config\" />\n    <None Include=\"SemanticLogging.Database.nuspec\" />\n  </ItemGroup>\n  <ItemGroup />\n  <ItemGroup>\n    <None Include=\"..\\..\\Scripts\\CreateSemanticLoggingDatabase.sql\">\n      <Link>Scripts\\CreateSemanticLoggingDatabase.sql</Link>\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </None>\n    <None Include=\"..\\..\\Scripts\\CreateSemanticLoggingDatabaseObjects.sql\">\n      <Link>Scripts\\CreateSemanticLoggingDatabaseObjects.sql</Link>\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </None>\n  </ItemGroup>\n  <PropertyGroup>\n    <DefineConstants Condition=\" '$(SignAssembly)' == 'true' \">$(DefineConstants);SIGN</DefineConstants>\n  </PropertyGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <Import Project=\"..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets\" Condition=\"Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets'))\" />\n  </Target>\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "source/Src/SemanticLogging.Database/SemanticLogging.Database.nuspec",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<package xmlns=\"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd\">\n  <metadata schemaVersion=\"2\">\n    <id>EnterpriseLibrary.SemanticLogging.Database</id>\n    <version>$Microsoft_Practices_EnterpriseLibrary_SemanticLogging_Database_Version$</version>\n    <title>Semantic Logging Application Block - SQL Server Sink</title>\n    <authors>Microsoft</authors>\n    <owners>Microsoft; patterns-and-practices</owners>\n    <licenseUrl>http://opensource.org/licenses/Apache-2.0</licenseUrl>\n    <projectUrl>http://slab.codeplex.com</projectUrl>\n    <iconUrl>http://nuget.org/Media/Default/Packages/Unity/2.0/entlib_new_icon_100x100.png</iconUrl>\n    <requireLicenseAcceptance>true</requireLicenseAcceptance>\n    <summary>The Semantic Logging Application Block provides a set of destinations to persist events published by a subclass of EventSource.</summary>\n    <description>The Semantic Logging Application Block provides a set of destinations to persist events published by a subclass of EventSource, This add-on packages adds support to persisting log entries in SQL Server and Azure SQL Database.</description>\n   <copyright>© 2014 Microsoft Corporation</copyright>\n   <tags>entlib entlib6 slab enterprise library ETW semantic logging EventSource event listener structured strongly-typed block sink SQL database table futures OSS</tags>\n    <dependencies>\n      <dependency id=\"EnterpriseLibrary.SemanticLogging\" version=\"$Microsoft_Practices_EnterpriseLibrary_SemanticLogging_Version$\" />\n    </dependencies>\n    <frameworkAssemblies>\n      <frameworkAssembly assemblyName=\"mscorlib\" targetFramework=\".NETFramework4.5\" />\n    </frameworkAssemblies>\n  </metadata>\n  <files>\n    <file src=\"NuGet\\Readme-Database.txt\" target=\"Readme.txt\" />\n    <file src=\"scripts\\CreateSemanticLoggingDatabase.sql\" target=\"scripts\" />\n    <file src=\"scripts\\CreateSemanticLoggingDatabaseObjects.sql\" target=\"scripts\" />\n    <file src=\"scripts\\CreateSemanticLoggingDb.cmd\" target=\"scripts\" />\n  </files>\n</package>"
  },
  {
    "path": "source/Src/SemanticLogging.Database/Sinks/SqlDatabaseSink.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Data;\nusing System.Data.SqlClient;\nusing System.Globalization;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Database.Utility;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks\n{\n    /// <summary>\n    /// Sink that asynchronously writes entries to SQL Server database.\n    /// </summary>\n    public class SqlDatabaseSink : IObserver<EventEntry>, IDisposable\n    {\n        private readonly RetryPolicy retryPolicy = new RetryPolicy<SqlDatabaseTransientErrorDetectionStrategy>(5, TimeSpan.FromSeconds(1), TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(5));\n        private readonly string instanceName;\n        private readonly string connectionString;\n        private readonly string tableName;\n        private readonly string storedProcedureName;\n        private readonly BufferedEventPublisher<EventEntry> bufferedPublisher;\n        private readonly TimeSpan onCompletedTimeout;\n        private CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"SqlDatabaseSink\" /> class with the specified instance name, connection string and table name.\n        /// </summary>\n        /// <param name=\"instanceName\">The name of the instance originating the entries.</param>\n        /// <param name=\"connectionString\">The connection string.</param>\n        /// <param name=\"tableName\">The name of the table.</param>\n        /// <param name=\"storedProcedureName\">The name of the stored procedure that writes to table></param>\n        /// <param name=\"bufferingInterval\">The buffering interval between each batch publishing.</param>\n        /// <param name=\"bufferingCount\">The number of entries that will trigger a batch publishing.</param>\n        /// <param name=\"maxBufferSize\">The maximum number of entries that can be buffered while it's sending to the store before the sink starts dropping entries.</param>      \n        /// <param name=\"onCompletedTimeout\">Defines a timeout interval for when flushing the entries after an <see cref=\"OnCompleted\"/> call is received and before disposing the sink.\n        /// This means that if the timeout period elapses, some event entries will be dropped and not sent to the store. Normally, calling <see cref=\"IDisposable.Dispose\"/> on \n        /// the <see cref=\"System.Diagnostics.Tracing.EventListener\"/> will block until all the entries are flushed or the interval elapses.\n        /// If <see langword=\"null\"/> is specified, then the call will block indefinitely until the flush operation finishes.</param>\n        public SqlDatabaseSink(string instanceName, string connectionString, string tableName, string storedProcedureName, TimeSpan bufferingInterval, int bufferingCount, int maxBufferSize, TimeSpan onCompletedTimeout)\n        {\n            Guard.ArgumentNotNullOrEmpty(instanceName, \"instanceName\");\n            Guard.ArgumentNotNullOrEmpty(connectionString, \"connectionString\");\n            Guard.ArgumentNotNullOrEmpty(tableName, \"tableName\");\n            Guard.ArgumentNotNullOrEmpty(tableName, \"storedProcedureName\");\n            Guard.ArgumentIsValidTimeout(onCompletedTimeout, \"onCompletedTimeout\");\n            ValidateSqlConnectionString(connectionString, \"connectionString\");\n\n            this.instanceName = instanceName;\n            this.connectionString = connectionString;\n            this.tableName = tableName;\n            this.storedProcedureName = storedProcedureName;\n            this.onCompletedTimeout = onCompletedTimeout;\n            this.retryPolicy.Retrying += Retrying;\n            string sinkId = string.Format(CultureInfo.InvariantCulture, \"SqlDatabaseSink ({0})\", instanceName);\n            this.bufferedPublisher = BufferedEventPublisher<EventEntry>.CreateAndStart(sinkId, this.PublishEventsAsync, bufferingInterval, bufferingCount, maxBufferSize, this.cancellationTokenSource.Token);\n        }\n\n        /// <summary>\n        /// Finalizes an instance of the <see cref=\"SqlDatabaseSink\"/> class.\n        /// </summary>\n        ~SqlDatabaseSink()\n        {\n            this.Dispose(false);\n        }\n\n        /// <summary>\n        /// Flushes the buffer content to <see cref=\"PublishEventsAsync\"/>.\n        /// </summary>\n        /// <returns>The Task that flushes the buffer.</returns>\n        public Task FlushAsync()\n        {\n            return this.bufferedPublisher.FlushAsync();\n        }\n\n        /// <summary>\n        /// Releases all resources used by the current instance of the <see cref=\"SqlDatabaseSink\"/> class.\n        /// </summary>\n        public void Dispose()\n        {\n            this.Dispose(true);\n            GC.SuppressFinalize(this);\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has finished sending push-based notifications.\n        /// </summary>\n        public void OnCompleted()\n        {\n            this.FlushSafe();\n            this.Dispose();\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has experienced an error condition.\n        /// </summary>\n        /// <param name=\"error\">An object that provides additional information about the error.</param>\n        public void OnError(Exception error)\n        {\n            this.FlushSafe();\n            this.Dispose();\n        }\n\n        /// <summary>\n        /// Provides the sink with new data to write.\n        /// </summary>\n        /// <param name=\"value\">The current entry to write to the database.</param>\n        public void OnNext(EventEntry value)\n        {\n            this.bufferedPublisher.TryPost(value);\n        }\n\n        /// <summary>\n        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.\n        /// </summary>\n        /// <param name=\"disposing\">A value indicating whether or not the class is disposing.</param>\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Usage\", \"CA2213:DisposableFieldsShouldBeDisposed\", MessageId = \"cancellationTokenSource\", Justification = \"Token is cancelled\")]\n        protected virtual void Dispose(bool disposing)\n        {\n            if (disposing)\n            {\n                this.cancellationTokenSource.Cancel();\n                this.bufferedPublisher.Dispose();\n            }\n        }\n\n        private static void Retrying(object sender, RetryingEventArgs e)\n        {\n            SemanticLoggingEventSource.Log.DatabaseSinkPublishEventsTransientError(e.LastException.ToString());\n        }\n\n        private static void ValidateSqlConnectionString(string connectionStringValue, string argumentName)\n        {\n            Guard.ArgumentNotNullOrEmpty(connectionStringValue, argumentName);\n\n            try\n            {\n                var builder = new SqlConnectionStringBuilder();\n                builder.ConnectionString = connectionStringValue;\n            }\n            catch (ArgumentException e)\n            {\n                throw new ArgumentException(Properties.Resources.InvalidConnectionStringError, argumentName, e);\n            }\n        }\n\n        private async Task<int> PublishEventsAsync(IList<EventEntry> collection)\n        {\n            int publishedEvents = collection.Count;\n\n            try\n            {\n                if (collection.Count > 128)\n                {\n                    await this.UseSqlBulkCopy(collection).ConfigureAwait(false);\n                }\n                else\n                {\n                    await this.UseStoredProcedure(collection).ConfigureAwait(false);\n                }\n\n                return publishedEvents;\n            }\n            catch (OperationCanceledException)\n            {\n                return 0;\n            }\n            catch (Exception ex)\n            {\n                if (this.cancellationTokenSource.IsCancellationRequested)\n                {\n                    return 0;\n                }\n\n                SemanticLoggingEventSource.Log.DatabaseSinkPublishEventsFailed(ex.ToString());\n                throw;\n            }\n        }\n\n        private async Task UseSqlBulkCopy(IList<EventEntry> collection)\n        {\n            int initialCount = collection.Count;\n\n            for (int retries = 0; retries < 3; retries++)\n            {\n                using (var reader = new EventEntryDataReader(collection, this.instanceName))\n                {\n                    try\n                    {\n                        await this.TrySqlBulkCopy(reader).ConfigureAwait(false);\n                        return;\n                    }\n                    catch (InvalidOperationException ex)\n                    {\n                        //// if all events were published throw                       \n                        if (reader.RecordsAffected == collection.Count)\n                        {\n                            throw;\n                        }\n\n                        int affectedRow = reader.RecordsAffected - 1;\n                        SemanticLoggingEventSource.Log.DatabaseSinkPublishEventsFailedAndDiscardSingleEntry(ex.Message, affectedRow);\n                        ////retry after removing the offending record\n                        collection.RemoveAt(affectedRow);\n                    }\n                }\n            }\n\n            ////If still pending events after all retries, discard batch and log.\n            if (initialCount != collection.Count)\n            {\n                SemanticLoggingEventSource.Log.DatabaseSinkPublishEventsFailedAndDiscardsEntries(collection.Count);\n            }\n        }\n\n        private async Task TrySqlBulkCopy(IDataReader reader)\n        {\n            var token = this.cancellationTokenSource.Token;\n\n            using (var sqlBulkCopy = new SqlBulkCopy(this.connectionString, SqlBulkCopyOptions.UseInternalTransaction))\n            {\n                sqlBulkCopy.DestinationTableName = this.tableName;\n                sqlBulkCopy.ColumnMappings.Add(\"InstanceName\", \"InstanceName\");\n                sqlBulkCopy.ColumnMappings.Add(\"ProviderId\", \"ProviderId\");\n                sqlBulkCopy.ColumnMappings.Add(\"ProviderName\", \"ProviderName\");\n                sqlBulkCopy.ColumnMappings.Add(\"EventId\", \"EventId\");\n                sqlBulkCopy.ColumnMappings.Add(\"EventKeywords\", \"EventKeywords\");\n                sqlBulkCopy.ColumnMappings.Add(\"Level\", \"Level\");\n                sqlBulkCopy.ColumnMappings.Add(\"Opcode\", \"Opcode\");\n                sqlBulkCopy.ColumnMappings.Add(\"Task\", \"Task\");\n                sqlBulkCopy.ColumnMappings.Add(\"Timestamp\", \"Timestamp\");\n                sqlBulkCopy.ColumnMappings.Add(\"Version\", \"Version\");\n                sqlBulkCopy.ColumnMappings.Add(\"FormattedMessage\", \"FormattedMessage\");\n                sqlBulkCopy.ColumnMappings.Add(\"Payload\", \"Payload\");\n                sqlBulkCopy.ColumnMappings.Add(\"ActivityId\", \"ActivityId\");\n                sqlBulkCopy.ColumnMappings.Add(\"RelatedActivityId\", \"RelatedActivityId\");\n                sqlBulkCopy.ColumnMappings.Add(\"ProcessId\", \"ProcessId\");\n                sqlBulkCopy.ColumnMappings.Add(\"ThreadId\", \"ThreadId\");\n\n                await this.retryPolicy.ExecuteAsync(() => sqlBulkCopy.WriteToServerAsync(reader, token), token).ConfigureAwait(false);\n            }\n        }\n\n        private async Task UseStoredProcedure(IList<EventEntry> collection)\n        {\n            var token = this.cancellationTokenSource.Token;\n\n            await this.retryPolicy.ExecuteAsync(\n                async () =>\n                {\n                    using (var conn = new SqlConnection(this.connectionString))\n                    {\n                        await conn.SuppressTransactionOpenAsync(token).ConfigureAwait(false);\n\n                        using (var reader = new EventEntryDataReader(collection, this.instanceName))\n                        using (var cmd = new SqlCommand(storedProcedureName, conn))\n                        {\n                            cmd.CommandType = CommandType.StoredProcedure;\n                            cmd.Parameters.Add(new SqlParameter(\"@InsertTraces\", SqlDbType.Structured));\n                            cmd.Parameters[0].Value = reader;\n                            cmd.Parameters[0].TypeName = \"dbo.TracesType\";\n\n                            return await cmd.ExecuteNonQueryAsync(token).ConfigureAwait(false);\n                        }\n                    }\n                },\n                token).ConfigureAwait(false);\n        }\n\n        private void FlushSafe()\n        {\n            try\n            {\n                this.FlushAsync().Wait(this.onCompletedTimeout);\n            }\n            catch (AggregateException ex)\n            {\n                // Flush operation will already log errors. Never expose this exception to the observable.\n                ex.Handle(e => e is FlushFailedException);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Database/SqlDatabaseLog.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.Threading;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging\n{\n    /// <summary>\n    /// Factories and helpers for using the <see cref=\"SqlDatabaseSink\"/>.\n    /// </summary>\n    public static class SqlDatabaseLog\n    {\n        /// <summary>\n        /// Default table name used to write traces.\n        /// </summary>\n        public const string DefaultTableName = \"Traces\";\n\n        /// <summary>\n        /// Default stored procedure name used to write traces.\n        /// </summary>\n        public const string DefaultStoredProcedureName = \"dbo.WriteTraces\";\n\n        /// <summary>\n        /// Subscribes to an <see cref=\"IObservable{EventEntry}\"/> using a <see cref=\"SqlDatabaseSink\"/>.\n        /// </summary>\n        /// <param name=\"eventStream\">The event stream. Typically this is an instance of <see cref=\"ObservableEventListener\" />.</param>\n        /// <param name=\"instanceName\">The name of the instance originating the entries.</param>\n        /// <param name=\"connectionString\">The connection string.</param>\n        /// <param name=\"tableName\">The name of the table.</param>\n        /// <param name=\"storedProcedureName\">The name of the stored procedure that writes to table></param>\n        /// <param name=\"bufferingInterval\">The buffering interval between each batch publishing. Default value is <see cref=\"Buffering.DefaultBufferingInterval\"/>.</param>\n        /// <param name=\"bufferingCount\">The number of entries that will trigger a batch publishing.</param>\n        /// <param name=\"onCompletedTimeout\">Defines a timeout interval for when flushing the entries after an <see cref=\"SqlDatabaseSink.OnCompleted\"/> call is received and before disposing the sink.\n        /// This means that if the timeout period elapses, some event entries will be dropped and not sent to the store. Normally, calling <see cref=\"IDisposable.Dispose\"/> on \n        /// the <see cref=\"System.Diagnostics.Tracing.EventListener\"/> will block until all the entries are flushed or the interval elapses.\n        /// If <see langword=\"null\"/> is specified, then the call will block indefinitely until the flush operation finishes.</param>\n        /// <param name=\"maxBufferSize\">The maximum number of entries that can be buffered while it's sending to SQL Database before the sink starts dropping entries.\n        /// This means that if the timeout period elapses, some event entries will be dropped and not sent to the store. Normally, calling <see cref=\"IDisposable.Dispose\" /> on\n        /// the <see cref=\"System.Diagnostics.Tracing.EventListener\" /> will block until all the entries are flushed or the interval elapses.\n        /// If <see langword=\"null\" /> is specified, then the call will block indefinitely until the flush operation finishes.</param>\n        /// <returns>A subscription to the sink that can be disposed to unsubscribe the sink and dispose it, or to get access to the sink instance.</returns>\n        public static SinkSubscription<SqlDatabaseSink> LogToSqlDatabase(this IObservable<EventEntry> eventStream, string instanceName, string connectionString, string tableName = DefaultTableName, string storedProcedureName = DefaultStoredProcedureName, TimeSpan? bufferingInterval = null, int bufferingCount = Buffering.DefaultBufferingCount, TimeSpan? onCompletedTimeout = null, int maxBufferSize = Buffering.DefaultMaxBufferSize)\n        {\n            var sink = new SqlDatabaseSink(\n                instanceName,\n                connectionString,\n                tableName,\n                storedProcedureName,\n                bufferingInterval ?? Buffering.DefaultBufferingInterval,\n                bufferingCount,\n                maxBufferSize,\n                onCompletedTimeout ?? Timeout.InfiniteTimeSpan);\n\n            var subscription = eventStream.Subscribe(sink);\n\n            return new SinkSubscription<SqlDatabaseSink>(subscription, sink);\n        }\n\n        /// <summary>\n        /// Subscribes to the listener using a <see cref=\"SqlDatabaseSink\" />.\n        /// </summary>\n        /// <param name=\"instanceName\">The name of the instance originating the entries.</param>\n        /// <param name=\"connectionString\">The connection string.</param>\n        /// <param name=\"tableName\">The name of the table.</param>\n        /// <param name=\"storedProcedureName\">The name of the stored procedure that writes to table></param>\n        /// <param name=\"bufferingInterval\">The buffering interval between each batch publishing.</param>\n        /// <param name=\"bufferingCount\">The number of entries that will trigger a batch publishing.</param>\n        /// <param name=\"listenerDisposeTimeout\">Defines a timeout interval for the flush operation when the listener is disposed.\n        /// This means that if the timeout period elapses, some event entries will be dropped and not sent to the store. Calling <see cref=\"IDisposable.Dispose\"/> on \n        /// the <see cref=\"EventListener\"/> will block until all the entries are flushed or the interval elapses.\n        /// If <see langword=\"null\"/> is specified, then the call will block indefinitely until the flush operation finishes.</param>\n        /// <param name=\"maxBufferSize\">The maximum number of entries that can be buffered while it's sending to SQL Database before the sink starts dropping entries.\n        /// This means that if the timeout period elapses, some event entries will be dropped and not sent to the store. Normally, calling <see cref=\"IDisposable.Dispose\" /> on\n        /// the <see cref=\"System.Diagnostics.Tracing.EventListener\" /> will block until all the entries are flushed or the interval elapses.\n        /// If <see langword=\"null\" /> is specified, then the call will block indefinitely until the flush operation finishes.</param>\n        /// <returns>An event listener that uses <see cref=\"SqlDatabaseSink\"/> to log events.</returns>\n        public static EventListener CreateListener(string instanceName, string connectionString, string tableName = DefaultTableName, string storedProcedureName = DefaultStoredProcedureName, TimeSpan? bufferingInterval = null, int bufferingCount = Buffering.DefaultBufferingCount, TimeSpan? listenerDisposeTimeout = null, int maxBufferSize = Buffering.DefaultMaxBufferSize)\n        {\n            var listener = new ObservableEventListener();\n            listener.LogToSqlDatabase(instanceName, connectionString, tableName, storedProcedureName, bufferingInterval, bufferingCount, listenerDisposeTimeout, maxBufferSize);\n            return listener;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Database/Utility/DbConnectionExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Data.Common;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Transactions;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Database.Utility\n{\n    internal static class DbConnectionExtensions\n    {\n        public static async Task SuppressTransactionOpenAsync(this DbConnection connection, CancellationToken token)\n        {\n            Task openTask;\n            using (new TransactionScope(TransactionScopeOption.Suppress))\n            {\n                // Opt-out of using ambient transactions while opening the connection.\n                // Disposing the transaction scope needs to happen in the same thread where it was created,\n                // and that is why the await is done after the using finishes.\n                openTask = connection.OpenAsync(token);\n            }\n\n            await openTask.ConfigureAwait(false);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Database/Utility/EventEntryExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Data;\nusing System.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing Microsoft.SqlServer.Server;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Database.Utility\n{\n    /// <summary>\n    /// Extensions for <see cref=\"EventEntry\"/>.\n    /// </summary>\n    internal static class EventEntryExtensions\n    {\n        internal static readonly SqlMetaData[] SqlMetaData;\n        internal static readonly string[] Fields;\n\n        static EventEntryExtensions()\n        {\n            SqlMetaData = new[]\n            {\n                new SqlMetaData(\"InstanceName\", SqlDbType.NVarChar, 1000),\n                new SqlMetaData(\"ProviderId\", SqlDbType.UniqueIdentifier),\n                new SqlMetaData(\"ProviderName\", SqlDbType.NVarChar, 500),\n                new SqlMetaData(\"EventId\", SqlDbType.Int),\n                new SqlMetaData(\"EventKeywords\", SqlDbType.BigInt),\n                new SqlMetaData(\"Level\", SqlDbType.Int),\n                new SqlMetaData(\"Opcode\", SqlDbType.Int),\n                new SqlMetaData(\"Task\", SqlDbType.Int),\n                new SqlMetaData(\"Timestamp\", SqlDbType.DateTimeOffset),\n                new SqlMetaData(\"Version\", SqlDbType.Int),\n                new SqlMetaData(\"FormattedMessage\", SqlDbType.NVarChar, 4000),\n                new SqlMetaData(\"Payload\", SqlDbType.NVarChar, 4000),\n                new SqlMetaData(\"ActivityId\", SqlDbType.UniqueIdentifier),\n                new SqlMetaData(\"RelatedActivityId\", SqlDbType.UniqueIdentifier),\n                new SqlMetaData(\"ProcessId\", SqlDbType.Int),\n                new SqlMetaData(\"ThreadId\", SqlDbType.Int)\n            };\n\n            Fields = SqlMetaData.Select(x => x.Name).ToArray();\n        }\n\n        internal static SqlDataRecord ToSqlDataRecord(this EventEntry record, string instanceName)\n        {\n            var sqlDataRecord = new SqlDataRecord(SqlMetaData);\n\n            sqlDataRecord.SetValue(0, instanceName ?? string.Empty);\n            sqlDataRecord.SetValue(1, record.ProviderId);\n            sqlDataRecord.SetValue(2, record.Schema.ProviderName ?? string.Empty);\n            sqlDataRecord.SetValue(3, record.EventId);\n            sqlDataRecord.SetValue(4, (long)record.Schema.Keywords);\n            sqlDataRecord.SetValue(5, (int)record.Schema.Level);\n            sqlDataRecord.SetValue(6, (int)record.Schema.Opcode);\n            sqlDataRecord.SetValue(7, (int)record.Schema.Task);\n            sqlDataRecord.SetValue(8, record.Timestamp);\n            sqlDataRecord.SetValue(9, record.Schema.Version);\n            sqlDataRecord.SetValue(10, (object)record.FormattedMessage ?? DBNull.Value);\n            sqlDataRecord.SetValue(11, (object)EventEntryUtil.JsonSerializePayload(record) ?? DBNull.Value);\n            sqlDataRecord.SetValue(12, record.ActivityId);\n            sqlDataRecord.SetValue(13, record.RelatedActivityId);\n            sqlDataRecord.SetValue(14, record.ProcessId);\n            sqlDataRecord.SetValue(15, record.ThreadId);\n\n            return sqlDataRecord;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Database/Utility/EventRecordDataReader.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Data;\nusing Microsoft.SqlServer.Server;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Database.Utility\n{\n    internal sealed class EventEntryDataReader : IDataReader, IConvertible\n    {\n        private readonly string instanceName;\n        private IEnumerator<EventEntry> enumerator;\n        private int recordsAffected;\n        private SqlDataRecord currentRecord;\n\n        public EventEntryDataReader(IEnumerable<EventEntry> collection, string instanceName)\n        {\n            this.enumerator = collection.GetEnumerator();\n            this.instanceName = instanceName;\n        }\n\n        #region IDataReader\n\n        public int Depth\n        {\n            get\n            {\n                throw new NotImplementedException();\n            }\n        }\n\n        public bool IsClosed\n        {\n            get\n            {\n                return this.enumerator == null;\n            }\n        }\n\n        public int RecordsAffected\n        {\n            get\n            {\n                return this.recordsAffected;\n            }\n        }\n\n        public int FieldCount\n        {\n            get\n            {\n                return EventEntryExtensions.Fields.Length;\n            }\n        }\n\n        public object this[string name]\n        {\n            get\n            {\n                throw new NotImplementedException();\n            }\n        }\n\n        public object this[int i]\n        {\n            get\n            {\n                throw new NotImplementedException();\n            }\n        }\n\n        public void Close()\n        {\n            this.Dispose();\n            this.enumerator = null;\n        }\n\n        public DataTable GetSchemaTable()\n        {\n            throw new NotImplementedException();\n        }\n\n        public bool NextResult()\n        {\n            return this.Read();\n        }\n\n        public bool Read()\n        {\n            bool result = this.enumerator.MoveNext();\n            if (result)\n            {\n                this.recordsAffected++;\n                this.currentRecord = this.enumerator.Current.ToSqlDataRecord(this.instanceName);\n            }\n\n            return result;\n        }\n\n        public void Dispose()\n        {\n            this.enumerator.Dispose();\n        }\n\n        public bool GetBoolean(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        public byte GetByte(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        public long GetBytes(int i, long fieldOffset, byte[] buffer, int bufferoffset, int length)\n        {\n            throw new NotImplementedException();\n        }\n\n        public char GetChar(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        public long GetChars(int i, long fieldoffset, char[] buffer, int bufferoffset, int length)\n        {\n            throw new NotImplementedException();\n        }\n\n        public IDataReader GetData(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        public string GetDataTypeName(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        public DateTime GetDateTime(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        public decimal GetDecimal(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        public double GetDouble(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        public Type GetFieldType(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        public float GetFloat(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        public Guid GetGuid(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        public short GetInt16(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        public int GetInt32(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        public long GetInt64(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        public string GetName(int i)\n        {\n            return EventEntryExtensions.Fields[i];\n        }\n\n        public int GetOrdinal(string name)\n        {\n            return Array.IndexOf<string>(EventEntryExtensions.Fields, name);\n        }\n\n        public string GetString(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        public object GetValue(int i)\n        {\n            return this.currentRecord.GetValue(i);\n        }\n\n        public int GetValues(object[] values)\n        {\n            throw new NotImplementedException();\n        }\n\n        public bool IsDBNull(int i)\n        {\n            throw new NotImplementedException();\n        }\n\n        #endregion\n\n        #region IConvertible\n\n        public TypeCode GetTypeCode()\n        {\n            throw new NotImplementedException();\n        }\n\n        public bool ToBoolean(IFormatProvider provider)\n        {\n            throw new NotImplementedException();\n        }\n\n        public byte ToByte(IFormatProvider provider)\n        {\n            throw new NotImplementedException();\n        }\n\n        public char ToChar(IFormatProvider provider)\n        {\n            throw new NotImplementedException();\n        }\n\n        public DateTime ToDateTime(IFormatProvider provider)\n        {\n            throw new NotImplementedException();\n        }\n\n        public decimal ToDecimal(IFormatProvider provider)\n        {\n            throw new NotImplementedException();\n        }\n\n        public double ToDouble(IFormatProvider provider)\n        {\n            throw new NotImplementedException();\n        }\n\n        public short ToInt16(IFormatProvider provider)\n        {\n            throw new NotImplementedException();\n        }\n\n        public int ToInt32(IFormatProvider provider)\n        {\n            throw new NotImplementedException();\n        }\n\n        public long ToInt64(IFormatProvider provider)\n        {\n            throw new NotImplementedException();\n        }\n\n        public sbyte ToSByte(IFormatProvider provider)\n        {\n            throw new NotImplementedException();\n        }\n\n        public float ToSingle(IFormatProvider provider)\n        {\n            throw new NotImplementedException();\n        }\n\n        public string ToString(IFormatProvider provider)\n        {\n            throw new NotImplementedException();\n        }\n\n        public object ToType(Type conversionType, IFormatProvider provider)\n        {\n            var list = new List<SqlDataRecord>();\n\n            while (this.enumerator.MoveNext())\n            {\n                list.Add(this.enumerator.Current.ToSqlDataRecord(this.instanceName));\n            }\n\n            this.enumerator.Reset();\n\n            return list;\n        }\n\n        public ushort ToUInt16(IFormatProvider provider)\n        {\n            throw new NotImplementedException();\n        }\n\n        public uint ToUInt32(IFormatProvider provider)\n        {\n            throw new NotImplementedException();\n        }\n\n        public ulong ToUInt64(IFormatProvider provider)\n        {\n            throw new NotImplementedException();\n        }\n\n        #endregion\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Database/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"EnterpriseLibrary.TransientFaultHandling\" version=\"6.0.1304.0\" targetFramework=\"net45\" />\n  <package id=\"EnterpriseLibrary.TransientFaultHandling.Data\" version=\"6.0.1304.1\" targetFramework=\"net45\" />\n  <package id=\"StyleCop.MSBuild\" version=\"4.7.49.0\" targetFramework=\"net45\" developmentDependency=\"true\" />\n</packages>"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/ConfigurationElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Collections.Generic;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    internal class ConfigurationElement\n    {\n        internal TraceEventServiceElement TraceEventService { get; set; }\n\n        internal IEnumerable<SinkConfigurationElement> SinkConfigurationElements { get; set; }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/ConfigurationException.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.Globalization;\nusing System.Linq;\nusing System.Runtime.Serialization;\nusing System.Security;\nusing System.Text;\nusing System.Xml.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    /// <summary>\n    /// Represents one or more errors that occur during loading the <see cref=\"TraceEventService\"/> configuration file.\n    /// </summary>\n    [Serializable]\n    public class ConfigurationException : Exception, ISerializable\n    {\n        private ReadOnlyCollection<Exception> innerExceptions;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"ConfigurationException\" /> class with a default message.\n        /// </summary>\n        public ConfigurationException()\n            : this(Properties.Resources.TraceEventServiceConfigurationExceptionDefaultMessage)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"ConfigurationException\" /> class.\n        /// </summary>\n        /// <param name=\"message\">The message.</param>\n        public ConfigurationException(string message)\n            : this(message, new Exception[0])\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"ConfigurationException\" /> class.\n        /// </summary>\n        /// <param name=\"innerExceptions\">The inner exceptions.</param>\n        public ConfigurationException(params Exception[] innerExceptions)\n            : this(Properties.Resources.TraceEventServiceConfigurationExceptionDefaultMessage, innerExceptions)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"ConfigurationException\" /> class \n        /// with references to the inner exceptions that are the cause of this exception.\n        /// </summary>\n        /// <param name=\"innerExceptions\">The inner exceptions that are the cause of this exception.</param>\n        public ConfigurationException(IEnumerable<Exception> innerExceptions)\n            : this(Properties.Resources.TraceEventServiceConfigurationExceptionDefaultMessage, innerExceptions)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"ConfigurationException\" /> class.\n        /// </summary>\n        /// <param name=\"message\">The message.</param>\n        /// <param name=\"innerException\">The inner exception.</param>\n        public ConfigurationException(string message, Exception innerException)\n            : this(message, new Exception[] { innerException ?? new Exception(message) })\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"ConfigurationException\" /> class \n        /// with a message descriptions and the references to the inner exceptions that are the cause of this exception.\n        /// </summary>\n        /// <param name=\"message\">The exception message.</param>\n        /// <param name=\"innerExceptions\">The references to the inner exceptions that are the cause of this exception.</param>\n        public ConfigurationException(string message, IEnumerable<Exception> innerExceptions)\n            : base(message, ExtractInnerException(innerExceptions))\n        {\n            var exceptions = new List<Exception>(innerExceptions);\n            exceptions.ForEach(e => Guard.ArgumentNotNull(e, \"innerException\"));\n\n            this.innerExceptions = new ReadOnlyCollection<Exception>(exceptions);\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"ConfigurationException\" /> class with serialized data.\n        /// </summary>\n        /// <param name=\"info\">The <see cref=\"SerializationInfo\"/> info.</param>\n        /// <param name=\"context\">The <see cref=\"StreamingContext\"/>.</param>\n        /// <exception cref=\"System.Runtime.Serialization.SerializationException\">Deserialization failure.</exception>\n        [SecurityCritical]\n        protected ConfigurationException(SerializationInfo info, StreamingContext context)\n            : base(info, context)\n        {\n            Guard.ArgumentNotNull(info, \"info\");\n\n            Exception[] list = info.GetValue(\"InnerExceptions\", typeof(Exception[])) as Exception[];\n\n            if (list == null)\n            {\n                throw new SerializationException(\"InnerExceptions\");\n            }\n\n            this.innerExceptions = new ReadOnlyCollection<Exception>(list);\n        }\n\n        /// <summary>\n        /// Gets a read-only collection of the Exception instances that caused the current configuration exception.\n        /// </summary>\n        /// <value>\n        /// The inner exceptions.\n        /// </value>\n        public ReadOnlyCollection<Exception> InnerExceptions\n        {\n            get { return this.innerExceptions; }\n        }\n\n        /// <summary>\n        /// Gets or sets the configuration file that generated this exception.\n        /// </summary>\n        /// <value>\n        /// The configuration file.\n        /// </value>\n        public string ConfigurationFile { get; set; }\n\n        /// <summary>\n        /// When overridden in a derived class, sets the <see cref=\"T:System.Runtime.Serialization.SerializationInfo\" /> with information about the exception.\n        /// </summary>\n        /// <param name=\"info\">The <see cref=\"T:System.Runtime.Serialization.SerializationInfo\" /> that holds the serialized object data about the exception being thrown.</param>\n        /// <param name=\"context\">The <see cref=\"T:System.Runtime.Serialization.StreamingContext\" /> that contains contextual information about the source or destination.</param>\n        /// <PermissionSet>\n        /// <IPermission class=\"System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" version=\"1\" Read=\"*AllFiles*\" PathDiscovery=\"*AllFiles*\" />\n        /// <IPermission class=\"System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" version=\"1\" Flags=\"SerializationFormatter\" />\n        /// </PermissionSet>\n        [SecurityCritical]\n        public override void GetObjectData(SerializationInfo info, StreamingContext context)\n        {\n            Guard.ArgumentNotNull(info, \"info\");\n\n            base.GetObjectData(info, context);\n            Exception[] array = new Exception[this.innerExceptions.Count];\n            this.innerExceptions.CopyTo(array, 0);\n\n            info.AddValue(\"InnerExceptions\", array, typeof(Exception[]));\n        }\n\n        /// <summary>\n        /// Creates and returns a string representation of the current <see cref=\"ConfigurationException\" />. (Overrides <see cref=\"Exception.ToString()\" />.).\n        /// </summary>\n        /// <returns>\n        /// A <see cref=\"System.String\" /> that represents this instance.\n        /// </returns>\n        public override string ToString()\n        {\n            StringBuilder sb = new StringBuilder();\n            sb.AppendLine(this.Message);\n\n            if (!string.IsNullOrEmpty(this.ConfigurationFile))\n            {\n                sb.AppendFormat(Properties.Resources.TraceEventServiceConfigurationFileFormat, this.ConfigurationFile);\n                sb.AppendLine();\n            }\n\n            for (int i = 0; i < this.innerExceptions.Count; i++)\n            {\n                ToStringDeep(this.innerExceptions[i], sb);\n            }\n\n            return sb.ToString();\n        }\n\n        private static void ToStringDeep(Exception exception, StringBuilder sb)\n        {\n            var ae = exception as AggregateException;\n            if (ae != null)\n            {\n                ae.Flatten().Handle(e => TraverseChilds(e, sb));\n                return;\n            }\n\n            TraverseChilds(exception, sb);\n        }\n\n        private static bool TraverseChilds(Exception exception, StringBuilder sb)\n        {\n            for (Exception e = exception; e != null; e = e.InnerException)\n            {\n                sb.AppendLine(ExtendedMessage(e));\n            }\n\n            return true;\n        }\n\n        private static string ExtendedMessage(Exception e)\n        {\n            XmlSchemaValidationException xsdValidation = e as XmlSchemaValidationException;\n\n            if (xsdValidation != null)\n            {\n                return string.Format(CultureInfo.CurrentCulture,\n                                     Properties.Resources.XmlSchemaValidationExceptionFormat,\n                                     RemoveNamespace(xsdValidation.Message),\n                                     Environment.NewLine,\n                                     xsdValidation.LineNumber,\n                                     xsdValidation.LinePosition);\n            }\n\n            return e.Message;\n        }\n\n        private static Exception ExtractInnerException(IEnumerable<Exception> innerExceptions)\n        {\n            Guard.ArgumentNotNull(innerExceptions, \"innerExceptions\");\n\n            return innerExceptions.FirstOrDefault();\n        }\n\n        private static string RemoveNamespace(string message)\n        {\n            return message.Replace(string.Format(CultureInfo.CurrentCulture, Properties.Resources.RemoveNamespaceFromErrrMessage, Constants.Namespace), string.Empty);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/ConfigurationReader.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\nusing System.Xml;\nusing System.Xml.Linq;\nusing System.Xml.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Utility;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    internal class ConfigurationReader\n    {\n        private const string SchemaFileName = \"SemanticLogging-svc.xsd\";\n        private static readonly XNamespace NamespaceName = Constants.Namespace;\n        private readonly ExtensionsLoader loader;\n        private readonly XName traceEventServiceName = NamespaceName + \"traceEventService\";\n        private readonly XName sinksName = NamespaceName + \"sinks\";\n        private readonly XName sourcesName = NamespaceName + \"sources\";\n        private readonly XName eventSourceName = NamespaceName + \"eventSource\";\n\n        internal ConfigurationReader(string file)\n        {\n            var fileInfo = FileUtil.ProcessFileNameForLogging(file);\n            this.File = fileInfo.FullName;\n            this.loader = ExtensionsLoader.GetOrCreateInstance(fileInfo.DirectoryName);\n            FormatterElementFactory.FormatterElements = this.loader.FormatterElements;\n        }\n\n        internal string File { get; private set; }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Justification = \"Exceptions aggregated\")]\n        internal ConfigurationElement Read()\n        {\n            XmlSchemaSet schemas = new XmlSchemaSet();\n\n            // load buit-in schema from resource\n            schemas.Add(GetSchemaFromResource());\n\n            if (this.loader.SchemaFileNames.Any())\n            {\n                AddExtensionSchemas(schemas, this.loader);\n            }\n\n            var readerSettings = new XmlReaderSettings()\n            {\n                Schemas = schemas,\n                CloseInput = true,\n                XmlResolver = new SchemaConfigurationXmlResolver(),\n                ValidationType = ValidationType.Schema,\n                ValidationFlags = XmlSchemaValidationFlags.ProcessIdentityConstraints |\n                                  XmlSchemaValidationFlags.ReportValidationWarnings |\n                                  XmlSchemaValidationFlags.ProcessSchemaLocation |\n                                  XmlSchemaValidationFlags.ProcessInlineSchema\n            };\n\n            var validationExceptions = new List<Exception>();\n            readerSettings.ValidationEventHandler += (s, a) =>\n                {\n                    //// Filter out any missing schema warnings for custom elements and its child sub elements\n                    if (a.Severity == XmlSeverityType.Warning)\n                    {\n                        var reader = (XmlReader)s;\n                        if (!schemas.Contains(reader.NamespaceURI) || reader.NamespaceURI == Constants.Namespace)\n                        {\n                            return;\n                        }\n                    }\n\n                    //// Collect all schema validation errors\n                    validationExceptions.Add(a.Exception);\n                };\n\n            XDocument doc = null;\n            using (var reader = XmlReader.Create(this.File, readerSettings))\n            {\n                try\n                {\n                    doc = XDocument.Load(reader, LoadOptions.SetLineInfo);\n                }\n                catch (Exception e)\n                {\n                    validationExceptions.Add(e);\n                }\n            }\n\n            if (validationExceptions.Count > 0)\n            {\n                throw new ConfigurationException(validationExceptions) { ConfigurationFile = this.File };\n            }\n\n            var configuration = new ConfigurationElement();\n\n            var tes = doc.Root.Element(this.traceEventServiceName);\n            configuration.TraceEventService = (tes == null) ? new TraceEventServiceElement() : TraceEventServiceElement.Read(tes);\n\n            var sinks = doc.Root.Elements(this.sinksName).Elements();\n            if (sinks != null)\n            {\n                configuration.SinkConfigurationElements = this.LoadSinkConfigurationElements(sinks);\n            }\n\n            return configuration;\n        }\n\n        private static void AddExtensionSchemas(XmlSchemaSet schemas, ExtensionsLoader loader)\n        {\n            if (schemas == null)\n            {\n                schemas = new XmlSchemaSet();\n            }\n\n            var validationExceptions = new List<Exception>();\n\n            foreach (var xsdFile in loader.SchemaFileNames)\n            {\n                using (var reader = XmlReader.Create(xsdFile, new XmlReaderSettings() { CloseInput = true }))\n                {\n                    var schema = XmlSchema.Read(reader, (s, a) => validationExceptions.Add(a.Exception));\n                    if (schema.TargetNamespace != Constants.Namespace)\n                    {\n                        schemas.Add(schema);\n                    }\n                }\n            }\n\n            if (validationExceptions.Count > 0)\n            {\n                throw new ConfigurationException(validationExceptions);\n            }\n        }\n\n        private static XmlSchema GetSchemaFromResource()\n        {\n            var thisAssembly = Assembly.GetExecutingAssembly();\n            var baseNs = typeof(ConfigurationReader).Namespace;\n            using (var reader = XmlReader.Create(thisAssembly.GetManifestResourceStream(baseNs + \".\" + SchemaFileName), new XmlReaderSettings() { CloseInput = true }))\n            {\n                return XmlSchema.Read(reader, (s, a) => { throw new ConfigurationException(a.Exception); });\n            }\n        }\n\n        private static Exception ElementInfoException(XElement element)\n        {\n            string lineInfo = null;\n            var info = element as IXmlLineInfo;\n            if (info != null && info.HasLineInfo())\n            {\n                lineInfo = string.Format(CultureInfo.CurrentCulture, Properties.Resources.LineInfoMessage, Environment.NewLine, info.LineNumber, info.LinePosition);\n            }\n\n            return new Exception(string.Format(CultureInfo.CurrentCulture, Properties.Resources.ElementInfoErrorMessage, Environment.NewLine, element, lineInfo));\n        }\n\n        private IEnumerable<SinkConfigurationElement> LoadSinkConfigurationElements(IEnumerable<XElement> sinks)\n        {\n            var sinkConfigurationElements = new List<SinkConfigurationElement>();\n\n            foreach (var @sink in sinks)\n            {\n                var instance = this.loader.SinkElements.FirstOrDefault(s => s.Value.CanCreateSink(@sink));\n                if (instance == null)\n                {\n                    throw new ConfigurationException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.SinkElementNotResolvedError, @sink.Name.LocalName));\n                }\n\n                sinkConfigurationElements.Add(new SinkConfigurationElement()\n                {\n                    Name = (string)@sink.Attribute(\"name\"),\n                    SinkPromise = new Lazy<IObserver<EventEntry>>(() =>\n                    {\n                        try\n                        {\n                            return instance.Value.CreateSink(@sink);\n                        }\n                        catch (Exception e)\n                        {\n                            throw new ConfigurationException(e, ElementInfoException(@sink));\n                        }\n                    }),\n                    EventSources = this.ReadEventSources(@sink),\n                    SinkConfiguration = this.CreateSinkConfiguration(@sink)\n                });\n            }\n\n            return sinkConfigurationElements;\n        }\n\n        private string CreateSinkConfiguration(XElement sink)\n        {\n            var clone = new XElement(sink);\n\n            // Remove EventSources elements\n            clone.Elements(this.sourcesName).Remove();\n\n            return clone.DeepNormalization().ToString(SaveOptions.DisableFormatting);\n        }\n\n        private IEnumerable<EventSourceElement> ReadEventSources(XElement element)\n        {\n            List<EventSourceElement> sources = new List<EventSourceElement>();\n            foreach (var eventSource in element.Elements(this.sourcesName).Elements(this.eventSourceName))\n            {\n                sources.Add(EventSourceElement.Read(eventSource));\n            }\n\n            if (sources.Count == 0)\n            {\n                throw new ConfigurationException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.NoEventSourcesError, element.Name.LocalName));\n            }\n\n            return sources;\n        }\n\n        private class SchemaConfigurationXmlResolver : XmlUrlResolver\n        {\n            private readonly byte[] emptySchema;\n\n            public SchemaConfigurationXmlResolver()\n            {\n                this.emptySchema = Encoding.UTF8.GetBytes(\"<schema xmlns=\\\"\" + XmlSchema.Namespace + \"\\\"/>\");\n            }\n\n            [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Validated with Guard class\")]\n            public override object GetEntity(Uri absoluteUri, string role, Type objectToReturn)\n            {\n                Guard.ArgumentNotNull(absoluteUri, \"absoluteUri\");\n\n                // If we are loading the built-in schema from schemaLocation, \n                // bail out with an empty schema to avoid duplicate validation errors since we already loaded the built-in schema\n                if (absoluteUri.IsFile && Path.GetFileName(absoluteUri.AbsolutePath).Equals(ConfigurationReader.SchemaFileName, StringComparison.OrdinalIgnoreCase))\n                {\n                    return new MemoryStream(this.emptySchema);\n                }\n\n                return base.GetEntity(absoluteUri, role, objectToReturn);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/EventSourceArgumentElement.cs",
    "content": "// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics;\nusing System.Xml.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    /// <summary>\n    /// Represents an argument to enable a provider.\n    /// </summary>\n    [DebuggerDisplay(\"{Key}-{Value}\")]\n    internal class EventSourceArgumentElement\n    {\n        private const string KeyAttributeKey = \"key\";\n        private const string ValueAttributeKey = \"value\";\n\n        internal static EventSourceArgumentElement Read(XElement element)\n        {\n            var instance =\n                new EventSourceArgumentElement\n                {\n                    Key = (string)element.Attribute(KeyAttributeKey),\n                    Value = (string)element.Attribute(ValueAttributeKey),\n                };\n\n            return instance;\n        }\n\n        /// <summary>\n        /// Gets or sets the key.\n        /// </summary>\n        /// <value>\n        /// The key.\n        /// </value>\n        public string Key { get; set; }\n\n        /// <summary>\n        /// Gets or sets the value.\n        /// </summary>\n        /// <value>\n        /// The value.\n        /// </value>\n        public string Value { get; set; }\n    }\n}"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/EventSourceElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Globalization;\nusing System.Linq;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    /// <summary>\n    /// Represents the configuration class for an event source element.\n    /// </summary>\n    internal class EventSourceElement\n    {\n        private const string NameAttributeKey = \"name\";\n        private const string EventIdAttributeKey = \"id\";\n        private const string LevelAttributeKey = \"level\";\n        private const string MatchAnyKeywordAttributeKey = \"matchAnyKeyword\";\n        private static readonly XName ArgumentsElementName = XName.Get(\"arguments\", Constants.Namespace);\n        private static readonly XName FilterElementName = XName.Get(\"filter\", Constants.Namespace);\n\n        /// <summary>\n        /// Gets or sets the name of the event source.\n        /// </summary>\n        /// <value>\n        /// The name identifier.\n        /// </value>\n        public string Name { get; set; }\n\n        /// <summary>\n        /// Gets or sets the event id of the event source.\n        /// </summary>\n        /// <value>\n        /// The event id.\n        /// </value>\n        public Guid EventId { get; set; }\n\n        /// <summary>\n        /// Gets or sets the <see cref=\"EventLevel\" /> to enable events.\n        /// </summary>\n        /// <value>\n        /// The event level.\n        /// </value>\n        public EventLevel Level { get; set; }\n\n        /// <summary>\n        /// Gets or sets the keyword flags necessary to enable the events.\n        /// </summary>\n        /// <value>\n        /// The <see cref=\"EventKeywords\"/>.\n        /// </value>\n        public EventKeywords MatchAnyKeyword { get; set; }\n\n        /// <summary>\n        /// Gets the arguments to supply when enabling the events.\n        /// </summary>\n        /// <value>\n        /// The arguments.\n        /// </value>\n        public IEnumerable<EventSourceArgumentElement> Arguments { get; private set; }\n\n        /// <summary>\n        /// Gets the process name filters to enable the events.\n        /// </summary>\n        /// <value>\n        /// The process name filters.\n        /// </value>\n        public IEnumerable<EventSourceProcessFilterElement> ProcessNameFilters { get; private set; }\n\n        internal static EventSourceElement Read(XElement element)\n        {\n            var instance = new EventSourceElement\n            {\n                Name = (string)element.Attribute(NameAttributeKey),\n                EventId = (Guid?)element.Attribute(EventIdAttributeKey) ?? Guid.Empty,\n                Level = (EventLevel)Enum.Parse(typeof(EventLevel), (string)element.Attribute(LevelAttributeKey) ?? default(EventLevel).ToString()),\n                MatchAnyKeyword = (EventKeywords)long.Parse((string)element.Attribute(MatchAnyKeywordAttributeKey) ?? ((long)default(EventKeywords)).ToString(CultureInfo.InvariantCulture), CultureInfo.InvariantCulture),\n                Arguments = element.Elements(ArgumentsElementName).Elements().Select(e => EventSourceArgumentElement.Read(e)).ToArray(),\n                ProcessNameFilters = element.Elements(FilterElementName).Elements().Select(e => EventSourceProcessFilterElement.Read(e)).ToArray()\n            };\n\n            return instance;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/EventSourceProcessFilterElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics;\nusing System.Xml.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    /// <summary>\n    /// Represents a process name to filter.\n    /// </summary>\n    [DebuggerDisplay(\"Process {Name}\")]\n    internal class EventSourceProcessFilterElement\n    {\n        private const string NameAttributeKey = \"name\";\n\n        internal static EventSourceProcessFilterElement Read(XElement element)\n        {\n            var instance =\n                new EventSourceProcessFilterElement\n                {\n                    Name = (string)element.Attribute(NameAttributeKey),\n                };\n\n            return instance;\n        }\n\n        /// <summary>\n        /// Gets or sets the process name.\n        /// </summary>\n        /// <value>\n        /// The process name.\n        /// </value>\n        public string Name { get; set; }\n    }\n}"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/EventSourceSettings.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing Microsoft.Diagnostics.Tracing.Session;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    /// <summary>\n    /// Represents the event source configuration settings.\n    /// </summary>\n    public class EventSourceSettings\n    {\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventSourceSettings\" /> class.\n        /// </summary>\n        /// <param name=\"name\">The friendly event source name.</param>\n        /// <param name=\"eventSourceId\">The event source id.</param>\n        /// <param name=\"level\">The level.</param>\n        /// <param name=\"matchAnyKeyword\">The match any keyword.</param>\n        /// <param name=\"arguments\">The arguments for the event source.</param>\n        /// <param name=\"processNameFilters\">The the process filters.</param>\n        /// <exception cref=\"ConfigurationException\">A validation exception.</exception>\n        public EventSourceSettings(\n            string name = null,\n            Guid? eventSourceId = null,\n            EventLevel level = EventLevel.LogAlways,\n            EventKeywords matchAnyKeyword = Keywords.All,\n            IEnumerable<KeyValuePair<string, string>> arguments = null,\n            IEnumerable<string> processNameFilters = null)\n        {\n            // If no Id, Name should not be optional so we may derive an Id from it.\n            if (!eventSourceId.HasValue || eventSourceId == Guid.Empty)\n            {\n                if (string.IsNullOrWhiteSpace(name))\n                {\n                    throw new ConfigurationException(Properties.Resources.MissingEventSourceNameAndId);\n                }\n\n                eventSourceId = TraceEventProviders.GetEventSourceGuidFromName(name);\n            }\n            else if (!string.IsNullOrWhiteSpace(name))\n            {\n                // throw and both name & Id specified\n                throw new ConfigurationException(Properties.Resources.EventSourceAmbiguityError);\n            }\n\n            this.EventSourceId = eventSourceId.Value;\n            this.Name = name ?? eventSourceId.ToString(); // Set a not null value for later use\n            this.Level = level;\n            this.MatchAnyKeyword = matchAnyKeyword;\n            this.Arguments = arguments ?? Enumerable.Empty<KeyValuePair<string, string>>();\n            this.ProcessNamesToFilter = processNameFilters ?? Enumerable.Empty<string>();\n        }\n\n        /// <summary>\n        /// Gets or sets the event source ID to monitor traced events.\n        /// </summary>\n        /// <value>\n        /// The name identifier.\n        /// </value>\n        public string Name { get; set; }\n\n        /// <summary>\n        /// Gets the event source ID to monitor traced events.\n        /// </summary>\n        /// <value>\n        /// The event source id.\n        /// </value>\n        public Guid EventSourceId { get; internal set; }\n\n        /// <summary>\n        /// Gets or sets the <see cref=\"EventLevel\" />.\n        /// </summary>\n        /// <value>\n        /// The event level.\n        /// </value>\n        public EventLevel Level { get; set; }\n\n        /// <summary>\n        /// Gets or sets the keyword flags necessary to enable the events.\n        /// </summary>\n        /// <value>\n        /// The <see cref=\"EventKeywords\"/>.\n        /// </value>\n        public EventKeywords MatchAnyKeyword { get; set; }\n\n        /// <summary>\n        /// Gets the arguments to use when enabling the ETW provider.\n        /// </summary>\n        /// <value>\n        /// The arguments.\n        /// </value>\n        public IEnumerable<KeyValuePair<string, string>> Arguments { get; private set; }\n\n        /// <summary>\n        /// Gets the process names to filter when enabling the ETW provider.\n        /// </summary>\n        /// <value>\n        /// The process names to filter.\n        /// </value>\n        public IEnumerable<string> ProcessNamesToFilter { get; private set; }\n\n        internal void CopyValuesFrom(EventSourceSettings settings)\n        {\n            this.Level = settings.Level;\n            this.MatchAnyKeyword = settings.MatchAnyKeyword;\n            this.Arguments = settings.Arguments;\n            this.ProcessNamesToFilter = settings.ProcessNamesToFilter;\n        }\n    }\n}"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/EventSourceSettingsEqualityComparer.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Collections.Generic;\nusing System.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    internal class EventSourceSettingsEqualityComparer : IEqualityComparer<EventSourceSettings>\n    {\n        private readonly bool nameOnly;\n\n        public EventSourceSettingsEqualityComparer(bool nameOnly = false)\n        {\n            this.nameOnly = nameOnly;\n        }\n\n        public bool Equals(EventSourceSettings x, EventSourceSettings y)\n        {\n            if (x == null || y == null)\n            {\n                return false;\n            }\n\n            return x.Name == y.Name\n                && (this.nameOnly\n                    || (x.Level == y.Level\n                        && x.MatchAnyKeyword == y.MatchAnyKeyword\n                        && x.Arguments.SequenceEqual(y.Arguments)\n                        && x.ProcessNamesToFilter.SequenceEqual(y.ProcessNamesToFilter)));\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Validated with Guard class\")]\n        public int GetHashCode(EventSourceSettings obj)\n        {\n            Guard.ArgumentNotNull(obj, \"obj\");\n\n            if (this.nameOnly)\n            {\n                return obj.Name.GetHashCode();\n            }\n\n            return obj.Name.GetHashCode() ^ (int)obj.Level ^ unchecked((int)obj.MatchAnyKeyword);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/ExtensionsInspector.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    /// <summary>\n    /// Inspect extensions without loading assemblies into the current domain.\n    /// </summary>\n    [Serializable]\n    internal class ExtensionsInspector : MarshalByRefObject\n    {\n        internal IEnumerable<string> ExtensionFiles { get; private set; }\n\n        internal static ExtensionsInspector CreateInstance(IEnumerable<string> filesToInspect)\n        {\n            var inspectorDomain = AppDomain.CreateDomain(\"ExtensionsInspector\", AppDomain.CurrentDomain.Evidence, AppDomain.CurrentDomain.SetupInformation);\n            try\n            {\n                var instance = (ExtensionsInspector)inspectorDomain.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, typeof(ExtensionsInspector).FullName);\n\n                instance.ProbeExtensions(filesToInspect.ToArray()); // ToArray(): avoid Linq serialization marshalling for cross AppDoamins \n\n                return new ExtensionsInspector() { ExtensionFiles = new List<string>(instance.ExtensionFiles) };\n            }\n            finally\n            {\n                AppDomain.Unload(inspectorDomain);\n            }\n        }\n\n        internal static Assembly LoadAssembly(string path)\n        {\n            try\n            {\n                return Assembly.LoadFrom(path);\n            }\n            catch (BadImageFormatException)\n            {\n                return null; // not a managed dll\n            }\n        }\n\n        internal void ProbeExtensions(string[] files)\n        {\n            var approvedFiles = new HashSet<string>();\n\n            foreach (var file in files)\n            {\n                Assembly asm = LoadAssembly(file);\n                if (asm != null && !asm.IsDynamic && !asm.IsFrameworkAssembly())\n                {\n                    foreach (Type type in asm.GetTypes())\n                    {\n                        if (typeof(ISinkElement).IsAssignableFrom(type) ||\n                            typeof(IFormatterElement).IsAssignableFrom(type))\n                        {\n                            approvedFiles.Add(type.Assembly.Location);\n                            break;\n                        }\n                    }\n                }\n            }\n\n            this.ExtensionFiles = approvedFiles;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/ExtensionsLoader.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Reflection;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Utility;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    /// <summary>\n    /// Loads all the configuration extension elements.\n    /// </summary>\n    internal sealed class ExtensionsLoader\n    {\n        private static readonly Dictionary<string, ExtensionsLoader> Instances = new Dictionary<string, ExtensionsLoader>();\n        private IEnumerable<string> schemaFileNames;\n        private IEnumerable<Lazy<ISinkElement>> sinkElements;\n        private IEnumerable<Lazy<IFormatterElement>> formatterElements;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"ExtensionsLoader\" /> class.\n        /// </summary>\n        internal ExtensionsLoader()\n            : this(AppDomain.CurrentDomain.BaseDirectory)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"ExtensionsLoader\" /> class.\n        /// </summary>\n        /// <param name=\"probingPath\">The probing path.</param>\n        internal ExtensionsLoader(string probingPath)\n        {\n            Guard.ArgumentNotNullOrEmpty(probingPath, \"probingPath\");\n            this.Initialize(probingPath);\n        }\n\n        /// <summary>\n        /// Gets the event listener elements that derives from base class <see cref=\"SinkElement\"/>.\n        /// </summary>\n        internal IEnumerable<Lazy<ISinkElement>> SinkElements\n        {\n            get { return this.sinkElements; }\n        }\n\n        /// <summary>\n        /// Gets the event text formatter elements that derives from type <see cref=\"FormatterElement\"/>.\n        /// </summary>\n        internal IEnumerable<Lazy<IFormatterElement>> FormatterElements\n        {\n            get { return this.formatterElements; }\n        }\n\n        /// <summary>\n        /// Gets the schema file names.\n        /// </summary>\n        internal IEnumerable<string> SchemaFileNames\n        {\n            get { return this.schemaFileNames; }\n        }\n\n        internal static ExtensionsLoader GetOrCreateInstance(string probingPath)\n        {\n            ExtensionsLoader loader;\n            if (!Instances.TryGetValue(probingPath, out loader))\n            {\n                loader = new ExtensionsLoader(probingPath);\n                Instances.Add(probingPath, loader);\n            }\n\n            return loader;\n        }\n\n        private static void ExtractTypes(Assembly assembly, ISet<Lazy<ISinkElement>> sinks, ISet<Lazy<IFormatterElement>> formatters)\n        {\n            if (assembly.IsFrameworkAssembly())\n            {\n                return;\n            }\n\n            foreach (Type type in assembly.GetTypes().Where(t => !t.IsAbstract))\n            {\n                if (typeof(ISinkElement).IsAssignableFrom(type))\n                {\n                    sinks.Add(new Lazy<ISinkElement>(() => (ISinkElement)Activator.CreateInstance(type)));\n                }\n                else if (typeof(IFormatterElement).IsAssignableFrom(type))\n                {\n                    formatters.Add(new Lazy<IFormatterElement>(() => (IFormatterElement)Activator.CreateInstance(type)));\n                }\n            }\n        }\n\n        private void Initialize(string probingPath)\n        {\n            var sinks = new HashSet<Lazy<ISinkElement>>();\n            var formatters = new HashSet<Lazy<IFormatterElement>>();\n            var currentAssemblies = AppDomain.CurrentDomain.GetAssemblies().Where(a => !a.IsDynamic);\n\n            // Load custom extensions in current domain\n            foreach (Assembly assembly in currentAssemblies)\n            {\n                ExtractTypes(assembly, sinks, formatters);\n            }\n\n            // inspect all dlls which are not already loaded in the current domain.\n            var filesToInspect = Directory.EnumerateFiles(probingPath, \"*.dll\", SearchOption.TopDirectoryOnly).\n                                           Except(currentAssemblies.Select(a => a.Location), StringComparer.OrdinalIgnoreCase);\n\n            // This will load external dll extensions in a separate domain so they can be unloaded\n            var inspector = ExtensionsInspector.CreateInstance(filesToInspect);\n\n            // Load extension in external domains\n            foreach (var assembly in inspector.ExtensionFiles.Select(f => Assembly.LoadFrom(f)))\n            {\n                ExtractTypes(assembly, sinks, formatters);\n            }\n\n            this.sinkElements = sinks;\n            this.formatterElements = formatters;\n            this.schemaFileNames = Directory.EnumerateFiles(probingPath, \"*.xsd\", SearchOption.AllDirectories);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/SinkConfigurationElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Xml.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    internal class SinkConfigurationElement\n    {\n        internal string Name { get; set; }\n\n        internal Lazy<IObserver<EventEntry>> SinkPromise { get; set; }\n\n        internal IEnumerable<EventSourceElement> EventSources { get; set; }\n\n        internal string SinkConfiguration { get; set; }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/SinkSettings.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    /// <summary>\n    /// Configuration settings for a Sink.\n    /// </summary>\n    public class SinkSettings\n    {\n        private IObserver<EventEntry> sink;\n        private Lazy<IObserver<EventEntry>> sinkPromise;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"SinkSettings\" /> class.\n        /// </summary>\n        /// <param name=\"name\">The event listener name.</param>\n        /// <param name=\"sink\">The sink instance.</param>\n        /// <param name=\"eventSources\">The event sources.</param>\n        /// <exception cref=\"ConfigurationException\">Validation exceptions.</exception>\n        public SinkSettings(string name, IObserver<EventEntry> sink, IEnumerable<EventSourceSettings> eventSources)\n            : this(name, eventSources)\n        {\n            Guard.ArgumentNotNull(sink, \"sink\");\n\n            this.Sink = sink;\n        }\n\n        internal SinkSettings(string name, Lazy<IObserver<EventEntry>> sinkPromise, IEnumerable<EventSourceSettings> eventSources)\n            : this(name, eventSources)\n        {\n            Guard.ArgumentNotNull(sinkPromise, \"sinkPromise\");\n\n            this.sinkPromise = sinkPromise;\n        }\n\n        private SinkSettings(string name, IEnumerable<EventSourceSettings> eventSources)\n        {\n            Guard.ArgumentNotNullOrEmpty(name, \"name\");\n            Guard.ArgumentLowerOrEqualThan<int>(200, name.Length, \"name.Length\");\n            Guard.ArgumentNotNull(eventSources, \"eventSources\");\n\n            // Do not allow an empty source list \n            if (eventSources.Count() == 0)\n            {\n                throw new ConfigurationException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.NoEventSourcesError, name));\n            }\n\n            // Validate duplicate sources by name\n            var duplicateByName = eventSources.GroupBy(l => l.Name).FirstOrDefault(g => g.Count() > 1);\n            if (duplicateByName != null)\n            {\n                throw new ConfigurationException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.DuplicateEventSourceNameError, duplicateByName.First().Name, name));\n            }\n\n            // Validate duplicate sources by id\n            var duplicateById = eventSources.GroupBy(l => l.EventSourceId).FirstOrDefault(g => g.Count() > 1);\n            if (duplicateById != null)\n            {\n                throw new ConfigurationException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.DuplicateEventSourceIdError, duplicateById.First().Name, name));\n            }\n\n            this.Name = name;\n            this.EventSources = eventSources;\n        }\n\n        /// <summary>\n        /// Gets or sets the sink.\n        /// </summary>\n        /// <value>\n        /// The event listener.\n        /// </value>\n        public IObserver<EventEntry> Sink\n        {\n            get { return this.sink ?? this.sinkPromise.Value; }\n            set { this.sink = value; }\n        }\n\n        /// <summary>\n        /// Gets or sets the name of the event listener.\n        /// </summary>\n        /// <value>\n        /// The name identifier.\n        /// </value>\n        public string Name { get; set; }\n\n        /// <summary>\n        /// Gets or sets the event sources.\n        /// </summary>\n        /// <value>\n        /// The event sources.\n        /// </value>\n        public IEnumerable<EventSourceSettings> EventSources { get; set; }\n\n        internal string SinkConfiguration { get; set; }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/SinkSettingsEqualityComparer.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Collections.Generic;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    internal class SinkSettingsEqualityComparer : IEqualityComparer<SinkSettings>\n    {\n        public bool Equals(SinkSettings x, SinkSettings y)\n        {\n            if (x == null || y == null)\n            {\n                return false;\n            }\n\n            return x.Name == y.Name;\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Validated with Guard class\")]\n        public int GetHashCode(SinkSettings obj)\n        {\n            Guard.ArgumentNotNull(obj, \"obj\");\n\n            return obj.Name.GetHashCode();\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/TraceEventServiceConfiguration.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.IO;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    /// <summary>\n    /// Configuration class that provides settings for a <see cref=\"TraceEventService\"/> instance.\n    /// </summary>\n    public sealed class TraceEventServiceConfiguration : IDisposable\n    {\n        private readonly TraceEventServiceSettings settings;\n        private readonly ObservableCollection<SinkSettings> sinkSettings;\n        private FileSystemWatcher watcher;\n        private bool watcherDisposed;\n        private bool disposed;\n        private string monitoredFile;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"TraceEventServiceConfiguration\" /> class.\n        /// </summary>\n        /// <param name=\"sinkSettings\">The sink settings.</param>\n        /// <param name=\"settings\">The settings.</param>\n        /// <exception cref=\"ConfigurationException\">The EventSources.</exception>\n        public TraceEventServiceConfiguration(IEnumerable<SinkSettings> sinkSettings = null, TraceEventServiceSettings settings = null)\n        {\n            this.sinkSettings = new ObservableCollection<SinkSettings>(sinkSettings ?? Enumerable.Empty<SinkSettings>());\n            this.settings = settings ?? new TraceEventServiceSettings();\n\n            // Validate duplicate sinks\n            if (this.sinkSettings.GroupBy(i => i.Name).Any(g => g.Count() > 1))\n            {\n                throw new ConfigurationException(Properties.Resources.DuplicateSinksError);\n            }\n        }\n\n        /// <summary>\n        /// Gets the settings.\n        /// </summary>\n        /// <value>\n        /// The settings.\n        /// </value>\n        public TraceEventServiceSettings Settings\n        {\n            get { return this.settings; }\n        }\n\n        /// <summary>\n        /// Gets the event sources.\n        /// </summary>\n        /// <value>\n        /// The event sources.\n        /// </value>\n        public ObservableCollection<SinkSettings> SinkSettings\n        {\n            get { return this.sinkSettings; }\n        }\n\n        /// <summary>\n        /// Loads the specified file name.\n        /// </summary>\n        /// <param name=\"fileName\">Name of the file.</param>\n        /// <param name=\"monitorChanges\">If set to <c>true</c> monitor file changes.</param>\n        /// <param name=\"createSinks\">If set to <c>true</c> [create sinks].</param>\n        /// <returns>\n        /// The loaded <see cref=\"TraceEventServiceConfiguration\" /> instance.\n        /// </returns>\n        /// <exception cref=\"ConfigurationException\">All the validation errors detected when opening the file.</exception>\n        public static TraceEventServiceConfiguration Load(string fileName, bool monitorChanges = false, bool createSinks = true)\n        {\n            var configReader = new ConfigurationReader(fileName);\n            ConfigurationElement configElement = configReader.Read();\n\n            var serviceSettings =\n                new TraceEventServiceSettings\n                {\n                    SessionNamePrefix = configElement.TraceEventService.SessionNamePrefix\n                };\n\n            var sinkSettings = new List<SinkSettings>();\n\n            foreach (var element in configElement.SinkConfigurationElements)\n            {\n                var eventSources =\n                    element.EventSources.Select(\n                        e =>\n                            new EventSourceSettings(\n                                e.Name,\n                                e.EventId,\n                                e.Level,\n                                e.MatchAnyKeyword,\n                                e.Arguments.Select(a => new KeyValuePair<string, string>(a.Key, a.Value)),\n                                e.ProcessNameFilters.Select(p => p.Name)));\n                var sink = createSinks ?\n                    new SinkSettings(element.Name, element.SinkPromise.Value, eventSources) :\n                    new SinkSettings(element.Name, element.SinkPromise, eventSources);\n                sink.SinkConfiguration = element.SinkConfiguration;\n                sinkSettings.Add(sink);\n            }\n\n            var configuration = new TraceEventServiceConfiguration(sinkSettings, serviceSettings);\n\n            if (monitorChanges)\n            {\n                configuration.StartConfigurationWatcher(configReader.File);\n            }\n\n            return configuration;\n        }\n\n        /// <summary>\n        /// Dispose listener instances.\n        /// </summary>\n        public void Dispose()\n        {\n            if (!this.disposed)\n            {\n                this.CloseAllListeners();\n                if (this.watcher != null)\n                {\n                    this.watcher.Dispose();\n                    this.watcher = null;\n                }\n\n                this.disposed = true;\n            }\n        }\n\n        internal void StartConfigurationWatcher(string file = null)\n        {\n            this.monitoredFile = file ?? this.monitoredFile;\n\n            this.watcher = \n                new FileSystemWatcher\n                {\n                    Path = Path.GetDirectoryName(this.monitoredFile),\n                    Filter = Path.GetFileName(this.monitoredFile),\n                    NotifyFilter = NotifyFilters.LastWrite\n                };\n\n            this.watcher.Changed += this.OnFileChanged;\n            this.watcher.Error += this.OnFileError;\n            this.watcher.Disposed += (s, e) => this.watcherDisposed = true;\n            this.watcherDisposed = false;\n            this.watcher.EnableRaisingEvents = true;\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Justification = \"Exceptions are stored and logged\")]\n        private void CloseAllListeners()\n        {\n            var exceptions = new ConcurrentQueue<Exception>();\n\n            Parallel.ForEach(this.sinkSettings, s =>\n            {\n                try\n                {\n                    s.Sink.OnCompleted();\n                }\n                catch (Exception e)\n                {\n                    exceptions.Enqueue(e);\n                }\n            });\n\n            if (exceptions.Count > 0)\n            {\n                SemanticLoggingEventSource.Log.TraceEventServiceConfigurationShutdownFault(new ConfigurationException(exceptions).ToString());\n            }\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Justification = \"Exception is logged\")]\n        private void OnFileChanged(object sender, FileSystemEventArgs e)\n        {\n            try\n            {\n                //// turn off events to avoid duplicates\n                this.watcher.EnableRaisingEvents = false;\n\n                //// Wait to reduce the chance for any transient IO error condition (file locks, etc) \n                Thread.Sleep(500);\n\n                ////Reload updated file and compare configurations\n                var updatedConfig = TraceEventServiceConfiguration.Load(e.FullPath, monitorChanges: false, createSinks: false);\n\n                if (!updatedConfig.Settings.Equals(this.Settings))\n                {\n                    this.Settings.SessionNamePrefix = updatedConfig.Settings.SessionNamePrefix;\n                    //// Shortcut for recycling service\n                    return;\n                }\n\n                var sinkComparer = new SinkSettingsEqualityComparer();\n                var eventSourceComparer = new EventSourceSettingsEqualityComparer();\n\n                // removed sinks\n                foreach (var removedSink in this.sinkSettings.Except(updatedConfig.SinkSettings, sinkComparer).ToArray())\n                {\n                    this.sinkSettings.Remove(removedSink);\n                }\n\n                // updated sinks\n                foreach (var currentSink in this.sinkSettings.Intersect(updatedConfig.SinkSettings, sinkComparer).ToArray())\n                {\n                    var updatedSink = updatedConfig.SinkSettings.Single(s => s.Name == currentSink.Name);\n                    if (updatedSink.SinkConfiguration != currentSink.SinkConfiguration)\n                    {\n                        // the sink definition was updated so remove/add \n                        this.sinkSettings.Remove(currentSink);\n                        this.sinkSettings.Add(updatedSink);\n                    }\n                    else if (!updatedSink.EventSources.SequenceEqual(currentSink.EventSources, eventSourceComparer))\n                    {\n                        currentSink.EventSources = updatedSink.EventSources;\n                        this.sinkSettings[this.sinkSettings.IndexOf(currentSink)] = currentSink;\n                    }\n                }\n\n                // new sinks\n                foreach (var newSink in updatedConfig.sinkSettings.Except(this.SinkSettings, sinkComparer).ToArray())\n                {\n                    this.sinkSettings.Add(newSink);\n                }\n            }\n            catch (Exception exception)\n            {\n                this.OnFileError(sender, new ErrorEventArgs(exception));\n            }\n            finally\n            {\n                if (!this.disposed)\n                {\n                    if (this.watcherDisposed)\n                    {\n                        //// Regenerate watcher instance because it was disposed and we are still running.\n                        this.StartConfigurationWatcher();\n                    }\n                    else\n                    {\n                        this.watcher.EnableRaisingEvents = true;\n                    }\n                }\n            }\n        }\n\n        private void OnFileError(object sender, ErrorEventArgs e)\n        {\n            // log error to slab source\n            SemanticLoggingEventSource.Log.TraceEventServiceConfigurationFileLoadFault(e.GetException().ToString());\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/TraceEventServiceElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    internal class TraceEventServiceElement\n    {\n        internal TraceEventServiceElement()\n        {\n            this.SessionNamePrefix = Constants.DefaultSessionNamePrefix;\n        }\n\n        internal string SessionNamePrefix { get; set; }\n\n        internal static TraceEventServiceElement Read(XElement element)\n        {\n            var instance = new TraceEventServiceElement();\n\n            var snpAttr = (string)element.Attribute(\"sessionNamePrefix\");\n            if (!string.IsNullOrWhiteSpace(snpAttr))\n            {\n                instance.SessionNamePrefix = snpAttr;\n            }\n\n            return instance;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Configuration/TraceEventServiceSettings.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.ComponentModel;\nusing System.Globalization;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Properties;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration\n{\n    /// <summary>\n    /// Configuration settings for an instance of <see cref=\"TraceEventService\"/> class.\n    /// </summary>\n    public class TraceEventServiceSettings : INotifyPropertyChanged\n    {\n        private const int MaxSessionNamePrefix = 200;\n        private string sessionNamePrefix;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"TraceEventServiceSettings\" /> class.\n        /// </summary>\n        public TraceEventServiceSettings()\n        {\n            this.sessionNamePrefix = Constants.DefaultSessionNamePrefix;\n        }\n\n        /// <summary>\n        /// Occurs when a property value changes.\n        /// </summary>\n        public event PropertyChangedEventHandler PropertyChanged;\n\n        /// <summary>\n        /// Gets or sets the name of the trace event session prefix.\n        /// </summary>\n        /// <value>\n        /// The name of the session prefix.\n        /// </value>\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Validated with Guard class\")]\n        public string SessionNamePrefix\n        {\n            get\n            {\n                return this.sessionNamePrefix;\n            }\n\n            set\n            {\n                if (this.sessionNamePrefix != value)\n                {\n                    Guard.ArgumentNotNullOrEmpty(value, \"value\");\n                    if (value.Length > MaxSessionNamePrefix)\n                    {\n                        throw new ArgumentOutOfRangeException(\"value\", string.Format(CultureInfo.InvariantCulture, Resources.ExceptionSessionPrefixNameTooLong, MaxSessionNamePrefix));\n                    }\n\n                    this.sessionNamePrefix = value;\n                    this.NotifyPropertyChanged(\"SessionNamePrefix\");\n                }\n            }\n        }\n\n        /// <summary>\n        /// Determines whether the specified <see cref=\"TraceEventServiceSettings\" /> is equal to the current <see cref=\"TraceEventServiceSettings\" />.\n        /// </summary>\n        /// <param name=\"obj\">The instance to compare with the current instance.</param>\n        /// <returns>\n        /// True if the specified instance is equal to the current instance; otherwise, false.\n        /// </returns>\n        public override bool Equals(object obj)\n        {\n            // Check for null values and compare run-time types.\n            if (obj == null || GetType() != obj.GetType())\n            {\n                return false;\n            }\n\n            TraceEventServiceSettings s = (TraceEventServiceSettings)obj;\n\n            return this.SessionNamePrefix == s.SessionNamePrefix;\n        }\n\n        /// <summary>\n        /// Returns a hash code for this instance.\n        /// </summary>\n        /// <returns>\n        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. \n        /// </returns>\n        public override int GetHashCode()\n        {\n            return this.SessionNamePrefix.GetHashCode();\n        }\n\n        private void NotifyPropertyChanged(string propertyName)\n        {\n            if (this.PropertyChanged != null)\n            {\n                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/GlobalSuppressions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\n// This file is used by Code Analysis to maintain SuppressMessage \n// attributes that are applied to this project.\n// Project-level suppressions either have no target or are given \n// a specific target and scoped to a namespace, type, member, etc.\n//\n// To add a suppression to this file, right-click the message in the \n// Code Analysis results, point to \"Suppress Message\", and click \n// \"In Suppression File\".\n// You do not need to add suppressions to this file manually.\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1020:AvoidNamespacesWithFewTypes\", Scope = \"namespace\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw\", \n    Justification = \"Even a few classes in a namespace (Utility) will provide a better structure for ordering types.\")]\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/ILMergeExcludes.txt",
    "content": "﻿Dia2Lib.I*\nDia2Lib.SymTagEnum"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Properties/AssemblyInfo.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Reflection;\nusing System.Resources;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Security;\n\n[assembly: AssemblyTitle(\"Enterprise Library Semantic ETW Logging Application Block\")]\n[assembly: AssemblyDescription(\"Enterprise Library Semantic ETW Logging Application Block\")]\n\n////[assembly: AllowPartiallyTrustedCallers]\n\n[assembly: AssemblyVersion(\"2.0.0.0\")]\n[assembly: AssemblyFileVersion(\"2.0.1406.1\")]\n[assembly: AssemblyInformationalVersion(\"2.0.1406.1\")]\n\n[assembly: ComVisible(false)]\n[assembly: NeutralResourcesLanguage(\"en-US\")]\n\n#if SIGN\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n#else\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\")]\n#endif"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Properties/Resources.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\n// <auto-generated>\n//     This code was generated by a tool.\n//     Runtime Version:4.0.30319.34209\n//\n//     Changes to this file may cause incorrect behavior and will be lost if\n//     the code is regenerated.\n// </auto-generated>\n//------------------------------------------------------------------------------\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Properties {\n    using System;\n    \n    \n    /// <summary>\n    ///   A strongly-typed resource class, for looking up localized strings, etc.\n    /// </summary>\n    // This class was auto-generated by the StronglyTypedResourceBuilder\n    // class via a tool like ResGen or Visual Studio.\n    // To add or remove a member, edit your .ResX file then rerun ResGen\n    // with the /str option, or rebuild your VS project.\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Resources.Tools.StronglyTypedResourceBuilder\", \"4.0.0.0\")]\n    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\n    internal class Resources {\n        \n        private static global::System.Resources.ResourceManager resourceMan;\n        \n        private static global::System.Globalization.CultureInfo resourceCulture;\n        \n        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"Microsoft.Performance\", \"CA1811:AvoidUncalledPrivateCode\")]\n        internal Resources() {\n        }\n        \n        /// <summary>\n        ///   Returns the cached ResourceManager instance used by this class.\n        /// </summary>\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\n        internal static global::System.Resources.ResourceManager ResourceManager {\n            get {\n                if (object.ReferenceEquals(resourceMan, null)) {\n                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Properties.Resources\", typeof(Resources).Assembly);\n                    resourceMan = temp;\n                }\n                return resourceMan;\n            }\n        }\n        \n        /// <summary>\n        ///   Overrides the current thread's CurrentUICulture property for all\n        ///   resource lookups using this strongly typed resource class.\n        /// </summary>\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\n        internal static global::System.Globalization.CultureInfo Culture {\n            get {\n                return resourceCulture;\n            }\n            set {\n                resourceCulture = value;\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The event source id &apos;{0}&apos; is duplicated in the sink &apos;{1}&apos;..\n        /// </summary>\n        internal static string DuplicateEventSourceIdError {\n            get {\n                return ResourceManager.GetString(\"DuplicateEventSourceIdError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The event source name &apos;{0}&apos; is duplicated in the sink &apos;{1}&apos;..\n        /// </summary>\n        internal static string DuplicateEventSourceNameError {\n            get {\n                return ResourceManager.GetString(\"DuplicateEventSourceNameError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Duplicate sinks..\n        /// </summary>\n        internal static string DuplicateSinksError {\n            get {\n                return ResourceManager.GetString(\"DuplicateSinksError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Configuration element:{0}{1}.{2}.\n        /// </summary>\n        internal static string ElementInfoErrorMessage {\n            get {\n                return ResourceManager.GetString(\"ElementInfoErrorMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to There is an ambiguity when both name and id are specified. Specify only one value..\n        /// </summary>\n        internal static string EventSourceAmbiguityError {\n            get {\n                return ResourceManager.GetString(\"EventSourceAmbiguityError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The maximum length for a session name prefix is {0}..\n        /// </summary>\n        internal static string ExceptionSessionPrefixNameTooLong {\n            get {\n                return ResourceManager.GetString(\"ExceptionSessionPrefixNameTooLong\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Only users with administrative privileges, users in the Performance Log Users group, and services running as LocalSystem, LocalService, NetworkService can control event tracing sessions. To grant a restricted user the ability to control trace sessions, add them to the Performance Log Users group..\n        /// </summary>\n        internal static string InsufficientPrivileges {\n            get {\n                return ResourceManager.GetString(\"InsufficientPrivileges\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The value does not represent a connection string.\n        /// </summary>\n        internal static string InvalidConnectionStringError {\n            get {\n                return ResourceManager.GetString(\"InvalidConnectionStringError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to  {0}Line: &apos;{1}&apos;, Position: &apos;{2}&apos;..\n        /// </summary>\n        internal static string LineInfoMessage {\n            get {\n                return ResourceManager.GetString(\"LineInfoMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The &apos;ElementName&apos; value in XmlRootAttribute of type &apos;{0}&apos; is misssing, null or empty..\n        /// </summary>\n        internal static string MissingElementNameInXmlRootAttributeError {\n            get {\n                return ResourceManager.GetString(\"MissingElementNameInXmlRootAttributeError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The EventSource &apos;name&apos; and &apos;id&apos; values are missing. Please provide either name or id..\n        /// </summary>\n        internal static string MissingEventSourceNameAndId {\n            get {\n                return ResourceManager.GetString(\"MissingEventSourceNameAndId\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The &apos;Namespace&apos; value in XmlRootAttribute of type &apos;{0}&apos; is missing, null or empty..\n        /// </summary>\n        internal static string MissingNamespaceInXmlRootAttributeError {\n            get {\n                return ResourceManager.GetString(\"MissingNamespaceInXmlRootAttributeError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to XmlRootAttribute missing in type &apos;{0}&apos; with name and namespace values..\n        /// </summary>\n        internal static string MissingXmlRootAttributeError {\n            get {\n                return ResourceManager.GetString(\"MissingXmlRootAttributeError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to No event listeners specified in configuration..\n        /// </summary>\n        internal static string NoEventListenersError {\n            get {\n                return ResourceManager.GetString(\"NoEventListenersError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to No event sources specified in configuration for this event listener: &apos;{0}&apos;..\n        /// </summary>\n        internal static string NoEventSourcesError {\n            get {\n                return ResourceManager.GetString(\"NoEventSourcesError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to  in namespace &apos;{0}&apos;.\n        /// </summary>\n        internal static string RemoveNamespaceFromErrrMessage {\n            get {\n                return ResourceManager.GetString(\"RemoveNamespaceFromErrrMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A sink was added from configuration changes..\n        /// </summary>\n        internal static string SinkAddedFromReconfiguration {\n            get {\n                return ResourceManager.GetString(\"SinkAddedFromReconfiguration\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The sink element definition with name &apos;{0}&apos; could not be resolved by an existing SinkElement implementation..\n        /// </summary>\n        internal static string SinkElementNotResolvedError {\n            get {\n                return ResourceManager.GetString(\"SinkElementNotResolvedError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A sink was removed from configuration changes..\n        /// </summary>\n        internal static string SinkRemovedFromReconfiguration {\n            get {\n                return ResourceManager.GetString(\"SinkRemovedFromReconfiguration\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to A sink was updated from configuration changes..\n        /// </summary>\n        internal static string SinkUpdatedFromReconfiguration {\n            get {\n                return ResourceManager.GetString(\"SinkUpdatedFromReconfiguration\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The execution time was longer than {0} milliseconds..\n        /// </summary>\n        internal static string TaskTimeoutError {\n            get {\n                return ResourceManager.GetString(\"TaskTimeoutError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to One or more errors occurred when loading the TraceEventService configuration file..\n        /// </summary>\n        internal static string TraceEventServiceConfigurationExceptionDefaultMessage {\n            get {\n                return ResourceManager.GetString(\"TraceEventServiceConfigurationExceptionDefaultMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Configuration file: {0}.\n        /// </summary>\n        internal static string TraceEventServiceConfigurationFileFormat {\n            get {\n                return ResourceManager.GetString(\"TraceEventServiceConfigurationFileFormat\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to {0}{1}Line number: {2}, Line position: {3}.\n        /// </summary>\n        internal static string XmlSchemaValidationExceptionFormat {\n            get {\n                return ResourceManager.GetString(\"XmlSchemaValidationExceptionFormat\", resourceCulture);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Properties/Resources.resx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The primary goals of this format is to allow a simple XML format \n    that is mostly human readable. The generation and parsing of the \n    various data types are done through the TypeConverter classes \n    associated with the data types.\n    \n    Example:\n    \n    ... ado.net/XML headers & schema ...\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\n    <resheader name=\"version\">2.0</resheader>\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\n    </data>\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\n        <comment>This is a comment</comment>\n    </data>\n                \n    There are any number of \"resheader\" rows that contain simple \n    name/value pairs.\n    \n    Each data row contains a name, and value. The row also contains a \n    type or mimetype. Type corresponds to a .NET class that support \n    text/value conversion through the TypeConverter architecture. \n    Classes that don't support this are serialized and stored with the \n    mimetype set.\n    \n    The mimetype is used for serialized objects, and tells the \n    ResXResourceReader how to depersist the object. This is currently not \n    extensible. For a given mimetype the value must be set accordingly:\n    \n    Note - application/x-microsoft.net.object.binary.base64 is the format \n    that the ResXResourceWriter will generate, however the reader can \n    read any of the formats listed below.\n    \n    mimetype: application/x-microsoft.net.object.binary.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\n            : and then encoded with base64 encoding.\n    \n    mimetype: application/x-microsoft.net.object.soap.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.bytearray.base64\n    value   : The object must be serialized into a byte array \n            : using a System.ComponentModel.TypeConverter\n            : and then encoded with base64 encoding.\n    -->\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\n      <xsd:complexType>\n        <xsd:choice maxOccurs=\"unbounded\">\n          <xsd:element name=\"metadata\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"assembly\">\n            <xsd:complexType>\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"data\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"resheader\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\n            </xsd:complexType>\n          </xsd:element>\n        </xsd:choice>\n      </xsd:complexType>\n    </xsd:element>\n  </xsd:schema>\n  <resheader name=\"resmimetype\">\n    <value>text/microsoft-resx</value>\n  </resheader>\n  <resheader name=\"version\">\n    <value>2.0</value>\n  </resheader>\n  <resheader name=\"reader\">\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <resheader name=\"writer\">\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <data name=\"DuplicateEventSourceIdError\" xml:space=\"preserve\">\n    <value>The event source id '{0}' is duplicated in the sink '{1}'.</value>\n  </data>\n  <data name=\"DuplicateEventSourceNameError\" xml:space=\"preserve\">\n    <value>The event source name '{0}' is duplicated in the sink '{1}'.</value>\n  </data>\n  <data name=\"DuplicateSinksError\" xml:space=\"preserve\">\n    <value>Duplicate sinks.</value>\n  </data>\n  <data name=\"ElementInfoErrorMessage\" xml:space=\"preserve\">\n    <value>Configuration element:{0}{1}.{2}</value>\n  </data>\n  <data name=\"EventSourceAmbiguityError\" xml:space=\"preserve\">\n    <value>There is an ambiguity when both name and id are specified. Specify only one value.</value>\n  </data>\n  <data name=\"ExceptionSessionPrefixNameTooLong\" xml:space=\"preserve\">\n    <value>The maximum length for a session name prefix is {0}.</value>\n  </data>\n  <data name=\"InsufficientPrivileges\" xml:space=\"preserve\">\n    <value>Only users with administrative privileges, users in the Performance Log Users group, and services running as LocalSystem, LocalService, NetworkService can control event tracing sessions. To grant a restricted user the ability to control trace sessions, add them to the Performance Log Users group.</value>\n  </data>\n  <data name=\"InvalidConnectionStringError\" xml:space=\"preserve\">\n    <value>The value does not represent a connection string</value>\n  </data>\n  <data name=\"LineInfoMessage\" xml:space=\"preserve\">\n    <value> {0}Line: '{1}', Position: '{2}'.</value>\n  </data>\n  <data name=\"MissingElementNameInXmlRootAttributeError\" xml:space=\"preserve\">\n    <value>The 'ElementName' value in XmlRootAttribute of type '{0}' is misssing, null or empty.</value>\n  </data>\n  <data name=\"MissingEventSourceNameAndId\" xml:space=\"preserve\">\n    <value>The EventSource 'name' and 'id' values are missing. Please provide either name or id.</value>\n  </data>\n  <data name=\"MissingNamespaceInXmlRootAttributeError\" xml:space=\"preserve\">\n    <value>The 'Namespace' value in XmlRootAttribute of type '{0}' is missing, null or empty.</value>\n  </data>\n  <data name=\"MissingXmlRootAttributeError\" xml:space=\"preserve\">\n    <value>XmlRootAttribute missing in type '{0}' with name and namespace values.</value>\n  </data>\n  <data name=\"NoEventListenersError\" xml:space=\"preserve\">\n    <value>No event listeners specified in configuration.</value>\n  </data>\n  <data name=\"NoEventSourcesError\" xml:space=\"preserve\">\n    <value>No event sources specified in configuration for this event listener: '{0}'.</value>\n  </data>\n  <data name=\"RemoveNamespaceFromErrrMessage\" xml:space=\"preserve\">\n    <value> in namespace '{0}'</value>\n  </data>\n  <data name=\"SinkAddedFromReconfiguration\" xml:space=\"preserve\">\n    <value>A sink was added from configuration changes.</value>\n  </data>\n  <data name=\"SinkElementNotResolvedError\" xml:space=\"preserve\">\n    <value>The sink element definition with name '{0}' could not be resolved by an existing SinkElement implementation.</value>\n  </data>\n  <data name=\"SinkRemovedFromReconfiguration\" xml:space=\"preserve\">\n    <value>A sink was removed from configuration changes.</value>\n  </data>\n  <data name=\"SinkUpdatedFromReconfiguration\" xml:space=\"preserve\">\n    <value>A sink was updated from configuration changes.</value>\n  </data>\n  <data name=\"TaskTimeoutError\" xml:space=\"preserve\">\n    <value>The execution time was longer than {0} milliseconds.</value>\n  </data>\n  <data name=\"TraceEventServiceConfigurationExceptionDefaultMessage\" xml:space=\"preserve\">\n    <value>One or more errors occurred when loading the TraceEventService configuration file.</value>\n  </data>\n  <data name=\"TraceEventServiceConfigurationFileFormat\" xml:space=\"preserve\">\n    <value>Configuration file: {0}</value>\n  </data>\n  <data name=\"XmlSchemaValidationExceptionFormat\" xml:space=\"preserve\">\n    <value>{0}{1}Line number: {2}, Line position: {3}</value>\n  </data>\n</root>"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/SemanticLogging.Etw.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{8440AEA2-CD55-42A0-8724-2ECCE2B32374}</ProjectGuid>\n    <OutputType>Library</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw</RootNamespace>\n    <AssemblyName>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw</AssemblyName>\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n    <NuGetPackageImportStamp>78df293f</NuGetPackageImportStamp>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>..\\..\\..\\bin\\Debug\\</OutputPath>\n    <DefineConstants>TRACE;DEBUG</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>\n    <CodeAnalysisRuleSet>..\\..\\EnterpriseLibrary.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>..\\..\\..\\bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"Microsoft.Data.Edm, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Microsoft.Data.Edm.5.6.4\\lib\\net40\\Microsoft.Data.Edm.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"Microsoft.Data.OData, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Microsoft.Data.OData.5.6.4\\lib\\net40\\Microsoft.Data.OData.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"Microsoft.Data.Services.Client, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Microsoft.Data.Services.Client.5.6.4\\lib\\net40\\Microsoft.Data.Services.Client.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"Microsoft.Diagnostics.Tracing.TraceEvent, Version=1.0.15.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\..\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\lib\\net40\\Microsoft.Diagnostics.Tracing.TraceEvent.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Newtonsoft.Json.6.0.8\\lib\\net45\\Newtonsoft.Json.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Configuration\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Data.Services.Client\" />\n    <Reference Include=\"System.Spatial, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\System.Spatial.5.6.4\\lib\\net40\\System.Spatial.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"System.Transactions\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"..\\..\\GlobalAssemblyInfo.cs\">\n      <Link>GlobalAssemblyInfo.cs</Link>\n    </Compile>\n    <Compile Include=\"Configuration\\ConfigurationElement.cs\" />\n    <Compile Include=\"Configuration\\ConfigurationReader.cs\" />\n    <Compile Include=\"Configuration\\EventSourceArgumentElement.cs\" />\n    <Compile Include=\"Configuration\\EventSourceProcessFilterElement.cs\" />\n    <Compile Include=\"Configuration\\EventSourceSettingsEqualityComparer.cs\" />\n    <Compile Include=\"Configuration\\EventSourceElement.cs\" />\n    <Compile Include=\"Configuration\\SinkConfigurationElement.cs\" />\n    <Compile Include=\"Configuration\\SinkSettingsEqualityComparer.cs\" />\n    <Compile Include=\"Configuration\\TraceEventServiceElement.cs\" />\n    <Compile Include=\"GlobalSuppressions.cs\" />\n    <Compile Include=\"TraceEventSchemaCache.cs\" />\n    <Compile Include=\"TraceEventManifestsCache.cs\" />\n    <Compile Include=\"TraceEventServiceWorker.cs\" />\n    <Compile Include=\"Configuration\\SinkSettings.cs\" />\n    <Compile Include=\"Configuration\\ExtensionsInspector.cs\" />\n    <Compile Include=\"Configuration\\ExtensionsLoader.cs\" />\n    <Compile Include=\"Configuration\\ConfigurationException.cs\" />\n    <Compile Include=\"Configuration\\EventSourceSettings.cs\" />\n    <Compile Include=\"Utility\\AssemblyExtensions.cs\" />\n    <Compile Include=\"StatusChangedEventArgs.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n    <Compile Include=\"Properties\\Resources.Designer.cs\">\n      <AutoGen>True</AutoGen>\n      <DesignTime>True</DesignTime>\n      <DependentUpon>Resources.resx</DependentUpon>\n    </Compile>\n    <Compile Include=\"ServiceStatus.cs\" />\n    <Compile Include=\"TraceEventService.cs\" />\n    <Compile Include=\"Configuration\\TraceEventServiceConfiguration.cs\" />\n    <Compile Include=\"Configuration\\TraceEventServiceSettings.cs\" />\n    <Compile Include=\"Utility\\TraceEventUtil.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <EmbeddedResource Include=\"..\\SemanticLogging.Etw.WindowsService\\SemanticLogging-svc.xsd\">\n      <Link>Configuration\\SemanticLogging-svc.xsd</Link>\n      <SubType>Designer</SubType>\n    </EmbeddedResource>\n    <None Include=\"..\\..\\SemanticLogging.licenseheader\">\n      <Link>SemanticLogging.licenseheader</Link>\n    </None>\n    <None Include=\"packages.config\">\n      <SubType>Designer</SubType>\n    </None>\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\SemanticLogging\\SemanticLogging.csproj\">\n      <Project>{2cd4105b-0dd6-4c18-9b37-05d8e8f57303}</Project>\n      <Name>SemanticLogging</Name>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <EmbeddedResource Include=\"Properties\\Resources.resx\">\n      <Generator>ResXFileCodeGenerator</Generator>\n      <LastGenOutput>Resources.Designer.cs</LastGenOutput>\n      <SubType>Designer</SubType>\n    </EmbeddedResource>\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"ILMergeExcludes.txt\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </None>\n  </ItemGroup>\n  <PropertyGroup>\n    <DefineConstants Condition=\" '$(SignAssembly)' == 'true' \">$(DefineConstants);SIGN</DefineConstants>\n  </PropertyGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <Import Project=\"..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets\" Condition=\"Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets'))\" />\n    <Error Condition=\"!Exists('..\\..\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\..\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets'))\" />\n  </Target>\n  <Import Project=\"..\\..\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets\" Condition=\"Exists('..\\..\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets')\" />\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/ServiceStatus.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw\n{\n    /// <summary>\n    /// The status of this service instance. \n    /// </summary>\n    public enum ServiceStatus\n    {\n        /// <summary>\n        /// The service was not started yet.\n        /// </summary>\n        NotStarted,\n\n        /// <summary>\n        /// The service has started.\n        /// </summary>\n        Started,\n\n        /// <summary>\n        /// The service is stopping.\n        /// </summary>\n        Stopping,\n\n        /// <summary>\n        /// The service was stopped.\n        /// </summary>\n        Stopped,\n\n        /// <summary>\n        /// The service was disposed.\n        /// </summary>\n        Disposed,\n\n        /// <summary>\n        /// The service has faulted.\n        /// </summary>\n        Faulted,\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/StatusChangedEventArgs.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw\n{\n    /// <summary>\n    /// Provides data for <see cref=\"TraceEventService.StatusChanged\"/> event.\n    /// </summary>\n    public class StatusChangedEventArgs : EventArgs\n    {\n        internal StatusChangedEventArgs(ServiceStatus status)\n        {\n            this.Status = status;\n        }\n\n        /// <summary>\n        /// Gets the changed status.\n        /// </summary>\n        /// <value>\n        /// The status.\n        /// </value>\n        public ServiceStatus Status { get; private set; }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/TraceEventManifestsCache.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.IO;\nusing Microsoft.Diagnostics.Tracing.Parsers;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw\n{\n    internal class TraceEventManifestsCache\n    {\n        private const string ManifestExtension = \".manifest.xml\";\n        private const string ManifestSearchPattern = \"*\" + ManifestExtension;\n        private static readonly object LockObject = new object();\n        private static readonly string ManifestsPath = Path.Combine(Path.GetTempPath(), \"7D2611AE-6432-4639-8B91-3E46EB56CADF\");\n        private readonly DynamicTraceEventParser parser;\n\n        public TraceEventManifestsCache(DynamicTraceEventParser parser)\n        {\n            this.parser = parser;\n        }\n\n        public void Read()\n        {\n            lock (LockObject)\n            {\n                if (Directory.Exists(ManifestsPath))\n                {\n                    this.parser.ReadAllManifests(ManifestsPath);\n                }\n            }\n        }\n\n        public void Write()\n        {\n            lock (LockObject)\n            {\n                this.parser.WriteAllManifests(ManifestsPath);\n            }\n        }\n\n        public static void Clear()\n        {\n            lock (LockObject)\n            {\n                if (Directory.Exists(ManifestsPath))\n                {\n                    Directory.Delete(ManifestsPath, true);\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/TraceEventSchemaCache.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing Microsoft.Diagnostics.Tracing;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw\n{\n    /// <summary>\n    /// Used for caching <see cref=\"EventSchema\"/> by event provider.\n    /// </summary>\n    internal sealed class TraceEventSchemaCache\n    {\n        private readonly Dictionary<Guid, IDictionary<int, EventSchema>> schemas = new Dictionary<Guid, IDictionary<int, EventSchema>>();\n        private readonly EventSourceSchemaReader schemaReader = new EventSourceSchemaReader();\n\n        internal EventSchema GetSchema(TraceEvent traceEvent)\n        {\n            int eventId = (int)traceEvent.ID;\n            EventSchema schema;\n            IDictionary<int, EventSchema> providerSchemas;\n            if (!this.schemas.TryGetValue(traceEvent.ProviderGuid, out providerSchemas))\n            {\n                schema = CreateEventSchema(traceEvent);\n                providerSchemas = new Dictionary<int, EventSchema>() { { eventId, schema } };\n                this.schemas.Add(traceEvent.ProviderGuid, providerSchemas);\n                return schema;\n            }\n\n            if (!providerSchemas.TryGetValue(eventId, out schema))\n            {\n                schema = CreateEventSchema(traceEvent);\n                providerSchemas.Add(eventId, schema);\n                this.schemas[traceEvent.ProviderGuid] = providerSchemas;\n            }\n\n            return schema;\n        }\n\n        internal void UpdateSchemaFromManifest(Guid providerGuid, string manifest)\n        {\n            this.schemas[providerGuid] = this.schemaReader.GetSchema(manifest);\n        }\n\n        private static EventSchema CreateEventSchema(TraceEvent traceEvent)\n        {\n            return new EventSchema(\n                        (int)traceEvent.ID,\n                        traceEvent.ProviderGuid,\n                        traceEvent.ProviderName,\n                        (EventLevel)traceEvent.Level,\n                        (EventTask)traceEvent.Task,\n                        traceEvent.TaskName,\n                        (EventOpcode)traceEvent.Opcode,\n                        traceEvent.OpcodeName,\n                        (EventKeywords)traceEvent.Keywords,\n                        null,  // Keywords description not parsed by DynamicTraceEventParser\n                        traceEvent.Version,\n                        traceEvent.PayloadNames);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/TraceEventService.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialized;\nusing System.Linq;\nusing System.Security.Principal;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw\n{\n    /// <summary>\n    /// Class for listening ETW trace events sent by an implementation of <see cref=\"System.Diagnostics.Tracing.EventSource\"/> typed event.\n    /// </summary>\n    public sealed class TraceEventService : IDisposable\n    {\n        private readonly TraceEventServiceConfiguration configuration;\n        private readonly SemanticLoggingEventSource logger = SemanticLoggingEventSource.Log;\n        private ServiceStatus status;\n        private Dictionary<string, TraceEventServiceWorker> workers;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"TraceEventService\" /> class.\n        /// Note that the instance of <see cref=\"TraceEventServiceConfiguration\"/> passed will not be disposed by this class.\n        /// </summary>\n        /// <param name=\"configuration\">The <see cref=\"TraceEventServiceConfiguration\"/> configuration instance.</param>\n        /// <exception cref=\"ArgumentNullException\">Configuration.EventSources; Configuration.Settings.</exception>\n        /// <exception cref=\"ArgumentException\">No Event Sources specified; Duplicate provider ID.</exception>\n        /// <exception cref=\"UnauthorizedAccessException\">Insufficient privileges.</exception>\n        /// <exception cref=\"ConfigurationException\">Configuration validation errors.</exception>\n        /// <exception cref=\"System.ArgumentOutOfRangeException\">MaxDegreeOfParallelism, BoundedCapacity, EventListenerMaxExecutionTimeInMilliseconds.</exception>\n        public TraceEventService(TraceEventServiceConfiguration configuration)\n        {\n            Guard.ArgumentNotNull(configuration, \"configuration\");\n            ThrowOnUnAuthorizedAccess();\n\n            this.configuration = configuration;\n            this.Status = ServiceStatus.NotStarted;\n            this.configuration.SinkSettings.CollectionChanged += this.OnSinkSettingsChanged;\n        }\n\n        /// <summary>Event raised when the <see cref=\"Status\"/> changed.</summary>\n        public event EventHandler<StatusChangedEventArgs> StatusChanged;\n\n        /// <summary>\n        /// Gets the status of this instance.\n        /// </summary>\n        /// <value>\n        /// The service status.\n        /// </value>\n        public ServiceStatus Status\n        {\n            get\n            {\n                return this.status;\n            }\n\n            private set\n            {\n                this.status = value;\n                this.OnStatusChanged();\n            }\n        }\n\n        /// <summary>\n        /// Creates an event trace session and start listening ETW events.\n        /// </summary>\n        /// <exception cref=\"System.ObjectDisposedException\">The instance was disposed.</exception>\n        public void Start()\n        {\n            if (this.Status == ServiceStatus.Started)\n            {\n                return;\n            }\n\n            if (this.Status == ServiceStatus.Disposed)\n            {\n                throw new ObjectDisposedException(this.GetType().Name);\n            }\n\n            this.workers = new Dictionary<string, TraceEventServiceWorker>();\n\n            // Initialize all workers\n            if (!this.AddWorkers(this.configuration.SinkSettings, notifyChanges: false))\n            {\n                this.logger.TraceEventServiceConfigurationWithFaults();\n            }\n\n            this.Status = ServiceStatus.Started;\n        }\n\n        /// <summary>\n        /// Stops listening ETW events and removes the created event trace session.\n        /// Any pending buffered event will be lost and any resource used by the\n        /// configured event listeners will be released only after disposing this instance.\n        /// </summary>\n        /// <exception cref=\"System.ObjectDisposedException\">The service was disposed.</exception>\n        public void Stop()\n        {\n            if (this.Status != ServiceStatus.Started)\n            {\n                return;\n            }\n\n            if (this.Status == ServiceStatus.Disposed)\n            {\n                throw new ObjectDisposedException(this.GetType().Name);\n            }\n\n            this.Status = ServiceStatus.Stopping;\n\n            foreach (var w in this.workers.Values)\n            {\n                w.Dispose();\n            }\n\n            // Dispose all listener instances in configuration\n            this.configuration.Dispose();\n\n            this.Status = ServiceStatus.Stopped;\n        }\n\n        /// <summary>\n        /// Will dispose all resources owned by this class. \n        /// Any external resource like <see cref=\"TraceEventServiceConfiguration\"/> will not be disposed.\n        /// </summary>\n        public void Dispose()\n        {\n            if (this.Status != ServiceStatus.Disposed)\n            {\n                this.Stop();\n                this.Status = ServiceStatus.Disposed;\n            }\n        }\n\n        private static void ThrowOnUnAuthorizedAccess()\n        {\n            WindowsIdentity indentity = WindowsIdentity.GetCurrent();\n\n            var isAuthorizedUser = indentity.User.IsWellKnown(WellKnownSidType.LocalSystemSid) ||\n                                   indentity.User.IsWellKnown(WellKnownSidType.LocalServiceSid) ||\n                                   indentity.User.IsWellKnown(WellKnownSidType.NetworkServiceSid);\n\n            if (isAuthorizedUser)\n            {\n                return;\n            }\n\n            var isAuthorizedGroup = indentity.Groups.Cast<SecurityIdentifier>().Any(si =>\n                                   si.IsWellKnown(WellKnownSidType.BuiltinAdministratorsSid) ||\n                                   si.IsWellKnown(WellKnownSidType.BuiltinPerformanceLoggingUsersSid));\n\n            if (false == isAuthorizedGroup)\n            {\n                throw new UnauthorizedAccessException(Properties.Resources.InsufficientPrivileges);\n            }\n        }\n\n        private void OnStatusChanged()\n        {\n            if (this.StatusChanged != null)\n            {\n                this.StatusChanged(this, new StatusChangedEventArgs(this.Status));\n            }\n        }\n\n        private void OnSinkSettingsChanged(object sender, NotifyCollectionChangedEventArgs e)\n        {\n            bool success = true;\n\n            switch (e.Action)\n            {\n                case NotifyCollectionChangedAction.Add:\n                    success = this.AddWorkers(e.NewItems);\n                    break;\n                case NotifyCollectionChangedAction.Remove:\n                    success = this.RemoveWorkers(e.OldItems);\n                    break;\n                case NotifyCollectionChangedAction.Replace:\n                    success = this.UpdateWorkers(e.NewItems);\n                    break;\n            }\n\n            if (!success)\n            {\n                this.logger.TraceEventServiceConfigurationWithFaults();\n            }\n        }\n\n        private bool AddWorkers(IList newSinks, bool notifyChanges = true)\n        {\n            bool success = true;\n            foreach (SinkSettings sink in newSinks)\n            {\n                success &= this.HandleException(sink.Name, () =>\n                {\n                    this.workers.Add(sink.Name, new TraceEventServiceWorker(sink, this.configuration.Settings));\n                    if (notifyChanges)\n                    {\n                        this.logger.TraceEventServiceConfigurationChanged(sink.Name, Properties.Resources.SinkAddedFromReconfiguration);\n                    }\n                });\n            }\n\n            return success;\n        }\n\n        private bool RemoveWorkers(IList oldSinks)\n        {\n            bool success = true;\n            foreach (SinkSettings settings in oldSinks)\n            {\n                success &= this.HandleException(settings.Name, () =>\n                {\n                    this.workers[settings.Name].Dispose();\n                    this.workers.Remove(settings.Name);\n                    settings.Sink.OnCompleted();\n                    this.logger.TraceEventServiceConfigurationChanged(settings.Name, Properties.Resources.SinkRemovedFromReconfiguration);\n                });\n            }\n\n            return success;\n        }\n\n        private bool UpdateWorkers(IList updatedSinks)\n        {\n            bool success = true;\n\n            foreach (SinkSettings settings in updatedSinks)\n            {\n                success &= this.HandleException(settings.Name, () =>\n                {\n                    this.workers[settings.Name].UpdateSession(settings.EventSources);\n                    this.logger.TraceEventServiceConfigurationChanged(settings.Name, Properties.Resources.SinkUpdatedFromReconfiguration);\n                });\n            }\n\n            return success;\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Justification = \"Exception is logged\")]\n        private bool HandleException(string callerName, Action body)\n        {\n            try\n            {\n                body();\n                return true;\n            }\n            catch (Exception exception)\n            {\n                this.logger.TraceEventServiceConfigurationFault(callerName, exception.ToString());\n                return false;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/TraceEventServiceWorker.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Microsoft.Diagnostics.Tracing;\nusing Microsoft.Diagnostics.Tracing.Parsers;\nusing Microsoft.Diagnostics.Tracing.Session;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Utility;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw\n{\n    internal sealed class TraceEventServiceWorker : IDisposable\n    {\n        private readonly SemanticLoggingEventSource logger = SemanticLoggingEventSource.Log;\n        private readonly TraceEventSchemaCache schemaCache = new TraceEventSchemaCache();\n        private readonly IObserver<EventEntry> sink;\n        private readonly List<EventSourceSettings> eventSources;\n        private readonly string sessionName;\n        private TraceEventManifestsCache manifestCache;\n        private ETWTraceEventSource source;\n        private TraceEventSession session;\n        private Task workerTask;\n        private volatile bool disposing;\n        private bool disposed;\n        private int eventsLost;\n\n        public TraceEventServiceWorker(SinkSettings sinkSettings, TraceEventServiceSettings serviceSettings)\n        {\n            Guard.ArgumentNotNull(sinkSettings, \"sinkSettings\");\n            Guard.ArgumentNotNull(serviceSettings, \"serviceSettings\");\n\n            this.sink = sinkSettings.Sink;\n            this.eventSources = new List<EventSourceSettings>(sinkSettings.EventSources);\n            this.sessionName = serviceSettings.SessionNamePrefix + \"-\" + sinkSettings.Name;\n            this.Initialize();\n        }\n\n        public void UpdateSession(IEnumerable<EventSourceSettings> updatedEventSources)\n        {\n            Guard.ArgumentNotNull(updatedEventSources, \"updatedEventSources\");\n            var updatedSources = updatedEventSources as EventSourceSettings[] ?? updatedEventSources.ToArray();\n\n            var eventSourceNameComparer = new EventSourceSettingsEqualityComparer(nameOnly: true);\n            var eventSourceFullComparer = new EventSourceSettingsEqualityComparer(nameOnly: false);\n\n            // updated sources\n            foreach (var currentSource in this.eventSources.Intersect(updatedSources, eventSourceNameComparer).ToArray())\n            {\n                var updatedSource = updatedSources.Single(s => s.Name == currentSource.Name);\n                if (!eventSourceFullComparer.Equals(currentSource, updatedSource))\n                {\n                    currentSource.CopyValuesFrom(updatedSource);\n                    TraceEventUtil.EnableProvider(\n                        this.session,\n                        currentSource.EventSourceId,\n                        currentSource.Level,\n                        currentSource.MatchAnyKeyword,\n                        currentSource.Arguments,\n                        currentSource.ProcessNamesToFilter,\n                        sendManifest: false);\n                }\n            }\n\n            // new sources\n            foreach (var newSource in updatedSources.Except(this.eventSources, eventSourceNameComparer).ToArray())\n            {\n                TraceEventUtil.EnableProvider(\n                    this.session,\n                    newSource.EventSourceId,\n                    newSource.Level,\n                    newSource.MatchAnyKeyword,\n                    newSource.Arguments,\n                    newSource.ProcessNamesToFilter,\n                    sendManifest: true);\n                this.eventSources.Add(newSource);\n            }\n\n            // removed sources\n            foreach (var removedSource in this.eventSources.Except(updatedSources, eventSourceNameComparer).ToArray())\n            {\n                this.session.DisableProvider(removedSource.EventSourceId);\n                this.eventSources.Remove(removedSource);\n            }\n        }\n\n        public void Dispose()\n        {\n            if (!this.disposed)\n            {\n                this.disposing = true;\n\n                if (this.eventsLost > 0)\n                {\n                    this.logger.TraceEventServiceProcessEventsLost(this.sessionName, this.eventsLost);\n                }\n\n                // By disposing source we force this.source.Process() to exit and end workerTask\n                // Note that source reference is not released rigth after Dispose() to avoid 'CallbackOnCollectedDelegate'exception\n                // that might be thrown before Process() ends.\n                this.source.Dispose();\n                this.workerTask.Wait();\n                this.session.Dispose();\n                this.session = null;\n                this.source = null;\n\n                this.disposed = true;\n            }\n        }\n\n        private void Initialize()\n        {\n            this.session = TraceEventUtil.CreateSession(this.sessionName);\n\n            // Hook up the ETWTraceEventSource to the specified session\n            this.source = new ETWTraceEventSource(this.sessionName, TraceEventSourceType.Session);\n\n            this.manifestCache = new TraceEventManifestsCache(this.source.Dynamic);\n\n            // get any previously cached manifest and update the schema cache\n            this.UpdateCaches();\n\n            // hook up to all incoming events and filter out manifests\n            this.source.Dynamic.All += e => this.ProcessEvent(e);\n\n            // listen to new manifests\n            this.source.Dynamic.DynamicProviderAdded += m => this.OnManifestReceived(m);\n\n            // We collect all the manifests and save/terminate process when done\n            this.source.UnhandledEvents += e => this.ProcessUnhandledEvent(e);\n\n            foreach (var eventSource in this.eventSources)\n            {\n                // Bind the provider (EventSource/EventListener) with the session\n                TraceEventUtil.EnableProvider(\n                    this.session,\n                    eventSource.EventSourceId,\n                    eventSource.Level,\n                    eventSource.MatchAnyKeyword,\n                    eventSource.Arguments,\n                    eventSource.ProcessNamesToFilter);\n            }\n\n            // source.Process() is blocking so we need to launch it on a separate thread.\n            this.workerTask = Task.Factory.StartNew(() => this.source.Process(), TaskCreationOptions.LongRunning).\n                                           ContinueWith(t => this.HandleProcessTaskFault(t));\n        }\n\n        private void UpdateCaches()\n        {\n            this.manifestCache.Read();\n            foreach (var provider in this.source.Dynamic.DynamicProviders)\n            {\n                this.schemaCache.UpdateSchemaFromManifest(provider.Guid, provider.Manifest);\n            }\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Justification = \"Exception is logged\")]\n        private void ProcessEvent(TraceEvent evt)\n        {\n            if (evt.ID != (TraceEventID)0xFFFE)\n            {\n                try\n                {\n                    this.sink.OnNext(this.CreateEventEntry(evt));\n                }\n                catch (Exception exception)\n                {\n                    this.logger.TraceEventServiceSinkUnhandledFault(this.sessionName, exception.ToString());\n                }\n            }\n        }\n\n        private void OnManifestReceived(ProviderManifest providerManifest)\n        {\n            // Update schemas for this provider \n            this.schemaCache.UpdateSchemaFromManifest(providerManifest.Guid, providerManifest.Manifest);\n\n            // Update manifest cache so any new worker instance may pick up the updates version on start up by calling \"this.manifestCache.Read()\".                \n            // Notice that we are refreshing the manifest with the latest version received so any older version will be overwritten.\n            this.manifestCache.Write();\n        }\n\n        private void ProcessUnhandledEvent(TraceEvent evt)\n        {\n            if (evt.ID == TraceEventUtil.ManifestEventID)\n            {\n                // manifest event - ignore\n                return;\n            }\n\n            if (evt.ID == 0)\n            {\n                // back channel event - log\n                this.logger.TraceEventServiceOutOfBandEvent(this.sessionName, evt.ProviderGuid, (EventLevel)evt.Level, (EventKeywords)evt.Keywords, evt.FormattedMessage);\n                return;\n            }\n\n            // Simply notify and count lost events since we don't have a manifest yet to parse this event.\n            this.NotifyEventLost();\n        }\n\n        private EventEntry CreateEventEntry(TraceEvent traceEvent)\n        {\n            return new EventEntry(\n                traceEvent.ProviderGuid,\n                (int)traceEvent.ID,\n                traceEvent.FormattedMessage,\n                this.CreatePayload(traceEvent),\n                new DateTimeOffset(traceEvent.TimeStamp),\n                traceEvent.ProcessID,\n                traceEvent.ThreadID,\n                traceEvent.ActivityID,\n                traceEvent.RelatedActivityID,\n                this.schemaCache.GetSchema(traceEvent));\n        }\n\n        private ReadOnlyCollection<object> CreatePayload(TraceEvent traceEvent)\n        {\n            var payloadValues = new List<object>();\n\n            for (int i = 0; i < traceEvent.PayloadNames.Length; i++)\n            {\n                payloadValues.Add(traceEvent.PayloadValue(i));\n            }\n\n            return new ReadOnlyCollection<object>(payloadValues);\n        }\n\n        private void HandleProcessTaskFault(Task task)\n        {\n            if (task.IsFaulted)\n            {\n                // set as observed exception\n                var exception = task.Exception;\n\n                if (!this.disposing)\n                {\n                    // The process stopped because of a non-transient exception so log it. \n                    // ReSharper disable once PossibleNullReferenceException - documented not to be null if task.IsFaulted is true\n                    this.logger.TraceEventServiceProcessTaskFault(this.sessionName, exception.Flatten().ToString());\n\n                    // The worker will be left in a stopped state and resources will be released on Dispose().\n                    // Stop session since we are not listening any new incoming event.\n                    this.session.Stop(noThrow: true);\n                }\n            }\n        }\n\n        private void NotifyEventLost()\n        {\n            // The event could not be parsed because there's no manifest cached yet.\n            if (this.eventsLost == 0)\n            {\n                this.logger.TraceEventServiceEventsWillBeLost(this.sessionName);\n            }\n            else if (this.eventsLost == int.MaxValue)\n            {\n                this.logger.TraceEventServiceProcessEventsLost(this.sessionName, this.eventsLost);\n                this.eventsLost = 0;\n            }\n\n            this.eventsLost++;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Utility/AssemblyExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Utility\n{\n    internal static class AssemblyExtensions\n    {\n        private static List<byte[]> frameworkTokens = new List<byte[]>()\n        {\n            new byte[] { 0xb7, 0x7a, 0x5c, 0x56, 0x19, 0x34, 0xe0, 0x89 },\n            new byte[] { 0xb0, 0x3f, 0x5f, 0x7f, 0x11, 0xd5, 0x0a, 0x3a }\n            //// Key used for Entlib\n            ////new byte[] { 0x31, 0xbf, 0x38, 0x56, 0xad, 0x36, 0x4e, 0x35 }\n        };\n\n        public static string ToProductString(this Assembly assembly)\n        {\n            StringBuilder sb = new StringBuilder();\n\n            string assemblyProduct = FromAttribute<AssemblyProductAttribute>(assembly).Product;\n\n            string assemblyCopyright = FromAttribute<AssemblyCopyrightAttribute>(assembly).Copyright;\n\n            if (string.IsNullOrWhiteSpace(assemblyCopyright))\n            {\n                assemblyCopyright = FromAttribute<AssemblyCompanyAttribute>(assembly).Company;\n            }\n\n            string assemblyDescription = FromAttribute<AssemblyDescriptionAttribute>(assembly).Description ?? assembly.GetName().Name;\n\n            sb.AppendLine(assemblyDescription);\n            sb.AppendFormat(\"{0} v{1}\", assemblyProduct, assembly.GetName().Version.ToString(2));\n            sb.AppendLine();\n            sb.AppendLine(assemblyCopyright);\n            sb.AppendLine();\n\n            return sb.ToString();\n        }\n\n        public static bool IsFrameworkAssembly(this Assembly assembly)\n        {\n            byte[] publicKeyToken = assembly.GetName().GetPublicKeyToken();\n\n            return publicKeyToken.Length > 0 && frameworkTokens.Any(t => t.SequenceEqual(publicKeyToken));\n        }\n\n        private static T FromAttribute<T>(Assembly assembly) where T : Attribute\n        {\n            return (assembly.GetCustomAttributes(typeof(T), false).FirstOrDefault() as T) ?? Activator.CreateInstance<T>();\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/Utility/TraceEventUtil.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing Microsoft.Diagnostics.Tracing;\nusing Microsoft.Diagnostics.Tracing.Session;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Utility\n{\n    internal static class TraceEventUtil\n    {\n        internal const TraceEventID ManifestEventID = (TraceEventID)0xFFFE;\n\n        internal static TraceEventSession CreateSession(string sessionName)\n        {\n            if (TraceEventSession.GetActiveSessionNames().Contains(sessionName, StringComparer.OrdinalIgnoreCase))\n            {\n                // Notify of session removal\n                SemanticLoggingEventSource.Log.TraceEventServiceSessionRemoved(sessionName);\n\n                // Remove existing session\n                new TraceEventSession(sessionName) { StopOnDispose = true }.Dispose();\n            }\n\n            return new TraceEventSession(sessionName, null) { StopOnDispose = true };\n        }\n\n        internal static void EnableProvider(\n            TraceEventSession session,\n            Guid providerId,\n            EventLevel level,\n            EventKeywords matchAnyKeyword,\n            IEnumerable<KeyValuePair<string, string>> arguments,\n            IEnumerable<string> processNamesToFilter,\n            bool sendManifest = true)\n        {\n            // Make explicit the invocation for requesting the manifest from the EventSource (Provider).\n            var argumentsDictionary = arguments.ToDictionary(kvp => kvp.Key, kvp => kvp.Value);\n            if (sendManifest)\n            {\n                argumentsDictionary[\"Command\"] = \"SendManifest\";\n            }\n\n            var options =\n                new TraceEventProviderOptions\n                {\n                    Arguments = argumentsDictionary,\n                    ProcessNameFilter = processNamesToFilter.ToArray()\n                };\n\n            session.EnableProvider(providerId, (TraceEventLevel)level, (ulong)matchAnyKeyword, options);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"Microsoft.Data.Edm\" version=\"5.6.4\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Data.OData\" version=\"5.6.4\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Data.Services.Client\" version=\"5.6.4\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Diagnostics.Tracing.TraceEvent\" version=\"1.0.15\" targetFramework=\"net45\" />\n  <package id=\"Newtonsoft.Json\" version=\"6.0.8\" targetFramework=\"net45\" />\n  <package id=\"StyleCop.MSBuild\" version=\"4.7.49.0\" targetFramework=\"net45\" developmentDependency=\"true\" />\n  <package id=\"System.Spatial\" version=\"5.6.4\" targetFramework=\"net45\" />\n</packages>"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/Application.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.ServiceProcess;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service.Properties;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service\n{\n    internal static class Application\n    {\n        internal static int Main(string[] args)\n        {\n            if (args.Length == 0 && false == Environment.UserInteractive)\n            {\n                // Called by SCM\n                ServiceBase.Run(new TraceEventServiceHost());\n                return (int)ApplicationExitCode.Success;\n            }\n\n            var options = new ParameterOptions();\n            var parameters = new ParameterSet\n            {\n                { \"i|install\", Resources.InstallArgDescription, (p, a) => options.Install(a) },\n                { \"u|uninstall\", Resources.UninstallArgDescription, (p, a) => options.Uninstall() },\n                { \"s|start\", Resources.StartArgDescription, (p, a) => options.Start(a) },\n                { \"c|console\", Resources.ConsoleArgDescription, (p, a) => options.ConsoleMode() },\n                { \"h|help|?\", Resources.HelpArgDescription, (p, a) => options.ShowHelp(p) },\n                { \"a|account\", Resources.AccountArgDescription, ParameterOptions.AccountParameterKey }\n            };\n\n            options.ShowHeader();\n\n            if (!parameters.Parse(args))\n            {\n                options.ShowHelp(parameters);\n                return (int)ApplicationExitCode.InputError;\n            }\n\n            return (int)options.ExitCode;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/ApplicationExitCode.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service\n{\n    internal enum ApplicationExitCode\n    {\n        Success,\n        InputError,\n        RuntimeError,\n        SecurityError\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/AssemblyExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Linq;\nusing System.Reflection;\nusing System.Text;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service\n{\n    internal static class AssemblyExtensions\n    {\n        public static string ToProductString(this Assembly assembly)\n        {\n            StringBuilder sb = new StringBuilder();\n\n            string assemblyProduct = FromAttribute<AssemblyProductAttribute>(assembly).Product;\n\n            string assemblyCopyright = FromAttribute<AssemblyCopyrightAttribute>(assembly).Copyright;\n\n            if (string.IsNullOrWhiteSpace(assemblyCopyright))\n            {\n                assemblyCopyright = FromAttribute<AssemblyCompanyAttribute>(assembly).Company;\n            }\n\n            string assemblyDescription = FromAttribute<AssemblyDescriptionAttribute>(assembly).Description ?? assembly.GetName().Name;\n            var version = FromAttribute<AssemblyFileVersionAttribute>(assembly).Version;\n\n            sb.AppendFormat(\"{0} v{1}\", assemblyDescription, version);\n            sb.AppendLine();\n            sb.AppendLine(assemblyProduct);\n            sb.AppendLine(assemblyCopyright);\n            sb.AppendLine();\n\n            return sb.ToString();\n        }\n\n        private static T FromAttribute<T>(Assembly assembly) where T : Attribute\n        {\n            return (assembly.GetCustomAttributes(typeof(T), false).FirstOrDefault() as T) ?? Activator.CreateInstance<T>();\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/Constants.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw\n{\n    internal static class Constants\n    {\n        internal const string ServiceName = \"Enterprise Library Semantic Logging Service\";\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/GlobalSuppressions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\n// This file is used by Code Analysis to maintain SuppressMessage \n// attributes that are applied to this project.\n// Project-level suppressions either have no target or are given \n// a specific target and scoped to a namespace, type, member, etc.\n//\n// To add a suppression to this file, right-click the message in the \n// Code Analysis results, point to \"Suppress Message\", and click \n// \"In Suppression File\".\n// You do not need to add suppressions to this file manually.\n\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1704:IdentifiersShouldBeSpelledCorrectly\", MessageId = \"Etw\", Scope = \"namespace\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service\", Justification = \"As designed\")]\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/Parameter.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service\n{\n    internal class Parameter\n    {\n        public Parameter(string name, string description, Action<ParameterSet, IEnumerable<Tuple<string, string>>> action)\n        {\n            this.Names = new HashSet<string>(name.Split(new[] { \"|\" }, StringSplitOptions.RemoveEmptyEntries));\n            this.Description = description;\n            this.Action = action;\n        }\n\n        public Parameter(string name, string description, string key)\n        {\n            this.Names = new HashSet<string>(name.Split(new[] { \"|\" }, StringSplitOptions.RemoveEmptyEntries));\n            this.Description = description;\n            this.Key = key;\n        }\n\n        public ICollection<string> Names { get; private set; }\n\n        public Action<ParameterSet, IEnumerable<Tuple<string, string>>> Action { get; private set; }\n\n        public string Description { get; private set; }\n\n        public string Key { get; private set; }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/ParameterOptions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Configuration.Install;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Reflection;\nusing System.Security.Principal;\nusing System.ServiceProcess;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service.Properties;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service\n{\n    internal class ParameterOptions\n    {\n        internal const string AccountParameterKey = \"account\";\n\n        private readonly TimeSpan startServiceTiemout = TimeSpan.FromSeconds(5);\n        private readonly TraceSource logSource = new TraceSource(\"SemanticLogging-svc\");\n\n        internal ParameterOptions()\n        {\n            this.ExitCode = ApplicationExitCode.Success;\n        }\n\n        public ApplicationExitCode ExitCode { get; private set; }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Justification = \"Exception is logged. Only used when in console model\")]\n        public void Install(IEnumerable<Tuple<string, string>> arguments)\n        {\n            // Check for admin rights\n            if (false == this.IsAuthorized())\n            {\n                this.logSource.TraceEvent(TraceEventType.Error, (int)ApplicationExitCode.SecurityError, Resources.InsufficientAccessPermission);\n                this.ExitCode = ApplicationExitCode.SecurityError;\n                return;\n            }\n\n            if (IsServiceInstalled())\n            {\n                this.logSource.TraceInformation(Resources.AlreadyInstalledService);\n                return;\n            }\n\n            try\n            {\n                var installerArgs = new List<string>();\n\n                var accountArgument = arguments.FirstOrDefault(a => a.Item1 == AccountParameterKey);\n                if (accountArgument != null)\n                {\n                    installerArgs.Add(\"/account=\" + accountArgument.Item2);\n                }\n\n                installerArgs.Add(Assembly.GetExecutingAssembly().Location);\n\n                ManagedInstallerClass.InstallHelper(installerArgs.ToArray());\n            }\n            catch (Exception e)\n            {\n                this.logSource.TraceEvent(TraceEventType.Error, (int)ApplicationExitCode.RuntimeError, e.Message);\n                this.ExitCode = ApplicationExitCode.RuntimeError;\n            }\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Justification = \"Exception is logged. Only used when in console model\")]\n        public void Uninstall()\n        {\n            // Check for admin rights\n            if (false == this.IsAuthorized())\n            {\n                this.logSource.TraceEvent(TraceEventType.Error, (int)ApplicationExitCode.SecurityError, Resources.InsufficientAccessPermission);\n                this.ExitCode = ApplicationExitCode.SecurityError;\n                return;\n            }\n\n            if (false == IsServiceInstalled())\n            {\n                this.logSource.TraceEvent(TraceEventType.Error, (int)ApplicationExitCode.InputError, Resources.NotInstalledService);\n                this.ExitCode = ApplicationExitCode.InputError;\n                return;\n            }\n\n            try\n            {\n                ManagedInstallerClass.InstallHelper(new[] { \"/u\", Assembly.GetExecutingAssembly().Location });\n            }\n            catch (Exception e)\n            {\n                this.logSource.TraceEvent(TraceEventType.Error, (int)ApplicationExitCode.RuntimeError, e.Message);\n                this.ExitCode = ApplicationExitCode.RuntimeError;\n            }\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Justification = \"Exception is logged. Only used when in console model\")]\n        public void Start(IEnumerable<Tuple<string, string>> arguments)\n        {\n            if (false == IsServiceInstalled())\n            {\n                this.Install(arguments);\n                if (this.ExitCode != ApplicationExitCode.Success)\n                {\n                    return;\n                }\n            }\n\n            ServiceController controller = GetController();\n\n            switch (controller.Status)\n            {\n                case ServiceControllerStatus.Running:\n                    this.logSource.TraceInformation(Resources.ServiceAlreadyStarted);\n                    return;\n                case ServiceControllerStatus.Stopped:\n                    try\n                    {\n                        controller.Start();\n                        controller.WaitForStatus(ServiceControllerStatus.Running, this.startServiceTiemout);\n                        this.logSource.TraceInformation(Resources.ServiceStarted);\n                        return;\n                    }\n                    catch (System.ServiceProcess.TimeoutException)\n                    {\n                        logSource.TraceEvent(TraceEventType.Warning, (int)ApplicationExitCode.RuntimeError, Resources.ServiceNotStartedTimeout);\n                        break;\n                    }\n                    catch (Exception e)\n                    {\n                        this.logSource.TraceEvent(TraceEventType.Error, (int)ApplicationExitCode.RuntimeError, e.Message);\n                        break;\n                    }\n\n                default:\n                    this.logSource.TraceEvent(TraceEventType.Error, 0, Resources.ServiceNotStarted, controller.Status);\n                    break;\n            }\n\n            this.ExitCode = ApplicationExitCode.RuntimeError;\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Justification = \"Exception is logged. Only used when in console model\")]\n        public void ConsoleMode()\n        {\n            try\n            {\n                using (var service = new TraceEventServiceHost())\n                {\n                    service.Start();\n                    Console.WriteLine();\n                    Console.WriteLine(Resources.StopServiceMessage);\n                    Console.ReadLine();\n                }\n            }\n            catch (Exception e)\n            {\n                DisplayExceptionOnConsole(e);\n            }\n        }\n\n        public void ShowHelp(ParameterSet parameters)\n        {\n            foreach (var parameter in parameters)\n            {\n                Console.WriteLine(parameter.Description);\n            }\n        }\n\n        public void ShowHeader()\n        {\n            Console.WriteLine(Assembly.GetExecutingAssembly().ToProductString());\n        }\n\n        private static bool IsServiceInstalled()\n        {\n            return GetController() != null;\n        }\n\n        private static ServiceController GetController()\n        {\n            return ServiceController.GetServices().FirstOrDefault(s => s.ServiceName.Equals(Constants.ServiceName, StringComparison.OrdinalIgnoreCase));\n        }\n\n        private void DisplayExceptionOnConsole(Exception e)\n        {\n            var rtle = e as ReflectionTypeLoadException;\n            if (rtle != null)\n            {\n                DisplayLoaderExceptionsOnConsole(rtle);\n            }\n\n            Console.WriteLine(e.ToString());\n            Console.WriteLine();\n            Console.WriteLine(Resources.StopServiceMessage);\n            Console.ReadLine();\n            this.ExitCode = ApplicationExitCode.RuntimeError;\n        }\n\n        private void DisplayLoaderExceptionsOnConsole(ReflectionTypeLoadException e)\n        {\n            foreach (var loaderException in e.LoaderExceptions)\n            {\n                Console.WriteLine(loaderException.ToString());\n            }\n        }\n\n        private bool IsAuthorized()\n        {\n            var user = WindowsIdentity.GetCurrent();\n            if (user == null)\n            {\n                return false;\n            }\n\n            var principal = new WindowsPrincipal(user);\n            return principal.IsInRole(WindowsBuiltInRole.Administrator);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/ParameterSet.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text.RegularExpressions;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service\n{\n    internal class ParameterSet : HashSet<Parameter>\n    {\n        private readonly Regex nameValueParser = new Regex(@\"^(?<f>--|-|/)(?<name>[^:=]+)(?:[:=](?<value>.*))?$\", RegexOptions.IgnoreCase | RegexOptions.Compiled);\n\n        public void Add(string name, string description, Action<ParameterSet, IEnumerable<Tuple<string, string>>> action)\n        {\n            base.Add(new Parameter(name, description, action));\n        }\n\n        public void Add(string name, string description, string key)\n        {\n            base.Add(new Parameter(name, description, key));\n        }\n\n        public bool Parse(IEnumerable<string> args)\n        {\n            // parse all parameters\n            var allArgs = new List<Tuple<string, string>>();\n            foreach (var arg in args)\n            {\n                var match = this.nameValueParser.Match(arg);\n                if (!match.Success)\n                {\n                    return false;\n                }\n\n                allArgs.Add(Tuple.Create(match.Groups[\"name\"].Value, match.Groups[\"value\"].Value));\n            }\n\n            // left join actual arguments with all the available names\n            var matchingParams = (from arg in allArgs\n                                  join par in this.SelectMany(p => p.Names.Select(n => new { Name = n, Parameter = p }))\n                                      on arg.Item1 equals par.Name into gj\n                                  from subpar in gj.DefaultIfEmpty()\n                                  select new { Argument = arg, Parameter = subpar != null ? subpar.Parameter : default(Parameter) }).ToList();\n\n            if (matchingParams.Any(p => p.Parameter == null))\n            {\n                return false;\n            }\n\n            var actionParams = matchingParams.Where(p => p.Parameter.Action != null).ToList();\n            if (actionParams.Count != 1)\n            {\n                return false;\n            }\n\n            // provide extra arguments using a stable key\n            var normalizedArguments =\n                matchingParams.Where(mp => mp.Parameter.Key != null).Select(mp => Tuple.Create(mp.Parameter.Key, mp.Argument.Item2));\n\n            actionParams[0].Parameter.Action(this, normalizedArguments);\n\n            return true;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/Properties/AssemblyInfo.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Reflection;\nusing System.Resources;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n[assembly: AssemblyTitle(\"Enterprise Library Semantic Logging Service\")]\n[assembly: AssemblyDescription(\"Enterprise Library Semantic Logging Service\")]\n\n[assembly: AssemblyVersion(\"2.0.0.0\")]\n[assembly: AssemblyFileVersion(\"2.0.1406.1\")]\n[assembly: AssemblyInformationalVersion(\"2.0.1406.1\")]\n\n[assembly: ComVisible(false)]\n[assembly: NeutralResourcesLanguage(\"en-US\")]\n\n#if SIGN\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n#else\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests\")]\n#endif"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/Properties/Resources.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\n// <auto-generated>\n//     This code was generated by a tool.\n//     Runtime Version:4.0.30319.34209\n//\n//     Changes to this file may cause incorrect behavior and will be lost if\n//     the code is regenerated.\n// </auto-generated>\n//------------------------------------------------------------------------------\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service.Properties {\n    using System;\n    \n    \n    /// <summary>\n    ///   A strongly-typed resource class, for looking up localized strings, etc.\n    /// </summary>\n    // This class was auto-generated by the StronglyTypedResourceBuilder\n    // class via a tool like ResGen or Visual Studio.\n    // To add or remove a member, edit your .ResX file then rerun ResGen\n    // with the /str option, or rebuild your VS project.\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Resources.Tools.StronglyTypedResourceBuilder\", \"4.0.0.0\")]\n    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\n    internal class Resources {\n        \n        private static global::System.Resources.ResourceManager resourceMan;\n        \n        private static global::System.Globalization.CultureInfo resourceCulture;\n        \n        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"Microsoft.Performance\", \"CA1811:AvoidUncalledPrivateCode\")]\n        internal Resources() {\n        }\n        \n        /// <summary>\n        ///   Returns the cached ResourceManager instance used by this class.\n        /// </summary>\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\n        internal static global::System.Resources.ResourceManager ResourceManager {\n            get {\n                if (object.ReferenceEquals(resourceMan, null)) {\n                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service.Properties.Reso\" +\n                            \"urces\", typeof(Resources).Assembly);\n                    resourceMan = temp;\n                }\n                return resourceMan;\n            }\n        }\n        \n        /// <summary>\n        ///   Overrides the current thread's CurrentUICulture property for all\n        ///   resource lookups using this strongly typed resource class.\n        /// </summary>\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\n        internal static global::System.Globalization.CultureInfo Culture {\n            get {\n                return resourceCulture;\n            }\n            set {\n                resourceCulture = value;\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to [ -a=type | -account=type]\tSpecifies the account type. Accepted values are &apos;User&apos;, &apos;LocalSystem&apos;, and &apos;LocalService&apos;. Default is &apos;LocalService&apos;..\n        /// </summary>\n        internal static string AccountArgDescription {\n            get {\n                return ResourceManager.GetString(\"AccountArgDescription\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The service is already installed or has been marked for deletion..\n        /// </summary>\n        internal static string AlreadyInstalledService {\n            get {\n                return ResourceManager.GetString(\"AlreadyInstalledService\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The configuration file was not found in the service config file &apos;appSettings&apos; section with key name &apos;EtwConfigurationFileName&apos;. .\n        /// </summary>\n        internal static string ConfigFileNameNotFoundError {\n            get {\n                return ResourceManager.GetString(\"ConfigFileNameNotFoundError\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to [ -c | -console ]\t\tRun as a console application..\n        /// </summary>\n        internal static string ConsoleArgDescription {\n            get {\n                return ResourceManager.GetString(\"ConsoleArgDescription\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Event Trace Session prefix: {0}.\n        /// </summary>\n        internal static string EventSessionMessage {\n            get {\n                return ResourceManager.GetString(\"EventSessionMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Arguments: {0}.\n        /// </summary>\n        internal static string EventSourceArgumentsMessage {\n            get {\n                return ResourceManager.GetString(\"EventSourceArgumentsMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to {0}, Level: {1}, MatchAnyKeyword: {2}.\n        /// </summary>\n        internal static string EventSourceDescriptionMessage {\n            get {\n                return ResourceManager.GetString(\"EventSourceDescriptionMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Event sources:.\n        /// </summary>\n        internal static string EventSourceListMessage {\n            get {\n                return ResourceManager.GetString(\"EventSourceListMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Name: {0}.\n        /// </summary>\n        internal static string EventSourceNameMessage {\n            get {\n                return ResourceManager.GetString(\"EventSourceNameMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Processes: {0}.\n        /// </summary>\n        internal static string EventSourceProcessNamesMessage {\n            get {\n                return ResourceManager.GetString(\"EventSourceProcessNamesMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to [ -h | -help | -? ]\t\tDisplay list of arguments.\n        /// </summary>\n        internal static string HelpArgDescription {\n            get {\n                return ResourceManager.GetString(\"HelpArgDescription\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to [ -i | -install ]\t\tInstall as a Windows Service. .\n        /// </summary>\n        internal static string InstallArgDescription {\n            get {\n                return ResourceManager.GetString(\"InstallArgDescription\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The requested operation requires elevation..\n        /// </summary>\n        internal static string InsufficientAccessPermission {\n            get {\n                return ResourceManager.GetString(\"InsufficientAccessPermission\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Configuration settings loaded from file: {0}.\n        /// </summary>\n        internal static string LoadedConfigurationMessage {\n            get {\n                return ResourceManager.GetString(\"LoadedConfigurationMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Loading configuration ....\n        /// </summary>\n        internal static string LoadingServiceConfigurationMessage {\n            get {\n                return ResourceManager.GetString(\"LoadingServiceConfigurationMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The service is not installed..\n        /// </summary>\n        internal static string NotInstalledService {\n            get {\n                return ResourceManager.GetString(\"NotInstalledService\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The configuration file changed and the current service instance will restart to reflect the changes..\n        /// </summary>\n        internal static string RecyclingServiceOnConfigChanged {\n            get {\n                return ResourceManager.GetString(\"RecyclingServiceOnConfigChanged\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The service is already running..\n        /// </summary>\n        internal static string ServiceAlreadyStarted {\n            get {\n                return ResourceManager.GetString(\"ServiceAlreadyStarted\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to This service can collect strongly typed events captured by event tracing for Windows (ETW) and foward to the configured EventListeners in the xml service configuration file. For further details read the service documentation..\n        /// </summary>\n        internal static string ServiceDescription {\n            get {\n                return ResourceManager.GetString(\"ServiceDescription\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Enterprise Library Semantic Logging Out-of-Process Service.\n        /// </summary>\n        internal static string ServiceDisplayName {\n            get {\n                return ResourceManager.GetString(\"ServiceDisplayName\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The account identifier is invalid &apos;{0}&apos;..\n        /// </summary>\n        internal static string ServiceInvalidAccount {\n            get {\n                return ResourceManager.GetString(\"ServiceInvalidAccount\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The service cannot start because it is in &apos;{0}&apos; state..\n        /// </summary>\n        internal static string ServiceNotStarted {\n            get {\n                return ResourceManager.GetString(\"ServiceNotStarted\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The service could not be started. Check the eventlog for more details..\n        /// </summary>\n        internal static string ServiceNotStartedTimeout {\n            get {\n                return ResourceManager.GetString(\"ServiceNotStartedTimeout\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The service has started..\n        /// </summary>\n        internal static string ServiceStarted {\n            get {\n                return ResourceManager.GetString(\"ServiceStarted\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Service stopped successfully..\n        /// </summary>\n        internal static string ServiceStoppedMessage {\n            get {\n                return ResourceManager.GetString(\"ServiceStoppedMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Closing all resources....\n        /// </summary>\n        internal static string ShutdownServiceMessage {\n            get {\n                return ResourceManager.GetString(\"ShutdownServiceMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Sink name: {0}.\n        /// </summary>\n        internal static string SinkNameMessage {\n            get {\n                return ResourceManager.GetString(\"SinkNameMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to [ -s | -start ]\t\t\tStart or install and start the service..\n        /// </summary>\n        internal static string StartArgDescription {\n            get {\n                return ResourceManager.GetString(\"StartArgDescription\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Service started..\n        /// </summary>\n        internal static string StartedServiceMessage {\n            get {\n                return ResourceManager.GetString(\"StartedServiceMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Press enter to end ....\n        /// </summary>\n        internal static string StopServiceMessage {\n            get {\n                return ResourceManager.GetString(\"StopServiceMessage\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to [ -u | -uninstall ]\t\tUninstall the Windows Service..\n        /// </summary>\n        internal static string UninstallArgDescription {\n            get {\n                return ResourceManager.GetString(\"UninstallArgDescription\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to The configuration is incomplete. Please update the configuration. The service will detect the configuration file change and reload the new settings..\n        /// </summary>\n        internal static string UpdateConfigFileMessage {\n            get {\n                return ResourceManager.GetString(\"UpdateConfigFileMessage\", resourceCulture);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/Properties/Resources.resx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The primary goals of this format is to allow a simple XML format \n    that is mostly human readable. The generation and parsing of the \n    various data types are done through the TypeConverter classes \n    associated with the data types.\n    \n    Example:\n    \n    ... ado.net/XML headers & schema ...\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\n    <resheader name=\"version\">2.0</resheader>\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\n    </data>\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\n        <comment>This is a comment</comment>\n    </data>\n                \n    There are any number of \"resheader\" rows that contain simple \n    name/value pairs.\n    \n    Each data row contains a name, and value. The row also contains a \n    type or mimetype. Type corresponds to a .NET class that support \n    text/value conversion through the TypeConverter architecture. \n    Classes that don't support this are serialized and stored with the \n    mimetype set.\n    \n    The mimetype is used for serialized objects, and tells the \n    ResXResourceReader how to depersist the object. This is currently not \n    extensible. For a given mimetype the value must be set accordingly:\n    \n    Note - application/x-microsoft.net.object.binary.base64 is the format \n    that the ResXResourceWriter will generate, however the reader can \n    read any of the formats listed below.\n    \n    mimetype: application/x-microsoft.net.object.binary.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\n            : and then encoded with base64 encoding.\n    \n    mimetype: application/x-microsoft.net.object.soap.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.bytearray.base64\n    value   : The object must be serialized into a byte array \n            : using a System.ComponentModel.TypeConverter\n            : and then encoded with base64 encoding.\n    -->\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\n      <xsd:complexType>\n        <xsd:choice maxOccurs=\"unbounded\">\n          <xsd:element name=\"metadata\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"assembly\">\n            <xsd:complexType>\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"data\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"resheader\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\n            </xsd:complexType>\n          </xsd:element>\n        </xsd:choice>\n      </xsd:complexType>\n    </xsd:element>\n  </xsd:schema>\n  <resheader name=\"resmimetype\">\n    <value>text/microsoft-resx</value>\n  </resheader>\n  <resheader name=\"version\">\n    <value>2.0</value>\n  </resheader>\n  <resheader name=\"reader\">\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <resheader name=\"writer\">\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <data name=\"AccountArgDescription\" xml:space=\"preserve\">\n    <value>[ -a=type | -account=type]\tSpecifies the account type. Accepted values are User, LocalSystem, and LocalService. Default is LocalService.</value>\n  </data>\n  <data name=\"AlreadyInstalledService\" xml:space=\"preserve\">\n    <value>The service is already installed or has been marked for deletion.</value>\n  </data>\n  <data name=\"ConfigFileNameNotFoundError\" xml:space=\"preserve\">\n    <value>The configuration file was not found in the service config file 'appSettings' section with key name 'EtwConfigurationFileName'. </value>\n  </data>\n  <data name=\"ConsoleArgDescription\" xml:space=\"preserve\">\n    <value>[ -c | -console ]\t\tRun as a console application.</value>\n  </data>\n  <data name=\"EventSessionMessage\" xml:space=\"preserve\">\n    <value>Event Trace Session prefix: {0}</value>\n  </data>\n  <data name=\"EventSourceArgumentsMessage\" xml:space=\"preserve\">\n    <value>Arguments: {0}</value>\n  </data>\n  <data name=\"EventSourceDescriptionMessage\" xml:space=\"preserve\">\n    <value>{0}, Level: {1}, MatchAnyKeyword: {2}</value>\n  </data>\n  <data name=\"EventSourceListMessage\" xml:space=\"preserve\">\n    <value>Event sources:</value>\n  </data>\n  <data name=\"EventSourceNameMessage\" xml:space=\"preserve\">\n    <value>Name: {0}</value>\n  </data>\n  <data name=\"EventSourceProcessNamesMessage\" xml:space=\"preserve\">\n    <value>Processes: {0}</value>\n  </data>\n  <data name=\"HelpArgDescription\" xml:space=\"preserve\">\n    <value>[ -h | -help | -? ]\t\tDisplay list of arguments</value>\n  </data>\n  <data name=\"InstallArgDescription\" xml:space=\"preserve\">\n    <value>[ -i | -install ]\t\tInstall as a Windows Service. </value>\n  </data>\n  <data name=\"InsufficientAccessPermission\" xml:space=\"preserve\">\n    <value>The requested operation requires elevation.</value>\n  </data>\n  <data name=\"LoadedConfigurationMessage\" xml:space=\"preserve\">\n    <value>Configuration settings loaded from file: {0}</value>\n  </data>\n  <data name=\"LoadingServiceConfigurationMessage\" xml:space=\"preserve\">\n    <value>Loading configuration ...</value>\n  </data>\n  <data name=\"NotInstalledService\" xml:space=\"preserve\">\n    <value>The service is not installed.</value>\n  </data>\n  <data name=\"RecyclingServiceOnConfigChanged\" xml:space=\"preserve\">\n    <value>The configuration file changed and the current service instance will restart to reflect the changes.</value>\n  </data>\n  <data name=\"ServiceAlreadyStarted\" xml:space=\"preserve\">\n    <value>The service is already running.</value>\n  </data>\n  <data name=\"ServiceDescription\" xml:space=\"preserve\">\n    <value>This service can collect strongly typed events captured by event tracing for Windows (ETW) and foward to the configured EventListeners in the xml service configuration file. For further details read the service documentation.</value>\n  </data>\n  <data name=\"ServiceDisplayName\" xml:space=\"preserve\">\n    <value>Enterprise Library Semantic Logging Out-of-Process Service</value>\n  </data>\n  <data name=\"ServiceInvalidAccount\" xml:space=\"preserve\">\n    <value>The account identifier is invalid '{0}'.</value>\n  </data>\n  <data name=\"ServiceNotStarted\" xml:space=\"preserve\">\n    <value>The service cannot start because it is in '{0}' state.</value>\n  </data>\n  <data name=\"ServiceNotStartedTimeout\" xml:space=\"preserve\">\n    <value>The service could not be started. Check the eventlog for more details.</value>\n  </data>\n  <data name=\"ServiceStarted\" xml:space=\"preserve\">\n    <value>The service has started.</value>\n  </data>\n  <data name=\"ServiceStoppedMessage\" xml:space=\"preserve\">\n    <value>Service stopped successfully.</value>\n  </data>\n  <data name=\"ShutdownServiceMessage\" xml:space=\"preserve\">\n    <value>Closing all resources...</value>\n  </data>\n  <data name=\"SinkNameMessage\" xml:space=\"preserve\">\n    <value>Sink name: {0}</value>\n  </data>\n  <data name=\"StartArgDescription\" xml:space=\"preserve\">\n    <value>[ -s | -start ]\t\t\tStart or install and start the service.</value>\n  </data>\n  <data name=\"StartedServiceMessage\" xml:space=\"preserve\">\n    <value>Service started.</value>\n  </data>\n  <data name=\"StopServiceMessage\" xml:space=\"preserve\">\n    <value>Press enter to end ...</value>\n  </data>\n  <data name=\"UninstallArgDescription\" xml:space=\"preserve\">\n    <value>[ -u | -uninstall ]\t\tUninstall the Windows Service.</value>\n  </data>\n  <data name=\"UpdateConfigFileMessage\" xml:space=\"preserve\">\n    <value>The configuration is incomplete. Please update the configuration. The service will detect the configuration file change and reload the new settings.</value>\n  </data>\n</root>"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/SemanticLogging-svc.xml",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\"\n               xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n               xsi:schemaLocation=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw SemanticLogging-svc.xsd\">\n  \n  <!-- Optional settings for fine tuning performance and Trace Event Session identification-->\n  <traceEventService/>\n\n  <!-- Sinks reference definitons used by this host to listen ETW events -->\n  <sinks>\n    <!-- The service identity should have security permissions to access the resource according to each event sink -->\n    <flatFileSink name=\"svcRuntime\" fileName=\"SemanticLogging-svc.runtime.log\" >\n      <sources>\n        <!-- The below settings shows a simple configuration sample for the buit-in non-transient fault tracing -->\n        <!-- Remove this eventSource if you'd like, and add your own configuration according to the documentation -->\n        <!-- The name attribute is from the EventSource.Name Property -->\n        <eventSource name=\"Microsoft-SemanticLogging\" level=\"Warning\"/>\n      </sources>\n      <!--[Add any built-in or custom formatter here if the sink supports text formatters]-->\n      <eventTextFormatter header=\"----------\"/>\n    </flatFileSink>\n    \n    <!--[Add any built-in or custom sink definition here]-->\n  \n  </sinks>\n\n</configuration>\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/SemanticLogging-svc.xsd",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\n           xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\"\n           xmlns:etw=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\"\n           targetNamespace=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\"\n           elementFormDefault=\"qualified\"\n           attributeFormDefault=\"unqualified\"\n           version=\"1.2\">\n\n    <xs:element name=\"configuration\" type=\"ConfigurationElement\"/>\n\n    <xs:complexType name=\"ConfigurationElement\">\n        <xs:sequence>\n            <xs:element minOccurs=\"0\" maxOccurs=\"1\" name=\"traceEventService\" type=\"TraceEventServiceElement\" />\n            <xs:element minOccurs=\"0\" maxOccurs=\"1\" name=\"sinks\" >\n                <xs:complexType>\n                    <xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n                        <xs:element name=\"flatFileSink\" type=\"FlatFileSinkElement\" />\n                        <xs:element name=\"rollingFlatFileSink\" type=\"RollingFlatFileSinkElement\" />\n                        <xs:element name=\"windowsAzureTableSink\" type=\"WindowsAzureTableSinkElement\" />\n                        <xs:element name=\"sqlDatabaseSink\" type=\"SqlDatabaseSinkElement\" />\n                        <xs:element name=\"consoleSink\" type=\"ConsoleSinkElement\" />\n                        <xs:element name=\"customSink\" type=\"CustomSinkElement\" />\n                        <xs:any namespace=\"##other\" processContents=\"lax\"/>\n                    </xs:choice>\n                </xs:complexType>\n                <xs:unique name=\"sinks\">\n                    <xs:selector xpath=\"etw:*\"/>\n                    <xs:field xpath=\"@name\"/>\n                </xs:unique>\n            </xs:element>\n        </xs:sequence>\n    </xs:complexType>\n\n    <xs:complexType name=\"TraceEventServiceElement\">\n        <xs:attribute name=\"sessionNamePrefix\" type=\"NoEmpty200CharsString\" use=\"optional\" />\n    </xs:complexType>\n\n    <xs:complexType name=\"SinkBaseWithFormatters\" abstract=\"true\">\n        <xs:complexContent mixed=\"false\">\n            <xs:extension base=\"SinkBase\">\n                <xs:choice minOccurs=\"0\" maxOccurs=\"1\">\n                    <xs:element name=\"eventTextFormatter\" type=\"TextEventTextFormatterElement\" />\n                    <xs:element name=\"xmlEventTextFormatter\" type=\"XmlEventTextFormatterElement\" />\n                    <xs:element name=\"jsonEventTextFormatter\" type=\"JsonEventTextFormatterElement\" />\n                    <xs:element name=\"customEventTextFormatter\" type=\"CustomEventTextFormatterElement\" />\n                    <xs:any namespace=\"##other\" processContents=\"lax\"/>\n                </xs:choice>\n            </xs:extension>\n        </xs:complexContent>\n    </xs:complexType>\n\n    <xs:complexType name=\"SinkBase\" abstract=\"true\">\n        <xs:sequence>\n            <xs:element minOccurs=\"1\" maxOccurs=\"1\" name=\"sources\" type=\"SourcesElement\">\n                <xs:unique name=\"eventSourceUniqueName\">\n                    <xs:selector xpath=\"etw:*\"/>\n                    <xs:field xpath=\"@name\"/>\n                </xs:unique>\n                <xs:unique name=\"eventSourceUniqueId\">\n                    <xs:selector xpath=\"etw:*\"/>\n                    <xs:field xpath=\"@id\"/>\n                </xs:unique>\n            </xs:element>\n        </xs:sequence>\n        <xs:attribute name=\"name\" type=\"NoEmpty200CharsString\" use=\"required\" />\n    </xs:complexType>\n\n    <xs:complexType name=\"SourcesElement\">\n        <xs:choice minOccurs=\"1\" maxOccurs=\"unbounded\">\n            <xs:element name=\"eventSource\" type=\"EventSourceElement\"/>\n        </xs:choice>\n    </xs:complexType>\n\n    <xs:complexType name=\"EventSourceElement\">\n        <xs:sequence>\n            <xs:element name=\"arguments\" minOccurs=\"0\" maxOccurs=\"1\">\n                <xs:complexType>\n                    <xs:sequence>\n                        <xs:element name=\"add\" type=\"EventSourceArgumentElement\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n                    </xs:sequence>\n                </xs:complexType>\n                <xs:unique name=\"arguments\">\n                    <xs:selector xpath=\"etw:*\"/>\n                    <xs:field xpath=\"@key\"/>\n                </xs:unique>\n            </xs:element>\n            <xs:element name=\"filter\" minOccurs=\"0\" maxOccurs=\"1\">\n                <xs:complexType>\n                    <xs:sequence>\n                        <xs:element name=\"process\" type=\"EventSourceFilterProcessElement\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n                    </xs:sequence>\n                </xs:complexType>\n                <xs:unique name=\"filter\">\n                    <xs:selector xpath=\"etw:*\"/>\n                    <xs:field xpath=\"@name\"/>\n                </xs:unique>\n            </xs:element>\n        </xs:sequence>\n        <xs:attribute name=\"name\" type=\"NoEmptyString\" use=\"optional\"/>\n        <xs:attribute name=\"id\" type=\"Guid\" use=\"optional\"/>\n        <xs:attribute name=\"level\" type=\"EventLevel\"/>\n        <xs:attribute name=\"matchAnyKeyword\" type=\"xs:long\"/>\n    </xs:complexType>\n\n    <xs:complexType name=\"EventSourceArgumentElement\">\n        <xs:attribute name=\"key\" type=\"NoEmptyString\" use=\"required\"/>\n        <xs:attribute name=\"value\" type=\"xs:string\" use=\"required\"/>\n    </xs:complexType>\n\n    <xs:complexType name=\"EventSourceFilterProcessElement\">\n        <xs:attribute name=\"name\" type=\"NoEmptyString\" use=\"required\"/>\n    </xs:complexType>\n\n    <xs:complexType name=\"FlatFileSinkElement\">\n        <xs:complexContent mixed=\"false\">\n            <xs:extension base=\"SinkBaseWithFormatters\">\n                <xs:attribute name=\"fileName\" type=\"NoEmptyString\" use=\"required\" />\n            </xs:extension>\n        </xs:complexContent>\n    </xs:complexType>\n\n    <xs:complexType name=\"RollingFlatFileSinkElement\">\n        <xs:complexContent mixed=\"false\">\n            <xs:extension base=\"SinkBaseWithFormatters\">\n                <xs:attribute name=\"fileName\" type=\"NoEmptyString\" use=\"required\" />\n                <xs:attribute name=\"rollSizeKB\" type=\"PositiveInteger\" use=\"optional\" />\n                <xs:attribute name=\"timeStampPattern\" type=\"NoEmptyString\" use=\"optional\" />\n                <xs:attribute name=\"rollFileExistsBehavior\" type=\"RollFileExistsBehavior\" use=\"optional\" default=\"Increment\" />\n                <xs:attribute name=\"rollInterval\" type=\"RollInterval\" use=\"optional\" default=\"None\" />\n                <xs:attribute name=\"maxArchivedFiles\" type=\"PositiveInteger\" use=\"optional\" />\n            </xs:extension>\n        </xs:complexContent>\n    </xs:complexType>\n\n    <xs:complexType name=\"WindowsAzureTableSinkElement\">\n        <xs:complexContent mixed=\"false\">\n            <xs:extension base=\"SinkBase\">\n                <xs:attribute name=\"instanceName\" type=\"NoEmptyString\" use=\"required\" />\n                <xs:attribute name=\"connectionString\" type=\"NoEmptyString\" use=\"required\" />\n                <xs:attribute name=\"tableAddress\" type=\"NoEmptyString\" use=\"optional\" />\n                <xs:attribute name=\"sortKeysAscending\" type=\"xs:boolean\" use=\"optional\" />\n                <xs:attribute name=\"bufferingIntervalInSeconds\" type=\"PositiveAndMinusOneInteger\" use=\"optional\" />\n                <xs:attribute name=\"maxBufferSize\" type=\"PositiveInteger\" use=\"optional\" />\n                <xs:attribute name=\"bufferingFlushAllTimeoutInSeconds\" type=\"PositiveAndMinusOneInteger\" use=\"optional\" />\n            </xs:extension>\n        </xs:complexContent>\n    </xs:complexType>\n\n    <xs:complexType name=\"SqlDatabaseSinkElement\">\n        <xs:complexContent mixed=\"false\">\n            <xs:extension base=\"SinkBase\">\n                <xs:attribute name=\"instanceName\" type=\"NoEmptyString\" use=\"required\" />\n                <xs:attribute name=\"connectionString\" type=\"NoEmptyString\" use=\"required\" />\n                <xs:attribute name=\"tableName\" type=\"NoEmptyString\" use=\"optional\" />\n                <xs:attribute name=\"storedProcedureName\" type=\"NoEmptyString\" use=\"optional\" />\n                <xs:attribute name=\"bufferingIntervalInSeconds\" type=\"PositiveAndMinusOneInteger\" use=\"optional\" />\n                <xs:attribute name=\"bufferingCount\" type=\"PositiveInteger\" use=\"optional\" />\n                <xs:attribute name=\"maxBufferSize\" type=\"PositiveInteger\" use=\"optional\" />\n                <xs:attribute name=\"bufferingFlushAllTimeoutInSeconds\" type=\"PositiveAndMinusOneInteger\" use=\"optional\" />\n            </xs:extension>\n        </xs:complexContent>\n    </xs:complexType>\n\n    <xs:complexType name=\"ConsoleSinkElement\">\n        <xs:complexContent mixed=\"false\">\n            <xs:extension base=\"SinkBaseWithFormatters\">\n                <xs:attribute name=\"colorMapperType\" type=\"NoEmptyString\" use=\"optional\" />\n            </xs:extension>\n        </xs:complexContent>\n    </xs:complexType>\n\n    <xs:complexType name=\"CustomSinkElement\">\n        <xs:complexContent mixed=\"false\">\n            <xs:extension base=\"SinkBaseWithFormatters\">\n                <xs:choice>\n                    <xs:element minOccurs=\"0\" maxOccurs=\"1\" name=\"parameters\" type=\"ArrayOfParameterElement\" />\n                </xs:choice>\n                <xs:attribute name=\"type\" type=\"NoEmptyString\" use=\"required\" />\n            </xs:extension>\n        </xs:complexContent>\n    </xs:complexType>\n\n    <xs:complexType name=\"JsonEventTextFormatterElement\">\n        <xs:attribute name=\"formatting\" type=\"EventTextFormatting\" use=\"optional\" default=\"None\" />\n        <xs:attribute name=\"dateTimeFormat\" type=\"NoEmptyString\" use=\"optional\" />\n        <xs:attribute name=\"includeEntrySeparator\" type=\"xs:boolean\" use=\"optional\" />\n    </xs:complexType>\n\n    <xs:complexType name=\"XmlEventTextFormatterElement\">\n        <xs:attribute name=\"formatting\" type=\"EventTextFormatting\" use=\"optional\" default=\"None\"/>\n        <xs:attribute name=\"dateTimeFormat\" type=\"NoEmptyString\" use=\"optional\" />\n    </xs:complexType>\n\n    <xs:complexType name=\"TextEventTextFormatterElement\">\n        <xs:attribute name=\"header\" type=\"xs:string\" use=\"optional\" />\n        <xs:attribute name=\"footer\" type=\"xs:string\" use=\"optional\" />\n        <xs:attribute name=\"verbosityThreshold\" type=\"EventLevel\" use=\"optional\" default=\"Error\" />\n        <xs:attribute name=\"dateTimeFormat\" type=\"NoEmptyString\" use=\"optional\" />\n    </xs:complexType>\n\n    <xs:complexType name=\"CustomEventTextFormatterElement\">\n        <xs:sequence>\n            <xs:element minOccurs=\"0\" maxOccurs=\"1\" name=\"parameters\" type=\"ArrayOfParameterElement\" />\n        </xs:sequence>\n        <xs:attribute name=\"type\" type=\"NoEmptyString\" use=\"required\" />\n    </xs:complexType>\n\n    <xs:complexType name=\"ArrayOfParameterElement\">\n        <xs:sequence>\n            <xs:element minOccurs=\"1\" maxOccurs=\"unbounded\" name=\"parameter\" nillable=\"true\" type=\"ParameterElement\" />\n        </xs:sequence>\n    </xs:complexType>\n\n    <xs:complexType name=\"ParameterElement\">\n        <xs:sequence>\n            <xs:element minOccurs=\"0\" maxOccurs=\"1\" name=\"parameters\" type=\"ArrayOfParameterElement\" />\n        </xs:sequence>\n        <xs:attribute name=\"name\" type=\"NoEmptyString\" />\n        <xs:attribute name=\"type\" type=\"NoEmptyString\" use=\"required\"/>\n        <xs:attribute name=\"value\" type=\"xs:string\" use=\"optional\" />\n    </xs:complexType>\n\n    <xs:simpleType name=\"EventTextFormatting\">\n        <xs:restriction base=\"xs:string\">\n            <xs:enumeration value=\"None\" />\n            <xs:enumeration value=\"Indented\" />\n        </xs:restriction>\n    </xs:simpleType>\n\n    <xs:simpleType name=\"EventLevel\">\n        <xs:restriction base=\"xs:string\">\n            <xs:enumeration value=\"LogAlways\" />\n            <xs:enumeration value=\"Critical\" />\n            <xs:enumeration value=\"Error\" />\n            <xs:enumeration value=\"Warning\" />\n            <xs:enumeration value=\"Informational\" />\n            <xs:enumeration value=\"Verbose\" />\n        </xs:restriction>\n    </xs:simpleType>\n\n    <xs:simpleType name=\"RollFileExistsBehavior\">\n        <xs:restriction base=\"xs:string\">\n            <xs:enumeration value=\"Overwrite\" />\n            <xs:enumeration value=\"Increment\" />\n        </xs:restriction>\n    </xs:simpleType>\n\n    <xs:simpleType name=\"RollInterval\">\n        <xs:restriction base=\"xs:string\">\n            <xs:enumeration value=\"None\" />\n            <xs:enumeration value=\"Minute\" />\n            <xs:enumeration value=\"Hour\" />\n            <xs:enumeration value=\"Day\" />\n            <xs:enumeration value=\"Week\" />\n            <xs:enumeration value=\"Month\" />\n            <xs:enumeration value=\"Year\" />\n            <xs:enumeration value=\"Midnight\" />\n        </xs:restriction>\n    </xs:simpleType>\n\n    <xs:simpleType name=\"Guid\">\n        <xs:restriction base=\"xs:string\">\n            <xs:pattern value=\"[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\" />\n        </xs:restriction>\n    </xs:simpleType>\n\n    <xs:simpleType name=\"NoEmptyString\">\n        <xs:restriction base=\"xs:string\">\n            <xs:minLength value=\"1\" />\n            <xs:pattern value=\".*[^\\s].*\" />\n        </xs:restriction>\n    </xs:simpleType>\n\n    <xs:simpleType name=\"NoEmpty200CharsString\">\n        <xs:restriction base=\"xs:string\">\n            <xs:minLength value=\"1\" />\n            <xs:maxLength value=\"200\" />\n            <xs:pattern value=\".*[^\\s].*\" />\n        </xs:restriction>\n    </xs:simpleType>\n\n    <xs:simpleType name=\"PositiveInteger\">\n        <xs:restriction base=\"xs:int\">\n            <xs:pattern value=\"^[0-9]+$\" />\n        </xs:restriction>\n    </xs:simpleType>\n\n    <xs:simpleType name=\"PositiveAndMinusOneInteger\">\n        <xs:restriction base=\"xs:int\">\n            <xs:pattern value=\"^-[1]+$|^[0-9]+$\" />\n        </xs:restriction>\n    </xs:simpleType>\n\n</xs:schema>"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/SemanticLogging.Etw.WindowsService.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{0EBF89E7-D2B2-4968-BC17-0DA066029C46}</ProjectGuid>\n    <OutputType>Exe</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service</RootNamespace>\n    <AssemblyName>SemanticLogging-svc</AssemblyName>\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>..\\..\\..\\bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>\n    <CodeAnalysisRuleSet>..\\..\\EnterpriseLibrary.ruleset</CodeAnalysisRuleSet>\n    <Prefer32Bit>false</Prefer32Bit>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>..\\..\\..\\bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n    <Prefer32Bit>false</Prefer32Bit>\n  </PropertyGroup>\n  <PropertyGroup>\n    <StartupObject />\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Configuration\" />\n    <Reference Include=\"System.Configuration.Install\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Management\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.ServiceProcess\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"..\\..\\GlobalAssemblyInfo.cs\">\n      <Link>GlobalAssemblyInfo.cs</Link>\n    </Compile>\n    <Compile Include=\"ApplicationExitCode.cs\" />\n    <Compile Include=\"AssemblyExtensions.cs\" />\n    <Compile Include=\"Constants.cs\" />\n    <Compile Include=\"GlobalSuppressions.cs\" />\n    <Compile Include=\"ParameterOptions.cs\" />\n    <Compile Include=\"ParameterSet.cs\" />\n    <Compile Include=\"Parameter.cs\" />\n    <Compile Include=\"Properties\\Resources.Designer.cs\">\n      <AutoGen>True</AutoGen>\n      <DesignTime>True</DesignTime>\n      <DependentUpon>Resources.resx</DependentUpon>\n    </Compile>\n    <Compile Include=\"ServiceEventLogSink.cs\" />\n    <Compile Include=\"TraceEventServiceHostInstaller.cs\">\n      <SubType>Component</SubType>\n    </Compile>\n    <Compile Include=\"TraceEventServiceHost.cs\">\n      <SubType>Component</SubType>\n    </Compile>\n    <Compile Include=\"Application.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\SemanticLogging.TextFile\\SemanticLogging.TextFile.csproj\">\n      <Project>{4b187511-187b-48b1-a593-18ba835b49c3}</Project>\n      <Name>SemanticLogging.TextFile</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\SemanticLogging.Etw\\SemanticLogging.Etw.csproj\">\n      <Project>{8440aea2-cd55-42a0-8724-2ecce2b32374}</Project>\n      <Name>SemanticLogging.Etw</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\SemanticLogging\\SemanticLogging.csproj\">\n      <Project>{2cd4105b-0dd6-4c18-9b37-05d8e8f57303}</Project>\n      <Name>SemanticLogging</Name>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"..\\..\\SemanticLogging.licenseheader\">\n      <Link>SemanticLogging.licenseheader</Link>\n    </None>\n    <None Include=\"app.config\" />\n    <Content Include=\"SemanticLogging-svc.xsd\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n  </ItemGroup>\n  <ItemGroup>\n    <EmbeddedResource Include=\"Properties\\Resources.resx\">\n      <Generator>ResXFileCodeGenerator</Generator>\n      <LastGenOutput>Resources.Designer.cs</LastGenOutput>\n    </EmbeddedResource>\n  </ItemGroup>\n  <ItemGroup>\n    <Content Include=\"SemanticLogging-svc.xml\">\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n      <SubType>Designer</SubType>\n    </Content>\n  </ItemGroup>\n  <PropertyGroup>\n    <DefineConstants Condition=\" '$(SignAssembly)' == 'true' \">$(DefineConstants);SIGN</DefineConstants>\n  </PropertyGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <Import Project=\"..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets\" Condition=\"Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets'))\" />\n  </Target>\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/ServiceEventLogSink.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics;\nusing System.Diagnostics.Tracing;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service\n{\n    internal class ServiceEventLogSink : IObserver<EventEntry>\n    {\n        private readonly IEventTextFormatter formatter;\n        private EventLog eventLog;\n\n        internal ServiceEventLogSink(EventLog eventLog)\n        {\n            this.eventLog = eventLog;\n            this.formatter = new EventTextFormatter();\n        }\n\n        public void OnCompleted()\n        {\n            this.eventLog = null;\n        }\n\n        public void OnError(Exception error)\n        {\n            this.eventLog = null;\n        }\n\n        public void OnNext(EventEntry value)\n        {\n            var log = this.eventLog;\n            if (log != null)\n            {                \n                log.WriteEntry(this.formatter.WriteEvent(value), this.ToEventLogEntryType(value.Schema.Level));\n            }\n        }\n\n        private EventLogEntryType ToEventLogEntryType(EventLevel level)\n        {\n            switch (level)\n            {\n                case EventLevel.Critical:\n                case EventLevel.Error:\n                    return EventLogEntryType.Error;\n                case EventLevel.Warning:\n                    return EventLogEntryType.Warning;\n                default:\n                    return EventLogEntryType.Information;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/TraceEventServiceHost.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.ComponentModel;\nusing System.Configuration;\nusing System.Diagnostics;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\nusing System.ServiceProcess;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service.Properties;\nusing System.Reflection;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service\n{\n    /// <summary>\n    /// The windows service host class for <see cref=\"TraceEventService\"/> class.\n    /// </summary>\n    public partial class TraceEventServiceHost : ServiceBase\n    {\n        private const string EtwConfigurationFileNameKey = \"EtwConfigurationFileName\";\n        private const string NonTransientErrorsEventLevelKey = \"NonTransientErrorsEventLevel\";\n\n        // Capture non-transient errors from internal SLAB EventSource\n        private EventListener slabNonTransientErrors;\n\n        private TraceEventService service;\n        private bool consoleMode;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"TraceEventServiceHost\" /> class.\n        /// </summary>\n        public TraceEventServiceHost()\n        {\n            this.Initialize();\n        }\n\n        // For running in Console mode\n        internal void Start()\n        {\n            this.consoleMode = true;\n            this.OnStart(null);\n        }\n\n        /// <summary>\n        /// When implemented in a derived class, executes when a Start command is sent to the service by the Service Control Manager (SCM) or when the operating system starts (for a service that starts automatically). Specifies actions to take when the service starts.\n        /// </summary>\n        /// <param name=\"args\">Data passed by the start command.</param>\n        protected override void OnStart(string[] args)\n        {\n            try\n            {\n                string configFile = GetConfigFileFullPath();\n                var configuration = TraceEventServiceConfiguration.Load(configFile, monitorChanges: true);\n                configuration.Settings.PropertyChanged += this.OnTraceEventServiceSettingsChanged;\n                this.service = new TraceEventService(configuration);\n\n                if (this.consoleMode)\n                {\n                    this.service.StatusChanged += this.OnServiceStatusChanged;\n                }\n\n                this.ShowConfiguration(configuration, configFile);\n                this.EnableNonTransientErrorsHandling();\n\n                this.service.Start();\n            }\n            catch (Exception e)\n            {\n                // log and rethrow to notify SCM\n                if (!this.consoleMode)\n                {\n                    LogException(e);\n                }\n\n                throw;\n            }\n        }\n\n        /// <summary>\n        /// When implemented in a derived class, executes when a Stop command is sent to the service by the Service Control Manager (SCM). Specifies actions to take when a service stops running.\n        /// </summary>\n        protected override void OnStop()\n        {\n            // Short-cut if TraceEventService was not started or is already stopped.\n            if (this.service == null)\n            {\n                return;\n            }\n\n            try\n            {\n                this.service.Dispose();\n                this.service = null;\n                this.DisableNonTransientErrorsHandling();\n                if (!this.consoleMode)\n                {\n                    this.EventLog.WriteEntry(Resources.ServiceStoppedMessage);\n                }\n            }\n            catch (Exception e)\n            {\n                // Notify in console error handling\n                if (this.consoleMode)\n                {\n                    throw;\n                }\n\n                // Do not rethrow in Service mode so SCM can mark this service as stopped (this will allow to uninstall the service properly) \n                this.EventLog.WriteEntry(e.ToString(), EventLogEntryType.Error);\n            }\n        }\n\n        /// <summary>\n        /// Disposes of the resources (other than memory) used by the <see cref=\"T:System.ServiceProcess.ServiceBase\" />.\n        /// </summary>\n        /// <param name=\"disposing\">True to release both managed and unmanaged resources; false to release only unmanaged resources.</param>\n        [SuppressMessage(\"Microsoft.Usage\", \"CA2213:DisposableFieldsShouldBeDisposed\", MessageId = \"configWatcher\", Justification = \"Disposed in OnStop()\"),\n         SuppressMessage(\"Microsoft.Usage\", \"CA2213:DisposableFieldsShouldBeDisposed\", MessageId = \"service\", Justification = \"Disposed in OnStop()\"),\n         SuppressMessage(\"Microsoft.Usage\", \"CA2213:DisposableFieldsShouldBeDisposed\", MessageId = \"slabNonTransientErrors\", Justification = \"Disposed in OnStop()\")]\n        protected override void Dispose(bool disposing)\n        {\n            this.OnStop();\n            base.Dispose(disposing);\n        }\n\n        private static string GetConfigFileFullPath()\n        {\n            string configFile = ConfigurationManager.AppSettings[EtwConfigurationFileNameKey];\n\n            if (string.IsNullOrWhiteSpace(configFile))\n            {\n                throw new ArgumentException(Resources.ConfigFileNameNotFoundError);\n            }\n\n            if (Path.IsPathRooted(configFile))\n            {\n                return configFile;\n            }\n\n            return Path.GetFullPath(configFile);\n        }\n\n        private void Initialize()\n        {\n            this.AutoLog = false;\n            this.ServiceName = Constants.ServiceName;\n\n            // Set current folder to this instance location so any relative file path\n            // referenced in any EventListener will point to this folder.\n            Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);\n        }\n\n        private void ShowConfiguration(TraceEventServiceConfiguration configuration, string file)\n        {\n            var sb = new StringBuilder();\n\n            sb.AppendFormat(Resources.LoadedConfigurationMessage, file);\n            sb.AppendLine();\n            sb.AppendLine();\n\n            if (configuration.SinkSettings.Count > 0)\n            {\n                sb.AppendFormat(Resources.EventSessionMessage, configuration.Settings.SessionNamePrefix);\n                sb.AppendLine();\n\n                foreach (var sink in configuration.SinkSettings)\n                {\n                    sb.AppendLine();\n                    sb.AppendFormat(Resources.SinkNameMessage, sink.Name);\n                    sb.AppendLine();\n                    sb.AppendLine(Resources.EventSourceListMessage);\n\n                    foreach (var eventSource in sink.EventSources)\n                    {\n                        sb.AppendFormat(Resources.EventSourceNameMessage, eventSource.EventSourceId);\n                        sb.AppendLine();\n                        sb.AppendFormat(Resources.EventSourceDescriptionMessage, eventSource.Name, eventSource.Level, eventSource.MatchAnyKeyword);\n                        sb.AppendLine();\n\n                        if (eventSource.Arguments.Any())\n                        {\n                            sb.AppendFormat(\n                                Resources.EventSourceArgumentsMessage,\n                                string.Join(\n                                    \", \",\n                                    eventSource.Arguments.Select(kvp => string.Format(\"\\\"{0}\\\" = \\\"{1}\\\"\", kvp.Key, kvp.Value))));\n                            sb.AppendLine();\n                        }\n\n                        if (eventSource.ProcessNamesToFilter.Any())\n                        {\n                            sb.AppendFormat(Resources.EventSourceProcessNamesMessage, string.Join(\", \", eventSource.ProcessNamesToFilter));\n                            sb.AppendLine();\n                        }\n                    }\n                }\n            }\n            else\n            {\n                sb.AppendLine(Resources.UpdateConfigFileMessage);\n            }\n\n            if (this.consoleMode)\n            {\n                Console.WriteLine(sb.ToString());\n            }\n            else\n            {\n                this.EventLog.WriteEntry(sb.ToString(), EventLogEntryType.Information);\n            }\n        }\n\n        private void OnServiceStatusChanged(object sender, StatusChangedEventArgs e)\n        {\n            switch (e.Status)\n            {\n                case ServiceStatus.Started:\n                    Console.WriteLine(Resources.StartedServiceMessage);\n                    break;\n                case ServiceStatus.Stopping:\n                    Console.WriteLine(Resources.ShutdownServiceMessage);\n                    break;\n                default:\n                    Console.WriteLine(e.Status);\n                    break;\n            }\n        }\n\n        private void OnTraceEventServiceSettingsChanged(object sender, PropertyChangedEventArgs e)\n        {\n            // We should recycle on any settings changes\n            if (this.consoleMode)\n            {\n                Console.WriteLine(Resources.RecyclingServiceOnConfigChanged);\n            }\n            else\n            {\n                this.EventLog.WriteEntry(Resources.RecyclingServiceOnConfigChanged, EventLogEntryType.Information);\n            }\n\n            // schedule recycle to decouple from current context\n            Task.Run(() => this.RecycleService());\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Justification = \"Exception is logged to event log and service is shut down.\")]\n        private void RecycleService()\n        {\n            try\n            {\n                this.OnStop();\n                this.OnStart(null);\n            }\n            catch (Exception e)\n            {\n                if (this.consoleMode)\n                {\n                    Console.WriteLine(e.ToString());\n                }\n                else\n                {\n                    this.EventLog.WriteEntry(e.ToString(), EventLogEntryType.Error);\n                }\n\n                Environment.Exit((int)ApplicationExitCode.InputError);\n            }\n        }\n\n        private void EnableNonTransientErrorsHandling()\n        {\n            var observable = new ObservableEventListener();\n            this.slabNonTransientErrors = observable;\n\n            if (this.consoleMode)\n            {\n                observable.LogToConsole();\n            }\n            else\n            {\n                observable.Subscribe(new ServiceEventLogSink(this.EventLog));\n            }\n\n            EventLevel level;\n            if (!Enum.TryParse(ConfigurationManager.AppSettings[NonTransientErrorsEventLevelKey], out level))\n            {\n                level = EventLevel.LogAlways;\n            }\n\n            this.slabNonTransientErrors.EnableEvents(SemanticLoggingEventSource.Log, level, Keywords.All);\n\n            // Capture any unhandled error in worker threads\n            AppDomain.CurrentDomain.UnhandledException += this.OnAppDomainUnhandledException;\n\n            // Handle unobserved task exceptions\n            TaskScheduler.UnobservedTaskException += this.OnUnobservedTaskException;\n        }\n\n        private void DisableNonTransientErrorsHandling()\n        {\n            if (this.slabNonTransientErrors != null)\n            {\n                this.slabNonTransientErrors.DisableEvents(SemanticLoggingEventSource.Log);\n                this.slabNonTransientErrors.Dispose();\n                this.slabNonTransientErrors = null;\n            }\n\n            AppDomain.CurrentDomain.UnhandledException -= this.OnAppDomainUnhandledException;\n            TaskScheduler.UnobservedTaskException -= this.OnUnobservedTaskException;\n        }\n\n        private void OnAppDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)\n        {\n            this.NotifyError((Exception)e.ExceptionObject);\n        }\n\n        private void OnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)\n        {\n            e.SetObserved();\n            this.NotifyError(e.Exception);\n        }\n\n        private void NotifyError(Exception error)\n        {\n            if (this.consoleMode)\n            {\n                Console.WriteLine(error.ToString());\n            }\n            else\n            {\n                this.EventLog.WriteEntry(error.ToString(), EventLogEntryType.Error);\n            }\n        }\n\n        private void LogException(Exception e)\n        {\n            var rtle = e as ReflectionTypeLoadException;\n            if (rtle != null)\n            {\n                LogLoaderExceptions(rtle);\n            }\n\n            this.EventLog.WriteEntry(e.ToString(), EventLogEntryType.Error);\n        }\n\n        private void LogLoaderExceptions(ReflectionTypeLoadException e)\n        {\n            foreach (var loaderException in e.LoaderExceptions)\n            {\n                this.EventLog.WriteEntry(loaderException.ToString(), EventLogEntryType.Error);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/TraceEventServiceHostInstaller.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections;\nusing System.ComponentModel;\nusing System.Configuration.Install;\nusing System.Globalization;\nusing System.ServiceProcess;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service.Properties;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Service\n{\n    /// <summary>\n    /// The installer class for <see cref=\"TraceEventServiceHost\"/>.\n    /// </summary>\n    [RunInstaller(true)]\n    public class TraceEventServiceHostInstaller : Installer\n    {\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"TraceEventServiceHostInstaller\" /> class.\n        /// </summary>\n        public TraceEventServiceHostInstaller()\n        {\n            this.Initialize();\n        }\n\n        public ServiceProcessInstaller ServiceProcessInstaller { get; set; }\n\n        protected override void OnBeforeInstall(IDictionary savedState)\n        {\n            this.UpdateServiceAccount();\n            base.OnBeforeInstall(savedState);\n        }\n\n        private void Initialize()\n        {\n            this.ServiceProcessInstaller =\n                new ServiceProcessInstaller\n                {\n                    Account = ServiceAccount.LocalService\n                };\n\n            var serviceInstaller =\n                new ServiceInstaller\n                {\n                    ServiceName = Constants.ServiceName,\n                    Description = Resources.ServiceDescription,\n                    DisplayName = Resources.ServiceDisplayName,\n                    StartType = ServiceStartMode.Manual\n                };\n\n            this.Installers.AddRange(new Installer[] { this.ServiceProcessInstaller, serviceInstaller });\n        }\n\n        private void UpdateServiceAccount()\n        {\n            var accountType = this.Context.Parameters[\"account\"];\n            if (accountType != null)\n            {\n                if (string.Equals(accountType, \"user\", StringComparison.OrdinalIgnoreCase))\n                {\n                    this.ServiceProcessInstaller.Account = ServiceAccount.User;\n                }\n                else if (string.Equals(accountType, \"localservice\", StringComparison.OrdinalIgnoreCase))\n                {\n                    this.ServiceProcessInstaller.Account = ServiceAccount.LocalService;\n                }\n                else if (string.Equals(accountType, \"localsystem\", StringComparison.OrdinalIgnoreCase))\n                {\n                    this.ServiceProcessInstaller.Account = ServiceAccount.LocalSystem;\n                }\n                else\n                {\n                    throw new InvalidOperationException(\n                        string.Format(CultureInfo.CurrentCulture, Resources.ServiceInvalidAccount,\n                            this.Context.Parameters[\"account\"]));\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/app.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n  <startup>\n    <supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.5\" />\n  </startup>\n  <appSettings>\n    <add key=\"EtwConfigurationFileName\" value=\"SemanticLogging-svc.xml\" />\n    <add key=\"NonTransientErrorsEventLevel\" value=\"LogAlways\"/> <!-- value=[see System.Diagnostics.Tracing.EventLevel] -->\n  </appSettings>\n  <system.diagnostics>\n    <sources>\n      <source name=\"SemanticLogging-svc\" switchValue=\"Verbose\">\n        <listeners>\n          <remove name=\"Default\" />\n          <add name=\"console\" />\n        </listeners>\n      </source>\n    </sources>\n    <sharedListeners>\n      <add name=\"console\" type=\"System.Diagnostics.ConsoleTraceListener\" />\n    </sharedListeners>\n  </system.diagnostics>\n  <runtime>\n    <gcServer enabled=\"true\" />\n    <gcConcurrent enabled=\"true\" />\n    <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">\n      <dependentAssembly>\n        <assemblyIdentity name=\"Microsoft.Data.OData\" publicKeyToken=\"31bf3856ad364e35\" culture=\"neutral\" />\n        <bindingRedirect oldVersion=\"0.0.0.0-5.2.0.0\" newVersion=\"5.2.0.0\" />\n      </dependentAssembly>\n    </assemblyBinding>\n  </runtime>\n</configuration>"
  },
  {
    "path": "source/Src/SemanticLogging.Etw.WindowsService/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"StyleCop.MSBuild\" version=\"4.7.49.0\" targetFramework=\"net45\" developmentDependency=\"true\" />\n</packages>"
  },
  {
    "path": "source/Src/SemanticLogging.EventSourceAnalyzer/EventSourceAnalyzer.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Globalization;\nusing System.Linq;\nusing System.Reflection;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Properties;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility\n{\n    /// <summary>\n    /// Helper class to validate the correctness of <see cref=\"EventSource\"/> instances. Useful in unit tests.\n    /// </summary>\n    /// <example>\n    ///   <code>EventSourceAnalyzer.InspectAll(MyEventSource.Instance);</code>\n    ///   <remarks>Where 'Instance' property returns a singleton instance of 'MyEventSource' class like:\n    ///     <code>public static MyEventSource Instance = new MyEventSource();</code>\n    ///   </remarks>\n    /// </example>\n    public sealed class EventSourceAnalyzer\n    {\n        private const BindingFlags Bindings = BindingFlags.Instance |\n                                              BindingFlags.DeclaredOnly |\n                                              BindingFlags.InvokeMethod |\n                                              BindingFlags.NonPublic |\n                                              BindingFlags.Public;\n\n        /// <summary>\n        /// Gets or sets a value indicating whether to exclude the internal <see cref=\"System.Diagnostics.Tracing.EventListener\"/> instance to emulate sending events.\n        /// </summary>\n        /// <remarks>\n        /// The analyzer performs a 'probing' execution using an internal <see cref=\"System.Diagnostics.Tracing.EventListener\"/> instance to emulate logging using the inspected <see cref=\"EventSource\"/> instance.\n        /// By excluding this analysis, no ETW events will be sent in case of executing the analysis from a running application where ETW events may be monitored.\n        /// </remarks>\n        /// <value>\n        /// <c>true</c> for excluding this analysis, <c>false</c> otherwise.\n        /// </value>\n        public bool ExcludeEventListenerEmulation { get; set; }\n\n        /// <summary>\n        /// Gets or sets a value indicating whether to exclude an exact type mapping between the event arguments and 'EventSource.WriteEvent' argument.\n        /// </summary>\n        /// <value>\n        /// <c>true</c> for excluding this analysis, <c>false</c> otherwise.\n        /// </value>\n        public bool ExcludeWriteEventTypeMapping { get; set; }\n\n        /// <summary>\n        /// Gets or sets a value indicating whether to exclude the type order analysis between the event arguments and the 'EventSource.WriteEvent' arguments order.\n        /// This process is costly and may be excluded for large event sources with events with many arguments. \n        /// However it is recommended to leave this option off (default) to ensure that all 'EventSource.WriteEvent' arguments are correctly mapped to the event parameters.\n        /// </summary>\n        /// <value>\n        /// <c>true</c> for excluding this analysis, <c>false</c> otherwise.\n        /// </value>\n        public bool ExcludeWriteEventTypeOrder { get; set; }\n\n        /// <summary>\n        /// Inspects the specified <see cref=\"EventSource\" /> for potential runtime errors.\n        /// </summary>\n        /// <param name=\"eventSource\">The event source instance to inspect.</param>\n        /// <example>\n        ///   <code>EventSourceAnalyzer.InspectAll(MyEventSource.Instance);</code>\n        ///   <remarks>Where 'Instance' property returns a singleton instance of 'MyEventSource' class like:\n        ///     <code>public static MyEventSource Instance = new MyEventSource();</code>\n        ///   </remarks>\n        /// </example>\n        /// <exception cref=\"EventSourceAnalyzerException\">Exception thrown if a failure was found in the specified <see cref=\"System.Diagnostics.Tracing.EventSource\" />.</exception>\n        /// <exception cref=\"ArgumentException\">Exception thrown if a failure was found in the specified <see cref=\"System.Diagnostics.Tracing.EventSource\" />.</exception>\n        public static void InspectAll(EventSource eventSource)\n        {\n            var instance = new EventSourceAnalyzer();\n            instance.Inspect(eventSource);\n        }\n\n        /// <summary>\n        /// Inspects the specified <see cref=\"System.Diagnostics.Tracing.EventSource\" /> for potential runtime errors \n        /// filtering out validations according to the specified instance properties.\n        /// </summary>\n        /// <param name=\"eventSource\">The event source instance to inspect.</param>\n        /// <example>\n        ///   <code>EventSourceAnalyzer.InspectAll(MyEventSource.Instance);</code>\n        ///   <remarks>Where 'Instance' property returns a singleton instance of 'MyEventSource' class like:\n        ///   <code>public static MyEventSource Instance = new MyEventSource();</code>\n        ///   </remarks>\n        /// </example>\n        /// <exception cref=\"EventSourceAnalyzerException\">Exception thrown if a failure was found in the specified <see cref=\"System.Diagnostics.Tracing.EventSource\" />.</exception>\n        /// <exception cref=\"ArgumentException\">Exception thrown if a failure was found in the specified <see cref=\"System.Diagnostics.Tracing.EventSource\" />.</exception>\n        public void Inspect(EventSource eventSource)\n        {\n            Guard.ArgumentNotNull(eventSource, \"eventSource\");\n\n            // Check internal validation when binding to a listener with EnableEvents().\n            this.CheckEnableEvents(eventSource);\n\n            var eventSchemas = this.GetEventSchemas(eventSource);\n            if (eventSchemas.Count == 0)\n            {\n                throw new EventSourceAnalyzerException(Resources.EventSourceAnalyzerNoEventsError);\n            }\n\n            if (!this.ExcludeEventListenerEmulation)\n            {\n                foreach (EventSchema eventSchema in eventSchemas)\n                {\n                    this.ProbeEvent(eventSchema, eventSource);\n                }\n            }\n        }\n\n        private MethodInfo GetMethodFromSchema(EventSource source, EventSchema schema)\n        {\n            return source.GetType().GetMethods(Bindings).SingleOrDefault(m => this.IsEvent(m, schema.Id)) ??\n                   source.GetType().GetMethod(schema.TaskName, Bindings);\n        }\n\n        private bool IsEvent(MethodInfo method, int eventId)\n        {\n            return method.GetCustomAttribute<EventAttribute>() != null &&\n                   method.GetCustomAttribute<EventAttribute>().EventId == eventId;\n        }\n\n        private void CheckEnableEvents(EventSource eventSource)\n        {\n            using (var listener = new ProbeEventListener())\n            {\n                //// EnableEvents will do a general validation pass\n                listener.EnableEvents(eventSource, EventLevel.LogAlways);\n                //// Restore source\n                listener.DisableEvents(eventSource);\n            }\n        }\n\n        private ICollection<EventSchema> GetEventSchemas(EventSource eventSource)\n        {\n            try\n            {\n                string manifest = EventSource.GenerateManifest(eventSource.GetType(), null);\n                this.CheckForBadFormedManifest(manifest);\n                return new EventSourceSchemaReader().GetSchema(manifest).Values;\n            }\n            catch (EventSourceAnalyzerException)\n            {\n                throw;\n            }\n            catch (Exception e)\n            {\n                throw new EventSourceAnalyzerException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.EventSourceAnalyzerManifestGenerationError, e.Message, EventSource.GenerateManifest(eventSource.GetType(), null)));\n            }\n        }\n\n        private void CheckForBadFormedManifest(string manifest)\n        {\n            // check for map values for Enum types other than Int21 and Int64.\n            if (manifest.IndexOf(\"\\\"0x\\\"\", StringComparison.OrdinalIgnoreCase) >= 0)\n            {\n                throw new EventSourceAnalyzerException(Properties.Resources.EventSourceAnalyzerBadFormedManifestError);\n            }\n        }\n\n        private void ProbeEvent(EventSchema eventSchema, EventSource source)\n        {\n            using (var listener = new ProbeEventListener(eventSchema, this))\n            {\n                try\n                {\n                    listener.EnableEvents(source, eventSchema.Level, eventSchema.Keywords);\n                    MethodInfo method;\n                    if (this.TryInvokeMethod(eventSchema, source, listener, out method))\n                    {\n                        if (listener.EventData == null)\n                        {\n                            throw new EventSourceAnalyzerException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.EventSourceAnalyzerMissingWriteEventCallError, method.Name));\n                        }\n\n                        if (listener.Error != null)\n                        {\n                            throw listener.Error;\n                        }\n                    }\n                }\n                finally\n                {\n                    listener.DisableEvents(source);\n                }\n            }\n        }\n\n        private bool TryInvokeMethod(EventSchema eventSchema, EventSource source, ProbeEventListener listener, out MethodInfo method)\n        {\n            //// Find the method that matches event id or task name\n            method = this.GetMethodFromSchema(source, eventSchema);\n\n            if (method != null)\n            {\n                try\n                {\n                    // Call with default values to perform all checks but order\n                    ParameterInfo[] parameters = method.GetParameters();\n                    object[] defaultValues = parameters.Select(p => p.ParameterType.Default()).ToArray();\n                    method.Invoke(source, defaultValues);\n\n                    if (listener.Error == null && !this.ExcludeWriteEventTypeOrder)\n                    {\n                        // Invoke the method at most N-1 times, where N == params count.\n                        for (int i = 0; i < parameters.Length - 1; i++)\n                        {\n                            listener.TypeOrderOffset = i;\n                            defaultValues[i] = parameters[i].ParameterType.NotDefault();\n                            method.Invoke(source, defaultValues);\n                            if (listener.Error != null)\n                            {\n                                break;\n                            }\n                        }\n                    }\n\n                    return true;\n                }\n                catch (ArgumentException e)\n                {\n                    throw new EventSourceAnalyzerException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.EventSourceAnalyzerMethodCallError, method.Name), e);\n                }\n            }\n\n            return false;\n        }\n\n        private class ProbeEventListener : EventListener\n        {\n            private EventSchema eventSchema;\n            private EventSourceAnalyzer analyzer;\n\n            internal ProbeEventListener(EventSchema eventSchema = null, EventSourceAnalyzer analyzer = null)\n            {\n                this.eventSchema = eventSchema;\n                this.analyzer = analyzer;\n                this.TypeOrderOffset = -1;\n            }\n\n            internal EventWrittenEventArgs EventData { get; set; }\n\n            internal Exception Error { get; set; }\n\n            internal int TypeOrderOffset { get; set; }\n\n            [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Justification = \"Exception is stored for further analysis\")]\n            protected override void OnEventWritten(EventWrittenEventArgs eventData)\n            {\n                this.EventData = eventData;\n\n                try\n                {\n                    if (this.TypeOrderOffset != -1)\n                    {\n                        this.CheckParametersOrder();\n                        return;\n                    }\n\n                    this.CheckPayload();\n                }\n                catch (Exception e)\n                {\n                    this.Error = e;\n                }\n            }\n\n            private static bool EqualTypes(Type parameterType, Type payloadType)\n            {\n                return parameterType.IsEnum && !payloadType.IsEnum ?\n                    parameterType.GetEnumUnderlyingType() == payloadType :\n                    parameterType == payloadType;\n            }\n\n            private void CheckParametersOrder()\n            {\n                MethodInfo eventMethod = this.analyzer.GetMethodFromSchema(this.EventData.EventSource, this.eventSchema);\n                ParameterInfo[] eventParameters = eventMethod.GetParameters();\n                int payloadParameterOffset = 0;\n                if (this.HasRelatedActivityId(eventParameters))\n                {\n                    if (this.TypeOrderOffset == 0)\n                    {\n                        // ignore the relatedActivityId parameter (first by convention)\n                        return;\n                    }\n\n                    payloadParameterOffset = 1;\n                }\n\n                //// If we get the default value then order is wrong becase \n                //// we should get a value != default\n                if (this.EventData.Payload[this.TypeOrderOffset - payloadParameterOffset].IsDefault())\n                {\n                    this.Error = new EventSourceAnalyzerException(string.Format(CultureInfo.CurrentCulture,\n                        Properties.Resources.EventSourceAnalyzerMismatchParametersOrder,\n                        eventParameters[this.TypeOrderOffset].Name,\n                        eventMethod.Name));\n                }\n            }\n\n            private void CheckPayload()\n            {\n                MethodInfo eventMethod = this.analyzer.GetMethodFromSchema(this.EventData.EventSource, this.eventSchema);\n                ParameterInfo[] eventParameters = eventMethod.GetParameters();\n                int payloadParameterOffset = this.HasRelatedActivityId(eventParameters) ? 1 : 0;\n\n                if (eventParameters.Length != this.EventData.Payload.Count + payloadParameterOffset)\n                {\n                    this.Error = new EventSourceAnalyzerException(string.Format(CultureInfo.CurrentCulture, Properties.Resources.EventSourceAnalyzerDifferentParameterCount, eventMethod.Name));\n                    return;\n                }\n\n                for (int i = 0; i < this.EventData.Payload.Count; i++)\n                {\n                    if (this.EventData.Payload[i] == null)\n                    {\n                        // We don't expect null values here so flag it and exit\n                        this.Error = new EventSourceAnalyzerException(string.Format(CultureInfo.CurrentCulture,\n                            Properties.Resources.EventSourceAnalyzerNullPayloadValue,\n                            i,\n                            eventParameters[i + payloadParameterOffset].Name,\n                            eventMethod.Name));\n                        break;\n                    }\n\n                    Type payloadType = this.EventData.Payload[i].GetType();\n\n                    //// Check that event args types matches WriteEvent arg types\n                    if (!this.analyzer.ExcludeWriteEventTypeMapping &&\n                        !EqualTypes(eventParameters[i + payloadParameterOffset].ParameterType, payloadType))\n                    {\n                        this.Error = new EventSourceAnalyzerException(string.Format(CultureInfo.CurrentCulture,\n                            Properties.Resources.EventSourceAnalyzerMismatchParametersType,\n                            eventParameters[i + payloadParameterOffset].Name,\n                            eventParameters[i + payloadParameterOffset].ParameterType,\n                            payloadType,\n                            eventMethod.Name));\n                        break;\n                    }\n                }\n            }\n\n            private bool HasRelatedActivityId(ParameterInfo[] eventParameters)\n            {\n                if (eventParameters.Length > 0\n                    && eventParameters[0].ParameterType == typeof(Guid)\n                    && string.Equals(eventParameters[0].Name, \"relatedActivityId\", StringComparison.Ordinal)\n                    && (this.eventSchema.Opcode == EventOpcode.Send || this.eventSchema.Opcode == EventOpcode.Receive))\n                {\n                    return true;\n                }\n\n                return false;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.EventSourceAnalyzer/EventSourceAnalyzerException.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Globalization;\nusing System.Runtime.Serialization;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility\n{\n    /// <summary>\n    /// Represents errors that occur during <see cref=\"EventSourceAnalyzer\"/> execution.\n    /// </summary>\n    [Serializable]\n    public class EventSourceAnalyzerException : Exception\n    {\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventSourceAnalyzerException\"/> class.\n        /// </summary>\n        /// <param name=\"message\">The message that describes the error.</param>\n        public EventSourceAnalyzerException(string message)\n            : base(message)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventSourceAnalyzerException\"/> class.\n        /// </summary>\n        /// <param name=\"message\">The error message that explains the reason for the exception.</param>\n        /// <param name=\"innerException\">The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.</param>\n        public EventSourceAnalyzerException(string message, Exception innerException)\n            : base(message, innerException)\n        {\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"EventSourceAnalyzerException\"/> class.\n        /// </summary>\n        /// <param name=\"info\">The <see cref=\"T:System.Runtime.Serialization.SerializationInfo\" /> that holds the serialized object data about the exception being thrown.</param>\n        /// <param name=\"context\">The <see cref=\"T:System.Runtime.Serialization.StreamingContext\" /> that contains contextual information about the source or destination.</param>\n        protected EventSourceAnalyzerException(SerializationInfo info, StreamingContext context)\n            : base(info, context)\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.EventSourceAnalyzer/Properties/AssemblyInfo.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Reflection;\nusing System.Runtime.InteropServices;\nusing System.Security;\n\n[assembly: AssemblyTitle(\"Enterprise Library Semantic Logging Application Block\")]\n[assembly: AssemblyDescription(\"Enterprise Library Semantic Logging Application Block\")]\n\n[assembly: SecurityTransparent]\n\n[assembly: AssemblyVersion(\"2.0.0.0\")]\n[assembly: AssemblyFileVersion(\"2.0.1406.1\")]\n[assembly: AssemblyInformationalVersion(\"2.0.1406.1\")]\n\n[assembly: ComVisible(false)]"
  },
  {
    "path": "source/Src/SemanticLogging.EventSourceAnalyzer/SemanticLogging.EventSourceAnalyzer.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{27EACC2A-EE11-420B-8760-4945412B0C4A}</ProjectGuid>\n    <OutputType>Library</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.EventSourceAnalyzer</RootNamespace>\n    <AssemblyName>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.EventSourceAnalyzer</AssemblyName>\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>..\\..\\..\\bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n    <DocumentationFile>..\\..\\..\\bin\\Debug\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.EventSourceAnalyzer.XML</DocumentationFile>\n    <CodeAnalysisRuleSet>..\\..\\EnterpriseLibrary.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>..\\..\\..\\bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n    <DocumentationFile>..\\..\\..\\bin\\Release\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.EventSourceAnalyzer.XML</DocumentationFile>\n    <CodeAnalysisRuleSet>..\\..\\EnterpriseLibrary.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"..\\..\\GlobalAssemblyInfo.cs\">\n      <Link>GlobalAssemblyInfo.cs</Link>\n    </Compile>\n    <Compile Include=\"EventSourceAnalyzer.cs\" />\n    <Compile Include=\"EventSourceAnalyzerException.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\SemanticLogging\\SemanticLogging.csproj\">\n      <Project>{2cd4105b-0dd6-4c18-9b37-05d8e8f57303}</Project>\n      <Name>SemanticLogging</Name>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"packages.config\" />\n    <None Include=\"SemanticLogging.EventSourceAnalyzer.nuspec\">\n      <SubType>Designer</SubType>\n    </None>\n  </ItemGroup>\n  <PropertyGroup>\n    <DefineConstants Condition=\" '$(SignAssembly)' == 'true' \">$(DefineConstants);SIGN</DefineConstants>\n  </PropertyGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <Import Project=\"..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets\" Condition=\"Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets'))\" />\n  </Target>\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "source/Src/SemanticLogging.EventSourceAnalyzer/SemanticLogging.EventSourceAnalyzer.nuspec",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<package xmlns=\"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd\">\n  <metadata schemaVersion=\"2\">\n    <id>EnterpriseLibrary.SemanticLogging.EventSourceAnalyzer</id>\n    <version>$Microsoft_Practices_EnterpriseLibrary_SemanticLogging_EventSourceAnalyzer_Version$</version>\n    <title>Semantic Logging Application Block - EventSource Analyzer</title>\n    <authors>Microsoft</authors>\n    <owners>Microsoft; patterns-and-practices</owners>\n    <licenseUrl>http://opensource.org/licenses/Apache-2.0</licenseUrl>\n    <projectUrl>http://slab.codeplex.com</projectUrl>\n    <iconUrl>http://nuget.org/Media/Default/Packages/Unity/2.0/entlib_new_icon_100x100.png</iconUrl>\n    <requireLicenseAcceptance>true</requireLicenseAcceptance>\n    <summary>The EventSource Analyzer helps validate EventSource instances.</summary>\n    <description>The EventSource Analyzer is part of the Semantic Logging Application Block. It can be incorporated into your automated tests to help validate your EventSource instances.</description>\n   <copyright>© 2014 Microsoft Corporation</copyright>\n   <tags>slab ETW semantic logging EventSource analyzer test testing</tags>\n    <dependencies>\n      <dependency id=\"EnterpriseLibrary.SemanticLogging\" version=\"$Microsoft_Practices_EnterpriseLibrary_SemanticLogging_Version$\" />\n    </dependencies>\n    <frameworkAssemblies>\n      <frameworkAssembly assemblyName=\"mscorlib\" targetFramework=\".NETFramework4.5\" />\n    </frameworkAssemblies>\n  </metadata>\n  <files>\n    <file src=\"NuGet\\Readme.txt\" target=\"\" />\n  </files>\n</package>"
  },
  {
    "path": "source/Src/SemanticLogging.EventSourceAnalyzer/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"StyleCop.MSBuild\" version=\"4.7.49.0\" targetFramework=\"net45\" developmentDependency=\"true\" />\n</packages>"
  },
  {
    "path": "source/Src/SemanticLogging.TextFile/Configuration/FlatFileSinkElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration\n{\n    /// <summary>\n    /// Represents a flat file configuration element that can create an instance of a flat file sink.\n    /// </summary>\n    internal class FlatFileSinkElement : ISinkElement\n    {\n        private readonly XName sinkName = XName.Get(\"flatFileSink\", Constants.Namespace);\n\n        /// <summary>\n        /// Determines whether this instance can create the specified configuration element.\n        /// </summary>\n        /// <param name=\"element\">The configuration element.</param>\n        /// <returns>\n        ///   <c>True</c> if this instance can create the specified element; otherwise, <c>false</c>.\n        /// </returns>\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Validated with Guard class\")]\n        public bool CanCreateSink(XElement element)\n        {\n            Guard.ArgumentNotNull(element, \"element\");\n\n            return element.Name == this.sinkName;\n        }\n\n        /// <summary>\n        /// Creates the <see cref=\"IObserver{EventEntry}\" /> instance for this sink.\n        /// </summary>\n        /// <param name=\"element\">The configuration element.</param>\n        /// <returns>\n        /// The sink instance.\n        /// </returns>\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Validated with Guard class\")]\n        public IObserver<EventEntry> CreateSink(XElement element)\n        {\n            Guard.ArgumentNotNull(element, \"element\");\n\n            var subject = new EventEntrySubject();\n            subject.LogToFlatFile((string)element.Attribute(\"fileName\"), FormatterElementFactory.Get(element));\n            return subject;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.TextFile/Configuration/RollingFlatFileSinkElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration\n{\n    /// <summary>\n    /// Represents a flat file configuration element that can create an instance of a flat file sink.\n    /// </summary>\n    internal class RollingFlatFileSinkElement : ISinkElement\n    {\n        private readonly XName sinkName = XName.Get(\"rollingFlatFileSink\", Constants.Namespace);\n\n        /// <summary>\n        /// Determines whether this instance can create the specified configuration element.\n        /// </summary>\n        /// <param name=\"element\">The configuration element.</param>\n        /// <returns>\n        ///   <c>True</c> if this instance can create the specified element; otherwise, <c>false</c>.\n        /// </returns>\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Validated with Guard class\")]\n        public bool CanCreateSink(XElement element)\n        {\n            Guard.ArgumentNotNull(element, \"element\");\n\n            return element.Name == this.sinkName;\n        }\n\n        /// <summary>\n        /// Creates the <see cref=\"IObserver{EventEntry}\" /> instance for this sink.\n        /// </summary>\n        /// <param name=\"element\">The configuration element.</param>\n        /// <returns>\n        /// The sink instance.\n        /// </returns>\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Validated with Guard class\")]\n        public IObserver<EventEntry> CreateSink(XElement element)\n        {\n            Guard.ArgumentNotNull(element, \"element\");\n\n            int rollSizeKB = (int?)element.Attribute(\"rollSizeKB\") ?? default(int);\n            RollFileExistsBehavior rollFileExistsBehavior = (RollFileExistsBehavior)Enum.Parse(typeof(RollFileExistsBehavior), (string)element.Attribute(\"rollFileExistsBehavior\") ?? default(RollFileExistsBehavior).ToString());\n            RollInterval rollInterval = (RollInterval)Enum.Parse(typeof(RollInterval), (string)element.Attribute(\"rollInterval\") ?? default(RollInterval).ToString());\n            int maxArchivedFiles = (int?)element.Attribute(\"maxArchivedFiles\") ?? default(int);\n\n            var subject = new EventEntrySubject();\n            subject.LogToRollingFlatFile(\n                (string)element.Attribute(\"fileName\"),\n                rollSizeKB,\n                (string)element.Attribute(\"timeStampPattern\"),\n                rollFileExistsBehavior,\n                rollInterval,\n                FormatterElementFactory.Get(element),\n                maxArchivedFiles);\n\n            return subject;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.TextFile/FlatFileLog.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging\n{\n    /// <summary>\n    /// Factories and helpers for using the <see cref=\"FlatFileSink\"/>.\n    /// </summary>\n    public static class FlatFileLog\n    {\n        /// <summary>\n        /// Subscribes to an <see cref=\"IObservable{EventEntry}\"/> using a <see cref=\"FlatFileSink\"/>.\n        /// </summary>\n        /// <param name=\"eventStream\">The event stream. Typically this is an instance of <see cref=\"ObservableEventListener\"/>.</param>\n        /// <param name=\"fileName\">Name of the file.</param>\n        /// <param name=\"formatter\">The formatter.</param>\n        /// <param name=\"isAsync\">Specifies if the writing should be done asynchronously, or synchronously with a blocking call.</param>\n        /// <returns>A subscription to the sink that can be disposed to unsubscribe the sink and dispose it, or to get access to the sink instance.</returns>\n        public static SinkSubscription<FlatFileSink> LogToFlatFile(this IObservable<EventEntry> eventStream, string fileName = null, IEventTextFormatter formatter = null, bool isAsync = false)\n        {\n            if (string.IsNullOrEmpty(fileName))\n            {\n                fileName = FileUtil.CreateRandomFileName();\n            }\n\n            var sink = new FlatFileSink(fileName, formatter ?? new EventTextFormatter(), isAsync);\n\n            var subscription = eventStream.Subscribe(sink);\n\n            return new SinkSubscription<FlatFileSink>(subscription, sink);\n        }\n\n        /// <summary>\n        /// Creates an event listener that logs using a <see cref=\"FlatFileSink\"/>.\n        /// </summary>\n        /// <param name=\"fileName\">Name of the file.</param>\n        /// <param name=\"formatter\">The formatter.</param>\n        /// <param name=\"isAsync\">Specifies if the writing should be done asynchronously, or synchronously with a blocking call.</param>\n        /// <returns>An event listener that uses <see cref=\"FlatFileSink\"/> to log events.</returns>\n        public static EventListener CreateListener(string fileName = null, IEventTextFormatter formatter = null, bool isAsync = false)\n        {\n            var listener = new ObservableEventListener();\n            listener.LogToFlatFile(fileName, formatter, isAsync);\n            return listener;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.TextFile/Properties/AssemblyInfo.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\nusing System.Security;\n\n[assembly: AssemblyTitle(\"Enterprise Library Semantic Logging Application Block\")]\n[assembly: AssemblyDescription(\"Enterprise Library Semantic Logging Application Block\")]\n\n[assembly: SecurityTransparent]\n\n[assembly: AssemblyVersion(\"2.0.0.0\")]\n[assembly: AssemblyFileVersion(\"2.0.1406.1\")]\n[assembly: AssemblyInformationalVersion(\"2.0.1406.1\")]\n\n[assembly: ComVisible(false)]\n\n#if SIGN\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n#else\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\")]\n#endif"
  },
  {
    "path": "source/Src/SemanticLogging.TextFile/RollingFlatFileLog.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging\n{\n    /// <summary>\n    /// Factories and helpers for using the <see cref=\"RollingFlatFileSink\"/>.\n    /// </summary>\n    public static class RollingFlatFileLog\n    {\n        /// <summary>\n        /// Subscribes to an <see cref=\"IObservable{EventEntry}\"/> using a <see cref=\"RollingFlatFileSink\"/>.\n        /// </summary>\n        /// <param name=\"eventStream\">The event stream. Typically this is an instance of <see cref=\"ObservableEventListener\"/>.</param>\n        /// <param name=\"fileName\">The filename where the entries will be logged.</param>\n        /// <param name=\"rollSizeKB\">The maximum file size (KB) before rolling.</param>\n        /// <param name=\"timestampPattern\">The date format that will be appended to the new roll file.</param>\n        /// <param name=\"rollFileExistsBehavior\">Expected behavior that will be used when the roll file has to be created.</param>\n        /// <param name=\"rollInterval\">The time interval that makes the file to be rolled.</param>\n        /// <param name=\"formatter\">The formatter.</param>\n        /// <param name=\"maxArchivedFiles\">The maximum number of archived files to keep.</param>\n        /// <param name=\"isAsync\">Specifies if the writing should be done asynchronously, or synchronously with a blocking call.</param>\n        /// <returns>A subscription to the sink that can be disposed to unsubscribe the sink and dispose it, or to get access to the sink instance.</returns>\n        public static SinkSubscription<RollingFlatFileSink> LogToRollingFlatFile(this IObservable<EventEntry> eventStream, string fileName, int rollSizeKB, string timestampPattern, RollFileExistsBehavior rollFileExistsBehavior, RollInterval rollInterval, IEventTextFormatter formatter = null, int maxArchivedFiles = 0, bool isAsync = false)\n        {\n            if (string.IsNullOrWhiteSpace(fileName))\n            {\n                fileName = FileUtil.CreateRandomFileName();\n            }\n\n            var sink = new RollingFlatFileSink(fileName, rollSizeKB, timestampPattern, rollFileExistsBehavior, rollInterval, maxArchivedFiles, formatter ?? new EventTextFormatter(), isAsync);\n\n            var subscription = eventStream.Subscribe(sink);\n\n            return new SinkSubscription<RollingFlatFileSink>(subscription, sink);\n        }\n\n        /// <summary>\n        /// Creates an event listener that logs using a <see cref=\"RollingFlatFileSink\"/>.\n        /// </summary>\n        /// <param name=\"fileName\">The filename where the entries will be logged.</param>\n        /// <param name=\"rollSizeKB\">The maximum file size (KB) before rolling.</param>\n        /// <param name=\"timestampPattern\">The date format that will be appended to the new roll file.</param>\n        /// <param name=\"rollFileExistsBehavior\">Expected behavior that will be used when the roll file has to be created.</param>\n        /// <param name=\"rollInterval\">The time interval that makes the file to be rolled.</param>\n        /// <param name=\"formatter\">The formatter.</param>\n        /// <param name=\"maxArchivedFiles\">The maximum number of archived files to keep.</param>\n        /// <param name=\"isAsync\">Specifies if the writing should be done asynchronously, or synchronously with a blocking call.</param>\n        /// <returns>An event listener that uses <see cref=\"RollingFlatFileSink\"/> to log events.</returns>\n        public static EventListener CreateListener(string fileName, int rollSizeKB, string timestampPattern, RollFileExistsBehavior rollFileExistsBehavior, RollInterval rollInterval, IEventTextFormatter formatter = null, int maxArchivedFiles = 0, bool isAsync = false)\n        {\n            var listener = new ObservableEventListener();\n            listener.LogToRollingFlatFile(fileName, rollSizeKB, timestampPattern, rollFileExistsBehavior, rollInterval, formatter, maxArchivedFiles, isAsync);\n            return listener;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.TextFile/SemanticLogging.TextFile.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{4B187511-187B-48B1-A593-18BA835B49C3}</ProjectGuid>\n    <OutputType>Library</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.TextFile</RootNamespace>\n    <AssemblyName>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.TextFile</AssemblyName>\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>..\\..\\..\\bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n    <DocumentationFile>..\\..\\..\\bin\\Debug\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.TextFile.xml</DocumentationFile>\n    <CodeAnalysisRuleSet>..\\..\\EnterpriseLibrary.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>..\\..\\..\\bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n    <DocumentationFile>..\\..\\..\\bin\\Release\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.TextFile.xml</DocumentationFile>\n    <CodeAnalysisRuleSet>..\\..\\EnterpriseLibrary.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Data.DataSetExtensions\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"..\\..\\GlobalAssemblyInfo.cs\">\n      <Link>GlobalAssemblyInfo.cs</Link>\n    </Compile>\n    <Compile Include=\"Configuration\\FlatFileSinkElement.cs\" />\n    <Compile Include=\"Configuration\\RollingFlatFileSinkElement.cs\" />\n    <Compile Include=\"FlatFileLog.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n    <Compile Include=\"RollingFlatFileLog.cs\" />\n    <Compile Include=\"Sinks\\FlatFileSink.cs\" />\n    <Compile Include=\"Sinks\\RollFileExistsBehavior.cs\" />\n    <Compile Include=\"Sinks\\RollingFlatFilePurger.cs\" />\n    <Compile Include=\"Sinks\\RollingFlatFileSink.cs\" />\n    <Compile Include=\"Sinks\\RollingFlatFileSink.Inner.cs\" />\n    <Compile Include=\"Sinks\\RollInterval.cs\" />\n    <Compile Include=\"Sinks\\TallyKeepingFileStreamWriter.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\SemanticLogging\\SemanticLogging.csproj\">\n      <Project>{2cd4105b-0dd6-4c18-9b37-05d8e8f57303}</Project>\n      <Name>SemanticLogging</Name>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"packages.config\" />\n    <None Include=\"SemanticLogging.TextFile.nuspec\" />\n  </ItemGroup>\n  <PropertyGroup>\n    <DefineConstants Condition=\" '$(SignAssembly)' == 'true' \">$(DefineConstants);SIGN</DefineConstants>\n  </PropertyGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <Import Project=\"..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets\" Condition=\"Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets'))\" />\n  </Target>\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "source/Src/SemanticLogging.TextFile/SemanticLogging.TextFile.nuspec",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<package xmlns=\"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd\">\n  <metadata schemaVersion=\"2\">\n    <id>EnterpriseLibrary.SemanticLogging.TextFile</id>\n    <version>$Microsoft_Practices_EnterpriseLibrary_SemanticLogging_TextFile_Version$</version>\n    <title>Semantic Logging Application Block - Text file sinks</title>\n    <authors>Microsoft</authors>\n    <owners>Microsoft; patterns-and-practices</owners>\n    <licenseUrl>http://opensource.org/licenses/Apache-2.0</licenseUrl>\n    <projectUrl>http://slab.codeplex.com</projectUrl>\n    <iconUrl>http://nuget.org/Media/Default/Packages/Unity/2.0/entlib_new_icon_100x100.png</iconUrl>\n    <requireLicenseAcceptance>true</requireLicenseAcceptance>\n    <summary>The Semantic Logging Application Block provides a set of destinations to persist events published by a subclass of EventSource.</summary>\n    <description>The Semantic Logging Application Block provides a set of destinations to persist events published by a subclass of EventSource, This add-on packages adds support to persisting log entries into rolling text files and simple text files.</description>\n   <copyright>© 2014 Microsoft Corporation</copyright>\n   <tags>slab ETW semantic logging EventSource rolling file text sink</tags>\n    <dependencies>\n      <dependency id=\"EnterpriseLibrary.SemanticLogging\" version=\"$Microsoft_Practices_EnterpriseLibrary_SemanticLogging_Version$\" />\n    </dependencies>\n    <frameworkAssemblies>\n      <frameworkAssembly assemblyName=\"mscorlib\" targetFramework=\".NETFramework4.5\" />\n    </frameworkAssemblies>\n  </metadata>\n  <files>\n    <file src=\"NuGet\\Readme.txt\" target=\"\" />\n  </files>\n</package>"
  },
  {
    "path": "source/Src/SemanticLogging.TextFile/Sinks/FlatFileSink.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Concurrent;\nusing System.IO;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks\n{\n    /// <summary>\n    /// A sink that writes to a flat file.\n    /// </summary>    \n    /// <remarks>This class is thread-safe.</remarks>\n    public class FlatFileSink : IObserver<EventEntry>, IDisposable\n    {\n        private readonly IEventTextFormatter formatter;\n        private readonly bool isAsync;\n        private readonly object lockObject = new object();\n        private readonly object flushLockObject = new object();\n        private StreamWriter writer;\n        private bool disposed;\n        private BlockingCollection<EventEntry> pendingEntries;\n        private volatile TaskCompletionSource<bool> flushSource = new TaskCompletionSource<bool>();\n        private CancellationTokenSource cancellationTokenSource;\n        private Task asyncProcessorTask;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"FlatFileSink\" /> class.\n        /// </summary>\n        /// <param name=\"fileName\">Name of the file.</param>\n        /// <param name=\"formatter\">The formatter for entries</param>\n        /// <param name=\"isAsync\">Specifies if the writing should be done asynchronously, or synchronously with a blocking call.</param>\n        public FlatFileSink(string fileName, IEventTextFormatter formatter, bool isAsync)\n        {\n            Guard.ArgumentNotNull(formatter, \"formatter\");\n\n            var file = FileUtil.ProcessFileNameForLogging(fileName);\n            this.formatter = formatter;\n            this.writer = new StreamWriter(file.Open(FileMode.Append, FileAccess.Write, FileShare.Read));\n\n            this.isAsync = isAsync;\n\n            this.flushSource.SetResult(true);\n\n            if (isAsync)\n            {\n                this.cancellationTokenSource = new CancellationTokenSource();\n                this.pendingEntries = new BlockingCollection<EventEntry>();\n                this.asyncProcessorTask = Task.Factory.StartNew((Action)this.WriteEntries, TaskCreationOptions.LongRunning);\n            }\n        }\n\n        /// <summary>\n        /// Finalizes an instance of the <see cref=\"FlatFileSink\"/> class.\n        /// </summary>\n        ~FlatFileSink()\n        {\n            this.Dispose(false);\n        }\n\n        /// <summary>\n        /// Flushes the buffer content to the file.\n        /// </summary>\n        /// <returns>The Task that gets completed when the buffer is flushed.</returns>\n        public Task FlushAsync()\n        {\n            lock (this.flushLockObject)\n            {\n                return this.flushSource.Task;\n            }\n        }\n\n        /// <summary>\n        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.\n        /// </summary>\n        /// <param name=\"disposing\">A value indicating whether or not the class is disposing.</param>\n        protected virtual void Dispose(bool disposing)\n        {\n            if (disposing)\n            {\n                if (!this.disposed)\n                {\n                    lock (this.lockObject)\n                    {\n                        if (!this.disposed)\n                        {\n                            this.disposed = true;\n\n                            if (this.isAsync)\n                            {\n                                this.cancellationTokenSource.Cancel();\n                                this.asyncProcessorTask.Wait();\n                                this.pendingEntries.Dispose();\n                                this.cancellationTokenSource.Dispose();\n                            }\n\n                            this.writer.Dispose();\n                        }\n                    }\n                }\n            }\n        }\n\n        private void OnSingleEventWritten(EventEntry entry)\n        {\n            var formattedEntry = entry.TryFormatAsString(this.formatter);\n\n            if (formattedEntry != null)\n            {\n                try\n                {\n                    lock (this.lockObject)\n                    {\n                        this.writer.Write(formattedEntry);\n                        this.writer.Flush();\n                    }\n                }\n                catch (Exception e)\n                {\n                    SemanticLoggingEventSource.Log.FlatFileSinkWriteFailed(e.ToString());\n                }\n            }\n        }\n\n        private void WriteEntries()\n        {\n            EventEntry entry;\n            var token = this.cancellationTokenSource.Token;\n\n            while (!token.IsCancellationRequested)\n            {\n                try\n                {\n                    if (this.pendingEntries.Count == 0 && !this.flushSource.Task.IsCompleted && !token.IsCancellationRequested)\n                    {\n                        this.writer.Flush();\n                        lock (this.flushLockObject)\n                        {\n                            if (this.pendingEntries.Count == 0 && !this.flushSource.Task.IsCompleted && !token.IsCancellationRequested)\n                            {\n                                this.flushSource.TrySetResult(true);\n                            }\n                        }\n                    }\n\n                    entry = this.pendingEntries.Take(token);\n                }\n                catch (OperationCanceledException)\n                {\n                    break;\n                }\n                catch (ObjectDisposedException)\n                {\n                    break;\n                }\n\n                var formattedEntry = entry.TryFormatAsString(this.formatter);\n                if (formattedEntry != null)\n                {\n                    try\n                    {\n                        this.writer.Write(formattedEntry);\n                    }\n                    catch (Exception e)\n                    {\n                        SemanticLoggingEventSource.Log.FlatFileSinkWriteFailed(e.ToString());\n                    }\n                }\n            }\n\n            lock (this.flushLockObject)\n            {\n                this.flushSource.TrySetResult(true);\n            }\n        }\n\n        /// <summary>\n        /// Releases all resources used by the current instance of the <see cref=\"FlatFileSink\"/> class.\n        /// </summary>\n        public void Dispose()\n        {\n            this.Dispose(true);\n            GC.SuppressFinalize(this);\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has finished sending push-based notifications.\n        /// </summary>\n        public void OnCompleted()\n        {\n            this.FlushAsync().Wait();\n            this.Dispose();\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has experienced an error condition.\n        /// </summary>\n        /// <param name=\"error\">An object that provides additional information about the error.</param>\n        public void OnError(Exception error)\n        {\n            this.FlushAsync().Wait();\n            this.Dispose();\n        }\n\n        /// <summary>\n        /// Provides the sink with new data to write.\n        /// </summary>\n        /// <param name=\"value\">The current entry to write to the file.</param>\n        public void OnNext(EventEntry value)\n        {\n            if (this.isAsync)\n            {\n                this.pendingEntries.Add(value);\n\n                if (this.flushSource.Task.IsCompleted)\n                {\n                    lock (this.flushLockObject)\n                    {\n                        if (this.flushSource.Task.IsCompleted)\n                        {\n                            this.flushSource = new TaskCompletionSource<bool>();\n                        }\n                    }\n                }\n            }\n            else\n            {\n                this.OnSingleEventWritten(value);\n            }\n        }\n    }\n}"
  },
  {
    "path": "source/Src/SemanticLogging.TextFile/Sinks/RollFileExistsBehavior.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks\n{\n    /// <summary>\n    /// Defines the behavior when the roll file is created.\n    /// </summary>\n    public enum RollFileExistsBehavior\n    {\n        /// <summary>\n        /// Overwrites the file if it already exists.\n        /// </summary>\n        Overwrite,\n\n        /// <summary>\n        /// Use a sequence number at the end of the generated file if it already exists.\n        /// </summary>\n        /// <remarks>\n        /// If it fails again then increment the sequence until a non existent filename is found.\n        /// </remarks>\n        Increment\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.TextFile/Sinks/RollInterval.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks\n{\n    /// <summary>\n    /// Defines the frequency when the file need to be rolled.\n    /// </summary>\n    public enum RollInterval\n    {\n        /// <summary>\n        /// None Interval.\n        /// </summary>\n        None,\n\n        /// <summary>\n        /// Minute Interval.\n        /// </summary>\n        Minute,\n\n        /// <summary>\n        /// Hour interval.\n        /// </summary>\n        Hour,\n\n        /// <summary>\n        /// Day Interval.\n        /// </summary>\n        Day,\n\n        /// <summary>\n        /// Week Interval.\n        /// </summary>\n        Week,\n\n        /// <summary>\n        /// Month Interval.\n        /// </summary>\n        Month,\n\n        /// <summary>\n        /// Year Interval.\n        /// </summary>\n        Year,\n\n        /// <summary>\n        /// At Midnight.\n        /// </summary>\n        Midnight\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.TextFile/Sinks/RollingFlatFilePurger.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks\n{\n    /// <summary>\n    /// Purges archive files generated by the <see cref=\"RollingFlatFileSink\"/>.\n    /// </summary>\n    public class RollingFlatFilePurger\n    {\n        private readonly string directory;\n        private readonly string baseFileName;\n        private readonly int cap;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"RollingFlatFilePurger\"/> class.\n        /// </summary>\n        /// <param name=\"directory\">The folder where archive files are kept.</param>\n        /// <param name=\"baseFileName\">The base name for archive files.</param>\n        /// <param name=\"cap\">The number of archive files to keep.</param>\n        public RollingFlatFilePurger(string directory, string baseFileName, int cap)\n        {\n            if (directory == null)\n            {\n                throw new ArgumentNullException(\"directory\");\n            }\n\n            if (baseFileName == null)\n            {\n                throw new ArgumentNullException(\"baseFileName\");\n            }\n\n            if (cap < 1)\n            {\n                throw new ArgumentOutOfRangeException(\"cap\");\n            }\n\n            this.directory = directory;\n            this.baseFileName = baseFileName;\n            this.cap = cap;\n        }\n\n        /// <summary>\n        /// Extracts the sequence number from an archive file name.\n        /// </summary>\n        /// <param name=\"fileName\">The archive file name.</param>\n        /// <returns>The sequence part of the file name.</returns>\n        public static string GetSequence(string fileName)\n        {\n            if (fileName == null)\n            {\n                throw new ArgumentNullException(\"fileName\");\n            }\n\n            int extensionDotIndex = fileName.LastIndexOf('.');\n\n            if (extensionDotIndex <= 0)\n            {\n                // no dots - can't extract sequence\n                return string.Empty;\n            }\n\n            int sequenceDotIndex = fileName.LastIndexOf('.', extensionDotIndex - 1);\n\n            if (sequenceDotIndex < 0)\n            {\n                // single dot - can't extract sequence\n                return string.Empty;\n            }\n\n            return fileName.Substring(sequenceDotIndex + 1, extensionDotIndex - sequenceDotIndex - 1);\n        }\n\n        /// <summary>\n        /// Purges archive files.\n        /// </summary>\n        public void Purge()\n        {\n            var extension = Path.GetExtension(this.baseFileName);\n            var searchPattern = Path.GetFileNameWithoutExtension(this.baseFileName) + \".*\" + extension;\n\n            string[] matchingFiles = this.TryGetMatchingFiles(searchPattern);\n\n            if (matchingFiles.Length <= this.cap)\n            {\n                // bail out early if possible\n                return;\n            }\n\n            // sort the archive files in descending order by creation date and sequence number\n            var sortedArchiveFiles =\n                matchingFiles\n                    .Select(matchingFile => new ArchiveFile(matchingFile))\n                    .OrderByDescending(archiveFile => archiveFile);\n\n            using (var enumerator = sortedArchiveFiles.GetEnumerator())\n            {\n                // skip the most recent files\n                for (int i = 0; i < this.cap; i++)\n                {\n                    if (!enumerator.MoveNext())\n                    {\n                        // should not happen\n                        return;\n                    }\n                }\n\n                // delete the older files\n                while (enumerator.MoveNext())\n                {\n                    TryDelete(enumerator.Current.Path);\n                }\n            }\n        }\n\n        private static void TryDelete(string path)\n        {\n            try\n            {\n                File.Delete(path);\n            }\n            catch (UnauthorizedAccessException)\n            {\n                // cannot delete the file because of a permissions issue - just skip it\n            }\n            catch (IOException)\n            {\n                // cannot delete the file, most likely because it is already opened - just skip it\n            }\n        }\n\n        private static DateTime GetCreationTime(string path)\n        {\n            try\n            {\n                return File.GetCreationTimeUtc(path);\n            }\n            catch (UnauthorizedAccessException)\n            {\n                // will cause file be among the first files when sorting, \n                // and its deletion will likely fail causing it to be skipped\n                return DateTime.MinValue;\n            }\n        }\n\n        private string[] TryGetMatchingFiles(string searchPattern)\n        {\n            try\n            {\n                return Directory.GetFiles(this.directory, searchPattern, SearchOption.TopDirectoryOnly);\n            }\n            catch (DirectoryNotFoundException)\n            {\n            }\n            catch (IOException)\n            {\n            }\n            catch (UnauthorizedAccessException)\n            {\n            }\n\n            return new string[0];\n        }\n\n        internal class ArchiveFile : IComparable<ArchiveFile>\n        {\n            private readonly string path;\n            private readonly DateTime creationTime;\n            private readonly string fileName;\n            private string sequenceString;\n            private int? sequence;\n\n            public ArchiveFile(string path)\n            {\n                this.path = path;\n                this.fileName = System.IO.Path.GetFileName(path);\n                this.creationTime = GetCreationTime(path);\n            }\n\n            public string Path\n            {\n                get { return this.path; }\n            }\n\n            public DateTime CreationTime\n            {\n                get { return this.creationTime; }\n            }\n\n            public string SequenceString\n            {\n                get\n                {\n                    if (this.sequenceString == null)\n                    {\n                        this.sequenceString = GetSequence(this.fileName);\n                    }\n\n                    return this.sequenceString;\n                }\n            }\n\n            public int Sequence\n            {\n                get\n                {\n                    if (!this.sequence.HasValue)\n                    {\n                        int theSequence;\n                        if (int.TryParse(this.SequenceString, NumberStyles.None, CultureInfo.InvariantCulture, out theSequence))\n                        {\n                            this.sequence = theSequence;\n                        }\n                        else\n                        {\n                            this.sequence = 0;\n                        }\n                    }\n\n                    return this.sequence.Value;\n                }\n            }\n\n            public int CompareTo(ArchiveFile other)\n            {\n                Guard.ArgumentNotNull(other, \"other\");\n\n                var creationDateComparison = this.CreationTime.CompareTo(other.CreationTime);\n                if (creationDateComparison != 0)\n                {\n                    return creationDateComparison;\n                }\n\n                if (this.Sequence != 0 && other.Sequence != 0)\n                {\n                    // both archive files have proper sequences - use them\n                    return this.Sequence.CompareTo(other.Sequence);\n                }\n                else\n                {\n                    // compare the sequence part of the file name as plain strings\n                    return string.Compare(this.SequenceString, other.SequenceString, StringComparison.Ordinal);\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.TextFile/Sinks/RollingFlatFileSink.Inner.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Globalization;\nusing System.IO;\nusing System.Text;\nusing System.Text.RegularExpressions;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks\n{\n    public partial class RollingFlatFileSink\n    {\n        /// <summary>\n        /// A data time provider.\n        /// </summary>\n        public class DateTimeProvider\n        {\n            /// <summary>\n            /// Gets the current data time.\n            /// </summary>\n            /// <value>\n            /// The current data time.\n            /// </value>\n            public virtual DateTime CurrentDateTime\n            {\n                get { return DateTime.Now; }\n            }\n        }\n\n        /// <summary>\n        /// Encapsulates the logic to perform rolls.\n        /// </summary>\n        /// <remarks>\n        /// If no rolling behavior has been configured no further processing will be performed.\n        /// </remarks>\n        public sealed class StreamWriterRollingHelper : IDisposable\n        {\n            private DateTimeProvider dateTimeProvider;\n\n            /// <summary>\n            /// A tally keeping writer used when file size rolling is configured.<para/>\n            /// The original stream writer from the base trace listener will be replaced with\n            /// this listener.\n            /// </summary>\n            private TallyKeepingFileStreamWriter managedWriter;\n\n            private DateTime? nextRollDateTime;\n\n            /// <summary>\n            /// The trace listener for which rolling is being managed.\n            /// </summary>\n            private RollingFlatFileSink owner;\n\n            /// <summary>\n            /// A flag indicating whether at least one rolling criteria has been configured.\n            /// </summary>\n            private bool performsRolling;\n\n            /// <summary>\n            /// Initializes a new instance of the <see cref=\"StreamWriterRollingHelper\"/>.\n            /// </summary>\n            /// <param name=\"owner\">The <see cref=\"RollingFlatFileSink\"/> to use.</param>\n            public StreamWriterRollingHelper(RollingFlatFileSink owner)\n            {\n                this.owner = owner;\n                this.dateTimeProvider = new DateTimeProvider();\n\n                this.performsRolling = this.owner.rollInterval != RollInterval.None || this.owner.rollSizeInBytes > 0;\n            }\n\n            /// <summary>\n            /// Gets or sets current date time provider.\n            /// </summary>\n            /// <value>\n            /// The provider for the current date. Necessary for unit testing.\n            /// </value>\n            public DateTimeProvider DateTimeProvider\n            {\n                get { return this.dateTimeProvider; }\n                set { this.dateTimeProvider = value; }\n            }\n\n            /// <summary>\n            /// Gets the next date when date based rolling should occur if configured.\n            /// </summary>\n            /// <value>\n            /// The next date when date based rolling should occur if configured.\n            /// </value>\n            public DateTime? NextRollDateTime\n            {\n                get { return this.nextRollDateTime; }\n            }\n\n            /// <summary>\n            /// Calculates the next roll date for the file.\n            /// </summary>\n            /// <param name=\"dateTime\">The new date.</param>\n            /// <returns>The new date time to use.</returns>\n            public DateTime CalculateNextRollDate(DateTime dateTime)\n            {\n                try\n                {\n                    switch (this.owner.rollInterval)\n                    {\n                        case RollInterval.Minute:\n                            return dateTime.AddMinutes(1);\n                        case RollInterval.Hour:\n                            return dateTime.AddHours(1);\n                        case RollInterval.Day:\n                            return dateTime.AddDays(1);\n                        case RollInterval.Week:\n                            return dateTime.AddDays(7);\n                        case RollInterval.Month:\n                            return dateTime.AddMonths(1);\n                        case RollInterval.Year:\n                            return dateTime.AddYears(1);\n                        case RollInterval.Midnight:\n                            return dateTime.AddDays(1).Date;\n                        default:\n                            return DateTime.MaxValue;\n                    }\n                }\n                catch (ArgumentOutOfRangeException)\n                {\n                    return DateTime.MaxValue;\n                }\n            }\n\n            /// <summary>\n            /// Checks whether rolling should be performed, and returns the date to use when performing the roll.\n            /// </summary>\n            /// <returns>The date roll to use if performing a roll, or <see langword=\"null\"/> if no rolling should occur.</returns>\n            /// <remarks>\n            /// Defer request for the roll date until it is necessary to avoid overhead.<para/>\n            /// Information used for rolling checks should be set by now.\n            /// </remarks>\n            public DateTime? CheckIsRollNecessary()\n            {\n                // check for size roll, if enabled.\n                if (this.owner.rollSizeInBytes > 0\n                    && (this.managedWriter != null && this.managedWriter.Tally > this.owner.rollSizeInBytes))\n                {\n                    return this.dateTimeProvider.CurrentDateTime;\n                }\n\n                // check for date roll, if enabled.\n                DateTime currentDateTime = this.dateTimeProvider.CurrentDateTime;\n                if (this.owner.rollInterval != RollInterval.None\n                    && (this.nextRollDateTime != null && currentDateTime.CompareTo(this.nextRollDateTime.Value) >= 0))\n                {\n                    return currentDateTime;\n                }\n\n                // no roll is necessary, return a null roll date\n                return null;\n            }\n\n            /// <summary>\n            /// Gets the file name to use for archiving the file.\n            /// </summary>\n            /// <param name=\"actualFileName\">The actual file name.</param>\n            /// <param name=\"currentDateTime\">The current date and time.</param>\n            /// <returns>The new file name.</returns>\n            public string ComputeArchiveFileName(string actualFileName, DateTime currentDateTime)\n            {\n                string directory = Path.GetDirectoryName(actualFileName);\n                string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(actualFileName);\n                string extension = Path.GetExtension(actualFileName);\n\n                StringBuilder fileNameBuilder = new StringBuilder(fileNameWithoutExtension);\n                if (!string.IsNullOrEmpty(this.owner.timestampPattern))\n                {\n                    fileNameBuilder.Append('.');\n                    fileNameBuilder.Append(currentDateTime.ToString(this.owner.timestampPattern, CultureInfo.InvariantCulture));\n                }\n\n                if (this.owner.rollFileExistsBehavior == RollFileExistsBehavior.Increment)\n                {\n                    // look for max sequence for date\n                    int newSequence = FindMaxSequenceNumber(directory, fileNameBuilder.ToString(), extension) + 1;\n                    fileNameBuilder.Append('.');\n                    fileNameBuilder.Append(newSequence.ToString(CultureInfo.InvariantCulture));\n                }\n\n                fileNameBuilder.Append(extension);\n\n                return Path.Combine(directory, fileNameBuilder.ToString());\n            }\n\n            /// <summary>\n            /// Finds the max sequence number for a log file.\n            /// </summary>\n            /// <param name=\"directoryName\">The directory to scan.</param>\n            /// <param name=\"fileName\">The file name.</param>\n            /// <param name=\"extension\">The extension to use.</param>\n            /// <returns>The next sequence number.</returns>\n            public static int FindMaxSequenceNumber(string directoryName, string fileName, string extension)\n            {\n                string[] existingFiles =\n                    Directory.GetFiles(directoryName, string.Format(CultureInfo.InvariantCulture, \"{0}*{1}\", fileName, extension));\n\n                int maxSequence = 0;\n                Regex regex = new Regex(string.Format(CultureInfo.InvariantCulture, @\"{0}\\.(?<sequence>\\d+){1}$\", fileName, extension));\n                for (int i = 0; i < existingFiles.Length; i++)\n                {\n                    Match sequenceMatch = regex.Match(existingFiles[i]);\n                    if (sequenceMatch.Success)\n                    {\n                        int currentSequence = 0;\n\n                        string sequenceInFile = sequenceMatch.Groups[\"sequence\"].Value;\n                        if (!int.TryParse(sequenceInFile, out currentSequence))\n                        {\n                            continue; // very unlikely\n                        }\n\n                        if (currentSequence > maxSequence)\n                        {\n                            maxSequence = currentSequence;\n                        }\n                    }\n                }\n\n                return maxSequence;\n            }\n\n            /// <summary>\n            /// Perform the roll for the next date.\n            /// </summary>\n            /// <param name=\"rollDateTime\">The roll date.</param>\n            internal void PerformRoll(DateTime rollDateTime)\n            {\n                string actualFileName = ((FileStream)((StreamWriter)this.owner.writer).BaseStream).Name;\n\n                if (this.owner.rollFileExistsBehavior == RollFileExistsBehavior.Overwrite\n                    && string.IsNullOrEmpty(this.owner.timestampPattern))\n                {\n                    // no roll will be actually performed: no timestamp pattern is available, and \n                    // the roll behavior is overwrite, so the original file will be truncated\n                    this.owner.writer.Close();\n                    File.WriteAllText(actualFileName, string.Empty);\n                }\n                else\n                {\n                    // calculate archive name\n                    string archiveFileName = this.ComputeArchiveFileName(actualFileName, rollDateTime);\n\n                    // close file\n                    this.owner.writer.Close();\n\n                    // move file\n                    SafeMove(actualFileName, archiveFileName, rollDateTime);\n\n                    // purge if necessary\n                    this.PurgeArchivedFiles(actualFileName);\n                }\n\n                this.owner.writer.Dispose();\n                this.owner.writer = new TallyKeepingFileStreamWriter(this.owner.file.Open(FileMode.Append, FileAccess.Write, FileShare.Read));\n\n                this.managedWriter = null;\n                this.nextRollDateTime = null;\n                this.UpdateRollingInformationIfNecessary();\n            }\n\n            /// <summary>\n            /// Rolls the file if necessary.\n            /// </summary>\n            public void RollIfNecessary()\n            {\n                if (!this.performsRolling)\n                {\n                    // avoid further processing if no rolling has been configured.\n                    return;\n                }\n\n                if (!this.UpdateRollingInformationIfNecessary())\n                {\n                    // an error was detected while handling roll information - avoid further processing\n                    return;\n                }\n\n                DateTime? rollDateTime;\n                if ((rollDateTime = this.CheckIsRollNecessary()) != null)\n                {\n                    this.PerformRoll(rollDateTime.Value);\n                }\n            }\n\n            /// <summary>\n            /// Updates book keeping information necessary for rolling, as required by the specified rolling configuration.\n            /// </summary>\n            /// <returns>true if update was successful, false if an error occurred.</returns>\n            public bool UpdateRollingInformationIfNecessary()\n            {\n                StreamWriter currentWriter = null;\n\n                // replace writer with the tally keeping version if necessary for size rolling\n                if (this.owner.rollSizeInBytes > 0 && this.managedWriter == null)\n                {\n                    currentWriter = this.owner.writer as StreamWriter;\n\n                    if (currentWriter == null)\n                    {\n                        // TWTL couldn't acquire the writer - abort\n                        return false;\n                    }\n\n                    var actualFileName = ((FileStream)currentWriter.BaseStream).Name;\n\n                    currentWriter.Close();\n\n                    FileStream fileStream = null;\n                    try\n                    {\n                        fileStream = File.Open(actualFileName, FileMode.Append, FileAccess.Write, FileShare.Read);\n                        this.managedWriter = new TallyKeepingFileStreamWriter(fileStream, GetEncodingWithFallback());\n                    }\n                    catch (IOException)\n                    {\n                        // there's a slight chance of error here - abort if this occurs and just let TWTL handle it without attempting to roll\n                        return false;\n                    }\n\n                    this.owner.writer = this.managedWriter;\n                }\n\n                // compute the next roll date if necessary\n                if (this.owner.rollInterval != RollInterval.None && this.nextRollDateTime == null)\n                {\n                    try\n                    {\n                        // casting should be safe at this point - only file stream writers can be the writers for the owner trace listener.\n                        // it should also happen rarely\n                        this.nextRollDateTime\n                            = this.CalculateNextRollDate(File.GetCreationTime(((FileStream)((StreamWriter)this.owner.writer).BaseStream).Name));\n                    }\n                    catch (IOException)\n                    {\n                        this.nextRollDateTime = DateTime.MaxValue; // disable rolling if no date could be retrieved.\n\n                        // there's a slight chance of error here - abort if this occurs and just let TWTL handle it without attempting to roll\n                        return false;\n                    }\n                }\n\n                return true;\n            }\n\n            /// <summary>\n            /// Releases all resources used by the current instance of the <see cref=\"StreamWriterRollingHelper\"/> class.\n            /// </summary>\n            public void Dispose()\n            {\n                using (this.managedWriter) { }\n            }\n\n            private static Encoding GetEncodingWithFallback()\n            {\n                Encoding encoding = (Encoding)new UTF8Encoding(false).Clone();\n                encoding.EncoderFallback = EncoderFallback.ReplacementFallback;\n                encoding.DecoderFallback = DecoderFallback.ReplacementFallback;\n                return encoding;\n            }\n\n            private static void SafeMove(string actualFileName, string archiveFileName, DateTime currentDateTime)\n            {\n                try\n                {\n                    if (File.Exists(archiveFileName))\n                    {\n                        File.Delete(archiveFileName);\n                    }\n\n                    // take care of tunneling issues http://support.microsoft.com/kb/172190\n                    File.SetCreationTime(actualFileName, currentDateTime);\n                    File.Move(actualFileName, archiveFileName);\n                }\n                catch (IOException)\n                {\n                    // catch errors and attempt move to a new file with a GUID\n                    archiveFileName = archiveFileName + Guid.NewGuid().ToString();\n\n                    try\n                    {\n                        File.Move(actualFileName, archiveFileName);\n                    }\n                    catch (IOException)\n                    {\n                    }\n                }\n            }\n\n            private void PurgeArchivedFiles(string actualFileName)\n            {\n                if (this.owner.maxArchivedFiles > 0)\n                {\n                    var directoryName = Path.GetDirectoryName(actualFileName);\n                    var fileName = Path.GetFileName(actualFileName);\n\n                    new RollingFlatFilePurger(directoryName, fileName, this.owner.maxArchivedFiles).Purge();\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.TextFile/Sinks/RollingFlatFileSink.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Concurrent;\nusing System.IO;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks\n{\n    /// <summary>\n    /// A sink that writes to a flat file with a rolling overwrite behavior. \n    /// </summary>\n    /// <remarks>This class is thread-safe.</remarks>\n    public partial class RollingFlatFileSink : IObserver<EventEntry>, IDisposable\n    {\n        private readonly FileInfo file;\n        private readonly IEventTextFormatter formatter;\n\n        private readonly StreamWriterRollingHelper rollingHelper;\n        private readonly RollFileExistsBehavior rollFileExistsBehavior;\n        private readonly RollInterval rollInterval;\n        private readonly long rollSizeInBytes;\n        private readonly string timestampPattern;\n        private readonly int maxArchivedFiles;\n        private readonly Timer timer;\n        private readonly object lockObject = new object();\n        private readonly object flushLockObject = new object();\n\n        private readonly bool isAsync;\n        private BlockingCollection<EventEntry> pendingEntries;\n        private volatile TaskCompletionSource<bool> flushSource = new TaskCompletionSource<bool>();\n        private CancellationTokenSource cancellationTokenSource;\n        private Task asyncProcessorTask;\n\n        private TallyKeepingFileStreamWriter writer;\n        private bool disposed;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"RollingFlatFileSink\"/> class with the specified values.\n        /// </summary>\n        /// <param name=\"fileName\">The filename where the entries will be logged.</param>\n        /// <param name=\"rollSizeKB\">The maximum file size (KB) before rolling.</param>\n        /// <param name=\"timestampPattern\">The date format that will be appended to the new roll file.</param>\n        /// <param name=\"rollFileExistsBehavior\">Expected behavior that will be used when the roll file has to be created.</param>\n        /// <param name=\"rollInterval\">The time interval that makes the file to be rolled.</param>\n        /// <param name=\"maxArchivedFiles\">The maximum number of archived files to keep.</param>\n        /// <param name=\"formatter\">The event entry formatter.</param>\n        /// <param name=\"isAsync\">Specifies if the writing should be done asynchronously, or synchronously with a blocking call.</param>\n        public RollingFlatFileSink(string fileName, int rollSizeKB, string timestampPattern, RollFileExistsBehavior rollFileExistsBehavior, RollInterval rollInterval, int maxArchivedFiles, IEventTextFormatter formatter, bool isAsync)\n        {\n            Guard.ArgumentNotNull(formatter, \"formatter\");\n\n            this.file = FileUtil.ProcessFileNameForLogging(fileName);\n            this.formatter = formatter;\n\n            if (rollInterval == RollInterval.None)\n            {\n                if (!string.IsNullOrWhiteSpace(timestampPattern))\n                {\n                    Guard.ValidateTimestampPattern(timestampPattern, \"timestampPattern\");\n                }\n            }\n            else\n            {\n                Guard.ValidateTimestampPattern(timestampPattern, \"timestampPattern\");\n            }\n\n            this.writer = new TallyKeepingFileStreamWriter(this.file.Open(FileMode.Append, FileAccess.Write, FileShare.Read));\n\n            this.rollSizeInBytes = rollSizeKB * 1024L;\n            this.timestampPattern = timestampPattern;\n            this.rollFileExistsBehavior = rollFileExistsBehavior;\n            this.rollInterval = rollInterval;\n            this.maxArchivedFiles = maxArchivedFiles;\n            this.isAsync = isAsync;\n\n            this.rollingHelper = new StreamWriterRollingHelper(this);\n\n            if (rollInterval == RollInterval.Midnight && !isAsync)\n            {\n                var now = this.rollingHelper.DateTimeProvider.CurrentDateTime;\n                var midnight = now.AddDays(1).Date;\n\n                var callback = new TimerCallback(delegate\n                {\n                    lock (this.lockObject)\n                    {\n                        this.rollingHelper.RollIfNecessary();\n                    }\n                });\n\n                this.timer = new Timer(callback, null, midnight.Subtract(now), TimeSpan.FromDays(1));\n            }\n\n            this.flushSource.SetResult(true);\n            if (isAsync)\n            {\n                this.cancellationTokenSource = new CancellationTokenSource();\n                this.pendingEntries = new BlockingCollection<EventEntry>();\n                this.asyncProcessorTask = Task.Factory.StartNew(this.WriteEntries, TaskCreationOptions.LongRunning);\n            }\n        }\n\n        /// <summary>\n        /// Finalizes an instance of the <see cref=\"RollingFlatFileSink\"/> class.\n        /// </summary>\n        ~RollingFlatFileSink()\n        {\n            this.Dispose(false);\n        }\n\n        /// <summary>\n        /// Gets the <see cref=\"StreamWriterRollingHelper\"/> for the flat file.\n        /// </summary>\n        /// <value>\n        /// The <see cref=\"StreamWriterRollingHelper\"/> for the flat file.\n        /// </value>\n        public StreamWriterRollingHelper RollingHelper\n        {\n            get { return this.rollingHelper; }\n        }\n\n        /// <summary>\n        /// Gets the tally of the length of the string.\n        /// </summary>\n        /// <value>\n        /// The tally of the length of the string.\n        /// </value>\n        public long Tally\n        {\n            get { return this.writer.Tally; }\n        }\n\n        /// <summary>\n        /// Flushes the buffer content to the file.\n        /// </summary>\n        /// <returns>The Task that gets completed when the buffer is flushed.</returns>\n        public Task FlushAsync()\n        {\n            lock (this.flushLockObject)\n            {\n                return this.flushSource.Task;\n            }\n        }\n\n        /// <summary>\n        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.\n        /// </summary>\n        /// <param name=\"disposing\">A value indicating whether or not the class is disposing.</param>\n        protected virtual void Dispose(bool disposing)\n        {\n            if (disposing)\n            {\n                if (!this.disposed)\n                {\n                    this.disposed = true;\n\n                    using (this.timer) { }\n\n                    lock (this.lockObject)\n                    {\n                        if (this.isAsync)\n                        {\n                            this.cancellationTokenSource.Cancel();\n                            this.asyncProcessorTask.Wait();\n                            this.pendingEntries.Dispose();\n                            this.cancellationTokenSource.Dispose();\n                        }\n\n                        this.writer.Dispose();\n                        using (this.rollingHelper) { }\n                    }\n                }\n            }\n        }\n\n        private void OnSingleEventWritten(EventEntry entry)\n        {\n            var formattedEntry = entry.TryFormatAsString(this.formatter);\n\n            if (formattedEntry != null)\n            {\n                try\n                {\n                    lock (this.lockObject)\n                    {\n                        this.rollingHelper.RollIfNecessary();\n                        this.writer.Write(formattedEntry);\n                        this.writer.Flush();\n                    }\n                }\n                catch (Exception e)\n                {\n                    SemanticLoggingEventSource.Log.RollingFlatFileSinkWriteFailed(e.ToString());\n                }\n            }\n        }\n\n        private void WriteEntries()\n        {\n            EventEntry entry;\n            var token = this.cancellationTokenSource.Token;\n\n            while (!token.IsCancellationRequested)\n            {\n                // lock free, as it is the single writer.\n                try\n                {\n                    if (this.pendingEntries.Count == 0 && !this.flushSource.Task.IsCompleted && !token.IsCancellationRequested)\n                    {\n                        this.writer.Flush();\n                        this.rollingHelper.RollIfNecessary();\n                        lock (this.flushLockObject)\n                        {\n                            if (this.pendingEntries.Count == 0 && !this.flushSource.Task.IsCompleted && !token.IsCancellationRequested)\n                            {\n                                this.flushSource.TrySetResult(true);\n                            }\n                        }\n                    }\n\n                    if (!this.pendingEntries.TryTake(out entry, this.GetNextRollTimeout(), token))\n                    {\n                        // continue the loop if timed out, to give a chance to roll if necessary.\n                        this.rollingHelper.RollIfNecessary();\n                        continue;\n                    }\n                }\n                catch (OperationCanceledException)\n                {\n                    break;\n                }\n                catch (ObjectDisposedException)\n                {\n                    break;\n                }\n\n                this.rollingHelper.RollIfNecessary();\n\n                var formattedEntry = entry.TryFormatAsString(this.formatter);\n                if (formattedEntry != null)\n                {\n                    try\n                    {\n                        this.writer.Write(formattedEntry);\n                    }\n                    catch (Exception e)\n                    {\n                        SemanticLoggingEventSource.Log.RollingFlatFileSinkWriteFailed(e.ToString());\n                    }\n                }\n            }\n\n            lock (this.flushLockObject)\n            {\n                this.flushSource.TrySetResult(true);\n            }\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has finished sending push-based notifications.\n        /// </summary>\n        public void OnCompleted()\n        {\n            this.FlushAsync().Wait();\n            this.Dispose();\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has experienced an error condition.\n        /// </summary>\n        /// <param name=\"error\">An object that provides additional information about the error.</param>\n        public void OnError(Exception error)\n        {\n            this.FlushAsync().Wait();\n            this.Dispose();\n        }\n\n        /// <summary>\n        /// Provides the sink with new data to write.\n        /// </summary>\n        /// <param name=\"value\">The current entry to write to the file.</param>\n        public void OnNext(EventEntry value)\n        {\n            if (this.isAsync)\n            {\n                this.pendingEntries.Add(value);\n\n                if (this.flushSource.Task.IsCompleted)\n                {\n                    lock (this.flushLockObject)\n                    {\n                        if (this.flushSource.Task.IsCompleted)\n                        {\n                            this.flushSource = new TaskCompletionSource<bool>();\n                        }\n                    }\n                }\n            }\n            else\n            {\n                this.OnSingleEventWritten(value);\n            }\n        }\n\n        /// <summary>\n        /// Releases all resources used by the current instance of the <see cref=\"RollingFlatFileSink\"/> class.\n        /// </summary>\n        public void Dispose()\n        {\n            this.Dispose(true);\n            GC.SuppressFinalize(this);\n        }\n\n        private int GetNextRollTimeout()\n        {\n            const long MaxTime = (long)int.MaxValue;\n            var nextRollDate = this.rollingHelper.NextRollDateTime;\n\n            int nextRollTimeout;\n            if (nextRollDate.HasValue)\n            {\n                var milliseconds = (long)(nextRollDate.Value - this.rollingHelper.DateTimeProvider.CurrentDateTime).TotalMilliseconds;\n                if (milliseconds > MaxTime)\n                {\n                    milliseconds = MaxTime;\n                }\n\n                nextRollTimeout = (int)milliseconds;\n            }\n            else\n            {\n                nextRollTimeout = -1;\n            }\n\n            return nextRollTimeout;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.TextFile/Sinks/TallyKeepingFileStreamWriter.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.IO;\nusing System.Text;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks\n{\n    /// <summary>\n    /// Represents a file stream writer that keeps a tally of the length of the file.\n    /// </summary>\n    internal sealed class TallyKeepingFileStreamWriter : StreamWriter\n    {\n        private long tally;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"TallyKeepingFileStreamWriter\"/> class with a <see cref=\"FileStream\"/>.\n        /// </summary>\n        /// <param name=\"stream\">The <see cref=\"FileStream\"/> to write to.</param>\n        public TallyKeepingFileStreamWriter(FileStream stream)\n            : base(stream)\n        {\n            this.tally = stream.Length;\n        }\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"TallyKeepingFileStreamWriter\"/> class with a <see cref=\"FileStream\"/>.\n        /// </summary>\n        /// <param name=\"stream\">The <see cref=\"FileStream\"/> to write to.</param>\n        /// <param name=\"encoding\">The <see cref=\"Encoding\"/> to use.</param>\n        public TallyKeepingFileStreamWriter(FileStream stream, Encoding encoding)\n            : base(stream, encoding)\n        {\n            this.tally = stream.Length;\n        }\n\n        /// <summary>\n        /// Gets the tally of the length of the string.\n        /// </summary>\n        /// <value>\n        /// The tally of the length of the string.\n        /// </value>\n        public long Tally\n        {\n            get\n            {\n                return this.tally;\n            }\n        }\n\n        /// <summary>\n        /// Writes a character to the stream.\n        /// </summary>\n        /// <param name=\"value\">The character to write to the text stream. </param>\n        /// <exception cref=\"T:System.ObjectDisposedException\"><see cref=\"P:System.IO.StreamWriter.AutoFlush\"></see> is true or the <see cref=\"T:System.IO.StreamWriter\"></see> buffer is full, and current writer is closed. </exception>\n        /// <exception cref=\"T:System.NotSupportedException\"><see cref=\"P:System.IO.StreamWriter.AutoFlush\"></see> is true or the <see cref=\"T:System.IO.StreamWriter\"></see> buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the <see cref=\"T:System.IO.StreamWriter\"></see> is at the end the stream. </exception>\n        /// <exception cref=\"T:System.IO.IOException\">An I/O error occurs. </exception><filterpriority>1</filterpriority>\n        public override void Write(char value)\n        {\n            base.Write(value);\n            this.tally += Encoding.GetByteCount(new char[] { value });\n        }\n\n        /// <summary>\n        /// Writes a character array to the stream.\n        /// </summary>\n        /// <param name=\"buffer\">A character array containing the data to write. If buffer is null, nothing is written. </param>\n        /// <exception cref=\"T:System.ObjectDisposedException\"><see cref=\"P:System.IO.StreamWriter.AutoFlush\"></see> is true or the <see cref=\"T:System.IO.StreamWriter\"></see> buffer is full, and current writer is closed. </exception>\n        /// <exception cref=\"T:System.NotSupportedException\"><see cref=\"P:System.IO.StreamWriter.AutoFlush\"></see> is true or the <see cref=\"T:System.IO.StreamWriter\"></see> buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the <see cref=\"T:System.IO.StreamWriter\"></see> is at the end the stream. </exception>\n        /// <exception cref=\"T:System.IO.IOException\">An I/O error occurs. </exception><filterpriority>1</filterpriority>\n        public override void Write(char[] buffer)\n        {\n            base.Write(buffer);\n            this.tally += Encoding.GetByteCount(buffer);\n        }\n\n        /// <summary>\n        /// Writes the specified buffer to the stream.\n        /// </summary>\n        /// <param name=\"buffer\">A character array containing the data to write.</param>\n        /// <param name=\"index\">The index into buffer at which to begin writing.</param>\n        /// <param name=\"count\">The number of characters to read from buffer.</param>\n        /// <exception cref=\"T:System.IO.IOException\">An I/O error occurs.</exception>\n        /// <exception cref=\"T:System.ObjectDisposedException\"><see cref=\"P:System.IO.StreamWriter.AutoFlush\"></see> is true or the <see cref=\"T:System.IO.StreamWriter\"></see> buffer is full, and current writer is closed. </exception>\n        /// <exception cref=\"T:System.NotSupportedException\"><see cref=\"P:System.IO.StreamWriter.AutoFlush\"></see> is true or the <see cref=\"T:System.IO.StreamWriter\"></see> buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the <see cref=\"T:System.IO.StreamWriter\"></see> is at the end the stream. </exception>\n        /// <exception cref=\"T:System.ArgumentOutOfRangeException\">index or count is negative. </exception>\n        /// <exception cref=\"T:System.ArgumentException\">The buffer length minus index is less than count. </exception>\n        /// <exception cref=\"T:System.ArgumentNullException\">buffer is null. </exception><filterpriority>1</filterpriority>\n        public override void Write(char[] buffer, int index, int count)\n        {\n            base.Write(buffer, index, count);\n            this.tally += Encoding.GetByteCount(buffer, index, count);\n        }\n\n        /// <summary>\n        /// Writes a string to the stream.\n        /// </summary>\n        /// <param name=\"value\">The string to write to the stream. If value is null, nothing is written. </param>\n        /// <exception cref=\"T:System.ObjectDisposedException\"><see cref=\"P:System.IO.StreamWriter.AutoFlush\"></see> is true or the <see cref=\"T:System.IO.StreamWriter\"></see> buffer is full, and current writer is closed. </exception>\n        /// <exception cref=\"T:System.NotSupportedException\"><see cref=\"P:System.IO.StreamWriter.AutoFlush\"></see> is true or the <see cref=\"T:System.IO.StreamWriter\"></see> buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the <see cref=\"T:System.IO.StreamWriter\"></see> is at the end the stream. </exception>\n        /// <exception cref=\"T:System.IO.IOException\">An I/O error occurs. </exception><filterpriority>1</filterpriority>\n        public override void Write(string value)\n        {\n            base.Write(value);\n            this.tally += Encoding.GetByteCount(value);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.TextFile/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"StyleCop.MSBuild\" version=\"4.7.49.0\" targetFramework=\"net45\" developmentDependency=\"true\" />\n</packages>"
  },
  {
    "path": "source/Src/SemanticLogging.WindowsAzure/Configuration/WindowsAzureTableSinkElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration\n{\n    internal class WindowsAzureTableSinkElement : ISinkElement\n    {\n        private readonly XName sinkName = XName.Get(\"windowsAzureTableSink\", Constants.Namespace);\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Validated with Guard class\")]\n        public bool CanCreateSink(XElement element)\n        {\n            Guard.ArgumentNotNull(element, \"element\");\n\n            return element.Name == this.sinkName;\n        }\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1062:Validate arguments of public methods\", MessageId = \"0\", Justification = \"Validated with Guard class\")]\n        public IObserver<EventEntry> CreateSink(XElement element)\n        {\n            Guard.ArgumentNotNull(element, \"element\");\n\n            var subject = new EventEntrySubject();\n            subject.LogToWindowsAzureTable(\n                (string)element.Attribute(\"instanceName\"),\n                (string)element.Attribute(\"connectionString\"),\n                (string)element.Attribute(\"tableAddress\") ?? WindowsAzureTableLog.DefaultTableName,\n                element.Attribute(\"bufferingIntervalInSeconds\").ToTimeSpan(),\n                (bool?)element.Attribute(\"sortKeysAscending\") ?? false,\n                element.Attribute(\"bufferingFlushAllTimeoutInSeconds\").ToTimeSpan() ?? Constants.DefaultBufferingFlushAllTimeout,\n                (int?)element.Attribute(\"maxBufferSize\") ?? Buffering.DefaultMaxBufferSize);\n\n            return subject;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.WindowsAzure/GlobalSuppressions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\n// This file is used by Code Analysis to maintain SuppressMessage \n// attributes that are applied to this project.\n// Project-level suppressions either have no target or are given \n// a specific target and scoped to a namespace, type, member, etc.\n//\n// To add a suppression to this file, right-click the message in the \n// Code Analysis results, point to \"Suppress Message\", and click \n// \"In Suppression File\".\n// You do not need to add suppressions to this file manually.\n\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1020:AvoidNamespacesWithFewTypes\", Scope = \"namespace\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging\", Justification = \"As designed\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1020:AvoidNamespacesWithFewTypes\", Scope = \"namespace\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks\", Justification = \"As designed\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1020:AvoidNamespacesWithFewTypes\", Scope = \"namespace\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.WindowsAzure\", Justification = \"As designed\")]\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1020:AvoidNamespacesWithFewTypes\", Scope = \"namespace\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility\", Justification = \"As designed\")]\n\n[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1031:DoNotCatchGeneralExceptionTypes\", Scope = \"member\", Target = \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility.CloudEventEntryExtensions.#InitializePayload(Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.WindowsAzure.CloudEventEntry,System.Collections.Generic.IList`1<System.Object>,Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema.EventSchema)\", Justification = \"Exception is logged\")]\n"
  },
  {
    "path": "source/Src/SemanticLogging.WindowsAzure/Properties/AssemblyInfo.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Reflection;\nusing System.Resources;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n[assembly: AssemblyTitle(\"Enterprise Library Semantic Logging Application Block\")]\n[assembly: AssemblyDescription(\"Enterprise Library Semantic Logging Application Block\")]\n\n////[assembly: AllowPartiallyTrustedCallers]\n\n[assembly: AssemblyVersion(\"2.0.0.0\")]\n[assembly: AssemblyFileVersion(\"2.0.1406.1\")]\n[assembly: AssemblyInformationalVersion(\"2.0.1406.1\")]\n\n[assembly: ComVisible(false)]\n[assembly: NeutralResourcesLanguage(\"en-US\")]\n\n#if SIGN\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9\")]\n#else\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.InProc.Tests\")]\n[assembly: InternalsVisibleTo(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.OutProc.Tests\")]\n#endif"
  },
  {
    "path": "source/Src/SemanticLogging.WindowsAzure/Properties/Resources.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\n// <auto-generated>\n//     This code was generated by a tool.\n//     Runtime Version:4.0.30319.18033\n//\n//     Changes to this file may cause incorrect behavior and will be lost if\n//     the code is regenerated.\n// </auto-generated>\n//------------------------------------------------------------------------------\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.WindowsAzure.Properties {\n    using System;\n    \n    \n    /// <summary>\n    ///   A strongly-typed resource class, for looking up localized strings, etc.\n    /// </summary>\n    // This class was auto-generated by the StronglyTypedResourceBuilder\n    // class via a tool like ResGen or Visual Studio.\n    // To add or remove a member, edit your .ResX file then rerun ResGen\n    // with the /str option, or rebuild your VS project.\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Resources.Tools.StronglyTypedResourceBuilder\", \"4.0.0.0\")]\n    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\n    internal class Resources {\n        \n        private static global::System.Resources.ResourceManager resourceMan;\n        \n        private static global::System.Globalization.CultureInfo resourceCulture;\n        \n        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"Microsoft.Performance\", \"CA1811:AvoidUncalledPrivateCode\")]\n        internal Resources() {\n        }\n        \n        /// <summary>\n        ///   Returns the cached ResourceManager instance used by this class.\n        /// </summary>\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\n        internal static global::System.Resources.ResourceManager ResourceManager {\n            get {\n                if (object.ReferenceEquals(resourceMan, null)) {\n                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Properties.Resources\", typeof(Resources).Assembly);\n                    resourceMan = temp;\n                }\n                return resourceMan;\n            }\n        }\n        \n        /// <summary>\n        ///   Overrides the current thread's CurrentUICulture property for all\n        ///   resource lookups using this strongly typed resource class.\n        /// </summary>\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\n        internal static global::System.Globalization.CultureInfo Culture {\n            get {\n                return resourceCulture;\n            }\n            set {\n                resourceCulture = value;\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to Table names may contain only alphanumeric characters, cannot begin with a numeric character and must be from 3 to 63 characters long..\n        /// </summary>\n        internal static string InvalidTableName {\n            get {\n                return ResourceManager.GetString(\"InvalidTableName\", resourceCulture);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.WindowsAzure/Properties/Resources.resx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The primary goals of this format is to allow a simple XML format \n    that is mostly human readable. The generation and parsing of the \n    various data types are done through the TypeConverter classes \n    associated with the data types.\n    \n    Example:\n    \n    ... ado.net/XML headers & schema ...\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\n    <resheader name=\"version\">2.0</resheader>\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\n    </data>\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\n        <comment>This is a comment</comment>\n    </data>\n                \n    There are any number of \"resheader\" rows that contain simple \n    name/value pairs.\n    \n    Each data row contains a name, and value. The row also contains a \n    type or mimetype. Type corresponds to a .NET class that support \n    text/value conversion through the TypeConverter architecture. \n    Classes that don't support this are serialized and stored with the \n    mimetype set.\n    \n    The mimetype is used for serialized objects, and tells the \n    ResXResourceReader how to depersist the object. This is currently not \n    extensible. For a given mimetype the value must be set accordingly:\n    \n    Note - application/x-microsoft.net.object.binary.base64 is the format \n    that the ResXResourceWriter will generate, however the reader can \n    read any of the formats listed below.\n    \n    mimetype: application/x-microsoft.net.object.binary.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\n            : and then encoded with base64 encoding.\n    \n    mimetype: application/x-microsoft.net.object.soap.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.bytearray.base64\n    value   : The object must be serialized into a byte array \n            : using a System.ComponentModel.TypeConverter\n            : and then encoded with base64 encoding.\n    -->\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\n      <xsd:complexType>\n        <xsd:choice maxOccurs=\"unbounded\">\n          <xsd:element name=\"metadata\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"assembly\">\n            <xsd:complexType>\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"data\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"resheader\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\n            </xsd:complexType>\n          </xsd:element>\n        </xsd:choice>\n      </xsd:complexType>\n    </xsd:element>\n  </xsd:schema>\n  <resheader name=\"resmimetype\">\n    <value>text/microsoft-resx</value>\n  </resheader>\n  <resheader name=\"version\">\n    <value>2.0</value>\n  </resheader>\n  <resheader name=\"reader\">\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <resheader name=\"writer\">\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <data name=\"InvalidTableName\" xml:space=\"preserve\">\n    <value>Table names may contain only alphanumeric characters, cannot begin with a numeric character and must be from 3 to 63 characters long.</value>\n  </data>\n</root>"
  },
  {
    "path": "source/Src/SemanticLogging.WindowsAzure/SemanticLogging.WindowsAzure.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{D7979E9B-7978-48FE-B345-3C767A20F9A1}</ProjectGuid>\n    <OutputType>Library</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>Microsoft.Practices.EnterpriseLibrary.SemanticLogging</RootNamespace>\n    <AssemblyName>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.WindowsAzure</AssemblyName>\n    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>..\\..\\..\\bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>\n    <DocumentationFile>..\\..\\..\\bin\\Debug\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.WindowsAzure.XML</DocumentationFile>\n    <CodeAnalysisRuleSet>..\\..\\EnterpriseLibrary.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>..\\..\\..\\bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n    <DocumentationFile>..\\..\\..\\bin\\Release\\Microsoft.Practices.EnterpriseLibrary.SemanticLogging.WindowsAzure.XML</DocumentationFile>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"Microsoft.Azure.KeyVault.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Microsoft.Azure.KeyVault.Core.1.0.0\\lib\\net40\\Microsoft.Azure.KeyVault.Core.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"Microsoft.Data.Edm, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Microsoft.Data.Edm.5.6.4\\lib\\net40\\Microsoft.Data.Edm.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"Microsoft.Data.OData, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Microsoft.Data.OData.5.6.4\\lib\\net40\\Microsoft.Data.OData.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"Microsoft.Data.Services.Client, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Microsoft.Data.Services.Client.5.6.4\\lib\\net40\\Microsoft.Data.Services.Client.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"Microsoft.WindowsAzure.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Microsoft.WindowsAzure.ConfigurationManager.2.0.3\\lib\\net40\\Microsoft.WindowsAzure.Configuration.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.WindowsAzure.Storage, Version=7.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\WindowsAzure.Storage.7.2.1\\lib\\net40\\Microsoft.WindowsAzure.Storage.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Newtonsoft.Json.6.0.8\\lib\\net45\\Newtonsoft.Json.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Data.Services.Client\" />\n    <Reference Include=\"System.Spatial, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\System.Spatial.5.6.4\\lib\\net40\\System.Spatial.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"Microsoft.CSharp\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Xml\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"..\\..\\GlobalAssemblyInfo.cs\">\n      <Link>GlobalAssemblyInfo.cs</Link>\n    </Compile>\n    <Compile Include=\"Configuration\\WindowsAzureTableSinkElement.cs\" />\n    <Compile Include=\"GlobalSuppressions.cs\" />\n    <Compile Include=\"Properties\\Resources.Designer.cs\">\n      <AutoGen>True</AutoGen>\n      <DesignTime>True</DesignTime>\n      <DependentUpon>Resources.resx</DependentUpon>\n    </Compile>\n    <Compile Include=\"Sinks\\CloudEventEntryExtensions.cs\" />\n    <Compile Include=\"Utility\\CloudEventEntryExtensions.cs\" />\n    <Compile Include=\"Sinks\\CloudEventEntry.cs\" />\n    <Compile Include=\"Sinks\\WindowsAzureTableSink.cs\" />\n    <Compile Include=\"Sinks\\DateTimeExtensions.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n    <Compile Include=\"WindowsAzureTableLog.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"..\\..\\SemanticLogging.licenseheader\">\n      <Link>SemanticLogging.licenseheader</Link>\n    </None>\n    <None Include=\"packages.config\">\n      <SubType>Designer</SubType>\n    </None>\n    <None Include=\"SemanticLogging.WindowsAzure.nuspec\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\SemanticLogging\\SemanticLogging.csproj\">\n      <Project>{2cd4105b-0dd6-4c18-9b37-05d8e8f57303}</Project>\n      <Name>SemanticLogging</Name>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <EmbeddedResource Include=\"Properties\\Resources.resx\">\n      <Generator>ResXFileCodeGenerator</Generator>\n      <CustomToolNamespace>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.WindowsAzure.Properties</CustomToolNamespace>\n      <LastGenOutput>Resources.Designer.cs</LastGenOutput>\n    </EmbeddedResource>\n  </ItemGroup>\n  <ItemGroup />\n  <PropertyGroup>\n    <DefineConstants Condition=\" '$(SignAssembly)' == 'true' \">$(DefineConstants);SIGN</DefineConstants>\n  </PropertyGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <Import Project=\"..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets\" Condition=\"Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets'))\" />\n  </Target>\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "source/Src/SemanticLogging.WindowsAzure/SemanticLogging.WindowsAzure.nuspec",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<package xmlns=\"http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd\">\n  <metadata schemaVersion=\"2\">\n    <id>EnterpriseLibrary.SemanticLogging.WindowsAzure</id>\n    <version>$Microsoft_Practices_EnterpriseLibrary_SemanticLogging_WindowsAzure_Version$</version>\n    <title>Semantic Logging Application Block - Azure Sink</title>\n    <authors>Microsoft</authors>\n    <owners>Microsoft; patterns-and-practices</owners>\n    <licenseUrl>http://opensource.org/licenses/Apache-2.0</licenseUrl>\n    <projectUrl>http://slab.codeplex.com</projectUrl>\n    <iconUrl>http://nuget.org/Media/Default/Packages/Unity/2.0/entlib_new_icon_100x100.png</iconUrl>\n    <requireLicenseAcceptance>true</requireLicenseAcceptance>\n    <summary>The Semantic Logging Application Block provides a set of destinations to persist events published by a subclass of EventSource.</summary>\n    <description>The Semantic Logging Application Block provides a set of destinations to persist events published by a subclass of EventSource, This add-on packages adds support to persisting log entries in Azure table storage.</description>\n   <copyright>© 2014 Microsoft Corporation</copyright>\n   <tags>entlib entlib6 slab enterprise library ETW semantic logging EventSource event listener structured strongly-typed block sink Azure cloud storage table futures OSS</tags>\n    <dependencies>\n      <dependency id=\"EnterpriseLibrary.SemanticLogging\" version=\"$Microsoft_Practices_EnterpriseLibrary_SemanticLogging_Version$\" />\n    </dependencies>\n    <frameworkAssemblies>\n      <frameworkAssembly assemblyName=\"mscorlib\" targetFramework=\".NETFramework4.5\" />\n    </frameworkAssemblies>\n  </metadata>\n  <files>\n    <file src=\"NuGet\\Readme.txt\" target=\"\" />\n  </files>\n</package>"
  },
  {
    "path": "source/Src/SemanticLogging.WindowsAzure/Sinks/CloudEventEntry.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.WindowsAzure\n{\n    /// <summary>\n    /// Represents a log entry in an Azure Table.\n    /// </summary>\n    public sealed class CloudEventEntry\n    {\n        private const string RowKeyFormat = \"{0}_{1}_{2:X5}\";\n\n        private readonly EventEntry eventEntry;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"CloudEventEntry\"/> class.\n        /// </summary>\n        internal CloudEventEntry(EventEntry eventEntry)\n        {\n            this.Payload = InitializePayload(eventEntry.Payload, eventEntry.Schema);\n            this.eventEntry = eventEntry;\n        }\n\n        /// <summary>\n        /// Gets or sets the event identifier.\n        /// </summary>\n        /// <value>\n        /// The event id.\n        /// </value>\n        public int EventId\n        {\n            get { return this.eventEntry.EventId; }\n        }\n\n        /// <summary>\n        /// Gets or sets the event date.\n        /// </summary>\n        /// <value>\n        /// The event date.\n        /// </value>\n        public DateTime EventDate\n        {\n            get { return this.eventEntry.Timestamp.UtcDateTime; }\n        }\n\n        /// <summary>\n        /// Gets or sets the keywords for the event.\n        /// </summary>\n        /// <value>\n        /// The keywords.\n        /// </value>\n        public long Keywords\n        {\n            get { return (long)this.eventEntry.Schema.Keywords; }\n        }\n\n        /// <summary>\n        /// Gets or sets the unique identifier for the provider, which is typically the class derived from <see cref=\"System.Diagnostics.Tracing.EventSource\"/>.\n        /// </summary>\n        /// <value>\n        /// The provider ID.\n        /// </value>\n        public Guid ProviderId\n        {\n            get { return this.eventEntry.ProviderId; }\n        }\n\n        /// <summary>\n        /// Gets or sets the friendly name of the class that is derived from the event source.\n        /// </summary>\n        /// <value>\n        /// The name of the event source.\n        /// </value>\n        public string ProviderName\n        {\n            get { return this.eventEntry.Schema.ProviderName; }\n        }\n\n        /// <summary>\n        /// Gets or sets the level of the event.\n        /// </summary>\n        /// <value>\n        /// The level.\n        /// </value>\n        public int Level\n        {\n            get { return (int)this.eventEntry.Schema.Level; }\n        }\n\n        /// <summary>\n        /// Gets or sets the message for the event.\n        /// </summary>\n        /// <value>\n        /// The message.\n        /// </value>\n        public string Message\n        {\n            get { return this.eventEntry.FormattedMessage; }\n        }\n\n        /// <summary>\n        /// Gets or sets the operation code for the event.\n        /// </summary>\n        /// <value>\n        /// The operation code.\n        /// </value>\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1702:CompoundWordsShouldBeCasedCorrectly\", MessageId = \"Opcode\", Justification = \"Uses casing from EventWrittenEventArgs.Opcode\")]\n        public int Opcode\n        {\n            get { return (int)this.eventEntry.Schema.Opcode; }\n        }\n\n        /// <summary>\n        /// Gets or sets the task for the event.\n        /// </summary>\n        /// <value>\n        /// The task code.\n        /// </value>\n        public int Task\n        {\n            get { return (int)this.eventEntry.Schema.Task; }\n        }\n\n        /// <summary>\n        /// Gets or sets the version of the event.\n        /// </summary>\n        /// <value>\n        /// The version.\n        /// </value>\n        public int Version\n        {\n            get { return this.eventEntry.Schema.Version; }\n        }\n\n        /// <summary>\n        /// Gets or sets the process id.\n        /// </summary>\n        /// <value>The process id.</value>\n        public int ProcessId\n        {\n            get { return this.eventEntry.ProcessId; }\n        }\n\n        /// <summary>\n        /// Gets or sets the thread id.\n        /// </summary>\n        /// <value>The thread id.</value>\n        public int ThreadId\n        {\n            get { return this.eventEntry.ThreadId; }\n        }\n\n        /// <summary>\n        /// Gets or sets the activity id for the event.\n        /// </summary>\n        /// <value>\n        /// The activity id.\n        /// </value>\n        public Guid ActivityId\n        {\n            get { return this.eventEntry.ActivityId; }\n        }\n\n        /// <summary>\n        /// Gets or sets the related activity id for the event.\n        /// </summary>\n        /// <value>\n        /// The related activity id.\n        /// </value>\n        public Guid RelatedActivityId\n        {\n            get { return this.eventEntry.RelatedActivityId; }\n        }\n\n        /// <summary>\n        /// Gets or sets the instance name where the entries are generated from.\n        /// </summary>\n        /// <value>\n        /// The name of the instance.\n        /// </value>\n        public string InstanceName { get; set; }\n\n        /// <summary>\n        /// Gets or sets the payload for the event.\n        /// </summary>\n        /// <value>\n        /// The payload.\n        /// </value>\n        public IReadOnlyDictionary<string, object> Payload { get; private set; }\n\n        /// <summary>\n        /// Gets or sets the entity's partition key.\n        /// </summary>\n        /// <value>\n        /// The partition key.\n        /// </value>\n        internal string PartitionKey { get; set; }\n\n        /// <summary>\n        /// Gets or sets the entity's partition key.\n        /// </summary>\n        /// <value>\n        /// The row key.\n        /// </value>\n        internal string RowKey { get; set; }\n\n        /// <summary>\n        /// Create a key for the entity.\n        /// </summary>\n        /// <param name=\"sortKeysAscending\"><see langword=\"true\" /> generates WAD-style keys, otherwise it uses an key generated from a reversed tick value that is sorted from newest to oldest.</param>\n        /// <param name=\"salt\">The salt for the key.</param>\n        public void CreateKey(bool sortKeysAscending, int salt)\n        {\n            this.PartitionKey = sortKeysAscending ? this.EventDate.GeneratePartitionKey() : this.EventDate.GeneratePartitionKeyReversed();\n\n            this.RowKey = string.Format(\n                CultureInfo.InvariantCulture,\n                RowKeyFormat,\n                this.InstanceName,\n                sortKeysAscending ? this.EventDate.GetTicks() : this.EventDate.GetTicksReversed(),\n                salt);\n        }\n\n        private static IReadOnlyDictionary<string, object> InitializePayload(IList<object> payload, EventSchema schema)\n        {\n            var payloadDictionary = new Dictionary<string, object>(payload.Count);\n\n            for (int i = 0; i < payload.Count; i++)\n            {\n                payloadDictionary.Add(schema.Payload[i], payload[i]);\n            }\n\n            return payloadDictionary;\n        }\n    }\n}"
  },
  {
    "path": "source/Src/SemanticLogging.WindowsAzure/Sinks/CloudEventEntryExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing Microsoft.WindowsAzure.Storage.Table;\nusing Newtonsoft.Json;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.WindowsAzure\n{\n    internal static class CloudEventEntryExtensions\n    {\n        private const int MaxStringLength = 30000;\n        private const int MaxPayloadItems = 200;\n\n        public static DynamicTableEntity CreateTableEntity(this CloudEventEntry entry)\n        {\n            var dictionary = new Dictionary<string, EntityProperty>();\n            dictionary.Add(\"EventId\", new EntityProperty(entry.EventId));\n            dictionary.Add(\"EventDate\", new EntityProperty(entry.EventDate));\n            dictionary.Add(\"Keywords\", new EntityProperty(entry.Keywords));\n            dictionary.Add(\"ProviderId\", new EntityProperty(entry.ProviderId));\n            dictionary.Add(\"ProviderName\", new EntityProperty(entry.ProviderName));\n            dictionary.Add(\"InstanceName\", new EntityProperty(entry.InstanceName));\n            dictionary.Add(\"Level\", new EntityProperty(entry.Level));\n            if (entry.Message != null)\n            {\n                dictionary.Add(\"Message\", new EntityProperty(Normalize(entry.Message)));\n            }\n\n            dictionary.Add(\"Opcode\", new EntityProperty(entry.Opcode));\n            dictionary.Add(\"Task\", new EntityProperty(entry.Task));\n            dictionary.Add(\"Version\", new EntityProperty(entry.Version));\n\n            dictionary.Add(\"ProcessId\", new EntityProperty(entry.ProcessId));\n            dictionary.Add(\"ThreadId\", new EntityProperty(entry.ThreadId));\n\n            if (entry.ActivityId != Guid.Empty)\n            {\n                dictionary.Add(\"ActivityId\", new EntityProperty(entry.ActivityId));\n            }\n\n            if (entry.RelatedActivityId != Guid.Empty)\n            {\n                dictionary.Add(\"RelatedActivityId\", new EntityProperty(entry.RelatedActivityId));\n            }\n\n            // Create a \"Payload\"\n            if (entry.Payload != null && entry.Payload.Count > 0)\n            {\n                var json = EventEntryUtil.JsonSerializePayload(entry.Payload);\n                if (json.Length > MaxStringLength)\n                {\n                    dictionary.Add(\"Payload\", new EntityProperty(\"{ 'payload_serialization_error':'The payload is too big to serialize.' }\"));\n                }\n                else\n                {\n                    dictionary.Add(\"Payload\", new EntityProperty(json));\n\n                    foreach (var item in entry.Payload.Take(MaxPayloadItems))\n                    {\n                        var value = item.Value;\n                        if (value != null)\n                        {\n                            EntityProperty property = null;\n                            var type = value.GetType();\n\n                            if (type == typeof(string))\n                            {\n                                property = new EntityProperty((string)value);\n                            }\n                            else if (type == typeof(int))\n                            {\n                                property = new EntityProperty((int)value);\n                            }\n                            else if (type == typeof(long))\n                            {\n                                property = new EntityProperty((long)value);\n                            }\n                            else if (type == typeof(double))\n                            {\n                                property = new EntityProperty((double)value);\n                            }\n                            else if (type == typeof(Guid))\n                            {\n                                property = new EntityProperty((Guid)value);\n                            }\n                            else if (type == typeof(bool))\n                            {\n                                property = new EntityProperty((bool)value);\n                            }\n                            else if (type.IsEnum)\n                            {\n                                var typeCode = ((Enum)value).GetTypeCode();\n                                if (typeCode <= TypeCode.Int32)\n                                {\n                                    property = new EntityProperty(Convert.ToInt32(value, CultureInfo.InvariantCulture));\n                                }\n                                else\n                                {\n                                    property = new EntityProperty(Convert.ToInt64(value, CultureInfo.InvariantCulture));\n                                }\n                            }\n                            else if (type == typeof(byte[]))\n                            {\n                                property = new EntityProperty((byte[])value);\n                            }\n\n                            //// TODO: add & review DateTimeOffset if it's supported\n\n                            if (property != null)\n                            {\n                                dictionary.Add(string.Format(CultureInfo.InvariantCulture, \"Payload_{0}\", item.Key), property);\n                            }\n                        }\n                    }\n                }\n            }\n\n            return new DynamicTableEntity(entry.PartitionKey, entry.RowKey, null, dictionary);\n        }\n\n        private static string Normalize(string value)\n        {\n            if (value.Length > MaxStringLength)\n            {\n                return value.Substring(0, MaxStringLength) + @\"--TRUNCATED--\";\n            }\n\n            return value;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.WindowsAzure/Sinks/DateTimeExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Globalization;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.WindowsAzure\n{\n    /// <summary>\n    /// Extension methods for <see cref=\"DateTime\"/>.\n    /// </summary>\n    public static class DateTimeExtensions\n    {\n        /// <summary>\n        /// Generates a PartitionKey representation based on the specified <see cref=\"DateTime\"/>.\n        /// </summary>\n        /// <param name=\"dateTime\">The DateTime.</param>\n        /// <returns>A string representing the Partition Key.</returns>\n        public static string GeneratePartitionKey(this DateTime dateTime)\n        {\n            dateTime = dateTime.AddMinutes(-1D);\n            var pk = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, 0, dateTime.Kind);\n\n            return GetTicks(pk);\n        }\n\n        /// <summary>\n        /// Generates a PartitionKey representation (in reverse order) based on the specified <see cref=\"DateTime\"/>.\n        /// </summary>\n        /// <param name=\"dateTime\">The DateTime.</param>\n        /// <returns>A string representing the Partition Key (in reverse order).</returns>\n        public static string GeneratePartitionKeyReversed(this DateTime dateTime)\n        {\n            dateTime = dateTime.AddMinutes(-1D);\n            var pk = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, dateTime.Hour, dateTime.Minute, 0, dateTime.Kind);\n\n            return GetTicksReversed(pk);\n        }\n\n        internal static string GetTicksReversed(this DateTime dateTime)\n        {\n            return (DateTime.MaxValue - dateTime.ToUniversalTime()).Ticks.ToString(\"d19\", CultureInfo.InvariantCulture);\n        }\n\n        internal static string GetTicks(this DateTime dateTime)\n        {\n            return dateTime.ToUniversalTime().Ticks.ToString(\"d19\", CultureInfo.InvariantCulture);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.WindowsAzure/Sinks/WindowsAzureTableSink.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Text.RegularExpressions;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Properties;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.WindowsAzure;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing Microsoft.WindowsAzure.Storage;\nusing Microsoft.WindowsAzure.Storage.RetryPolicies;\nusing Microsoft.WindowsAzure.Storage.Table;\nusing Guard = Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility.Guard;\nusing WindowsAzureResources = Microsoft.Practices.EnterpriseLibrary.SemanticLogging.WindowsAzure.Properties.Resources;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks\n{\n    /// <summary>\n    /// Sink that asynchronously writes entries to an Azure table.\n    /// </summary>\n    public class WindowsAzureTableSink : IObserver<EventEntry>, IDisposable\n    {\n        private const int BufferCountTrigger = 100;\n        private static readonly char[] DisallowedCharsInPartitionAndRowKeys = new[] { '/', '\\\\', '#', '@' };\n\n        private static int salt = 0;\n\n        private readonly string instanceName;\n        private readonly CloudTableClient client;\n        private readonly CloudTable table;\n        private readonly TimeSpan onCompletedTimeout;\n        private CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();\n        private bool sortKeysAscending;\n        private BufferedEventPublisher<CloudEventEntry> bufferedPublisher;\n\n        /// <summary>\n        /// Initializes a new instance of the <see cref=\"WindowsAzureTableSink\"/> class with the specified connection string and table address.\n        /// </summary>\n        /// <param name=\"instanceName\">The name of the instance originating the entries.</param>\n        /// <param name=\"connectionString\">The connection string for the storage account.</param>\n        /// <param name=\"tableAddress\">Either the name of the table, or the absolute URI to the table.</param>\n        /// <param name=\"bufferInterval\">The buffering interval to wait for events to accumulate before sending them to Azure Storage.</param>\n        /// <param name=\"maxBufferSize\">The maximum number of entries that can be buffered while it's sending to Azure Storage before the sink starts dropping entries.</param>\n        /// <param name=\"onCompletedTimeout\">Defines a timeout interval for when flushing the entries after an <see cref=\"OnCompleted\"/> call is received and before disposing the sink.\n        /// This means that if the timeout period elapses, some event entries will be dropped and not sent to the store. Normally, calling <see cref=\"IDisposable.Dispose\"/> on \n        /// the <see cref=\"System.Diagnostics.Tracing.EventListener\"/> will block until all the entries are flushed or the interval elapses.\n        /// If <see langword=\"null\"/> is specified, then the call will block indefinitely until the flush operation finishes.</param>\n        public WindowsAzureTableSink(string instanceName, string connectionString, string tableAddress, TimeSpan bufferInterval, int maxBufferSize, TimeSpan onCompletedTimeout)\n        {\n            Guard.ArgumentNotNullOrEmpty(instanceName, \"instanceName\");\n            Guard.ArgumentNotNullOrEmpty(connectionString, \"connectionString\");\n            Guard.ArgumentNotNullOrEmpty(tableAddress, \"tableAddress\");\n            Guard.ArgumentIsValidTimeout(onCompletedTimeout, \"onCompletedTimeout\");\n\n            this.onCompletedTimeout = onCompletedTimeout;\n\n            CloudStorageAccount account = GetStorageAccount(connectionString);\n\n            if (!IsValidTableName(tableAddress))\n            {\n                throw new ArgumentException(WindowsAzureResources.InvalidTableName, \"tableAddress\");\n            }\n\n            this.instanceName = NormalizeInstanceName(instanceName);\n            this.client = account.CreateCloudTableClient();\n            this.client.DefaultRequestOptions = new TableRequestOptions\n            {\n                RetryPolicy = new ExponentialRetry(TimeSpan.FromSeconds(5), 7)\n            };\n            this.table = this.client.GetTableReference(tableAddress);\n            string sinkId = string.Format(CultureInfo.InvariantCulture, \"WindowsAzureTableSink ({0})\", instanceName);\n            this.bufferedPublisher = BufferedEventPublisher<CloudEventEntry>.CreateAndStart(sinkId, this.PublishEventsAsync, bufferInterval, BufferCountTrigger, maxBufferSize, this.cancellationTokenSource.Token);\n        }\n\n        /// <summary>\n        /// Finalizes an instance of the <see cref=\"WindowsAzureTableSink\"/> class.\n        /// </summary>\n        ~WindowsAzureTableSink()\n        {\n            this.Dispose(false);\n        }\n\n        /// <summary>\n        /// Gets or sets a value indicating whether to sort the row keys in ascending order.\n        /// </summary>\n        /// <value>The value indicating whether to sort the row keys in ascending order.</value>\n        public bool SortKeysAscending\n        {\n            get\n            {\n                return this.sortKeysAscending;\n            }\n\n            set\n            {\n                this.sortKeysAscending = value;\n\n                if (value == true)\n                {\n                    salt = 0xFFFF;\n                }\n            }\n        }\n\n        /// <summary>\n        /// Causes the buffer to be written immediately.\n        /// </summary>\n        /// <returns>The Task that flushes the buffer.</returns>\n        public Task FlushAsync()\n        {\n            return this.bufferedPublisher.FlushAsync();\n        }\n\n        /// <summary>\n        /// Releases all resources used by the current instance of the <see cref=\"WindowsAzureTableSink\"/> class.\n        /// </summary>\n        public void Dispose()\n        {\n            this.Dispose(true);\n            GC.SuppressFinalize(this);\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has finished sending push-based notifications.\n        /// </summary>\n        public void OnCompleted()\n        {\n            this.FlushSafe();\n            this.Dispose();\n        }\n\n        /// <summary>\n        /// Notifies the observer that the provider has experienced an error condition.\n        /// </summary>\n        /// <param name=\"error\">An object that provides additional information about the error.</param>\n        public void OnError(Exception error)\n        {\n            this.FlushSafe();\n            this.Dispose();\n        }\n\n        /// <summary>\n        /// Provides the sink with new data to write.\n        /// </summary>\n        /// <param name=\"value\">The current entry to write.</param>\n        public void OnNext(EventEntry value)\n        {\n            this.OnNext(value.TryConvertToCloudEventEntry());\n        }\n\n        internal void OnNext(CloudEventEntry value)\n        {\n            if (value == null)\n            {\n                return;\n            }\n\n            value.InstanceName = value.InstanceName != null ? NormalizeInstanceName(value.InstanceName) : this.instanceName;\n\n            this.bufferedPublisher.TryPost(value);\n        }\n\n        internal virtual Task<IList<TableResult>> ExecuteBatchAsync(TableBatchOperation batch)\n        {\n            return this.table.ExecuteBatchAsync(batch, this.cancellationTokenSource.Token);\n        }\n\n        internal virtual async Task<bool> EnsureTableExistsAsync()\n        {\n            var token = this.cancellationTokenSource.Token;\n            if (token.IsCancellationRequested)\n            {\n                return false;\n            }\n\n            try\n            {\n                await this.table.CreateIfNotExistsAsync(token).ConfigureAwait(false);\n                return true;\n            }\n            catch (OperationCanceledException)\n            {\n                // This exception is never thrown as of the current version of the storage client library.\n                // Keeping in case in the future this exception is thrown by the storage client.\n                return false;\n            }\n            catch (Exception ex)\n            {\n                if (!IsOperationCanceled(ex as StorageException))\n                {\n                    SemanticLoggingEventSource.Log.WindowsAzureTableSinkTableCreationFailed(ex.ToString());\n                }\n\n                return false;\n            }\n        }\n\n        /// <summary>\n        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.\n        /// </summary>\n        /// <param name=\"disposing\">A value indicating whether or not the class is disposing.</param>\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Usage\", \"CA2213:DisposableFieldsShouldBeDisposed\", MessageId = \"cancellationTokenSource\", Justification = \"Token is cancelled\")]\n        protected virtual void Dispose(bool disposing)\n        {\n            if (disposing)\n            {\n                this.cancellationTokenSource.Cancel();\n                this.bufferedPublisher.Dispose();\n            }\n        }\n\n        /// <summary>\n        /// Normalizes the instance name, as it will be used as part of the row key for each of the entries.\n        /// </summary>\n        /// <param name=\"instanceName\">The original desired instance name.</param>\n        /// <returns>A normalized string that is limited in its length and removes reserved characters.</returns>\n        private static string NormalizeInstanceName(string instanceName)\n        {\n            const int InstanceNameMaxLength = 255;\n\n            if (instanceName.Length > InstanceNameMaxLength)\n            {\n                instanceName = instanceName.Substring(0, InstanceNameMaxLength);\n            }\n\n            foreach (var disallowedChar in DisallowedCharsInPartitionAndRowKeys)\n            {\n                instanceName = instanceName.Replace(disallowedChar, '_');\n            }\n\n            return instanceName;\n        }\n\n        private static bool IsValidTableName(string tableName)\n        {\n            var isMatch = Regex.IsMatch(tableName, @\"^[A-Za-z][A-Za-z0-9]{2,62}$\", RegexOptions.Compiled);\n\n            return isMatch;\n        }\n\n        /// <summary>\n        /// Validate the Azure connection string or throws an exception.\n        /// </summary>\n        /// <param name=\"connectionString\">The connection string value.</param>\n        /// <exception cref=\"ArgumentNullException\">Null or empty connection string.</exception>\n        /// <exception cref=\"ArgumentException\">Invalid connection string.</exception>\n        /// <returns>The <see cref=\"Microsoft.WindowsAzure.Storage.CloudStorageAccount\"/>.</returns>\n        private static CloudStorageAccount GetStorageAccount(string connectionString)\n        {\n            Guard.ArgumentNotNullOrEmpty(connectionString, \"connectionString\");\n\n            try\n            {\n                return CloudStorageAccount.Parse(connectionString);\n            }\n            catch (FormatException e)\n            {\n                throw new ArgumentException(Resources.InvalidConnectionStringError, \"connectionString\", e);\n            }\n        }\n\n        private static TableBatchOperation GetBatchOperation(IEnumerable<CloudEventEntry> entries)\n        {\n            const int MaxBatchSizeInBytes = 4000000;\n\n            var batchOperation = new TableBatchOperation();\n\n            int approximateBatchSize = 0;\n            foreach (var item in entries)\n            {\n                var entity = item.CreateTableEntity();\n\n                approximateBatchSize += GetApproximateEntitySize(entity);\n\n                if (approximateBatchSize >= MaxBatchSizeInBytes)\n                {\n                    break;\n                }\n\n                batchOperation.InsertOrReplace(entity);\n            }\n\n            return batchOperation;\n        }\n\n        private static int GetApproximateEntitySize(DynamicTableEntity entity)\n        {\n            // rough estimate of entry size without accounting for payload\n            int approximateEntitySize = entity.Properties.Count * 300;\n\n            // Approximate payload size. It is very conservative, as the size is not accurate and it's\n            // better to send batches with fewer items instead of getting exceptions due to size.\n            if (entity.Properties.ContainsKey(\"Payload\"))\n            {\n                // Payload arguments are serialized twice as UTF-16: as JSON and also there are individual columns.\n                approximateEntitySize += entity.Properties[\"Payload\"].StringValue.Length * 4;\n            }\n\n            // Approximate formatted message size.\n            if (entity.Properties.ContainsKey(\"Message\"))\n            {\n                // Payload arguments are serialized as UTF-16.\n                approximateEntitySize += entity.Properties[\"Message\"].StringValue.Length * 2;\n            }\n\n            return approximateEntitySize;\n        }\n\n        private static bool IsOperationCanceled(StorageException ex)\n        {\n            // Code used by the storage client library to identify cancellations.\n            const int OperationCanceledStatusCode = 306;\n\n            return ex != null && ex.RequestInformation != null && ex.RequestInformation.HttpStatusCode == OperationCanceledStatusCode;\n        }\n\n        private List<CloudEventEntry> FilterBatch(IList<CloudEventEntry> collection)\n        {\n            string partitionKey = null;\n            var entries = new List<CloudEventEntry>();\n            int index = 0;\n\n            this.UpdateSalt();\n\n            foreach (var entry in collection)\n            {\n                if (entry.PartitionKey == null)\n                {\n                    entry.CreateKey(this.SortKeysAscending, salt);\n                }\n\n                if (partitionKey == null)\n                {\n                    partitionKey = entry.PartitionKey;\n                }\n\n                if (entry.PartitionKey == partitionKey)\n                {\n                    entries.Add(entry);\n                }\n                else\n                {\n                    break;\n                }\n\n                // a batch cannot contain more than 100 items\n                if (++index >= 100)\n                {\n                    break;\n                }\n            }\n\n            foreach (var group in entries.GroupBy(x => x.RowKey))\n            {\n                var items = group.ToList();\n                if (items.Count > 1)\n                {\n                    foreach (var item in items)\n                    {\n                        this.UpdateSalt();\n\n                        // if there are more than 1 item in the group, regenerate their keys to make them unique.\n                        item.CreateKey(this.sortKeysAscending, salt);\n                    }\n                }\n            }\n\n            return entries;\n        }\n\n        private void UpdateSalt()\n        {\n            if (this.sortKeysAscending)\n            {\n                salt++;\n            }\n            else\n            {\n                salt--;\n            }\n        }\n\n        private async Task<IList<TableResult>> ExecuteBatchSafeAsync(TableBatchOperation batch)\n        {\n            try\n            {\n                return await this.ExecuteBatchAsync(batch).ConfigureAwait(false);\n            }\n            catch (StorageException ex)\n            {\n                if (ex.RequestInformation == null\n                    || ex.RequestInformation.HttpStatusCode != 404 // Not Found\n                    || ex.RequestInformation.ExtendedErrorInformation == null\n                    || ex.RequestInformation.ExtendedErrorInformation.ErrorCode != \"TableNotFound\")\n                {\n                    throw;\n                }\n            }\n\n            if (await this.EnsureTableExistsAsync().ConfigureAwait(false))\n            {\n                return await this.ExecuteBatchAsync(batch).ConfigureAwait(false);\n            }\n\n            return null;\n        }\n\n        private async Task<int> PublishEventsAsync(IList<CloudEventEntry> collection)\n        {\n            var entries = this.FilterBatch(collection);\n            var batchOperation = GetBatchOperation(entries);\n\n            try\n            {\n                var result = await this.ExecuteBatchSafeAsync(batchOperation).ConfigureAwait(false);\n                return result != null ? batchOperation.Count : 0;\n            }\n            catch (StorageException ex)\n            {\n                if (IsOperationCanceled(ex))\n                {\n                    return 0;\n                }\n\n                if (ex.RequestInformation != null && ex.RequestInformation.HttpStatusCode == 400)\n                {\n                    // Bad request\n                    SemanticLoggingEventSource.Log.WindowsAzureTableSinkPublishEventsFailedAndDiscardsEntries(batchOperation.Count);\n                    return batchOperation.Count;\n                }\n\n                SemanticLoggingEventSource.Log.WindowsAzureTableSinkPublishEventsFailed(ex.ToString());\n                throw;\n            }\n            catch (OperationCanceledException)\n            {\n                return 0;\n            }\n            catch (Exception ex)\n            {\n                SemanticLoggingEventSource.Log.WindowsAzureTableSinkPublishEventsFailed(ex.ToString());\n                throw;\n            }\n        }\n\n        private void FlushSafe()\n        {\n            try\n            {\n                this.FlushAsync().Wait(this.onCompletedTimeout);\n            }\n            catch (AggregateException ex)\n            {\n                // Flush operation will already log errors. Never expose this exception to the observable.\n                ex.Handle(e => e is FlushFailedException);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.WindowsAzure/Utility/CloudEventEntryExtensions.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.WindowsAzure;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility\n{\n    /// <summary>\n    /// Extensions for <see cref=\"EventEntry\"/>.\n    /// </summary>\n    public static class CloudEventEntryExtensions\n    {\n        /// <summary>\n        /// Subscribes an <see cref=\"IObserver{CloudEventEntry}\"/> sink by doing a straight projection of a sequence of <see cref=\"EventEntry\"/>\n        /// and converting it to a <see cref=\"CloudEventEntry\"/> entity.\n        /// </summary>\n        /// <param name=\"source\">The original stream of events.</param>\n        /// <param name=\"sink\">The underlying sink.</param>\n        /// <returns>A subscription token to unsubscribe to the event stream.</returns>\n        /// <remarks>When using Reactive Extensions (Rx), this is equivalent to doing a Select statement on the <paramref name=\"source\"/> to convert it to <see cref=\"IObservable{String}\"/> and then\n        /// calling Subscribe on it.\n        /// </remarks>\n        public static IDisposable SubscribeWithConversion(this IObservable<EventEntry> source, IObserver<CloudEventEntry> sink)\n        {\n            return source.CreateSubscription(sink, TryConvertToCloudEventEntry);\n        }\n\n        /// <summary>\n        /// Converts an <see cref=\"EventEntry\"/> to a <see cref=\"CloudEventEntry\"/>.\n        /// </summary>\n        /// <param name=\"entry\">The entry to convert.</param>\n        /// <returns>A converted entry, or <see langword=\"null\"/> if the payload is invalid.</returns>\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\",\n            \"CA1062:Validate arguments of public methods\", MessageId = \"0\",\n            Justification = \"Validated using Guard class\")]\n        public static CloudEventEntry TryConvertToCloudEventEntry(this EventEntry entry)\n        {\n            Guard.ArgumentNotNull(entry, \"entry\");\n\n            try\n            {\n                return new CloudEventEntry(entry);\n            }\n            catch (Exception e)\n            {\n                SemanticLoggingEventSource.Log.WindowsAzureTableSinkEntityCreationFailed(e.ToString());\n                return null;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.WindowsAzure/WindowsAzureTableLog.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.Threading;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging\n{\n    /// <summary>\n    /// Factories and helpers for using the <see cref=\"WindowsAzureTableSink\"/>.\n    /// </summary>\n    public static class WindowsAzureTableLog\n    {\n        /// <summary>\n        /// The default table name where logs are written to.\n        /// </summary>\n        public const string DefaultTableName = \"SLABLogsTable\";\n\n        /// <summary>\n        /// Subscribes to an <see cref=\"IObservable{EventEntry}\" /> using a <see cref=\"WindowsAzureTableSink\" />.\n        /// </summary>\n        /// <param name=\"eventStream\">The event stream. Typically this is an instance of <see cref=\"ObservableEventListener\" />.</param>\n        /// <param name=\"instanceName\">The name of the instance originating the entries.</param>\n        /// <param name=\"connectionString\">The connection string for the storage account.</param>\n        /// <param name=\"tableAddress\">Either the name of the table, or the absolute URI to the table.</param>\n        /// <param name=\"bufferingInterval\">The buffering interval between each batch publishing. Default value is <see cref=\"Buffering.DefaultBufferingInterval\" />.</param>\n        /// <param name=\"sortKeysAscending\">The value indicating whether to sort the row keys in ascending order.</param>\n        /// <param name=\"onCompletedTimeout\">Defines a timeout interval for when flushing the entries after an <see cref=\"WindowsAzureTableSink.OnCompleted\" /> call is received and before disposing the sink.</param>\n        /// <param name=\"maxBufferSize\">The maximum number of entries that can be buffered while it's sending to Azure Storage before the sink starts dropping entries.\n        /// This means that if the timeout period elapses, some event entries will be dropped and not sent to the store. Normally, calling <see cref=\"IDisposable.Dispose\" /> on\n        /// the <see cref=\"System.Diagnostics.Tracing.EventListener\" /> will block until all the entries are flushed or the interval elapses.\n        /// If <see langword=\"null\" /> is specified, then the call will block indefinitely until the flush operation finishes.</param>\n        /// <returns>\n        /// A subscription to the sink that can be disposed to unsubscribe the sink and dispose it, or to get access to the sink instance.\n        /// </returns>\n        public static SinkSubscription<WindowsAzureTableSink> LogToWindowsAzureTable(this IObservable<EventEntry> eventStream, string instanceName, string connectionString, string tableAddress = DefaultTableName, TimeSpan? bufferingInterval = null, bool sortKeysAscending = false, TimeSpan? onCompletedTimeout = null, int maxBufferSize = Buffering.DefaultMaxBufferSize)\n        {\n            var sink = new WindowsAzureTableSink(\n                instanceName,\n                connectionString,\n                tableAddress,\n                bufferingInterval ?? Buffering.DefaultBufferingInterval,\n                maxBufferSize,\n                onCompletedTimeout ?? Timeout.InfiniteTimeSpan)\n            {\n                SortKeysAscending = sortKeysAscending\n            };\n\n            var subscription = eventStream.Subscribe(sink);\n            return new SinkSubscription<WindowsAzureTableSink>(subscription, sink);\n        }\n\n        /// <summary>\n        /// Creates an event listener that logs using a <see cref=\"WindowsAzureTableSink\" />.\n        /// </summary>\n        /// <param name=\"instanceName\">The name of the instance originating the entries.</param>\n        /// <param name=\"connectionString\">The connection string for the storage account.</param>\n        /// <param name=\"tableAddress\">Either the name of the table, or the absolute URI to the table.</param>\n        /// <param name=\"bufferingInterval\">The buffering interval between each batch publishing.</param>\n        /// <param name=\"sortKeysAscending\">The value indicating whether to sort the row keys in ascending order.</param>\n        /// <param name=\"listenerDisposeTimeout\">Defines a timeout interval for the flush operation when the listener is disposed.</param>\n        /// <param name=\"maxBufferSize\">The maximum number of entries that can be buffered while it's sending to Azure Storage before the sink starts dropping entries.\n        /// This means that if the timeout period elapses, some event entries will be dropped and not sent to the store. Calling <see cref=\"IDisposable.Dispose\" /> on\n        /// the <see cref=\"EventListener\" /> will block until all the entries are flushed or the interval elapses.\n        /// If <see langword=\"null\" /> is specified, then the call will block indefinitely until the flush operation finishes.</param>\n        /// <returns>\n        /// An event listener that uses <see cref=\"WindowsAzureTableSink\" /> to log events.\n        /// </returns>\n        public static EventListener CreateListener(string instanceName, string connectionString, string tableAddress = DefaultTableName, TimeSpan? bufferingInterval = null, bool sortKeysAscending = false, TimeSpan? listenerDisposeTimeout = null, int maxBufferSize = Buffering.DefaultMaxBufferSize)\n        {\n            var listener = new ObservableEventListener();\n            listener.LogToWindowsAzureTable(instanceName, connectionString, tableAddress, bufferingInterval, sortKeysAscending, listenerDisposeTimeout, maxBufferSize);\n            return listener;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Src/SemanticLogging.WindowsAzure/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"Microsoft.Azure.KeyVault.Core\" version=\"1.0.0\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Data.Edm\" version=\"5.6.4\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Data.OData\" version=\"5.6.4\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.Data.Services.Client\" version=\"5.6.4\" targetFramework=\"net45\" />\n  <package id=\"Microsoft.WindowsAzure.ConfigurationManager\" version=\"2.0.3\" targetFramework=\"net45\" />\n  <package id=\"Newtonsoft.Json\" version=\"6.0.8\" targetFramework=\"net45\" />\n  <package id=\"StyleCop.MSBuild\" version=\"4.7.49.0\" targetFramework=\"net45\" developmentDependency=\"true\" />\n  <package id=\"System.Spatial\" version=\"5.6.4\" targetFramework=\"net45\" />\n  <package id=\"WindowsAzure.Storage\" version=\"7.2.1\" targetFramework=\"net45\" />\n</packages>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/App.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n  <connectionStrings>\n    <add name=\"invalid\" connectionString=\"invalid connection string\" />\n    <add name=\"noprovider\" connectionString=\"Data Source=(localdb)\\v11.0; AttachDBFilename='|DataDirectory|\\Logging.mdf';Initial Catalog=SemanticLoggingTests;Integrated Security=True\" />\n    <add name=\"invalidprovider\" connectionString=\"Data Source=(localdb)\\v11.0; AttachDBFilename='|DataDirectory|\\Logging.mdf';Initial Catalog=SemanticLoggingTests;Integrated Security=True\" providerName=\"invalid\" />\n    <add name=\"valid\" connectionString=\"Data Source=(localdb)\\v11.0; AttachDBFilename='|DataDirectory|\\Logging.mdf';Initial Catalog=SemanticLoggingTests;Integrated Security=True\" providerName=\"System.Data.SqlClient\" />\n  </connectionStrings>\n  \n  <appSettings>\n    <add key=\"StorageConnectionString\" value=\"DefaultEndpointsProtocol=https;AccountName=[AccountName];AccountKey=[AccountKey]\" />\n    <!-- You can also use the storage emulator, but make sure to start it before running the tests -->\n    <!--<add key=\"StorageConnectionString\" value=\"UseDevelopmentStorage=true\" />-->\n\n    <!-- Elasticsearch must be installed to run the integration tests. See http://www.elasticsearch.org/overview/elkdownloads/ for details. -->\n    <!--<add key=\"ElasticsearchUrl\" value=\"http://localhost:9200\" />-->\n    \n    <add key=\"StorageConnectionStringOutprocSvc\" value=\"UseDevelopmentStorage=true\" />\n    \n    <add key=\"RunSlowIntegrationTests\" value=\"true\" />\n  </appSettings>\n\n  <system.diagnostics>\n    <!-- Turn off Assert.Debug dialog to prevent any interective dialog to show up while running tests. Any assertion will be saved to log file -->\n    <assert assertuienabled=\"false\" logfilename=\"debug.assert.errors.log\" />\n  </system.diagnostics>\n\n  <runtime>\n    <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">\n      <dependentAssembly>\n        <assemblyIdentity name=\"Microsoft.Data.OData\" publicKeyToken=\"31bf3856ad364e35\" culture=\"neutral\" />\n        <bindingRedirect oldVersion=\"0.0.0.0-5.2.0.0\" newVersion=\"5.2.0.0\" />\n      </dependentAssembly>\n      <dependentAssembly>\n        <assemblyIdentity name=\"Microsoft.Data.Edm\" publicKeyToken=\"31bf3856ad364e35\" culture=\"neutral\" />\n        <bindingRedirect oldVersion=\"0.0.0.0-5.2.0.0\" newVersion=\"5.2.0.0\" />\n      </dependentAssembly>\n      <dependentAssembly>\n        <assemblyIdentity name=\"System.Spatial\" publicKeyToken=\"31bf3856ad364e35\" culture=\"neutral\" />\n        <bindingRedirect oldVersion=\"0.0.0.0-5.2.0.0\" newVersion=\"5.2.0.0\" />\n      </dependentAssembly>\n    </assemblyBinding>\n  </runtime>\n<startup><supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.5.1\" /></startup></configuration>\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/MySinkElement.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Etw.Configuration\n{\n    public class MySinkElement : ISinkElement\n    {\n        private readonly XName sinkName = XName.Get(\"mySink\", \"urn:test\");\n\n        public bool CanCreateSink(XElement element)\n        {\n            return element.Name == this.sinkName;\n        }\n\n        public IObserver<EventEntry> CreateSink(XElement element)\n        {\n            var sink = new MySink(FormatterElementFactory.Get(element));\n            MySink.Instance = sink;\n            return sink;\n        }\n    }\n\n    public class MyNoSchemaSinkElement : ISinkElement\n    {\n        private readonly XName sinkName = XName.Get(\"mySink\", \"urn:no_schema\");\n\n        public bool CanCreateSink(XElement element)\n        {\n            return element.Name == this.sinkName;\n        }\n\n        public IObserver<EventEntry> CreateSink(XElement element)\n        {\n            var sink = new MySink(FormatterElementFactory.Get(element));\n            MySink.Instance = sink;\n            return sink;\n        }\n    }\n\n    public class MySink : IObserver<EventEntry>\n    {\n        public static MySink Instance { get; set; }\n\n        public MySink(IEventTextFormatter formatter)\n        {\n            this.Formatter = formatter;\n        }\n\n        public IEventTextFormatter Formatter { get; set; }\n\n        public void OnCompleted()\n        {\n        }\n\n        public void OnError(Exception error)\n        {\n        }\n\n        public void OnNext(EventEntry value)\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/MySinkElement.xsd",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\n           xmlns=\"urn:test\"\n           xmlns:etw=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\"\n           targetNamespace=\"urn:test\"\n           elementFormDefault=\"qualified\"\n           attributeFormDefault=\"unqualified\">\n\n  <!--<xs:import namespace=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\" \n             schemaLocation=\"C:\\Microsoft\\EntLib\\EL-V6\\Source\\Blocks\\SemanticLogging\\Src\\SemanticLogging.Etw.WindowsService\\SemanticLogging-svc.xsd\"/>-->\n  \n  <xs:element name=\"mySink\">\n    <xs:complexType>\n      <!--<xs:complexContent mixed=\"false\">\n        <xs:extension base=\"etw:SinkBaseWithFormatters\">\n          <xs:attribute name=\"attr\" type=\"EventTextFormatting\" use=\"required\" />\n        </xs:extension>\n      </xs:complexContent>-->\n      <xs:sequence>       \n        <xs:any minOccurs=\"0\" maxOccurs=\"unbounded\" processContents=\"skip\"/>\n      </xs:sequence>\n      <xs:attribute name=\"name\" type=\"xs:string\" use=\"required\" />\n      <xs:attribute name=\"attr\" type=\"EventTextFormatting\" use=\"required\" />\n    </xs:complexType>    \n  </xs:element>\n  \n  <xs:simpleType name=\"EventTextFormatting\">\n    <xs:restriction base=\"xs:string\">\n      <xs:enumeration value=\"None\" />\n      <xs:enumeration value=\"Indented\" />\n    </xs:restriction>\n  </xs:simpleType>\n  \n</xs:schema>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithBadTypes.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  \n  <sinks>\n    <customSink name=\"custom\" type=\"badType\">\n      <sources>\n        <eventSource id=\"659518be-d338-564b-2759-c63c10ef82e2\"/>\n      </sources>\n    </customSink>\n  </sinks>\n  \n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithDefaultValues.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithDiff0.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <traceEventService sessionNamePrefix=\"Microsoft.SemanticLogging.Etw\" />\n\n  <sinks>\n    \n    <flatFileSink name=\"FlatFileEventListener1\" fileName=\"FlatFile.log\" >\n      \n      <sources>\n        <eventSource name=\"Test\" level=\"Error\" matchAnyKeyword=\"1\"/>\n      </sources>\n      \n      <!-- No Diff -->\n      \n      <eventTextFormatter header=\"---\" \n                          footer=\"\"  \n                          dateTimeFormat=\"o\"  \n                          verbosityThreshold=\"Verbose\"/>\n    </flatFileSink>\n    \n  </sinks>\n  \n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithDiff1.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <traceEventService sessionNamePrefix=\"Microsoft.SemanticLogging.Etw\" />\n\n  <sinks>\n    <flatFileSink name=\"FlatFileEventListener1\" fileName=\"FlatFile.log\">\n      <sources>\n        <eventSource name=\"Test\" level=\"Error\" matchAnyKeyword=\"1\"/>\n      </sources>\n      <eventTextFormatter header=\"---\" footer=\"\" verbosityThreshold=\"Verbose\" dateTimeFormat=\"o\"/>\n    </flatFileSink>\n  </sinks>\n  \n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithDiff2.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <traceEventService sessionNamePrefix=\"Microsoft.SemanticLogging.Etw.Diff1\" />\n\n  <sinks>\n    <flatFileSink name=\"FlatFileEventListener1\" fileName=\"FlatFile.log\">\n      <sources>\n        <eventSource name=\"Test\" level=\"Error\" matchAnyKeyword=\"1\"/>\n        <eventSource name=\"Diff2\" level=\"Error\" matchAnyKeyword=\"1\"/>\n      </sources>\n      <eventTextFormatter header=\"Dif3\" footer=\"\" verbosityThreshold=\"Verbose\" dateTimeFormat=\"o\"/>\n    </flatFileSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithDuplicateNames.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <customSink name=\"customListener\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects.InMemoryEventListener, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\">\n      <sources>\n        <eventSource name=\"MyCompany\"/>\n      </sources>\n    </customSink>\n    <consoleSink name=\"customListener\">\n      <sources>\n        <eventSource name=\"Test\"/>\n        <eventSource name=\"Test\"/>\n      </sources>\n      <eventTextFormatter/>\n      <eventTextFormatter/>\n    </consoleSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithEmptyNonStringValues.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  \n  <traceEventService sessionNamePrefix=\"\"/>\n\n  <sinks>\n    <consoleSink name=\"customListener\">\n      <sources>\n        <eventSource id=\"\"/>\n      </sources>\n    </consoleSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithErrorOnSinkCreation.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  \n  <sinks>\n    <flatFileSink name=\"file\" fileName=\"c:\\bad\\c:\\path\\mylogfile.log\">\n      <sources>\n        <eventSource name=\"MyCompany\"/>\n      </sources>\n    </flatFileSink>\n  </sinks>\n  \n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithEventSourceIdOnly.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <consoleSink name=\"customListener\">\n      <sources>\n        <eventSource id=\"659518be-d338-564b-2759-c63c10ef82e2\"/>\n      </sources>\n    </consoleSink>\n  </sinks>\n  \n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithEventSourceNameOnly.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n \n  <sinks>\n    <consoleSink name=\"customListener\">\n      <sources>\n        <eventSource name=\"MyCompany\"/>\n      </sources>\n    </consoleSink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithExtensions.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  \n  <sinks>\n    <customSink name=\"custom\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects.InMemoryEventListener, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\">\n      <sources>\n        <eventSource name=\"MyCompany\"/>\n      </sources>\n      <parameters>\n        <parameter name=\"formatter\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects.MockFormatter, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\"/>\n      </parameters>\n    </customSink>\n    <consoleSink name=\"withCustomFormatter\">\n      <sources>\n        <eventSource name=\"MyCompany\"/>        \n      </sources>\n      <customEventTextFormatter type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects.MockFormatter, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\"/>\n    </consoleSink>               \n    <ext:mySink xmlns:ext=\"urn:test\" name=\"my\" attr=\"Indented\">\n      <sources>\n        <eventSource name=\"MyCompany\"/>          \n      </sources>\n      <jsonEventTextFormatter formatting=\"Indented\"/>\n    </ext:mySink>\n</sinks>\n  \n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithExtensionsIncompleteParams.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  \n  <sinks>\n    <customSink name=\"incompleteParamSink\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects.CustomSink, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\">\n      <sources>\n        <eventSource name=\"MyCompany\"/>\n      </sources>\n      <parameters>\n        <parameter name=\"required\" type=\"System.String\" value=\"test\"/>\n      </parameters>\n    </customSink>\n  </sinks>\n  \n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithExtensionsNoSchemaValidation.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <noxsd:mySink xmlns:noxsd =\"urn:no_schema\" name=\"my\" attr=\"Indented\">\n      <sources>\n        <eventSource name=\"MyCompany\"/>          \n      </sources>\n      <jsonEventTextFormatter formatting=\"Indented\"/>\n    </noxsd:mySink>  \n  </sinks>\n  \n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithExtensionsSchemaValidation.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\"\n               xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <sinks>\n    <customSink name=\"custom\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects.InMemoryEventListener, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\">\n      <sources>\n        <eventSource name=\"MyCompany\"/>\n      </sources>\n      <parameters>\n        <parameter name=\"formatter\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects.MockFormatter, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\"/>\n      </parameters>\n    </customSink>\n    <consoleSink name=\"withCustomFormatter\">\n      <sources>\n        <eventSource name=\"MyCompany\"/>          \n      </sources>\n      <customEventTextFormatter type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects.MockFormatter, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\"/>\n    </consoleSink>\n    <mySink xmlns=\"urn:test\" name=\"my\">\n      <sources>\n        <eventSource name=\"MyCompany\"/>\n      </sources>      \n      <jsonEventTextFormatter name=\"json\"/>    \n    </mySink>\n  </sinks>\n\n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithManyEventSources.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <sinks>\n    <customSink name=\"sink1\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects.InMemoryEventListener, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\">\n      <sources>\n        <eventSource name=\"MyCompany\" level=\"Error\"/>\n      </sources>\n    </customSink>\n    <consoleSink name=\"sink2\">\n      <sources>\n        <eventSource name=\"Test\" level=\"Warning\"/>\n      </sources>\n    </consoleSink>\n  </sinks>\n  \n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithManyEventSourcesWithArgumentsAndFilters.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n  <sinks>\n    <customSink name=\"sink1\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects.InMemoryEventListener, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\">\n      <sources>\n        <eventSource name=\"MyCompany\" level=\"Error\">\n          <arguments>\n            <add key=\"ActivitySampling\" value=\"true\"/>\n          </arguments>\n        </eventSource>\n      </sources>\n    </customSink>\n    <consoleSink name=\"sink2\">\n      <sources>\n        <eventSource name=\"Test\" level=\"Warning\">\n          <arguments>\n            <add key=\"ActivitySamplingStartEvent\" value=\"RequestStarted:5\"/>\n            <add key=\"SomeOtherArgument\" value=\"\"/>\n          </arguments>\n          <filter>\n            <process name=\"iis.exe\"/>\n            <process name=\"iisexpress.exe\"/>\n          </filter>\n        </eventSource>\n        <eventSource name=\"Test2\" level=\"Warning\">\n          <filter>\n            <process name=\"iis.exe\"/>\n          </filter>\n        </eventSource>\n      </sources>\n    </consoleSink>\n  </sinks>\n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithManySinks.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <traceEventService sessionNamePrefix=\"Microsoft.SemanticLogging.Etw\"/>\n  \n  <sinks>\n    <flatFileSink name=\"FlatFileEventListener1\" fileName=\"FlatFile.log\">\n      <sources>\n        <eventSource name=\"Test\" level=\"Error\" matchAnyKeyword=\"1\"/>\n      </sources>\n      <eventTextFormatter header=\"---\" footer=\"\" verbosityThreshold=\"Verbose\" dateTimeFormat=\"o\"/> \n    </flatFileSink>\n    \n    <consoleSink name=\"ConsoleEventListener1\">\n      <sources>\n        <eventSource name=\"MyCompany\" level=\"Error\"/>\n      </sources>\n      <xmlEventTextFormatter formatting=\"Indented\" dateTimeFormat=\"o\"/>\n    </consoleSink>\n    \n    <customSink name=\"custom\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects.InMemoryEventListener, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\">\n      <sources>\n        <eventSource name=\"MyCompany\" level=\"Error\"/>\n      </sources>\n      <xmlEventTextFormatter formatting=\"Indented\" dateTimeFormat=\"o\"/>\n      <parameters>\n        <parameter name=\"formatter\" type=\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects.MockFormatter, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\"/>\n      </parameters>\n    </customSink>\n    \n    <windowsAzureTableSink name=\"azure1\" \n                           connectionString=\"UseDevelopmentStorage=true\" \n                           instanceName=\"AzureTableInstance\" \n                           tableAddress=\"SLABAzureTableLogs\">\n      <sources>\n        <eventSource name=\"MyCompany\" level=\"LogAlways\" matchAnyKeyword=\"123\"/>\n      </sources>\n    </windowsAzureTableSink>\n  </sinks>\n  \n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithNoEventSourceNameId.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n \n  <sinks>\n    <consoleSink name=\"customListener\">\n      <sources>\n        <eventSource/>\n      </sources>\n    </consoleSink>\n  </sinks>\n  \n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/Configuration/WithWarnings.xml",
    "content": "<?xml version=\"1.0\"?>\n<configuration xmlns=\"http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw\">\n\n  <traceEventService sessionNamePrefix=\"\"/> <!--warning, empty sessionNamePrefix-->\n  \n  <sinks>\n    <consoleSink name=\"\"> <!--warning, empty name-->\n      <sources>\n        <eventSource name=\"MyCompany\"/>\n      </sources>\n    </consoleSink>\n    <mySink xmlns=\"urn:test\"/> <!--warning, no schema found-->\n  </sinks>\n  \n</configuration>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/ConfigurationExceptionFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.Serialization.Formatters.Binary;\nusing System.Xml.Schema;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Etw\n{\n    [TestClass]\n    public class given_configurationException_initializer\n    {\n        [TestMethod]\n        public void when_creating_instance_with_null_message()\n        {\n            var sut = new ConfigurationException((string)null);\n\n            Assert.AreEqual(\"Exception of type '\" + typeof(ConfigurationException).FullName + \"' was thrown.\", sut.Message);\n            Assert.AreEqual(0, sut.InnerExceptions.Count);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentNullException))]\n        public void when_creating_instance_with_null_innerExceptions()\n        {\n            new ConfigurationException((IEnumerable<Exception>)null);\n        }\n\n        [TestMethod]\n        public void when_creating_instance_with_empty_innerExceptions()\n        {\n            var sut = new ConfigurationException(Enumerable.Empty<Exception>());\n\n            Assert.IsNotNull(sut.Message);\n            Assert.IsNull(sut.InnerException);\n            Assert.AreEqual(0, sut.InnerExceptions.Count);\n        }\n\n        [TestMethod]\n        public void when_creating_instance_with_innerExceptions()\n        {\n            var inner = new ArgumentException(\"args\");\n            var sut = new ConfigurationException(new Exception[] { inner });\n\n            Assert.IsNotNull(sut.Message);\n            Assert.AreEqual(inner, sut.InnerException);\n            Assert.AreEqual(1, sut.InnerExceptions.Count);\n            Assert.AreEqual(inner, sut.InnerExceptions.First());\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentNullException))]\n        public void when_creating_instance_with_a_null_exception_within_innerExceptions()\n        {\n            new ConfigurationException(new Exception[] { new Exception(), null, new Exception() });\n        }\n\n        [TestMethod]\n        public void when_calling_toString()\n        {\n            List<Exception> inners = new List<Exception>();\n            inners.Add(new ArgumentException(\"Msg1\"));\n            inners.Add(new InvalidOperationException(\"Inv2\"));\n            inners.Add(new XmlSchemaValidationException(\"Validation\", new Exception(\"inner\"), 111, 222));\n\n            var sut = new ConfigurationException(inners);\n            var toStr = sut.ToString();\n\n            StringAssert.Contains(toStr, \"Msg1\");\n            StringAssert.Contains(toStr, \"Inv2\");\n            StringAssert.Contains(toStr, \"Validation\");\n            StringAssert.Contains(toStr, \"inner\");\n            StringAssert.Contains(toStr, \"111\");\n            StringAssert.Contains(toStr, \"222\");\n        }\n\n        [TestMethod]\n        public void when_calling_toString_with_configurationFile()\n        {\n            var sut = new ConfigurationException(\"test\") { ConfigurationFile = \"myConfigfile\" };\n\n            var toStr = sut.ToString();\n            StringAssert.Contains(toStr, \"test\");\n            StringAssert.Contains(toStr, \"myConfigfile\");\n        }\n\n        [TestMethod]\n        public void when_serializing_with_inner_shoulld_deserialize_back()\n        {\n            List<Exception> inners = new List<Exception>();\n            inners.Add(new ArgumentException(\"Msg1\"));\n            inners.Add(new InvalidOperationException(\"Inv2\"));\n            inners.Add(new XmlSchemaValidationException(\"Validation\", new Exception(\"inner\"), 111, 222));\n\n            var sut = new ConfigurationException(inners);\n            var str = sut.ToString();\n\n            BinaryFormatter formatter = new BinaryFormatter();\n            using (MemoryStream stream = new MemoryStream())\n            {\n                formatter.Serialize(stream, sut);\n                stream.Position = 0;\n                var deserialized = formatter.Deserialize(stream) as ConfigurationException;\n\n                Assert.AreEqual(str, deserialized.ToString());\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/ConfigurationReaderFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Linq;\nusing System.Xml.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Configuration\n{\n    [TestClass]\n    public class given_configurationReaderInstance\n    {\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentNullException))]\n        public void when_creating_instance_with_null_file()\n        {\n            new ConfigurationReader(null);\n        }\n    }\n\n    [TestClass]\n    public class when_reading_from_file_with_many_sinks\n    {\n        [TestMethod]\n        public void then_instance_is_loaded_with_all_sinks()\n        {\n            var sut = new ConfigurationReader(\"Etw\\\\Configuration\\\\WithManySinks.xml\");\n            ConfigurationElement config = sut.Read();\n\n            SinkConfigurationElement[] elements = config.SinkConfigurationElements.ToArray();\n            Assert.AreEqual(4, elements.Length);\n            Assert.AreEqual(\"Microsoft.SemanticLogging.Etw\", config.TraceEventService.SessionNamePrefix);\n\n            Assert.IsNotNull(elements[0].SinkPromise.Value);\n            Assert.AreEqual(1, elements[0].EventSources.Count());\n\n            Assert.IsNotNull(elements[1].SinkPromise.Value);\n            Assert.AreEqual(1, elements[1].EventSources.Count());\n\n            Assert.IsNotNull(elements[2].SinkPromise.Value);\n            Assert.AreEqual(1, elements[2].EventSources.Count());\n        }\n    }\n\n    [TestClass]\n    public class when_reading_from_two_different_files\n    {\n        [TestMethod]\n        public void then_differences_should_be_detected()\n        {\n            var sut1 = new ConfigurationReader(\"Etw\\\\Configuration\\\\WithDiff1.xml\");\n            var sut2 = new ConfigurationReader(\"Etw\\\\Configuration\\\\WithDiff2.xml\");\n            ConfigurationElement config1 = sut1.Read();\n            ConfigurationElement config2 = sut2.Read();\n\n            Assert.AreEqual(\"Microsoft.SemanticLogging.Etw\", config1.TraceEventService.SessionNamePrefix);\n            Assert.AreEqual(\"Microsoft.SemanticLogging.Etw.Diff1\", config2.TraceEventService.SessionNamePrefix);\n\n            Assert.AreEqual(1, config1.SinkConfigurationElements.First().EventSources.Count());\n            Assert.AreEqual(2, config2.SinkConfigurationElements.First().EventSources.Count());\n\n            Assert.AreNotEqual(\n                config1.SinkConfigurationElements.First().SinkConfiguration,\n                config2.SinkConfigurationElements.First().SinkConfiguration);\n        }\n    }\n\n    [TestClass]\n    public class when_reading_from_two_equal_files\n    {\n        [TestMethod]\n        public void then_differences_should_not_be_detected()\n        {\n            var sut0 = new ConfigurationReader(\"Etw\\\\Configuration\\\\WithDiff0.xml\");\n            var sut1 = new ConfigurationReader(\"Etw\\\\Configuration\\\\WithDiff1.xml\");\n            ConfigurationElement config0 = sut0.Read();\n            ConfigurationElement config1 = sut1.Read();\n\n            Assert.AreEqual(\n                config0.SinkConfigurationElements.First().SinkConfiguration,\n                config1.SinkConfigurationElements.First().SinkConfiguration);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/ConsoleSinkElementFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Etw\n{\n    public abstract class given_consoleSinkElement : ContextBase\n    {\n        protected ISinkElement sut;\n        private XElement element;\n\n        protected override void Given()\n        {\n            this.element = new XElement(XName.Get(\"consoleSink\", Constants.Namespace));\n\n            this.sut = new ConsoleSinkElement();\n        }\n\n        [TestClass]\n        public class when_query_for_canCreateSink : given_consoleSinkElement\n        {\n            [TestMethod]\n            public void then_instance_can_be_created()\n            {\n                Assert.IsTrue(this.sut.CanCreateSink(this.element));\n            }\n        }\n\n        [TestClass]\n        public class when_createSink_with_default_parameters : given_consoleSinkElement\n        {\n            private IObserver<EventEntry> observer;\n\n            protected override void When()\n            {\n                this.observer = this.sut.CreateSink(this.element);\n            }\n\n            [TestMethod]\n            public void then_sink_is_created()\n            {\n                Assert.IsNotNull(this.observer);\n            }\n        }\n\n        [TestClass]\n        public class when_createSink_with_colorMapper_parameter : given_consoleSinkElement\n        {\n            private IObserver<EventEntry> observer;\n\n            protected override void When()\n            {\n                this.element.Add(new XAttribute(\"colorMapperType\", typeof(MockColorMapper).AssemblyQualifiedName));\n                this.observer = this.sut.CreateSink(this.element);\n            }\n\n            [TestMethod]\n            public void then_sink_is_created()\n            {\n                Assert.IsNotNull(MockColorMapper.Instance);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/EventSourceSettingsFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Etw\n{\n    [TestClass]\n    public class given_eventSourceSettings\n    {\n        [TestMethod]\n        [ExpectedException(typeof(ConfigurationException))]\n        public void when_creating_instance_with_no_values()\n        {\n            new EventSourceSettings();\n        }\n\n        [TestMethod]\n        public void when_creating_instance_with_name_only()\n        {\n            var sut = new EventSourceSettings(MyCompanyEventSource.Log.Name);\n\n            Assert.AreEqual(MyCompanyEventSource.Log.Name, sut.Name);\n            Assert.AreEqual(MyCompanyEventSource.Log.Guid, sut.EventSourceId);\n            Assert.AreEqual(EventLevel.LogAlways, sut.Level);\n            Assert.AreEqual(Keywords.All, sut.MatchAnyKeyword);\n        }\n\n        [TestMethod]\n        public void when_creating_instance_with_id_only()\n        {\n            var sut = new EventSourceSettings(eventSourceId: MyCompanyEventSource.Log.Guid);\n\n            Assert.AreEqual(MyCompanyEventSource.Log.Guid.ToString(), sut.Name);\n            Assert.AreEqual(MyCompanyEventSource.Log.Guid, sut.EventSourceId);\n            Assert.AreEqual(EventLevel.LogAlways, sut.Level);\n            Assert.AreEqual(Keywords.All, sut.MatchAnyKeyword);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ConfigurationException))]\n        public void when_creating_instance_with_both_name_and_id()\n        {\n            new EventSourceSettings(MyCompanyEventSource.Log.Name, MyCompanyEventSource.Log.Guid);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/ExtensionsLoaderFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Etw\n{\n    public abstract class given_extensionsloader : ContextBase\n    {\n        internal ExtensionsLoader Sut;\n\n        protected override void Given()\n        {\n            this.Sut = new ExtensionsLoader();\n        }\n\n        protected static IEnumerable<Type> FilterTypes(Type type)\n        {\n            return AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes().Where(t => !t.IsAbstract && type.IsAssignableFrom(t)));\n        }\n\n        protected static string FilterSchemas(IEnumerable<string> schemas, string schemaFile)\n        {\n            return schemas.SingleOrDefault(s => Path.GetFileName(s).Equals(schemaFile, StringComparison.OrdinalIgnoreCase));\n        }\n\n        [TestClass]\n        public class when_creating_instance_and_query_for_sinkExtensions : given_extensionsloader\n        {\n            private IEnumerable<Lazy<ISinkElement>> sinkElements;\n\n            protected override void When()\n            {\n                sinkElements = this.Sut.SinkElements;\n            }\n\n            [TestMethod]\n            public void then_all_sinkExtensions_in_topDirectoryOnly_should_be_loaded()\n            {\n                var actualTypes = FilterTypes(typeof(ISinkElement));\n                Assert.IsTrue(sinkElements.All(t => actualTypes.Contains(t.Value.GetType())));\n            }\n        }\n\n        [TestClass]\n        public class when_creating_instance_and_query_for_eventTextFormattersExtensions : given_extensionsloader\n        {\n            private IEnumerable<Lazy<IFormatterElement>> formatterElements;\n\n            protected override void When()\n            {\n                formatterElements = this.Sut.FormatterElements;\n            }\n\n            [TestMethod]\n            public void then_all_eventTextFormattersExtensions_in_topDirectoryOnly_should_be_loaded()\n            {\n                var actualTypes = FilterTypes(typeof(IFormatterElement));\n\n                Assert.IsTrue(formatterElements.All(t => actualTypes.Contains(t.Value.GetType())));\n            }\n        }\n\n        [TestClass]\n        public class when_creating_instance_and_query_for_schemas : given_extensionsloader\n        {\n            private IEnumerable<string> schemas;\n\n            protected override void When()\n            {\n                schemas = this.Sut.SchemaFileNames;\n            }\n\n            [TestMethod]\n            public void then_all_schemas_in_allDirectories_should_be_loaded()\n            {\n                Assert.IsNotNull(FilterSchemas(schemas, \"MySinkElement.xsd\"));\n                Assert.IsNotNull(FilterSchemas(schemas, \"Event.xsd\"));\n            }\n        }\n\n        [TestClass]\n        public class when_loading_custom_sinks_from_external_assemblies : given_extensionsloader\n        {\n            private string generatedAssemblyPath;\n            private const string Source =\n@\"using Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing System;\nusing System.Xml.Linq;\n\nnamespace Test\n{\n    public class TestSinkElement : ISinkElement\n    {\n        public bool CanCreateSink(XElement element)\n        {\n            throw new NotImplementedException();\n        }\n\n        public IObserver<EventEntry> CreateSink(XElement element)\n        {\n            throw new NotImplementedException();\n        }\n    }\n}\n\";\n            protected override void Given()\n            {\n            }\n\n            protected override void When()\n            {\n                var results = AssemblyBuilder.CompileFromSource(Source, generateInMemory: false);\n                Assert.AreEqual(0, results.Errors.Count, AssemblyBuilder.DumpOnErrors(results));\n                this.generatedAssemblyPath = results.PathToAssembly;\n            }\n\n            [TestMethod]\n            public void then_all_custom_implementations_should_be_loaded()\n            {\n                using (var domain = new DisposableDomain())\n                {\n                    domain.DoCallBack(() =>\n                    {\n                        var sut = new ExtensionsLoader();\n                        Assert.IsTrue(sut.SinkElements.Any(s => s.Value.GetType().FullName == \"Test.TestSinkElement\"));\n                    });\n                }\n            }\n\n            protected override void OnCleanup()\n            {\n                if (File.Exists(this.generatedAssemblyPath))\n                {\n                    File.Delete(this.generatedAssemblyPath);\n                }\n\n                base.OnCleanup();\n            }\n        }\n\n        [TestClass]\n        public class when_loading_internal_custom_sinks_from_external_assemblies : given_extensionsloader\n        {\n            private string generatedAssemblyPath;\n            private const string Source =\n@\"using Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing System;\nusing System.Xml.Linq;\n\nnamespace Test\n{\n    internal class TestSinkElement : ISinkElement\n    {\n        public bool CanCreateSink(XElement element)\n        {\n            throw new NotImplementedException();\n        }\n\n        public IObserver<EventEntry> CreateSink(XElement element)\n        {\n            throw new NotImplementedException();\n        }\n    }\n}\n\";\n            protected override void Given()\n            {\n            }\n\n            protected override void When()\n            {\n                var results = AssemblyBuilder.CompileFromSource(Source, generateInMemory: false);\n                Assert.AreEqual(0, results.Errors.Count, AssemblyBuilder.DumpOnErrors(results));\n                this.generatedAssemblyPath = results.PathToAssembly;\n            }\n\n            [TestMethod]\n            public void then_all_custom_implementations_should_be_loaded()\n            {\n                using (var domain = new DisposableDomain())\n                {\n                    domain.DoCallBack(() =>\n                    {\n                        var sut = new ExtensionsLoader();\n                        Assert.IsTrue(sut.SinkElements.Any(s => s.Value.GetType().FullName == \"Test.TestSinkElement\"));\n                    });\n                }\n            }\n\n            protected override void OnCleanup()\n            {\n                if (File.Exists(this.generatedAssemblyPath))\n                {\n                    File.Delete(this.generatedAssemblyPath);\n                }\n\n                base.OnCleanup();\n            }\n        }\n\n        [TestClass]\n        public class when_loading_custom_formatter_from_external_assemblies : given_extensionsloader\n        {\n            private string generatedAssemblyPath;\n            private const string Source =\n@\"using Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing System;\nusing System.Xml.Linq;\n\nnamespace Test\n{\n    public class TestFormatterElement : IFormatterElement\n    {\n        public bool CanCreateFormatter(XElement element)\n        {\n            throw new NotImplementedException();\n        }\n\n        public IEventTextFormatter CreateFormatter(XElement element)\n        {\n            throw new NotImplementedException();\n        }\n    }\n}\n\";\n            protected override void Given()\n            {\n            }\n\n            protected override void When()\n            {\n                var results = AssemblyBuilder.CompileFromSource(Source, generateInMemory: false);\n                Assert.AreEqual(0, results.Errors.Count, AssemblyBuilder.DumpOnErrors(results));\n                this.generatedAssemblyPath = results.PathToAssembly;\n            }\n\n            [TestMethod]\n            public void then_all_custom_implementations_should_be_loaded()\n            {\n                using (var domain = new DisposableDomain())\n                {\n                    domain.DoCallBack(() =>\n                    {\n                        var sut = new ExtensionsLoader();\n                        Assert.IsTrue(sut.FormatterElements.Any(s => s.Value.GetType().FullName == \"Test.TestFormatterElement\"));\n                    });\n                }\n            }\n\n            protected override void OnCleanup()\n            {\n                if (File.Exists(this.generatedAssemblyPath))\n                {\n                    File.Delete(this.generatedAssemblyPath);\n                }\n\n                base.OnCleanup();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/FormatterFactoryFixture.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Etw\n{\n    public class given_formatterelementfactory\n    {\n        public abstract class when_creating_json_formatter : ContextBase\n        {\n            protected JsonEventTextFormatter sut;\n\n            protected override void Given()\n            {\n                FormatterElementFactory.FormatterElements = GetFormatterElements();\n            }\n\n            private IEnumerable<Lazy<IFormatterElement>> GetFormatterElements()\n            {\n                yield return new Lazy<IFormatterElement>(() => new JsonEventTextFormatterElement());\n                yield return new Lazy<IFormatterElement>(() => new XmlEventTextFormatterElement());\n                yield return new Lazy<IFormatterElement>(() => new EventTextFormatterElement());\n            }\n\n            protected override void When()\n            {\n                sut =\n                    FormatterElementFactory.Get(XElement.Parse(string.Format(@\"<consoleSink xmlns='http://schemas.microsoft.com/practices/2013/entlib/semanticlogging/etw' name='ConsoleEventListener1'><sources><eventSource name='Foo' level='Error'/></sources>{0}</consoleSink>\", GetElementText()))) as JsonEventTextFormatter;\n            }\n\n            protected abstract string GetElementText();\n        }\n\n        [TestClass]\n        public class when_creating_formatter_with_separator_set_to_false : when_creating_json_formatter\n        {\n            protected override string GetElementText()\n            {\n                return @\"<jsonEventTextFormatter includeEntrySeparator='false' />\";\n            }\n\n            [TestMethod]\n            public void then_separator_should_be_set_to_false()\n            {\n                Assert.IsFalse(sut.IncludeEntrySeparator);\n            }\n        }\n\n        [TestClass]\n        public class when_creating_formatter_with_separator_set_to_true : when_creating_json_formatter\n        {\n            protected override string GetElementText()\n            {\n                return @\"<jsonEventTextFormatter includeEntrySeparator='true' />\";\n            }\n\n            [TestMethod]\n            public void then_separator_should_be_set_to_true()\n            {\n                Assert.IsTrue(sut.IncludeEntrySeparator);\n            }\n        }\n\n        [TestClass]\n        public class when_creating_formatter_with_separator_not_set : when_creating_json_formatter\n        {\n            protected override string GetElementText()\n            {\n                return @\"<jsonEventTextFormatter/>\";\n            }\n\n            [TestMethod]\n            public void then_separator_should_be_set_to_true()\n            {\n                Assert.IsTrue(sut.IncludeEntrySeparator);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/SinkSettingsFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Etw\n{\n    [TestClass]\n    public class given_sinkSettings\n    {\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentNullException))]\n        public void when_creating_instance_with_null_name()\n        {\n            new SinkSettings(null, new InMemoryEventListener(), Enumerable.Empty<EventSourceSettings>());\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ConfigurationException))]\n        public void when_creating_instance_with_null_sink()\n        {\n            new SinkSettings(\"name\", sink: null, eventSources: Enumerable.Empty<EventSourceSettings>());\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentNullException))]\n        public void when_creating_instance_with_null_sources()\n        {\n            new SinkSettings(\"name\", new InMemoryEventListener(), null);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentOutOfRangeException))]\n        public void when_creating_instance_with_max_name_length()\n        {\n            new SinkSettings(new string('a', 201), new InMemoryEventListener(), Enumerable.Empty<EventSourceSettings>());\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ConfigurationException))]\n        public void when_creating_instance_with_empty_sources()\n        {\n            new SinkSettings(\"test\", new InMemoryEventListener(), Enumerable.Empty<EventSourceSettings>());\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ConfigurationException))]\n        public void when_creating_instance_with_duplicate_sources_by_name()\n        {\n            var sources = new List<EventSourceSettings>() { new EventSourceSettings(\"test\"), new EventSourceSettings(\"test\") };\n            new SinkSettings(\"test\", new InMemoryEventListener(), sources);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ConfigurationException))]\n        public void when_creating_instance_with_duplicate_sources_by_id()\n        {\n            var sources = new List<EventSourceSettings>() { new EventSourceSettings(eventSourceId: MyCompanyEventSource.Log.Guid), new EventSourceSettings(eventSourceId: MyCompanyEventSource.Log.Guid) };\n            new SinkSettings(\"test\", new InMemoryEventListener(), sources);\n        }\n\n        [TestMethod]\n        public void when_creating_instance_with_default_values()\n        {\n            var sources = new List<EventSourceSettings>() { new EventSourceSettings(MyCompanyEventSource.Log.Name) };\n            var sink = new InMemoryEventListener();\n            var sut = new SinkSettings(\"test\", sink, sources);\n\n            Assert.AreEqual(\"test\", sut.Name);\n            Assert.AreEqual(sink, sut.Sink);\n            Assert.AreEqual(1, sut.EventSources.Count());\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/SqlDatabaseSinkElementFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Etw\n{\n    public abstract class given_sqlDatabaseSinkElement : ContextBase\n    {\n        protected ISinkElement sut;\n        private XElement element;\n\n        protected override void Given()\n        {\n            this.element = new XElement(XName.Get(\"sqlDatabaseSink\", Constants.Namespace),\n                                        new XAttribute(\"instanceName\", \"instanceName\"),\n                                        new XAttribute(\"connectionString\", \"Data Source=(localdb)\\v11.0;Initial Catalog=SemanticLoggingTests;Integrated Security=True\"));\n\n            this.sut = new SqlDatabaseSinkElement();\n        }\n\n        [TestClass]\n        public class when_query_for_canCreateSink : given_sqlDatabaseSinkElement\n        {\n            [TestMethod]\n            public void then_instance_can_be_created()\n            {\n                Assert.IsTrue(this.sut.CanCreateSink(this.element));\n            }\n        }\n\n        [TestClass]\n        public class when_createSink_with_required_parameters : given_sqlDatabaseSinkElement\n        {\n            private IObserver<EventEntry> observer;\n\n            protected override void When()\n            {\n                this.observer = this.sut.CreateSink(this.element);\n            }\n\n            [TestMethod]\n            public void then_sink_is_created()\n            {\n                Assert.IsNotNull(this.observer);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/TraceEventServiceConfigurationFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\nusing System.Xml.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Etw\n{\n    [TestClass]\n    public class given_traceEventServiceConfigurationInstance\n    {\n        [TestMethod]\n        public void when_creating_instance_with_null_values()\n        {\n            var sut = new TraceEventServiceConfiguration();\n\n            Assert.AreEqual(0, sut.SinkSettings.Count);\n            Assert.AreEqual(new TraceEventServiceSettings().SessionNamePrefix, sut.Settings.SessionNamePrefix);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ConfigurationException))]\n        public void when_creating_instance_with_duplicate_sinkSettings()\n        {\n            var sinks = new List<SinkSettings>();\n\n            var sources = new List<EventSourceSettings> { new EventSourceSettings(\"test\"), new EventSourceSettings(\"test\") };\n            var sink = new SinkSettings(\"test\", new Lazy<IObserver<EventEntry>>(() => new InMemoryEventListener()), sources);\n            sinks.Add(sink);\n            sinks.Add(sink);\n\n            new TraceEventServiceConfiguration(sinks);\n        }\n    }\n\n    public abstract class given_traceEventServiceConfiguration : ContextBase\n    {\n        protected TraceEventServiceConfiguration sut;\n\n        protected override void OnCleanup()\n        {\n            if (this.sut != null)\n            {\n                this.sut.Dispose();\n            }\n        }\n\n        [TestClass]\n        public class when_loading_instance_from_file_with_default_values : given_traceEventServiceConfiguration\n        {\n            protected override void When()\n            {\n                this.sut = TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithDefaultValues.xml\");\n            }\n\n            [TestMethod]\n            public void then_instance_is_loaded_with_default_values()\n            {\n                Assert.IsNotNull(this.sut);\n                Assert.IsTrue(this.sut.Settings.SessionNamePrefix.StartsWith(Constants.DefaultSessionNamePrefix));\n                Assert.AreEqual(0, this.sut.SinkSettings.Count);\n            }\n        }\n\n        [TestClass]\n        public class when_loading_instance_from_file_with_eventSource_name_only : given_traceEventServiceConfiguration\n        {\n            protected override void When()\n            {\n                this.sut = TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithEventSourceNameOnly.xml\");\n            }\n\n            [TestMethod]\n            public void then_instance_is_loaded_with_default_values()\n            {\n                Assert.IsNotNull(this.sut);\n                Assert.AreEqual(\"MyCompany\", this.sut.SinkSettings[0].EventSources.First().Name);\n                Assert.AreEqual(MyCompanyEventSource.Log.Guid, this.sut.SinkSettings[0].EventSources.First().EventSourceId);\n            }\n        }\n\n        [TestClass]\n        public class when_loading_instance_from_file_with_eventSource_id_only : given_traceEventServiceConfiguration\n        {\n            protected override void When()\n            {\n                this.sut = TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithEventSourceIdOnly.xml\");\n            }\n\n            [TestMethod]\n            public void then_instance_is_loaded_with_id_and_name_values()\n            {\n                Assert.IsNotNull(this.sut);\n                Assert.AreEqual(MyCompanyEventSource.Log.Guid.ToString(), this.sut.SinkSettings[0].EventSources.First().Name);\n                Assert.AreEqual(MyCompanyEventSource.Log.Guid, this.sut.SinkSettings[0].EventSources.First().EventSourceId);\n            }\n        }\n\n        [TestClass]\n        public class when_loading_instance_from_file_with_no_eventSource_name_guid : given_traceEventServiceConfiguration\n        {\n            [TestMethod]\n            [ExpectedException(typeof(ConfigurationException))]\n            public void then_exception_is_thrown()\n            {\n                TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithNoEventSourceNameId.xml\");\n            }\n        }\n\n        [TestClass]\n        public class when_loading_instance_from_file_with_duplicate_names : given_traceEventServiceConfiguration\n        {\n            [TestMethod]\n            public void then_schema_validation_exception_is_thrown()\n            {\n                var exception = AssertEx.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithDuplicateNames.xml\"));\n\n                Assert.AreEqual(3, exception.InnerExceptions.Count);\n                Assert.IsTrue(exception.InnerExceptions.All(e => e is XmlSchemaValidationException), \"All exceptions should be xml schema validation exceptions\");\n\n                Assert.IsTrue(exception.InnerExceptions.Any(e =>\n                    e.Message.StartsWith(\"There is a duplicate key sequence 'customListener'\", StringComparison.OrdinalIgnoreCase)));\n\n                Assert.IsTrue(exception.InnerExceptions.Any(e =>\n                    e.Message.StartsWith(\"There is a duplicate key sequence 'Test'\", StringComparison.OrdinalIgnoreCase)));\n\n                Assert.IsTrue(exception.InnerExceptions.Any(e =>\n                    e.Message.Contains(\"invalid child element 'eventTextFormatter'\")));\n            }\n        }\n\n        [TestClass]\n        public class when_loading_instance_from_file_with_empty_non_string_values : given_traceEventServiceConfiguration\n        {\n            [TestMethod]\n            public void then_schema_validation_exception_is_thrown()\n            {\n                var exception = AssertEx.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithEmptyNonStringValues.xml\"));\n\n                Assert.AreEqual(2, exception.InnerExceptions.Count);\n                Assert.IsTrue(exception.InnerExceptions.All(e => e is XmlSchemaValidationException || e is InvalidOperationException), \"Exceptions should be schema validation or invalid operation exceptions\");\n\n                Assert.IsTrue(exception.InnerExceptions.Any(e => e.Message.StartsWith(\"The 'sessionNamePrefix' attribute is invalid\", StringComparison.OrdinalIgnoreCase)));\n                Assert.IsTrue(exception.InnerExceptions.Any(e => e.Message.StartsWith(\"The 'id' attribute is invalid\", StringComparison.OrdinalIgnoreCase)));\n            }\n        }\n\n        [TestClass]\n        public class when_loading_instance_from_file_with_warnings_validation : given_traceEventServiceConfiguration\n        {\n            [TestMethod]\n            public void then_schema_validation_exception_is_thrown()\n            {\n                var exception = AssertEx.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithWarnings.xml\"));\n\n                Assert.AreEqual(4, exception.InnerExceptions.Count);\n                Assert.IsTrue(exception.InnerExceptions.All(e => e is XmlSchemaValidationException), \"Exceptions should be schema validation exceptions\");\n                Assert.IsTrue(exception.InnerExceptions.Any(e => e.Message.Contains(\"The required attribute 'attr' is missing.\")));\n                Assert.IsTrue(exception.InnerExceptions.Any(e => e.Message.Contains(\"The 'sessionNamePrefix' attribute is invalid\")));\n                Assert.IsTrue(exception.InnerExceptions.Any(e => e.Message.Contains(\"The 'name' attribute is invalid\") &&\n                                                                 ((XmlSchemaValidationException)e).LineNumber == 7 &&\n                                                                 ((XmlSchemaValidationException)e).LinePosition == 18));\n                Assert.IsTrue(exception.InnerExceptions.Any(e => e.Message.Contains(\"The required attribute 'name' is missing.\")));\n            }\n        }\n\n        [TestClass]\n        public class when_loading_instance_from_file_with_many_eventSources : given_traceEventServiceConfiguration\n        {\n            protected override void When()\n            {\n                this.sut = TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithManyEventSources.xml\");\n            }\n\n            [TestMethod]\n            public void then_instance_is_loaded_with_all_configured_eventSources()\n            {\n                Assert.IsNotNull(this.sut);\n                Assert.AreEqual(2, this.sut.SinkSettings.Count);\n\n                var firstSink = this.sut.SinkSettings.SingleOrDefault(s => s.Name == \"sink1\");\n                Assert.IsNotNull(firstSink);\n                Assert.AreEqual(1, firstSink.EventSources.Count());\n                Assert.AreEqual(\"MyCompany\", firstSink.EventSources.ElementAt(0).Name);\n                Assert.IsFalse(firstSink.EventSources.ElementAt(0).Arguments.Any());\n                Assert.IsFalse(firstSink.EventSources.ElementAt(0).ProcessNamesToFilter.Any());\n\n                var secondSink = this.sut.SinkSettings.SingleOrDefault(e => e.Name == \"sink2\");\n                Assert.IsNotNull(secondSink);\n                Assert.AreEqual(1, secondSink.EventSources.Count());\n                Assert.AreEqual(\"Test\", secondSink.EventSources.ElementAt(0).Name);\n                Assert.IsFalse(firstSink.EventSources.ElementAt(0).Arguments.Any());\n                Assert.IsFalse(firstSink.EventSources.ElementAt(0).ProcessNamesToFilter.Any());\n            }\n        }\n\n        [TestClass]\n        public class when_loading_instance_from_file_with_many_eventSources_with_filters_and_arguments : given_traceEventServiceConfiguration\n        {\n            protected override void When()\n            {\n                this.sut = TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithManyEventSourcesWithArgumentsAndFilters.xml\");\n            }\n\n            [TestMethod]\n            public void then_instance_is_loaded_with_all_configured_eventSources()\n            {\n                Assert.IsNotNull(this.sut);\n                Assert.AreEqual(2, this.sut.SinkSettings.Count);\n\n                var firstSink = this.sut.SinkSettings.SingleOrDefault(s => s.Name == \"sink1\");\n                Assert.IsNotNull(firstSink);\n                Assert.AreEqual(1, firstSink.EventSources.Count());\n                Assert.AreEqual(\"MyCompany\", firstSink.EventSources.ElementAt(0).Name);\n                Assert.AreEqual(1, firstSink.EventSources.ElementAt(0).Arguments.Count());\n                Assert.AreEqual(\"ActivitySampling\", firstSink.EventSources.ElementAt(0).Arguments.ElementAt(0).Key);\n                Assert.AreEqual(\"true\", firstSink.EventSources.ElementAt(0).Arguments.ElementAt(0).Value);\n                Assert.IsFalse(firstSink.EventSources.ElementAt(0).ProcessNamesToFilter.Any());\n\n                var secondSink = this.sut.SinkSettings.SingleOrDefault(e => e.Name == \"sink2\");\n                Assert.IsNotNull(secondSink);\n                Assert.AreEqual(2, secondSink.EventSources.Count());\n                Assert.AreEqual(\"Test\", secondSink.EventSources.ElementAt(0).Name);\n\n                Assert.AreEqual(2, secondSink.EventSources.ElementAt(0).Arguments.Count());\n                Assert.AreEqual(\"ActivitySamplingStartEvent\", secondSink.EventSources.ElementAt(0).Arguments.ElementAt(0).Key);\n                Assert.AreEqual(\"RequestStarted:5\", secondSink.EventSources.ElementAt(0).Arguments.ElementAt(0).Value);\n                Assert.AreEqual(\"SomeOtherArgument\", secondSink.EventSources.ElementAt(0).Arguments.ElementAt(1).Key);\n                Assert.AreEqual(string.Empty, secondSink.EventSources.ElementAt(0).Arguments.ElementAt(1).Value);\n\n                Assert.AreEqual(2, secondSink.EventSources.ElementAt(0).ProcessNamesToFilter.Count());\n                Assert.AreEqual(\"iis.exe\", secondSink.EventSources.ElementAt(0).ProcessNamesToFilter.ElementAt(0));\n                Assert.AreEqual(\"iisexpress.exe\", secondSink.EventSources.ElementAt(0).ProcessNamesToFilter.ElementAt(1));\n\n                Assert.IsFalse(secondSink.EventSources.ElementAt(1).Arguments.Any());\n                Assert.AreEqual(1, secondSink.EventSources.ElementAt(1).ProcessNamesToFilter.Count());\n                Assert.AreEqual(\"iis.exe\", secondSink.EventSources.ElementAt(1).ProcessNamesToFilter.ElementAt(0));\n            }\n        }\n\n        [TestClass]\n        public class when_loading_instance_from_file_with_parameters : given_traceEventServiceConfiguration\n        {\n            protected override void When()\n            {\n                this.sut = TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithManySinks.xml\");\n            }\n\n            [TestMethod]\n            public void then_instance_is_loaded_with_all_configured_eventSources()\n            {\n                Assert.IsNotNull(this.sut);\n\n                Assert.AreEqual(4, this.sut.SinkSettings.Count);\n                Assert.AreEqual(EventLevel.Error, this.sut.SinkSettings[0].EventSources.First().Level);\n                Assert.AreEqual((EventKeywords)1, this.sut.SinkSettings[0].EventSources.First().MatchAnyKeyword);\n\n                Assert.AreEqual(EventLevel.Error, this.sut.SinkSettings[1].EventSources.First().Level);\n                Assert.AreEqual(EventKeywords.None, this.sut.SinkSettings[1].EventSources.First().MatchAnyKeyword);\n\n                Assert.AreEqual(EventLevel.Error, this.sut.SinkSettings[2].EventSources.First().Level);\n\n                //Assert.AreEqual((EventKeywords)123, this.Sut.SinkSettings[3].EventSources.First().MatchAnyKeyword);\n            }\n        }\n\n        [TestClass]\n        public class when_disposing_instance : given_traceEventServiceConfiguration\n        {\n            private const string FlatFile = \"FlatFile.log\";\n\n            protected override void When()\n            {\n                this.sut = TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithManySinks.xml\");\n            }\n\n            [TestMethod]\n            public void then_all_listeners_will_be_disposed()\n            {\n                // Check if configured file was created\n                Assert.IsTrue(File.Exists(FlatFile));\n\n                // try to delete and confirm is locked by listener\n                try { File.Delete(FlatFile); }\n                catch (IOException)\n                {\n                }\n\n                this.sut.Dispose();\n\n                // Locked file is released\n                File.Delete(FlatFile);\n            }\n        }\n\n        [TestClass]\n        public class when_loading_bad_types : given_traceEventServiceConfiguration\n        {\n            [TestMethod]\n            [ExpectedException(typeof(ConfigurationException))]\n            public void then_exception_is_thrown()\n            {\n                TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithBadTypes.xml\");\n            }\n        }\n\n        [TestClass]\n        public class when_extending_configuration : given_traceEventServiceConfiguration\n        {\n            protected override void When()\n            {\n                this.sut = TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithExtensions.xml\");\n            }\n\n            [TestMethod]\n            public void then_extensions_will_be_loaded()\n            {\n                Assert.AreEqual(\"custom\", this.sut.SinkSettings[0].Name);\n                Assert.AreEqual(\"withCustomFormatter\", this.sut.SinkSettings[1].Name);\n                Assert.AreEqual(\"my\", this.sut.SinkSettings[2].Name);\n\n                Assert.IsNotNull(MySink.Instance);\n            }\n\n            [TestMethod]\n            public void then_parameters_are_passed()\n            {\n                var customSink = MySink.Instance;\n\n                Assert.IsInstanceOfType(customSink.Formatter, typeof(JsonEventTextFormatter));\n            }\n        }\n\n        [TestClass]\n        public class when_loading_extensions_with_schema_validation : given_traceEventServiceConfiguration\n        {\n            [TestMethod]\n            public void then_validation_exception_is_thrown()\n            {\n                var exception = AssertEx.Throws<ConfigurationException>(() => TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithExtensionsSchemaValidation.xml\"));\n\n                Assert.AreEqual(1, exception.InnerExceptions.Count);\n                Assert.IsTrue(exception.InnerExceptions.All(e => e is XmlSchemaValidationException), \"Exceptions should be schema validation exceptions\");\n                Assert.AreEqual(\"The required attribute 'attr' is missing.\", exception.InnerException.Message);\n            }\n        }\n\n        [TestClass]\n        public class when_loading_instance_from_file_with_error_on_sink_creation : given_traceEventServiceConfiguration\n        {\n            [TestMethod]\n            public void then_load_validation_exception_is_thrown()\n            {\n                var exception = AssertEx.Throws<ConfigurationException>(() =>\n                {\n                    TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithErrorOnSinkCreation.xml\");\n                });\n\n                StringAssert.Contains(exception.ToString(), \"The given path's format is not supported.\");\n            }\n        }\n\n        [TestClass]\n        public class when_loading_extensions_with_no_schema_validation : given_traceEventServiceConfiguration\n        {\n            protected override void When()\n            {\n                this.sut = TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithExtensionsNoSchemaValidation.xml\");\n            }\n\n            [TestMethod]\n            public void then_extensions_will_be_loaded()\n            {\n                Assert.AreEqual(\"my\", this.sut.SinkSettings[0].Name);\n                Assert.IsInstanceOfType(this.sut.SinkSettings[0].Sink, typeof(MySink));\n            }\n        }\n\n        [TestClass]\n        public class when_loading_custom_extension_with_incomplete_sink_parameters : given_traceEventServiceConfiguration\n        {\n            [TestMethod]\n            public void then_load_validation_exception_is_thrown()\n            {\n                var exception = AssertEx.Throws<ConfigurationException>(() =>\n                {\n                    TraceEventServiceConfiguration.Load(\"Etw\\\\Configuration\\\\WithExtensionsIncompleteParams.xml\");\n                });\n\n                StringAssert.Contains(exception.ToString(), \"The parameters specified in this element does not map to an existing type member. All paramters are required in the same order of the defined type member\");\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/TraceEventServiceFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing Microsoft.Diagnostics.Tracing.Session;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Etw\n{\n    [TestClass]\n    public class given_traceEventService_instance\n    {\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentNullException))]\n        public void when_creating_instance_with_null_configuration()\n        {\n            new TraceEventService(null);\n        }\n    }\n\n    public abstract class given_traceEventService : ContextBase\n    {\n        protected readonly TimeSpan AsyncProcessTimeout = TimeSpan.FromSeconds(15);\n        protected TraceEventService sut;\n        protected List<EventSourceSettings> eventSources;\n        protected List<SinkSettings> sinkSettings;\n        protected EventSourceSettings sourceSettings;\n        protected InMemoryEventListener inMemoryListener;\n        protected MockFormatter formatter;\n        protected TraceEventServiceConfiguration configuration;\n        protected TraceEventServiceSettings serviceSettings;\n\n        protected override void Given()\n        {\n            TraceEventManifestsCache.Clear();\n\n            this.formatter = new MockFormatter();\n            this.inMemoryListener = new InMemoryEventListener(this.formatter);\n            var sink = new Lazy<IObserver<EventEntry>>(() => this.inMemoryListener);\n            this.sourceSettings = this.sourceSettings ?? new EventSourceSettings(EventSource.GetName(typeof(MyCompanyEventSource)));\n            this.eventSources = new List<EventSourceSettings> { this.sourceSettings };\n            this.sinkSettings = new List<SinkSettings> { new SinkSettings(\"test\", sink, this.eventSources) };\n            this.configuration = new TraceEventServiceConfiguration(sinkSettings, this.serviceSettings);\n\n            try\n            {\n                this.sut = new TraceEventService(configuration);\n            }\n            catch (UnauthorizedAccessException uae)\n            {\n                Assert.Inconclusive(uae.Message);\n            }\n\n            // Clean up any previous unclosed session to avoid collisions\n            this.RemoveAnyExistingSession();\n        }\n\n        protected override void OnCleanup()\n        {\n            if (this.sut != null)\n            {\n                this.sut.Dispose();\n            }\n        }\n\n        protected bool IsCreatedSessionAlive()\n        {\n            return TraceEventSession.GetActiveSessionNames().Any(s =>\n                s.StartsWith(this.configuration.Settings.SessionNamePrefix, StringComparison.OrdinalIgnoreCase));\n        }\n\n        protected void RemoveAnyExistingSession(string sessionName = Constants.DefaultSessionNamePrefix)\n        {\n            TraceEventSession.GetActiveSessionNames().\n                Where(s => s.StartsWith(sessionName, StringComparison.OrdinalIgnoreCase)).ToList().\n                ForEach(n => new TraceEventSession(n) { StopOnDispose = true }.Dispose());\n        }\n\n        [TestClass]\n        public class when_starting_session : given_traceEventService\n        {\n            protected override void When()\n            {\n                this.sut.Start();\n            }\n\n            [TestMethod]\n            public void then_session_is_created_and_started()\n            {\n                Assert.AreEqual(ServiceStatus.Started, this.sut.Status);\n                Assert.IsTrue(IsCreatedSessionAlive());\n            }\n        }\n\n        [TestClass]\n        public class when_stopping_session : given_traceEventService\n        {\n            protected override void Given()\n            {\n                base.Given();\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                this.sut.Stop();\n            }\n\n            [TestMethod]\n            public void then_session_is_stopped_and_deleted()\n            {\n                Assert.AreEqual(ServiceStatus.Stopped, this.sut.Status);\n                Assert.IsFalse(IsCreatedSessionAlive());\n            }\n        }\n\n        [TestClass]\n        public class when_disposing_session : given_traceEventService\n        {\n            protected override void Given()\n            {\n                base.Given();\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                this.sut.Dispose();\n            }\n\n            [TestMethod]\n            [ExpectedException(typeof(ObjectDisposedException))]\n            public void then_session_is_disposed_and_error_is_thrown_on_start()\n            {\n                Assert.AreEqual(ServiceStatus.Disposed, this.sut.Status);\n                Assert.IsFalse(IsCreatedSessionAlive());\n                this.sut.Start();\n            }\n        }\n\n        [TestClass]\n        public class when_starting_second_service_instance_with_same_config_other_sessionPrefix : given_traceEventService\n        {\n            private TraceEventService collector2;\n\n            protected override void Given()\n            {\n                base.Given();\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                this.configuration.Settings.SessionNamePrefix = \"SecondInstance\";\n                collector2 = new TraceEventService(this.configuration);\n            }\n\n            [TestMethod]\n            public void then_session_is_created()\n            {\n                collector2.Start();\n            }\n\n            protected override void OnCleanup()\n            {\n                collector2.Dispose();\n                base.OnCleanup();\n            }\n        }\n\n        [TestClass]\n        public class when_logging_an_event : given_traceEventService\n        {\n            private int processId;\n            private int threadId;\n\n            protected override void Given()\n            {\n                base.Given();\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                this.processId = System.Diagnostics.Process.GetCurrentProcess().Id;\n                this.threadId = Utility.NativeMethods.GetCurrentThreadId();\n\n                MyCompanyEventSource.Log.PageStart(10, \"test\");\n            }\n\n            [TestMethod]\n            public void then_event_is_collected_and_processed()\n            {\n                // Wait for event to be processed\n                inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout);\n\n                Assert.AreEqual(1, inMemoryListener.EventWrittenCount);\n                var entry = formatter.WriteEventCalls.FirstOrDefault();\n                Assert.IsNotNull(entry);\n\n                Assert.AreEqual(MyCompanyEventSource.Log.Name, entry.Schema.ProviderName);\n                Assert.AreEqual(sourceSettings.EventSourceId, entry.ProviderId);\n                Assert.AreEqual(\"loading page test activityID=10\", entry.FormattedMessage);\n                Assert.AreEqual(EventOpcode.Start, entry.Schema.Opcode);\n                Assert.AreEqual(3, entry.EventId);\n                Assert.AreEqual(processId, entry.ProcessId);\n                Assert.AreEqual(threadId, entry.ThreadId);\n                Assert.AreEqual(Guid.Empty, entry.ActivityId);\n                Assert.AreEqual(Guid.Empty, entry.RelatedActivityId);\n            }\n        }\n\n        [TestClass]\n        public class when_logging_an_event_with_activity_id : given_traceEventService\n        {\n            private Guid activityId;\n\n            protected override void Given()\n            {\n                base.Given();\n                this.sut.Start();\n\n                this.activityId = Guid.NewGuid();\n            }\n\n            protected override void When()\n            {\n                Guid previousActivityId = Guid.Empty;\n\n                try\n                {\n                    EventSource.SetCurrentThreadActivityId(this.activityId, out previousActivityId);\n\n                    MyCompanyEventSource.Log.PageStart(10, \"test\");\n                }\n                finally\n                {\n                    EventSource.SetCurrentThreadActivityId(previousActivityId);\n                }\n            }\n\n            [TestMethod]\n            public void then_event_is_collected_and_processed()\n            {\n                // Wait for event to be processed\n                inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout);\n\n                Assert.AreEqual(1, inMemoryListener.EventWrittenCount);\n                var entry = formatter.WriteEventCalls.FirstOrDefault();\n                Assert.IsNotNull(entry);\n\n                Assert.AreEqual(MyCompanyEventSource.Log.Name, entry.Schema.ProviderName);\n                Assert.AreEqual(sourceSettings.EventSourceId, entry.ProviderId);\n                Assert.AreEqual(\"loading page test activityID=10\", entry.FormattedMessage);\n                Assert.AreEqual(EventOpcode.Start, entry.Schema.Opcode);\n                Assert.AreEqual(3, entry.EventId);\n                Assert.AreEqual(this.activityId, entry.ActivityId);\n                Assert.AreEqual(Guid.Empty, entry.RelatedActivityId);\n            }\n        }\n\n        [TestClass]\n        public class when_logging_an_event_with_activity_id_and_related_activity_id : given_traceEventService\n        {\n            private Guid activityId;\n            private Guid relatedActivityId;\n\n            protected override void Given()\n            {\n                base.Given();\n                this.sut.Start();\n\n                this.activityId = Guid.NewGuid();\n                this.relatedActivityId = Guid.NewGuid();\n            }\n\n            protected override void When()\n            {\n                Guid previousActivityId = Guid.Empty;\n\n                try\n                {\n                    EventSource.SetCurrentThreadActivityId(this.activityId, out previousActivityId);\n\n                    MyCompanyEventSource.Log.WithRelatedActivityId(this.relatedActivityId);\n                }\n                finally\n                {\n                    EventSource.SetCurrentThreadActivityId(previousActivityId);\n                }\n            }\n\n            [TestMethod]\n            public void then_event_is_collected_and_processed()\n            {\n                // Wait for event to be processed\n                inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout);\n\n                Assert.AreEqual(1, inMemoryListener.EventWrittenCount);\n                var entry = formatter.WriteEventCalls.FirstOrDefault();\n                Assert.IsNotNull(entry);\n\n                Assert.AreEqual(MyCompanyEventSource.Log.Name, entry.Schema.ProviderName);\n                Assert.AreEqual(sourceSettings.EventSourceId, entry.ProviderId);\n                Assert.AreEqual(EventOpcode.Send, entry.Schema.Opcode);\n                Assert.AreEqual(11, entry.EventId);\n                Assert.AreEqual(this.activityId, entry.ActivityId);\n                Assert.AreEqual(this.relatedActivityId, entry.RelatedActivityId);\n            }\n        }\n\n        [TestClass]\n        public class when_logging_an_event_by_level : given_traceEventService\n        {\n            protected override void Given()\n            {\n                base.Given();\n                var sink = new Lazy<IObserver<EventEntry>>(() => inMemoryListener);\n                sourceSettings = new EventSourceSettings(EventSource.GetName(typeof(MyCompanyEventSource)), level: EventLevel.Warning);\n                eventSources = new List<EventSourceSettings> { sourceSettings };\n                sinkSettings = new List<SinkSettings> { new SinkSettings(\"test\", sink, eventSources) };\n                configuration = new TraceEventServiceConfiguration(sinkSettings);\n                this.sut = new TraceEventService(configuration);\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                MyCompanyEventSource.Log.PageStart(10, \"test\");\n                MyCompanyEventSource.Log.Failure(\"failure\");\n            }\n\n            [TestMethod]\n            public void then_event_is_logged_by_level_or_filtered_out()\n            {\n                // Wait for event to be processed\n                inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout);\n\n                // Only Info event is logged\n                Assert.AreEqual(1, formatter.WriteEventCalls.Count);\n                var entry = formatter.WriteEventCalls.FirstOrDefault();\n                Assert.IsNotNull(entry);\n\n                Assert.AreEqual(MyCompanyEventSource.Log.Name, entry.Schema.ProviderName);\n                Assert.AreEqual(sourceSettings.EventSourceId, entry.ProviderId);\n                Assert.AreEqual(\"Application Failure: failure\", entry.FormattedMessage);\n                Assert.AreEqual(EventOpcode.Info, entry.Schema.Opcode);\n                Assert.AreEqual(1, entry.EventId);\n            }\n        }\n\n        [TestClass]\n        public class when_logging_an_event_by_keywords : given_traceEventService\n        {\n            protected override void Given()\n            {\n                base.Given();\n                var sink = new Lazy<IObserver<EventEntry>>(() => inMemoryListener);\n                sourceSettings = new EventSourceSettings(EventSource.GetName(typeof(MyCompanyEventSource)), level: EventLevel.Warning, matchAnyKeyword: MyCompanyEventSource.Keywords.Diagnostic);\n                eventSources = new List<EventSourceSettings> { sourceSettings };\n                sinkSettings = new List<SinkSettings> { new SinkSettings(\"test\", sink, eventSources) };\n                configuration = new TraceEventServiceConfiguration(sinkSettings);\n                this.sut = new TraceEventService(configuration);\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                MyCompanyEventSource.Log.PageStart(10, \"test\");\n                MyCompanyEventSource.Log.Failure(\"failure\");\n            }\n\n            [TestMethod]\n            public void then_event_is_logged_by_level_or_filtered_out()\n            {\n                // Wait for event to be processed\n                Assert.IsTrue(inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout));\n\n                // Only Info event is logged\n                Assert.AreEqual(1, formatter.WriteEventCalls.Count);\n                var entry = formatter.WriteEventCalls.FirstOrDefault();\n                Assert.IsNotNull(entry);\n\n                Assert.AreEqual(MyCompanyEventSource.Log.Name, entry.Schema.ProviderName);\n                Assert.AreEqual(sourceSettings.EventSourceId, entry.ProviderId);\n                Assert.AreEqual(\"Application Failure: failure\", entry.FormattedMessage);\n                Assert.AreEqual(EventOpcode.Info, entry.Schema.Opcode);\n                Assert.AreEqual(1, entry.EventId);\n            }\n        }\n\n        [TestClass]\n        public class when_logging_many_events_from_same_eventsource : given_traceEventService\n        {\n            protected override void Given()\n            {\n                base.Given();\n                inMemoryListener.WaitSignalCondition = () => inMemoryListener.EventWrittenCount == 2;\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                MyCompanyEventSource.Log.PageStart(10, \"test\");\n                MyCompanyEventSource.Log.PageStart(11, \"test2\");\n            }\n\n            [TestMethod]\n            public void then_all_events_are_collected_and_processed()\n            {\n                // Wait for event to be processed\n                inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout);\n\n                Assert.AreEqual(2, formatter.WriteEventCalls.Count);\n                var entry = formatter.WriteEventCalls.FirstOrDefault();\n                Assert.IsNotNull(entry);\n                Assert.AreEqual(MyCompanyEventSource.Log.Name, entry.Schema.ProviderName);\n                Assert.AreEqual(MyCompanyEventSource.Log.Guid, entry.ProviderId);\n\n                entry = formatter.WriteEventCalls.LastOrDefault();\n                Assert.IsNotNull(entry);\n                Assert.AreEqual(MyCompanyEventSource.Log.Name, entry.Schema.ProviderName);\n                Assert.AreEqual(MyCompanyEventSource.Log.Guid, entry.ProviderId);\n            }\n        }\n\n        [TestClass]\n        public class when_logging_from_two_different_eventSources : given_traceEventService\n        {\n            protected override void Given()\n            {\n                base.Given();\n                inMemoryListener.WaitSignalCondition = () => inMemoryListener.EventWrittenCount == 2;\n                var sink = new Lazy<IObserver<EventEntry>>(() => inMemoryListener);\n                var localSourceSettings = new EventSourceSettings(EventSource.GetName(typeof(TestEventSource)));\n                this.eventSources.Add(localSourceSettings);\n                sinkSettings = new List<SinkSettings> { new SinkSettings(\"test\", sink, eventSources) };\n                configuration = new TraceEventServiceConfiguration(sinkSettings);\n                this.sut = new TraceEventService(configuration);\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                MyCompanyEventSource.Log.PageStart(10, \"test\");\n                TestEventSource.Log.NonDefaultOpcodeNonDefaultVersionEvent(1, 2, 3);\n            }\n\n            [TestMethod]\n            public void then_event_all_events_are_collected_and_processed()\n            {\n                // Wait for event to be processed\n                inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout);\n\n                Assert.AreEqual(2, formatter.WriteEventCalls.Count);\n                var entry = formatter.WriteEventCalls.FirstOrDefault(e => e.ProviderId == MyCompanyEventSource.Log.Guid);\n                Assert.IsNotNull(entry);\n                Assert.AreEqual(MyCompanyEventSource.Log.Name, entry.Schema.ProviderName);\n                Assert.AreEqual(MyCompanyEventSource.Log.Guid, entry.ProviderId);\n                Assert.AreEqual(\"PageStart\", entry.Schema.EventName);\n\n                entry = formatter.WriteEventCalls.FirstOrDefault(e => e.ProviderId == TestEventSource.Log.Guid);\n                Assert.IsNotNull(entry);\n                Assert.AreEqual(TestEventSource.Log.Name, entry.Schema.ProviderName);\n                Assert.AreEqual(TestEventSource.Log.Guid, entry.ProviderId);\n                Assert.AreEqual(\"DBQueryReply\", entry.Schema.EventName);\n            }\n        }\n\n        [TestClass]\n        public class when_listener_throws : given_traceEventService\n        {\n            private InMemoryEventListener slabListener;\n\n            protected override void Given()\n            {\n                base.Given();\n                inMemoryListener = new InMemoryEventListener(new MockFormatter { BeforeWriteEventAction = f => { throw new Exception(\"unhandled_exception_test\"); } });\n                var sink = new Lazy<IObserver<EventEntry>>(() => inMemoryListener);\n                sourceSettings = new EventSourceSettings(EventSource.GetName(typeof(MyCompanyEventSource)));\n                eventSources = new List<EventSourceSettings> { sourceSettings };\n                sinkSettings = new List<SinkSettings> { new SinkSettings(\"test\", sink, eventSources) };\n                configuration = new TraceEventServiceConfiguration(sinkSettings);\n                this.sut = new TraceEventService(configuration);\n\n                slabListener = new InMemoryEventListener();\n                slabListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Error, SemanticLoggingEventSource.Keywords.TraceEvent);\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                MyCompanyEventSource.Log.PageStart(10, \"test\");\n            }\n\n            [TestMethod]\n            public void then_exception_is_handled_and_logged()\n            {\n                // Wait for event to be processed\n                Assert.IsTrue(slabListener.WaitOnAsyncEvents.WaitOne(AsyncProcessTimeout));\n\n                Assert.AreEqual(0, formatter.WriteEventCalls.Count);\n                StringAssert.Contains(slabListener.ToString(), \"unhandled_exception_test\");\n            }\n\n            protected override void OnCleanup()\n            {\n                slabListener.DisableEvents(SemanticLoggingEventSource.Log);\n                base.OnCleanup();\n            }\n        }\n\n        [TestClass]\n        public class when_logging_to_provider_created_in_two_different_sessions : given_traceEventService\n        {\n            private const string SessionName2 = \"when_logging_to_provider_created_in_two_different_sessions\";\n            private TraceEventService sut2;\n            private InMemoryEventListener inMemoryListener2;\n            private MyCompanyEventSource logger;\n\n            protected override void Given()\n            {\n                RemoveAnyExistingSession(SessionName2);\n                base.Given();\n\n                inMemoryListener2 = new InMemoryEventListener(formatter);\n                var sink = new Lazy<IObserver<EventEntry>>(() => inMemoryListener2);\n                var localSourceSettings = new EventSourceSettings(EventSource.GetName(typeof(MyCompanyEventSource)), level: EventLevel.Informational, matchAnyKeyword: MyCompanyEventSource.Keywords.Page);\n                var localEventSources = new List<EventSourceSettings> { localSourceSettings };\n                var localSinkSettings = new List<SinkSettings> { new SinkSettings(\"test\", sink, localEventSources) };\n                var localConfiguration = new TraceEventServiceConfiguration(localSinkSettings, new TraceEventServiceSettings { SessionNamePrefix = SessionName2 });\n                this.sut2 = new TraceEventService(localConfiguration);\n            }\n\n            protected override void When()\n            {\n                // Start EventSource instance\n                logger = MyCompanyEventSource.Log;\n\n                // Start both instances\n                this.sut.Start();\n                this.sut2.Start();\n\n                // log from single source to both sessions\n                logger.PageStart(10, \"test\");\n            }\n\n            [TestMethod]\n            public void then_event_is_collected_and_processed_in_first_session()\n            {\n                // Wait for event to be processed\n                inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout);\n                inMemoryListener2.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout);\n\n                Assert.AreEqual(1, inMemoryListener.EventWrittenCount, \"No event get to inMemoryListener\");\n                Assert.AreEqual(\"loading page test activityID=1010,test\", inMemoryListener.ToString());\n\n                // In case the second listener got events because the cached manifest was already initialized...\n                if (inMemoryListener2.EventWrittenCount > 0)\n                {\n                    Assert.AreEqual(1, inMemoryListener2.EventWrittenCount, \"No event get to inMemoryListener2\");\n                    Assert.AreEqual(\"loading page test activityID=1010,test\", inMemoryListener2.ToString());\n                }\n            }\n\n            protected override void OnCleanup()\n            {\n                this.sut2.Dispose();\n                base.OnCleanup();\n            }\n        }\n\n        [TestClass]\n        public class when_tryToUpdateConfiguration_with_new_level : given_traceEventService\n        {\n            protected override void Given()\n            {\n                base.Given();\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                var current = this.configuration.SinkSettings[0];\n                current.EventSources.First().Level = EventLevel.Warning;\n                var newSink = new SinkSettings(current.Name, current.Sink, current.EventSources);\n\n                // will trigger changed event\n                this.configuration.SinkSettings.Remove(current);\n                this.configuration.SinkSettings.Add(newSink);\n            }\n\n            [TestMethod]\n            public void then_new_configuration_is_updated()\n            {\n                // This event should be filtered out\n                MyCompanyEventSource.Log.PageStart(10, \"test\");\n                // This event should be logged\n                MyCompanyEventSource.Log.Failure(\"failure\");\n\n                // Wait for event to be processed\n                inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout);\n\n                // Only Info event is logged\n                Assert.AreEqual(1, formatter.WriteEventCalls.Count);\n                var entry = formatter.WriteEventCalls.SingleOrDefault(e => e.FormattedMessage == \"Application Failure: failure\");\n                Assert.IsNotNull(entry);\n            }\n        }\n\n        [TestClass]\n        public class when_tryToUpdateConfiguration_with_new_source : given_traceEventService\n        {\n            protected override void Given()\n            {\n                base.Given();\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                var current = this.configuration.SinkSettings[0];\n                var newSources = new List<EventSourceSettings>(current.EventSources);\n                newSources.Add(new EventSourceSettings(EventSource.GetName(typeof(TestEventSource))));\n                var newSink = new SinkSettings(current.Name, current.Sink, newSources);\n\n                // will trigger changed event\n                this.configuration.SinkSettings.Remove(current);\n                this.configuration.SinkSettings.Add(newSink);\n\n                // We expect 2 events\n                this.inMemoryListener.WaitSignalCondition = () => inMemoryListener.EventWrittenCount == 2;\n            }\n\n            [TestMethod]\n            public void then_new_configuration_is_updated()\n            {\n                // This event from former source should be logged\n                MyCompanyEventSource.Log.PageStart(10, \"test\");\n                // This event from new source should be logged\n                TestEventSource.Log.UsingEnumArguments(MyLongEnum.Value2, MyIntEnum.Value3);\n\n                // Wait for event to be processed\n                inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout);\n\n                Assert.IsTrue(formatter.WriteEventCalls.Any(e => e.EventId == 3));\n                Assert.IsTrue(formatter.WriteEventCalls.Any(e => e.EventId == 305));\n            }\n        }\n\n        [TestClass]\n        public class when_tryToUpdateConfiguration_with_new_listener : given_traceEventService\n        {\n            protected override void Given()\n            {\n                base.Given();\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                // We expect 3 events, 2 for listener1(Level=LogAlways) and 1 for listener2 (Level=Warning)\n                inMemoryListener.WaitSignalCondition = () => inMemoryListener.EventWrittenCount == 3;\n\n                var sink = new Lazy<IObserver<EventEntry>>(() => inMemoryListener);\n                var localSourceSettings = new EventSourceSettings(EventSource.GetName(typeof(MyCompanyEventSource)), level: EventLevel.Warning);\n                var localEventSources = new List<EventSourceSettings> { localSourceSettings };\n                this.configuration.SinkSettings.Add(new SinkSettings(\"test2\", sink, localEventSources));\n            }\n\n            [TestMethod]\n            public void then_new_configuration_is_updated()\n            {\n                // This event should be filtered out\n                MyCompanyEventSource.Log.PageStart(10, \"test\");\n                // This event should be logged\n                MyCompanyEventSource.Log.Failure(\"failure\");\n\n                // Wait for event to be processed\n                Assert.IsTrue(inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout), \"wait timed out\");\n\n                Assert.AreEqual(2, formatter.WriteEventCalls.Count(e => e.FormattedMessage == \"Application Failure: failure\"));\n                Assert.AreEqual(1, formatter.WriteEventCalls.Count(e => e.FormattedMessage == \"loading page test activityID=10\"));\n            }\n        }\n\n        [TestClass]\n        public class when_updating_manifest_and_logging_a_new_event : given_traceEventService\n        {\n            private DisposableDomain domain1;\n            private DisposableDomain domain2;\n\n            protected override void Given()\n            {\n                this.domain1 = new DisposableDomain();\n                this.domain2 = new DisposableDomain();\n\n                var initialManifest = EventSource.GenerateManifest(typeof(MyNewCompanyEventSource), null);\n                this.sourceSettings = new EventSourceSettings(EventSource.GetName(typeof(MyNewCompanyEventSource)));\n                base.Given();\n\n                // We expect 2 events\n                this.inMemoryListener.WaitSignalCondition = () => inMemoryListener.EventWrittenCount == 2;\n\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                this.domain1.DoCallBack(() =>\n                {\n                    MyNewCompanyEventSource.Logger.Event1(11);\n                });\n\n                this.domain2.DoCallBack(() =>\n                {\n                    //Send the new event to update the manifest\n                    MyNewCompanyEventSource2.Logger.Event2(22);\n                });\n            }\n\n            protected override void OnCleanup()\n            {\n                this.domain1.Dispose();\n                this.domain2.Dispose();\n                base.OnCleanup();\n            }\n\n            [TestMethod]\n            public void then_manifest_is_updated_and_event_is_collected_and_processed()\n            {\n                // Wait for event to be processed\n                bool signaled = inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout);\n\n                Assert.IsTrue(signaled);\n\n                var entry1 = formatter.WriteEventCalls.FirstOrDefault();\n                Assert.IsNotNull(entry1);\n                var entry2 = formatter.WriteEventCalls.LastOrDefault();\n                Assert.IsNotNull(entry2);\n\n                Assert.AreEqual(MyNewCompanyEventSource.Logger.Name, entry1.Schema.ProviderName);\n                Assert.AreEqual(sourceSettings.EventSourceId, entry1.ProviderId);\n                Assert.AreEqual(\"Event1 ID=11\", entry1.FormattedMessage);\n                Assert.AreEqual(EventOpcode.Start, entry1.Schema.Opcode);\n                Assert.AreEqual(1, entry1.EventId);\n\n                Assert.AreEqual(MyNewCompanyEventSource2.Logger.Name, entry2.Schema.ProviderName);\n                Assert.AreEqual(sourceSettings.EventSourceId, entry2.ProviderId);\n                Assert.AreEqual(\"Event2 ID=22\", entry2.FormattedMessage);\n                Assert.AreEqual(EventOpcode.Stop, entry2.Schema.Opcode);\n                Assert.AreEqual(2, entry2.EventId);\n            }\n\n            [EventSource(Name = \"MyCompany1\")]\n            private sealed class MyNewCompanyEventSource : EventSource\n            {\n                public static class Tasks\n                {\n                    public const EventTask Custom = (EventTask)1;\n                }\n\n                [Event(1, Task = Tasks.Custom, Opcode = EventOpcode.Start, Message = \"Event1 ID={0}\")]\n                public void Event1(int id)\n                {\n                    if (IsEnabled()) { WriteEvent(1, id); }\n                }\n\n                public static readonly MyNewCompanyEventSource Logger = new MyNewCompanyEventSource();\n            }\n\n            [EventSource(Name = \"MyCompany1\")]\n            private sealed class MyNewCompanyEventSource2 : EventSource\n            {\n                public static class Tasks\n                {\n                    public const EventTask Custom = (EventTask)1;\n                }\n\n                [Event(1, Task = Tasks.Custom, Opcode = EventOpcode.Start, Message = \"Event1 ID={0}\")]\n                public void Event1(int id)\n                {\n                    if (IsEnabled()) { WriteEvent(1, id); }\n                }\n\n                [Event(2, Task = Tasks.Custom, Opcode = EventOpcode.Stop, Message = \"Event2 ID={0}\")]\n                public void Event2(int id)\n                {\n                    if (IsEnabled()) { WriteEvent(2, id); }\n                }\n\n                public static readonly MyNewCompanyEventSource2 Logger = new MyNewCompanyEventSource2();\n            }\n        }\n\n        [TestClass]\n        public class when_logging_an_event_with_multiple_payload_types : given_traceEventService\n        {\n            protected override void Given()\n            {\n                this.sourceSettings = new EventSourceSettings(EventSource.GetName(typeof(MultipleTypesEventSource)));\n                base.Given();\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                MultipleTypesEventSource.Log.ManyTypes(1, 2, 3, 4, 5, 6, 7, 8, 9, true, \"test\", Guid.NewGuid(), MultipleTypesEventSource.Color.Blue, 10);\n            }\n\n            [TestMethod]\n            public void then_event_is_collected_and_processed()\n            {\n                // Wait for event to be processed\n                inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout);\n\n                Assert.AreEqual(1, inMemoryListener.EventWrittenCount);\n                var entry = formatter.WriteEventCalls.FirstOrDefault();\n                Assert.IsNotNull(entry);\n\n                Assert.AreEqual(MultipleTypesEventSource.Log.Name, entry.Schema.ProviderName);\n                Assert.AreEqual(sourceSettings.EventSourceId, entry.ProviderId);\n                Assert.AreEqual((int)MultipleTypesEventSource.Color.Blue, entry.Payload[entry.Schema.Payload.ToList().FindIndex(m => m == \"arg16\")]);\n            }\n        }\n\n        [TestClass]\n        public class when_logging_with_multiple_enum_types : given_traceEventService\n        {\n            private InMemoryEventListener slabListener;\n\n            protected override void Given()\n            {\n                this.sourceSettings = new EventSourceSettings(EventSource.GetName(typeof(DifferentEnumsEventSource)));\n                base.Given();\n\n                this.slabListener = new InMemoryEventListener();\n                this.slabListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Error, SemanticLoggingEventSource.Keywords.TraceEvent);\n\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                DifferentEnumsEventSource.Log.UsingAllEnumArguments(MyLongEnum.Value1, MyIntEnum.Value2, MyShortEnum.Value3,\n                    MyByteEnum.Value1, MySByteEnum.Value2, MyUShortEnum.Value3, MyUIntEnum.Value1, MyULongEnum.Value2);\n            }\n\n            [TestMethod]\n            [Ignore]    // TraceEvent does not notify of manifest failures\n            public void then_error_is_logged_to_slab_eventsource()\n            {\n                // Wait for event to be processed\n                slabListener.WaitOnAsyncEvents.WaitOne(AsyncProcessTimeout);\n\n                Assert.AreEqual(0, formatter.WriteEventCalls.Count);\n                StringAssert.Contains(slabListener.ToString(), \"EventId : 810\");\n            }\n\n            protected override void OnCleanup()\n            {\n                slabListener.DisableEvents(SemanticLoggingEventSource.Log);\n                base.OnCleanup();\n            }\n        }\n\n        [TestClass]\n        public class when_logging_with_a_provider_with_large_manifest : given_traceEventService\n        {\n            protected override void Given()\n            {\n                this.sourceSettings = new EventSourceSettings(EventSource.GetName(typeof(LargeManifestEventSource)));\n                base.Given();\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                LargeManifestEventSource.Log.MultipleKeywords11(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);\n            }\n\n            [TestMethod]\n            public void then_event_is_collected_and_processed()\n            {\n                // Wait for event to be processed\n                Assert.IsTrue(inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout));\n\n                Assert.AreEqual(1, inMemoryListener.EventWrittenCount);\n                var entry = formatter.WriteEventCalls.FirstOrDefault();\n                Assert.IsNotNull(entry);\n\n                Assert.AreEqual(LargeManifestEventSource.Log.Name, entry.Schema.ProviderName);\n                Assert.AreEqual(sourceSettings.EventSourceId, entry.ProviderId);\n            }\n        }\n\n        [TestClass]\n        public class when_logging_with_a_provider_with_large_manifest_from_two_event_source_instances : given_traceEventService\n        {\n            private DisposableDomain domain1;\n            private DisposableDomain domain2;\n\n            protected override void Given()\n            {\n                this.domain1 = new DisposableDomain();\n                this.domain2 = new DisposableDomain();\n                this.sourceSettings = new EventSourceSettings(EventSource.GetName(typeof(LargeManifestEventSource)));\n\n                base.Given();\n\n                // We expect 2 events\n                this.inMemoryListener.WaitSignalCondition = () => inMemoryListener.EventWrittenCount == 2;\n\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                this.domain1.DoCallBack(() =>\n                    {\n                        LargeManifestEventSource.Log.MultipleKeywords11(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);\n                    });\n\n                this.domain2.DoCallBack(() =>\n                    {\n                        LargeManifestEventSource.Log.MultipleKeywords11(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11);\n                    });\n            }\n\n            protected override void OnCleanup()\n            {\n                this.domain1.Dispose();\n                this.domain2.Dispose();\n                base.OnCleanup();\n            }\n\n            [TestMethod]\n            public void then_both_events_are_collected_and_processed()\n            {\n                // Wait for event to be processed\n                Assert.IsTrue(inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout));\n\n                var entry0 = formatter.WriteEventCalls.ElementAt(0);\n                var entry1 = formatter.WriteEventCalls.ElementAt(1);\n\n                Assert.AreEqual(LargeManifestEventSource.Log.Name, entry0.Schema.ProviderName);\n                Assert.AreEqual(sourceSettings.EventSourceId, entry0.ProviderId);\n\n                Assert.AreEqual(LargeManifestEventSource.Log.Name, entry1.Schema.ProviderName);\n                Assert.AreEqual(sourceSettings.EventSourceId, entry1.ProviderId);\n            }\n        }\n\n        [TestClass]\n        public class when_logging_an_event_from_a_process_process_included_in_filters : given_traceEventService\n        {\n            protected override void Given()\n            {\n                this.sourceSettings =\n                    new EventSourceSettings(\n                        EventSource.GetName(typeof(MyCompanyEventSource)),\n                    processNameFilters: new[] { System.IO.Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName) });\n                base.Given();\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                MyCompanyEventSource.Log.PageStart(10, \"test\");\n            }\n\n            [TestMethod]\n            public void then_event_is_collected_and_processed()\n            {\n                // Wait for event to be processed\n                inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout);\n\n                Assert.AreEqual(1, inMemoryListener.EventWrittenCount);\n                var entry = formatter.WriteEventCalls.FirstOrDefault();\n                Assert.IsNotNull(entry);\n\n                Assert.AreEqual(MyCompanyEventSource.Log.Name, entry.Schema.ProviderName);\n                Assert.AreEqual(sourceSettings.EventSourceId, entry.ProviderId);\n                Assert.AreEqual(\"loading page test activityID=10\", entry.FormattedMessage);\n                Assert.AreEqual(EventOpcode.Start, entry.Schema.Opcode);\n                Assert.AreEqual(3, entry.EventId);\n                Assert.AreEqual(Guid.Empty, entry.ActivityId);\n                Assert.AreEqual(Guid.Empty, entry.RelatedActivityId);\n            }\n        }\n\n        [TestClass]\n        public class when_logging_an_event_from_a_process_process_not_included_in_filters : given_traceEventService\n        {\n            protected override void Given()\n            {\n                this.sourceSettings =\n                    new EventSourceSettings(\n                        EventSource.GetName(typeof(MyCompanyEventSource)),\n                    processNameFilters: new[] { Guid.NewGuid().ToString() });\n                base.Given();\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                MyCompanyEventSource.Log.PageStart(10, \"test\");\n            }\n\n            [TestMethod]\n            public void then_event_is_not_collected()\n            {\n                // Wait for event to be processed\n                Assert.IsFalse(inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout));\n\n                Assert.AreEqual(0, inMemoryListener.EventWrittenCount);\n            }\n        }\n\n        [TestClass]\n        public class when_logging_multiple_events_from_a_process_process_without_sampling : given_traceEventService\n        {\n            protected override void Given()\n            {\n                this.sourceSettings =\n                    new EventSourceSettings(\n                        EventSource.GetName(typeof(MyCompanyEventSource)));\n                base.Given();\n                this.inMemoryListener.WaitSignalCondition = () => inMemoryListener.EventWrittenCount == 15;\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                Guid currentActivityGuid = EventSource.CurrentThreadActivityId;\n\n                try\n                {\n                    for (int i = 0; i < 15; i++)\n                    {\n                        EventSource.SetCurrentThreadActivityId(Guid.NewGuid());\n                        MyCompanyEventSource.Log.PageStart(i, \"test\");\n                    }\n                }\n                finally\n                {\n                    EventSource.SetCurrentThreadActivityId(currentActivityGuid);\n                }\n            }\n\n            [TestMethod]\n            public void then_all_events_are_collected_and_processed()\n            {\n                // Wait for event to be processed\n                inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout);\n\n                Assert.AreEqual(15, this.inMemoryListener.EventWrittenCount);\n                Assert.AreEqual(0, this.formatter.WriteEventCalls[0].Payload[0]);\n                Assert.AreEqual(1, this.formatter.WriteEventCalls[1].Payload[0]);\n                Assert.AreEqual(2, this.formatter.WriteEventCalls[2].Payload[0]);\n                Assert.AreEqual(3, this.formatter.WriteEventCalls[3].Payload[0]);\n                Assert.AreEqual(4, this.formatter.WriteEventCalls[4].Payload[0]);\n                Assert.AreEqual(5, this.formatter.WriteEventCalls[5].Payload[0]);\n                Assert.AreEqual(6, this.formatter.WriteEventCalls[6].Payload[0]);\n                Assert.AreEqual(7, this.formatter.WriteEventCalls[7].Payload[0]);\n                Assert.AreEqual(8, this.formatter.WriteEventCalls[8].Payload[0]);\n                Assert.AreEqual(9, this.formatter.WriteEventCalls[9].Payload[0]);\n                Assert.AreEqual(10, this.formatter.WriteEventCalls[10].Payload[0]);\n                Assert.AreEqual(11, this.formatter.WriteEventCalls[11].Payload[0]);\n                Assert.AreEqual(12, this.formatter.WriteEventCalls[12].Payload[0]);\n                Assert.AreEqual(13, this.formatter.WriteEventCalls[13].Payload[0]);\n                Assert.AreEqual(14, this.formatter.WriteEventCalls[14].Payload[0]);\n            }\n        }\n\n#if !EVENT_SOURCE_PACKAGE\n        // sampling not supported when using the NuGet package\n        [TestClass]\n        public class when_logging_multiple_events_from_a_process_process_with_sampling : given_traceEventService\n        {\n            protected override void Given()\n            {\n                this.sourceSettings =\n                    new EventSourceSettings(\n                        EventSource.GetName(typeof(MyCompanyEventSource)),\n                    arguments: new[] { new KeyValuePair<string, string>(\"ActivitySamplingStartEvent\", \"PageStart:5\") });\n                base.Given();\n                this.inMemoryListener.WaitSignalCondition = () => inMemoryListener.EventWrittenCount == 3;\n                this.sut.Start();\n            }\n\n            protected override void When()\n            {\n                Guid currentActivityGuid = EventSource.CurrentThreadActivityId;\n\n                try\n                {\n                    for (int i = 0; i < 15; i++)\n                    {\n                        EventSource.SetCurrentThreadActivityId(Guid.NewGuid());\n                        MyCompanyEventSource.Log.PageStart(i, \"test\");\n                    }\n                }\n                finally\n                {\n                    EventSource.SetCurrentThreadActivityId(currentActivityGuid);\n                }\n            }\n\n            [TestMethod]\n            public void then_sampled_events_are_collected_and_processed()\n            {\n                // Wait for event to be processed\n                inMemoryListener.WaitOnAsyncEvents.WaitOne(this.AsyncProcessTimeout);\n\n                Assert.AreEqual(3, this.inMemoryListener.EventWrittenCount);\n                Assert.AreEqual(0, this.formatter.WriteEventCalls[0].Payload[0]);\n                Assert.AreEqual(5, this.formatter.WriteEventCalls[1].Payload[0]);\n                Assert.AreEqual(10, this.formatter.WriteEventCalls[2].Payload[0]);\n            }\n        }\n#endif\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/TraceEventServiceSettingsFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Etw\n{\n    [TestClass]\n    public class given_traceEventServiceSettings_configuration\n    {\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentNullException))]\n        public void when_creating_instance_with_null_sessionName()\n        {\n            new TraceEventServiceSettings() { SessionNamePrefix = null };\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentException))]\n        public void when_creating_instance_with_empty_sessionName()\n        {\n            new TraceEventServiceSettings() { SessionNamePrefix = string.Empty };\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentOutOfRangeException))]\n        public void when_creating_instance_with_max_sessionName_length()\n        {\n            new TraceEventServiceSettings() { SessionNamePrefix = new string('a', 201) };\n        }\n\n        [TestMethod]\n        public void when_creating_instance_with_default_values()\n        {\n            var sut = new TraceEventServiceSettings();\n\n            Assert.IsTrue(sut.SessionNamePrefix.StartsWith(Constants.DefaultSessionNamePrefix));\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/TraceEventServiceWorkerFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing Microsoft.Diagnostics.Tracing.Session;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Etw\n{\n    public abstract class given_traceEventServiceWorker : ContextBase\n    {\n        protected SinkSettings sinkSettings;\n        protected TraceEventServiceSettings traceEventServiceSettings;\n        internal TraceEventServiceWorker Sut;\n\n        protected override void Given()\n        {\n            this.sinkSettings = new SinkSettings(\"test\", new InMemoryEventListener(), new[] { new EventSourceSettings(\"Test\") });\n            this.traceEventServiceSettings = new TraceEventServiceSettings();\n        }\n\n        protected override void OnCleanup()\n        {\n            if (this.Sut != null)\n            {\n                this.Sut.Dispose();\n            }\n        }\n\n        [TestClass]\n        public class when_creating_instance_with_null_arguments : given_traceEventServiceWorker\n        {\n            [TestMethod]\n            [ExpectedException(typeof(ArgumentNullException))]\n            public void then_exception_is_thrown_on_null_sinkSettings()\n            {\n                new TraceEventServiceWorker(null, this.traceEventServiceSettings);\n            }\n\n            [TestMethod]\n            [ExpectedException(typeof(ArgumentNullException))]\n            public void then_exception_is_thrown_on_null_traceEventServiceSettings()\n            {\n                new TraceEventServiceWorker(this.sinkSettings, null);\n            }\n        }\n\n        [TestClass]\n        public class when_creating_instance_with_valid_settings : given_traceEventServiceWorker\n        {\n            protected override void When()\n            {\n                try\n                {\n                    this.Sut = new TraceEventServiceWorker(this.sinkSettings, this.traceEventServiceSettings);\n                }\n                catch (UnauthorizedAccessException ex)\n                {\n                    Assert.Inconclusive(\"In order to run the tests, please run Visual Studio as Administrator.\\r\\n{0}\", ex);\n                }\n            }\n\n            [TestMethod]\n            public void then_session_is_started()\n            {\n                bool sessionCreated = TraceEventSession.GetActiveSessionNames().\n                    Any(s => s.StartsWith(this.traceEventServiceSettings.SessionNamePrefix, StringComparison.OrdinalIgnoreCase));\n\n                Assert.IsTrue(sessionCreated);\n            }\n        }\n\n        [TestClass]\n        public class when_updating_session : given_traceEventServiceWorker\n        {\n            protected override void When()\n            {\n                try\n                {\n                    this.Sut = new TraceEventServiceWorker(this.sinkSettings, this.traceEventServiceSettings);\n                }\n                catch (UnauthorizedAccessException ex)\n                {\n                    Assert.Inconclusive(\"In order to run the tests, please run Visual Studio as Administrator.\\r\\n{0}\", ex);\n                }\n            }\n\n            [TestMethod]\n            [ExpectedException(typeof(ArgumentNullException))]\n            public void then_exception_is_thrown_with_null_eventSources()\n            {\n                this.Sut.UpdateSession(null);\n            }\n\n            [TestMethod]\n            public void then_session_is_updated_with_new_eventSources()\n            {\n                var currentEventSource = this.sinkSettings.EventSources.First();\n                var newEventSource = new EventSourceSettings(currentEventSource.Name, level: currentEventSource.Level, matchAnyKeyword: EventKeywords.AuditSuccess);\n\n                this.Sut.UpdateSession(new List<EventSourceSettings> { newEventSource });\n\n                Assert.AreEqual(newEventSource.Level, currentEventSource.Level);\n                Assert.AreEqual(newEventSource.MatchAnyKeyword, currentEventSource.MatchAnyKeyword);\n                EnumerableAssert.AreEqual(newEventSource.Arguments, currentEventSource.Arguments);\n                EnumerableAssert.AreEqual(newEventSource.ProcessNamesToFilter, currentEventSource.ProcessNamesToFilter);\n            }\n\n            [TestMethod]\n            public void then_session_is_updated_with_new_eventSources_with_filters_and_arguments()\n            {\n                var currentEventSource = this.sinkSettings.EventSources.First();\n                var newEventSource =\n                    new EventSourceSettings(\n                        currentEventSource.Name,\n                        level: currentEventSource.Level,\n                        matchAnyKeyword: currentEventSource.MatchAnyKeyword,\n                        arguments: new[] { new KeyValuePair<string, string>(\"key\", \"value\") },\n                        processNameFilters: new[] { \"process\" });\n\n                this.Sut.UpdateSession(new List<EventSourceSettings> { newEventSource });\n\n                Assert.AreEqual(newEventSource.Level, currentEventSource.Level);\n                Assert.AreEqual(newEventSource.MatchAnyKeyword, currentEventSource.MatchAnyKeyword);\n                EnumerableAssert.AreEqual(newEventSource.Arguments, currentEventSource.Arguments);\n                EnumerableAssert.AreEqual(newEventSource.ProcessNamesToFilter, currentEventSource.ProcessNamesToFilter);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/WindowsAzureTableSinkElementFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Configuration;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Etw\n{\n    public abstract class given_windowsAzureTableSinkElement : ContextBase\n    {\n        protected ISinkElement sut;\n        private XElement element;\n\n        protected override void Given()\n        {\n            this.element = new XElement(XName.Get(\"windowsAzureTableSink\", Constants.Namespace),\n                                        new XAttribute(\"instanceName\", \"instanceName\"),\n                                        new XAttribute(\"connectionString\", \"UseDevelopmentStorage=true\"));\n\n            this.sut = new WindowsAzureTableSinkElement();\n        }\n\n        [TestClass]\n        public class when_query_for_canCreateSink : given_windowsAzureTableSinkElement\n        {\n            [TestMethod]\n            public void then_instance_can_be_created()\n            {\n                Assert.IsTrue(this.sut.CanCreateSink(this.element));\n            }\n        }\n\n        [TestClass]\n        public class when_createSink_with_required_parameters : given_windowsAzureTableSinkElement\n        {\n            private IObserver<EventEntry> observer;\n\n            protected override void When()\n            {\n                this.observer = this.sut.CreateSink(this.element);\n            }\n\n            [TestMethod]\n            public void then_sink_is_created()\n            {\n                Assert.IsNotNull(this.observer);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Etw/XmlUtilFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Threading;\nusing System.Xml.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Etw.Utility;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Etw\n{\n    [TestClass]\n    public class given_xmlUtil\n    {\n        [TestMethod]\n        public void when_converting_toTimeSpan_from_null_attribute()\n        {\n            TimeSpan? result = ((XAttribute)null).ToTimeSpan();\n\n            Assert.AreEqual((TimeSpan?)null, result);\n        }\n\n        [TestMethod]\n        public void when_converting_toTimeSpan_from_infinite()\n        {\n            TimeSpan? result = new XAttribute(\"value\", -1).ToTimeSpan();\n\n            Assert.AreEqual(Timeout.InfiniteTimeSpan, result);\n        }\n\n        [TestMethod]\n        public void when_converting_toTimeSpan_from_int()\n        {\n            TimeSpan? result = new XAttribute(\"value\", 123).ToTimeSpan();\n\n            Assert.AreEqual(TimeSpan.FromSeconds(123), result);\n        }\n\n        [TestMethod]\n        public void when_creating_instance_from_element()\n        {\n            var element = new XElement(\"test\", new XAttribute(\"type\", \"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects.InMemoryEventListener, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\"));\n            var sut = XmlUtil.CreateInstance<InMemoryEventListener>(element);\n\n            Assert.IsNotNull(sut);\n            Assert.IsInstanceOfType(sut, typeof(InMemoryEventListener));\n        }\n\n        [TestMethod]\n        public void when_creating_instance_from_element_with_parameters()\n        {\n            var doc = XDocument.Parse(\n               @\"<customSink name=\"\"custom\"\" type=\"\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects.InMemoryEventListener, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\"\">\n                    <sources>\n                      <eventSource name=\"\"MyCompany\"\"/>\n                    </sources>\n                    <parameters>\n                      <parameter name=\"\"formatter\"\" type=\"\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects.MockFormatter, Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\"\"/>\n                    </parameters>\n                 </customSink>\");\n\n            var sut = XmlUtil.CreateInstance<InMemoryEventListener>(doc.Root);\n\n            Assert.IsNotNull(sut);\n            Assert.IsInstanceOfType(sut, typeof(InMemoryEventListener));\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Event.xsd",
    "content": "<xs:schema targetNamespace=\"http://schemas.microsoft.com/win/2004/08/events/event\" elementFormDefault=\"qualified\" xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" xmlns:evt=\"http://schemas.microsoft.com/win/2004/08/events/event\">\n\t<xs:simpleType name=\"GUIDType\">\n\t\t<xs:restriction base=\"xs:string\">\n\t\t\t<xs:pattern value=\"\\{[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\\}\"/>\n\t\t</xs:restriction>\n\t</xs:simpleType>\n\t<xs:complexType name=\"DataType\">\n\t\t<xs:simpleContent>\n\t\t\t<xs:extension base=\"xs:string\">\n\t\t\t\t<xs:attribute name=\"Name\" type=\"xs:string\" use=\"optional\"/>\n\t\t\t\t<xs:attribute name=\"Type\" type=\"xs:QName\" use=\"optional\"/>\n\t\t\t</xs:extension>\n\t\t</xs:simpleContent>\n\t</xs:complexType>\n\t<xs:simpleType name=\"HexInt32Type\">\n\t\t<xs:annotation>\n\t\t\t<xs:documentation> Hex 1-8 digits in size</xs:documentation>\n\t\t</xs:annotation>\n\t\t<xs:restriction base=\"xs:string\">\n\t\t\t<xs:pattern value=\"0[xX][0-9A-Fa-f]{1,8}\"/>\n\t\t</xs:restriction>\n\t</xs:simpleType>\n\t<xs:simpleType name=\"HexInt64Type\">\n\t\t<xs:annotation>\n\t\t\t<xs:documentation> Hex 1-16 digits in size</xs:documentation>\n\t\t</xs:annotation>\n\t\t<xs:restriction base=\"xs:string\">\n\t\t\t<xs:pattern value=\"0[xX][0-9A-Fa-f]{1,16}\"/>\n\t\t</xs:restriction>\n\t</xs:simpleType>\n\t<xs:complexType name=\"ComplexDataType\">\n\t\t<xs:sequence>\n\t\t\t<xs:element name=\"Data\" type=\"evt:DataType\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n\t\t</xs:sequence>\n\t\t<xs:attribute name=\"Name\" type=\"xs:string\" use=\"optional\"/>\n\t</xs:complexType>\n\t<xs:complexType name=\"SystemPropertiesType\">\n\t\t<xs:sequence>\n\t\t\t<xs:element name=\"Provider\">\n\t\t\t\t<xs:complexType>\n\t\t\t\t\t<xs:attribute name=\"Name\" type=\"xs:anyURI\" use=\"optional\"/>\n\t\t\t\t\t<xs:attribute name=\"Guid\" type=\"evt:GUIDType\" use=\"optional\"/>\n\t\t\t\t\t<xs:attribute name=\"EventSourceName\" type=\"xs:string\" use=\"optional\"/>\n\t\t\t\t</xs:complexType>\n\t\t\t</xs:element>\n\t\t\t<xs:element name=\"EventID\">\n\t\t\t\t<xs:complexType>\n\t\t\t\t\t<xs:simpleContent>\n\t\t\t\t\t\t<xs:extension base=\"xs:unsignedShort\">\n\t\t\t\t\t\t\t<xs:attribute name=\"Qualifiers\" type=\"xs:unsignedShort\" use=\"optional\"/>\n\t\t\t\t\t\t</xs:extension>\n\t\t\t\t\t</xs:simpleContent>\n\t\t\t\t</xs:complexType>\n\t\t\t</xs:element>\n\t\t\t<xs:element name=\"Version\" type=\"xs:unsignedByte\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"Level\" type=\"xs:unsignedByte\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"Task\" type=\"xs:unsignedShort\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"Opcode\" type=\"xs:unsignedByte\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"Keywords\" type=\"evt:HexInt64Type\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"TimeCreated\" minOccurs=\"0\">\n\t\t\t\t<xs:complexType>\n\t\t\t\t\t<xs:attribute name=\"SystemTime\" type=\"xs:dateTime\" use=\"optional\"/>\n\t\t\t\t\t<xs:attribute name=\"RawTime\" type=\"xs:unsignedLong\" use=\"optional\"/>\n\t\t\t\t</xs:complexType>\n                <xs:key name=\"uniqueAtt\">\n                    <xs:selector xpath=\".\"/>\n                    <xs:field xpath=\"@SystemTime|@RawTime\"/>\n                </xs:key>\n\t\t\t</xs:element>\n\t\t\t<xs:element name=\"EventRecordID\" minOccurs=\"0\">\n\t\t\t\t<xs:complexType>\n\t\t\t\t\t<xs:simpleContent>\n\t\t\t\t\t\t<xs:extension base=\"xs:unsignedLong\"/>\n\t\t\t\t\t</xs:simpleContent>\n\t\t\t\t</xs:complexType>\n\t\t\t</xs:element>\n\t\t\t<xs:element name=\"Correlation\" minOccurs=\"0\">\n\t\t\t\t<xs:complexType>\n\t\t\t\t\t<xs:attribute name=\"ActivityID\" type=\"evt:GUIDType\" use=\"optional\"/>\n\t\t\t\t\t<xs:attribute name=\"RelatedActivityID\" type=\"evt:GUIDType\" use=\"optional\"/>\n\t\t\t\t</xs:complexType>\n\t\t\t</xs:element>\n\t\t\t<xs:element name=\"Execution\" minOccurs=\"0\">\n\t\t\t\t<xs:complexType>\n\t\t\t\t\t<xs:attribute name=\"ProcessID\" type=\"xs:unsignedInt\" use=\"required\"/>\n\t\t\t\t\t<xs:attribute name=\"ThreadID\" type=\"xs:unsignedInt\" use=\"required\"/>\n\t\t\t\t\t<xs:attribute name=\"ProcessorID\" type=\"xs:unsignedByte\" use=\"optional\"/>\n\t\t\t\t\t<xs:attribute name=\"SessionID\" type=\"xs:unsignedInt\" use=\"optional\"/>\n\t\t\t\t\t<xs:attribute name=\"KernelTime\" type=\"xs:unsignedInt\" use=\"optional\"/>\n\t\t\t\t\t<xs:attribute name=\"UserTime\" type=\"xs:unsignedInt\" use=\"optional\"/>\n\t\t\t\t\t<xs:attribute name=\"ProcessorTime\" type=\"xs:unsignedInt\" use=\"optional\"/>\n\t\t\t\t</xs:complexType>\n\t\t\t</xs:element>\n\t\t\t<xs:element name=\"Channel\" type=\"xs:anyURI\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"Computer\" type=\"xs:string\"/>\n\t\t\t<xs:element name=\"Security\" minOccurs=\"0\">\n\t\t\t\t<xs:complexType>\n\t\t\t\t\t<xs:attribute name=\"UserID\" type=\"xs:string\" use=\"optional\"/>\n\t\t\t\t</xs:complexType>\n\t\t\t</xs:element>\n\t\t\t<xs:any namespace=\"##other\" processContents=\"lax\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n\t\t</xs:sequence>\n\t\t<xs:anyAttribute namespace=\"##other\" processContents=\"lax\"/>\n\t</xs:complexType>\n\t<xs:complexType name=\"EventDataType\">\n\t\t<xs:sequence>\n\t\t\t<xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\">\n\t\t\t\t<xs:element name=\"Data\" type=\"evt:DataType\"/>\n\t\t\t\t<xs:element name=\"ComplexData\" type=\"evt:ComplexDataType\"/>\n\t\t\t</xs:choice>\n\t\t\t<xs:element name=\"Binary\" type=\"xs:hexBinary\" minOccurs=\"0\">\n\t\t\t\t<xs:annotation>\n\t\t\t\t\t<xs:documentation>Classic eventlog binary data</xs:documentation>\n\t\t\t\t</xs:annotation>\n\t\t\t</xs:element>\n\t\t</xs:sequence>\n\t\t<xs:attribute name=\"Name\" type=\"xs:string\" use=\"optional\"/>\n\t</xs:complexType>\n\t<xs:complexType name=\"UserDataType\">\n\t\t<xs:sequence>\n\t\t\t<xs:any namespace=\"##other\" processContents=\"lax\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n\t\t</xs:sequence>\n\t\t<xs:anyAttribute namespace=\"##other\" processContents=\"lax\"/>\n\t</xs:complexType>\n\t<xs:complexType name=\"DebugDataType\">\n\t\t<xs:sequence>\n\t\t\t<xs:element name=\"SequenceNumber\" type=\"xs:unsignedInt\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"FlagsName\" type=\"xs:string\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"LevelName\" type=\"xs:string\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"Component\" type=\"xs:string\"/>\n\t\t\t<xs:element name=\"SubComponent\" type=\"xs:string\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"FileLine\" type=\"xs:string\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"Function\" type=\"xs:string\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"Message\" type=\"xs:string\"/>\n\t\t\t<xs:any namespace=\"##other\" processContents=\"lax\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n\t\t</xs:sequence>\n\t\t<xs:anyAttribute namespace=\"##other\" processContents=\"lax\"/>\n\t</xs:complexType>\n\t<xs:complexType name=\"ProcessingErrorDataType\">\n\t\t<xs:sequence>\n\t\t\t<xs:element name=\"ErrorCode\" type=\"xs:unsignedInt\"/>\n\t\t\t<xs:element name=\"DataItemName\" type=\"xs:string\"/>\n\t\t\t<xs:element name=\"EventPayload\" type=\"xs:hexBinary\"/>\n\t\t\t<xs:any namespace=\"##other\" processContents=\"lax\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n\t\t</xs:sequence>\n\t\t<xs:anyAttribute namespace=\"##other\" processContents=\"lax\"/>\n\t</xs:complexType>\n\t<xs:complexType name=\"RenderingInfoType\">\n\t\t<xs:sequence>\n\t\t\t<xs:element name=\"Message\" type=\"xs:string\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"Level\" type=\"xs:string\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"Opcode\" type=\"xs:string\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"Task\" type=\"xs:string\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"Channel\" type=\"xs:string\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"Provider\" type=\"xs:string\" minOccurs=\"0\"/>\n\t\t\t<xs:element name=\"Keywords\" minOccurs=\"0\">\n\t\t\t\t<xs:complexType>\n\t\t\t\t\t<xs:sequence>\n\t\t\t\t\t\t<xs:element name=\"Keyword\" type=\"xs:string\" minOccurs=\"0\" maxOccurs=\"64\"/>\n\t\t\t\t\t</xs:sequence>\n\t\t\t\t</xs:complexType>\n\t\t\t</xs:element>\n\t\t\t<xs:any namespace=\"##other\" processContents=\"lax\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n\t\t</xs:sequence>\n\t\t<xs:attribute name=\"Culture\" type=\"xs:language\" use=\"required\"/>\n\t\t<xs:anyAttribute namespace=\"##other\" processContents=\"lax\"/>\n\t</xs:complexType>\n\t<xs:complexType name=\"EventType\">\n\t\t<xs:sequence>\n\t\t\t<xs:element name=\"System\" type=\"evt:SystemPropertiesType\"/>\n\t\t\t<xs:choice>\n\t\t\t\t<xs:element name=\"EventData\" type=\"evt:EventDataType\" minOccurs=\"0\">\n\t\t\t\t\t<xs:annotation>\n\t\t\t\t\t\t<xs:documentation>Generic event</xs:documentation>\n\t\t\t\t\t</xs:annotation>\n\t\t\t\t</xs:element>\n\t\t\t\t<xs:element name=\"UserData\" type=\"evt:UserDataType\" minOccurs=\"0\">\n\t\t\t\t\t<xs:annotation>\n\t\t\t\t\t\t<xs:documentation>Custom event</xs:documentation>\n\t\t\t\t\t</xs:annotation>\n\t\t\t\t</xs:element>\n\t\t\t\t<xs:element name=\"DebugData\" type=\"evt:DebugDataType\" minOccurs=\"0\">\n\t\t\t\t\t<xs:annotation>\n\t\t\t\t\t\t<xs:documentation>WPP debug event</xs:documentation>\n\t\t\t\t\t</xs:annotation>\n\t\t\t\t</xs:element>\n\t\t\t\t<xs:element name=\"BinaryEventData\" type=\"xs:hexBinary\" minOccurs=\"0\">\n\t\t\t\t\t<xs:annotation>\n\t\t\t\t\t\t<xs:documentation>Non schematized event</xs:documentation>\n\t\t\t\t\t</xs:annotation>\n\t\t\t\t</xs:element>\n\t\t\t\t<xs:element name=\"ProcessingErrorData\" type=\"evt:ProcessingErrorDataType\" minOccurs=\"0\">\n\t\t\t\t\t<xs:annotation>\n\t\t\t\t\t\t<xs:documentation>Instrumentation event</xs:documentation>\n\t\t\t\t\t</xs:annotation>\n\t\t\t\t</xs:element>\n\t\t\t</xs:choice>\n\t\t\t<xs:element name=\"RenderingInfo\" type=\"evt:RenderingInfoType\" minOccurs=\"0\"/>\n\t\t\t<xs:any namespace=\"##other\" processContents=\"lax\" minOccurs=\"0\" maxOccurs=\"unbounded\"/>\n\t\t</xs:sequence>\n\t\t<xs:anyAttribute namespace=\"##other\" processContents=\"lax\"/>\n\t</xs:complexType>\n\t<xs:element name=\"Event\" type=\"evt:EventType\"/>\n</xs:schema>\n\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/EventSourceSchemaReaderFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Schema\n{\n    [TestClass]\n    public class EventSourceSchemaReaderFixture\n    {\n        [TestMethod]\n        public void when_parsing_schema_then_can_read_payload_argument_names()\n        {\n            var reader = new EventSourceSchemaReader();\n\n            var schema = reader.GetSchema(SimpleEventSource.Log);\n\n            Assert.AreEqual(\"event1Arg0\", schema[1].Payload[0]);\n            Assert.AreEqual(\"event1Arg1\", schema[1].Payload[1]);\n\n            Assert.AreEqual(\"event2Arg0\", schema[2].Payload[0]);\n            Assert.AreEqual(\"event2Arg1\", schema[2].Payload[1]);\n\n#if !EVENT_SOURCE_PACKAGE\n            Assert.AreEqual(\"event3Arg0\", schema[3].Payload[0]);\n            Assert.AreEqual(\"event3Arg1\", schema[3].Payload[1]);\n            Assert.AreEqual(\"event3Arg2\", schema[3].Payload[2]);\n#endif\n        }\n\n        [TestMethod]\n        public void when_parsing_schema_then_can_read_task_names()\n        {\n            var reader = new EventSourceSchemaReader();\n\n            var schema = reader.GetSchema(SimpleEventSource.Log);\n\n            Assert.AreEqual(\"MyEvent1\", schema[1].TaskName);\n            Assert.AreEqual(\"MyEvent2\", schema[2].TaskName);\n#if !EVENT_SOURCE_PACKAGE\n            Assert.IsNull(schema[3].TaskName);\n#endif\n        }\n\n        [TestMethod]\n        public void when_parsing_schema_then_reads_provider_name()\n        {\n            var reader = new EventSourceSchemaReader();\n\n            var schema = reader.GetSchema(SimpleEventSource.Log);\n\n            Assert.AreEqual(\"SimpleEventSource-CustomName\", schema[1].ProviderName);\n            Assert.AreEqual(\"SimpleEventSource-CustomName\", schema[2].ProviderName);\n        }\n\n        [TestMethod]\n        public void when_parsing_schema_then_can_read_events_with_and_without_tasks()\n        {\n            var reader = new EventSourceSchemaReader();\n            var schema = reader.GetSchema(MyCompanyEventSource.Log);\n\n            Assert.AreEqual<string>(\"Failure\", schema[1].TaskName);\n\n            Assert.AreEqual<string>(\"Startup\", schema[2].TaskName);\n\n            Assert.AreEqual<string>(\"Page\", schema[3].TaskName);\n            Assert.AreEqual<EventTask>(MyCompanyEventSource.Tasks.Page, schema[3].Task);\n\n            Assert.AreEqual<string>(\"Page\", schema[4].TaskName);\n            Assert.AreEqual<EventTask>(MyCompanyEventSource.Tasks.Page, schema[4].Task);\n\n            Assert.AreEqual<string>(\"DBQuery\", schema[5].TaskName);\n            Assert.AreEqual<EventTask>(MyCompanyEventSource.Tasks.DBQuery, schema[5].Task);\n\n            Assert.AreEqual<string>(\"DBQuery\", schema[6].TaskName);\n            Assert.AreEqual<EventTask>(MyCompanyEventSource.Tasks.DBQuery, schema[6].Task);\n\n            Assert.AreEqual<string>(\"Mark\", schema[7].TaskName);\n\n            Assert.AreEqual<string>(\"LogColor\", schema[8].TaskName);\n            Assert.AreEqual<EventTask>((EventTask)65526, schema[8].Task);\n\n#if !EVENT_SOURCE_PACKAGE\n            Assert.IsNull(null, schema[9].TaskName);\n            Assert.AreEqual<EventTask>((EventTask)0, schema[9].Task);\n#endif\n        }\n\n        [TestMethod]\n        public void when_parsing_schema_then_can_read_events_with_and_without_opcodes()\n        {\n            var reader = new EventSourceSchemaReader();\n            var schema = reader.GetSchema(SimpleEventSource.Log);\n\n            Assert.AreEqual<string>(\"Info\", schema[1].OpcodeName);\n            Assert.AreEqual<EventOpcode>(EventOpcode.Info, schema[1].Opcode);\n\n            Assert.AreEqual<string>(\"Info\", schema[4].OpcodeName);\n            Assert.AreEqual<EventOpcode>(EventOpcode.Info, schema[4].Opcode);\n\n            Assert.AreEqual<string>(\"Start\", schema[5].OpcodeName);\n            Assert.AreEqual<EventOpcode>(EventOpcode.Start, schema[5].Opcode);\n\n            Assert.AreEqual<string>(\"Stop\", schema[6].OpcodeName);\n            Assert.AreEqual<EventOpcode>(EventOpcode.Stop, schema[6].Opcode);\n\n            Assert.AreEqual<string>(\"DC_Start\", schema[7].OpcodeName);\n            Assert.AreEqual<EventOpcode>(EventOpcode.DataCollectionStart, schema[7].Opcode);\n\n            Assert.AreEqual<string>(\"DC_Stop\", schema[8].OpcodeName);\n            Assert.AreEqual<EventOpcode>(EventOpcode.DataCollectionStop, schema[8].Opcode);\n\n            Assert.AreEqual<string>(\"Extension\", schema[9].OpcodeName);\n            Assert.AreEqual<EventOpcode>(EventOpcode.Extension, schema[9].Opcode);\n\n            Assert.AreEqual<string>(\"Reply\", schema[10].OpcodeName);\n            Assert.AreEqual<EventOpcode>(EventOpcode.Reply, schema[10].Opcode);\n\n            Assert.AreEqual<string>(\"Resume\", schema[11].OpcodeName);\n            Assert.AreEqual<EventOpcode>(EventOpcode.Resume, schema[11].Opcode);\n\n            Assert.AreEqual<string>(\"Suspend\", schema[12].OpcodeName);\n            Assert.AreEqual<EventOpcode>(EventOpcode.Suspend, schema[12].Opcode);\n\n            Assert.AreEqual<string>(\"Send\", schema[13].OpcodeName);\n            Assert.AreEqual<EventOpcode>(EventOpcode.Send, schema[13].Opcode);\n\n            Assert.AreEqual<string>(\"Receive\", schema[14].OpcodeName);\n            Assert.AreEqual<EventOpcode>(EventOpcode.Receive, schema[14].Opcode);\n        }\n\n        [TestMethod]\n        public void when_parsing_schema_then_can_read_complex_payloads()\n        {\n            var reader = new EventSourceSchemaReader();\n            var schema = reader.GetSchema(MyCompanyEventSource.Log);\n\n            // Failure\n            Assert.AreEqual<string>(\"message\", schema[1].Payload[0]);\n\n            // PageStart\n            Assert.AreEqual<string>(\"id\", schema[3].Payload[0]);\n            Assert.AreEqual<string>(\"url\", schema[3].Payload[1]);\n\n            // PageStop\n            Assert.AreEqual<string>(\"id\", schema[4].Payload[0]);\n\n            // DBQueryStart\n            Assert.AreEqual<string>(\"sqlQuery\", schema[5].Payload[0]);\n\n            // Mark\n            Assert.AreEqual<string>(\"id\", schema[7].Payload[0]);\n\n            // LogColor\n            Assert.AreEqual<string>(\"color\", schema[8].Payload[0]);\n        }\n\n        [TestMethod]\n        public void can_parse_custom_opcodes()\n        {\n            var reader = new EventSourceSchemaReader();\n            var schema = reader.GetSchema(SimpleEventSource.Log);\n\n            Assert.AreEqual<string>(\"Opcode1\", schema[15].OpcodeName);\n            Assert.AreEqual<EventOpcode>((EventOpcode)100, schema[15].Opcode);\n\n            Assert.AreEqual<string>(\"Opcode2\", schema[16].OpcodeName);\n            Assert.AreEqual<EventOpcode>((EventOpcode)101, schema[16].Opcode);\n        }\n\n        //[TestMethod]\n        //public void can_parse_messages()\n        //{\n        //    var reader = new EventSourceSchemaReader();\n        //    var schema = reader.GetSchema(MyCompanyEventSource.Log);\n\n        //    Assert.AreEqual(\"Application Failure: {0}\", schema[1].MessageFormat);\n        //    Assert.AreEqual(\"Starting up.\", schema[2].MessageFormat);\n        //    Assert.AreEqual(\"loading page {1} activityID={0}\", schema[3].MessageFormat);\n        //    Assert.IsNull(schema[4].MessageFormat);\n        //}\n\n        [TestMethod]\n        public void can_parse_keywords()\n        {\n            var reader = new EventSourceSchemaReader();\n            var schema = reader.GetSchema(MyCompanyEventSource.Log);\n\n            Assert.AreEqual(MyCompanyEventSource.Keywords.Diagnostic, schema[1].Keywords);\n            Assert.AreEqual(\"Diagnostic\", schema[1].KeywordsDescription);\n\n            Assert.AreEqual(MyCompanyEventSource.Keywords.Perf, schema[2].Keywords);\n            Assert.AreEqual(\"Perf\", schema[2].KeywordsDescription);\n\n            Assert.AreEqual(MyCompanyEventSource.Keywords.Page, schema[3].Keywords);\n            Assert.AreEqual(\"Page\", schema[3].KeywordsDescription);\n\n            Assert.AreEqual(MyCompanyEventSource.Keywords.DataBase, schema[5].Keywords);\n            Assert.AreEqual(\"DataBase\", schema[5].KeywordsDescription);\n\n            Assert.AreEqual((EventKeywords)0, schema[8].Keywords);\n            Assert.IsNull(schema[8].KeywordsDescription);\n\n            Assert.AreEqual(MyCompanyEventSource.Keywords.DataBase | MyCompanyEventSource.Keywords.Perf, schema[10].Keywords);\n            Assert.AreEqual(\"DataBase Perf\", schema[10].KeywordsDescription);\n        }\n\n        [TestMethod]\n        public void can_parse_level()\n        {\n            var reader = new EventSourceSchemaReader();\n            var schema = reader.GetSchema(SimpleEventSource.Log);\n\n            Assert.AreEqual(EventLevel.LogAlways, schema[21].Level);\n            Assert.AreEqual(EventLevel.Critical, schema[22].Level);\n            Assert.AreEqual(EventLevel.Error, schema[23].Level);\n            Assert.AreEqual(EventLevel.Warning, schema[24].Level);\n            Assert.AreEqual(EventLevel.Informational, schema[25].Level);\n            Assert.AreEqual(EventLevel.Verbose, schema[26].Level);\n        }\n\n        [TestMethod]\n        public void can_parse_version()\n        {\n            var reader = new EventSourceSchemaReader();\n            var schema = reader.GetSchema(SimpleEventSource.Log);\n\n            Assert.AreEqual(1, schema[1].Version);\n            Assert.AreEqual(0, schema[2].Version);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(System.ArgumentNullException))]\n        public void when_receiving_null_source_throws()\n        {\n            new EventSourceSchemaReader().GetSchema((EventSource)null);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(System.ArgumentNullException))]\n        public void when_receiving_null_manifest_throws()\n        {\n            new EventSourceSchemaReader().GetSchema((string)null);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Formatters/DefaultConsoleColorMapperFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Formatters\n{\n    [TestClass]\n    public class DefaultConsoleColorMapperFixture\n    {\n        [TestClass]\n        public class given_default_colors : ContextBase\n        {\n            private IConsoleColorMapper sut;\n            private Dictionary<EventLevel, ConsoleColor?> results;\n\n            protected override void Given()\n            {\n                sut = new DefaultConsoleColorMapper();\n                results = new Dictionary<EventLevel, ConsoleColor?>();\n            }\n\n            protected override void When()\n            {\n                foreach (EventLevel level in Enum.GetValues(typeof(EventLevel)))\n                {\n                    results.Add(level, sut.Map(level));\n                }\n            }\n\n            [TestMethod]\n            public void then_all_eventlevels_should_be_mapped()\n            {\n                Assert.AreEqual(DefaultConsoleColorMapper.LogAlways, results[EventLevel.LogAlways]);\n                Assert.AreEqual(DefaultConsoleColorMapper.Critical, results[EventLevel.Critical]);\n                Assert.AreEqual(DefaultConsoleColorMapper.Error, results[EventLevel.Error]);\n                Assert.AreEqual(DefaultConsoleColorMapper.Warning, results[EventLevel.Warning]);\n                Assert.AreEqual(DefaultConsoleColorMapper.Verbose, results[EventLevel.Verbose]);\n                Assert.AreEqual(DefaultConsoleColorMapper.Informational, results[EventLevel.Informational]);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Formatters/EventTextFormatterTests.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Text.RegularExpressions;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Formatters\n{\n    [TestClass]\n    public class EventTextFormatterTests\n    {\n        private static readonly MyCompanyEventSource Logger = MyCompanyEventSource.Log;\n\n        [TestMethod]\n        public void WritesEventData()\n        {\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator) { VerbosityThreshold = EventLevel.Critical };\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(Logger, EventLevel.LogAlways, Keywords.All);\n\n                Logger.Failure(\"Failure message\");\n                formatter.VerbosityThreshold = EventLevel.Informational;\n                Logger.DBQueryStart(\"select * from table\");\n                Logger.DBQueryStop();\n                Logger.LogColor(MyColor.Red);\n\n                var entries = Regex.Split(listener.ToString(), formatter.Header + \"\\r\\n\").Where(c => !string.IsNullOrWhiteSpace(c)).ToList();\n\n                StringAssert.Contains(entries[0], \"EventId : 1\");\n                StringAssert.Contains(entries[0], \"Level : Error\");\n                StringAssert.Contains(entries[0], \"Payload : [message : Failure message]\");\n                StringAssert.Contains(entries[1],\n@\"EventId : 5\nKeywords : 2\nLevel : Informational\nMessage : \nOpcode : Start\nTask : 2\nVersion : 0\nPayload : [sqlQuery : select * from table]\");\n\n                StringAssert.Contains(entries[2],\n@\"EventId : 6\nKeywords : 2\nLevel : Informational\nMessage : \nOpcode : Stop\nTask : 2\nVersion : 0\nPayload :\");\n                StringAssert.Contains(entries[3],\n@\"EventId : 8\nKeywords : None\nLevel : Informational\nMessage : \nOpcode : Info\nTask : 65526\nVersion : 0\nPayload : [color : 0]\");\n            }\n        }\n\n        [TestMethod]\n        public void IncludesTaskName()\n        {\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator, verbosityThreshold: EventLevel.LogAlways);\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(Logger, EventLevel.LogAlways, Keywords.All);\n\n                Logger.DBQueryStart(\"select * from table\");\n                Logger.DBQueryStop();\n\n                var entries = Regex.Split(listener.ToString(), formatter.Header + \"\\r\\n\").Where(c => !string.IsNullOrWhiteSpace(c)).ToList();\n                StringAssert.Matches(entries[0], new Regex(\"EventName : .*DBQuery\"));\n                StringAssert.Matches(entries[1], new Regex(\"Task : .*\" + MyCompanyEventSource.Tasks.DBQuery.ToString()));\n            }\n        }\n\n        [TestMethod]\n        public void WritesCustomHeader()\n        {\n            var formatter = new EventTextFormatter(\"*** header ***\");\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(Logger, EventLevel.LogAlways, Keywords.All);\n\n                Logger.DBQueryStart(\"select * from table\");\n\n                Assert.IsTrue(listener.ToString().Contains(formatter.Header));\n            }\n        }\n\n        [TestMethod]\n        public void WritesCustomFooter()\n        {\n            var formatter = new EventTextFormatter(null, \"___footer___\");\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(Logger, EventLevel.LogAlways, Keywords.All);\n\n                Logger.Startup();\n\n                Assert.IsTrue(listener.ToString().Contains(formatter.Footer));\n            }\n        }\n\n        [TestMethod]\n        public void WritesCustomHeaderAndFooter()\n        {\n            var formatter = new EventTextFormatter(\"---header---\", \"___footer___\");\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(Logger, EventLevel.LogAlways, Keywords.All);\n\n                Logger.Startup();\n\n                var contents = listener.ToString();\n                Assert.IsTrue(contents.Contains(formatter.Header));\n                Assert.IsTrue(contents.Contains(formatter.Footer));\n            }\n        }\n\n        [TestMethod]\n        public void WritesDetailedOnEventLevel()\n        {\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator) { VerbosityThreshold = EventLevel.Critical };\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(Logger, EventLevel.LogAlways, Keywords.All);\n\n                Logger.Failure(\"Summary\");\n                formatter.VerbosityThreshold = EventLevel.Error;\n                Logger.Failure(\"Detailed\");\n\n                var entries = Regex.Split(listener.ToString(), formatter.Header + \"\\r\\n\").Where(c => !string.IsNullOrWhiteSpace(c)).ToList();\n\n                StringAssert.Contains(entries[0], \"EventId : 1\");\n                StringAssert.Contains(entries[0], \"Level : Error\");\n                StringAssert.Contains(entries[0], \"Payload : [message : Summary]\");\n\n                StringAssert.Contains(entries[1],\n@\"ProviderId : 659518be-d338-564b-2759-c63c10ef82e2\nEventId : 1\nKeywords : 4\nLevel : Error\nMessage : Application Failure: Detailed\nOpcode : Info\nTask : 65533\nVersion : 0\nPayload : [message : Detailed] \nEventName : FailureInfo\");\n            }\n        }\n\n        [TestMethod]\n        public void ShouldWriteTimestampWithDefaultDateTimeFormat()\n        {\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(Logger, EventLevel.LogAlways, Keywords.All);\n                Logger.Failure(\"error\");\n\n                var logged = listener.ToString();\n                var lookup = \"Timestamp : \";\n                var lookupIndex = logged.IndexOf(lookup);\n                var dateLength = logged.IndexOf(\"\\r\\n\", lookupIndex) - lookupIndex - lookup.Length;\n                var ts = logged.Substring(lookupIndex + lookup.Length, dateLength);\n                DateTime dt;\n                Assert.IsTrue(DateTime.TryParseExact(ts, formatter.DateTimeFormat ?? EventEntry.DefaultDateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt));\n            }\n        }\n\n        [TestMethod]\n        public void ShouldWriteTimestampWithCustomDateTimeFormat()\n        {\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator) { DateTimeFormat = \"yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'fffZ\" };\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(Logger, EventLevel.LogAlways, Keywords.All);\n                Logger.Failure(\"error\");\n\n                var logged = listener.ToString();\n                var lookup = \"Timestamp : \";\n                var lookupIndex = logged.IndexOf(lookup);\n                var dateLength = logged.IndexOf(\"\\r\\n\", lookupIndex) - lookupIndex - lookup.Length;\n                var ts = logged.Substring(lookupIndex + lookup.Length, dateLength);\n                DateTime dt;\n                Assert.IsTrue(DateTime.TryParseExact(ts, formatter.DateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt));\n            }\n        }\n\n        [TestMethod]\n        public void ShouldWriteTimestampWithDefaultDateTimeFormatWhenNull()\n        {\n            var formatter = new EventTextFormatter(EventTextFormatter.DashSeparator) { DateTimeFormat = null };\n            using (var listener = new InMemoryEventListener(formatter))\n            {\n                listener.EnableEvents(Logger, EventLevel.LogAlways, Keywords.All);\n                Logger.Failure(\"error\");\n\n                var logged = listener.ToString();\n                var lookup = \"Timestamp : \";\n                var lookupIndex = logged.IndexOf(lookup);\n                var dateLength = logged.IndexOf(\"\\r\\n\", lookupIndex) - lookupIndex - lookup.Length;\n                var ts = logged.Substring(lookupIndex + lookup.Length, dateLength);\n                DateTime dt;\n                Assert.IsTrue(DateTime.TryParseExact(ts, \"o\", CultureInfo.InvariantCulture, DateTimeStyles.None, out dt));\n            }\n        }\n\n        [TestMethod]\n        public void WritesProcessIdAndThreadId()\n        {\n            var formatter = new EventTextFormatter();\n            using (var writer = new StringWriter())\n            {\n                var processId = 200;\n                var threadId = 300;\n\n                formatter.WriteEvent(\n                    new EventEntry(\n                        Guid.NewGuid(),\n                        0,\n                        string.Empty,\n                        new System.Collections.ObjectModel.ReadOnlyCollection<object>(new object[0]),\n                        DateTimeOffset.MaxValue,\n                        processId,\n                        threadId,\n                        Guid.Empty,\n                        Guid.Empty,\n                        new EventSourceSchemaReader().GetSchema(Logger).Values.First()),\n                    writer);\n\n                var message = writer.ToString();\n\n                var processIdMatch = Regex.Match(message, \"\\\\bProcessId : (?<id>\\\\d+)\\\\w?\").Groups[\"id\"].Value;\n                var threadIdMatch = Regex.Match(message, \"\\\\bThreadId : (?<id>\\\\d+)\\\\w?\").Groups[\"id\"].Value;\n\n                Assert.AreEqual(processId.ToString(), processIdMatch);\n                Assert.AreEqual(threadId.ToString(), threadIdMatch);\n            }\n        }\n\n        [TestMethod]\n        public void WritesProcessIdAndThreadIdOnSummary()\n        {\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.Critical);\n            using (var writer = new StringWriter())\n            {\n                var processId = 200;\n                var threadId = 300;\n\n                formatter.WriteEvent(\n                    new EventEntry(\n                        Guid.NewGuid(),\n                        0,\n                        string.Empty,\n                        new System.Collections.ObjectModel.ReadOnlyCollection<object>(new object[0]),\n                        DateTimeOffset.MaxValue,\n                        processId,\n                        threadId,\n                        Guid.Empty,\n                        Guid.Empty,\n                        new EventSourceSchemaReader().GetSchema(Logger).Values.First()),\n                    writer);\n\n                var message = writer.ToString();\n\n                var processIdMatch = Regex.Match(message, \"\\\\bProcessId : (?<id>\\\\d+)\\\\w?\").Groups[\"id\"].Value;\n                var threadIdMatch = Regex.Match(message, \"\\\\bThreadId : (?<id>\\\\d+)\\\\w?\").Groups[\"id\"].Value;\n\n                Assert.AreEqual(processId.ToString(), processIdMatch);\n                Assert.AreEqual(threadId.ToString(), threadIdMatch);\n            }\n        }\n\n        [TestMethod]\n        public void WritesNonEmptyActivityIds()\n        {\n            var formatter = new EventTextFormatter();\n            using (var writer = new StringWriter())\n            {\n                var activityId = Guid.NewGuid();\n                var relatedActivityId = Guid.NewGuid();\n\n                formatter.WriteEvent(\n                    new EventEntry(\n                        Guid.NewGuid(),\n                        0,\n                        string.Empty,\n                        new System.Collections.ObjectModel.ReadOnlyCollection<object>(new object[0]),\n                        DateTimeOffset.MaxValue,\n                        200,\n                        300,\n                        activityId,\n                        relatedActivityId,\n                        new EventSourceSchemaReader().GetSchema(Logger).Values.First()),\n                    writer);\n\n                var message = writer.ToString();\n\n                var activityIdMatch = Regex.Match(message, \"\\\\bActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n                var relatedActivityIdMatch = Regex.Match(message, \"\\\\bRelatedActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n\n                Assert.AreEqual(activityId.ToString(), activityIdMatch);\n                Assert.AreEqual(relatedActivityId.ToString(), relatedActivityIdMatch);\n            }\n        }\n\n        [TestMethod]\n        public void WritesNonEmptyActivityId()\n        {\n            var formatter = new EventTextFormatter();\n            using (var writer = new StringWriter())\n            {\n                var activityId = Guid.NewGuid();\n\n                formatter.WriteEvent(\n                    new EventEntry(\n                        Guid.NewGuid(),\n                        0,\n                        string.Empty,\n                        new System.Collections.ObjectModel.ReadOnlyCollection<object>(new object[0]),\n                        DateTimeOffset.MaxValue,\n                        activityId,\n                        Guid.Empty,\n                        new EventSourceSchemaReader().GetSchema(Logger).Values.First()),\n                    writer);\n\n                var message = writer.ToString();\n\n                var activityIdMatch = Regex.Match(message, \"\\\\bActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n                var relatedActivityIdMatch = Regex.Match(message, \"\\\\bRelatedActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n\n                Assert.AreEqual(activityId.ToString(), activityIdMatch);\n                Assert.AreEqual(string.Empty, relatedActivityIdMatch);\n            }\n        }\n\n        [TestMethod]\n        public void WritesNonEmptyRelatedActivityId()\n        {\n            var formatter = new EventTextFormatter();\n            using (var writer = new StringWriter())\n            {\n                var relatedActivityId = Guid.NewGuid();\n\n                formatter.WriteEvent(\n                    new EventEntry(\n                        Guid.NewGuid(),\n                        0,\n                        string.Empty,\n                        new System.Collections.ObjectModel.ReadOnlyCollection<object>(new object[0]),\n                        DateTimeOffset.MaxValue,\n                        Guid.Empty,\n                        relatedActivityId,\n                        new EventSourceSchemaReader().GetSchema(Logger).Values.First()),\n                    writer);\n\n                var message = writer.ToString();\n\n                var activityIdMatch = Regex.Match(message, \"\\\\bActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n                var relatedActivityIdMatch = Regex.Match(message, \"\\\\bRelatedActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n\n                Assert.AreEqual(string.Empty, activityIdMatch);\n                Assert.AreEqual(relatedActivityId.ToString(), relatedActivityIdMatch);\n            }\n        }\n\n        [TestMethod]\n        public void SkipsEmptyActivityIds()\n        {\n            var formatter = new EventTextFormatter();\n            using (var writer = new StringWriter())\n            {\n                formatter.WriteEvent(\n                    new EventEntry(\n                        Guid.NewGuid(),\n                        0,\n                        string.Empty,\n                        new System.Collections.ObjectModel.ReadOnlyCollection<object>(new object[0]),\n                        DateTimeOffset.MaxValue,\n                        Guid.Empty,\n                        Guid.Empty,\n                        new EventSourceSchemaReader().GetSchema(Logger).Values.First()),\n                    writer);\n\n                var message = writer.ToString();\n\n                var activityIdMatch = Regex.Match(message, \"\\\\bActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n                var relatedActivityIdMatch = Regex.Match(message, \"\\\\bRelatedActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n\n                Assert.AreEqual(string.Empty, relatedActivityIdMatch);\n                Assert.AreEqual(string.Empty, relatedActivityIdMatch);\n            }\n        }\n\n        [TestMethod]\n        public void WritesNonEmptyActivityIdsOnSummary()\n        {\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.Critical);\n            using (var writer = new StringWriter())\n            {\n                var activityId = Guid.NewGuid();\n                var relatedActivityId = Guid.NewGuid();\n\n                formatter.WriteEvent(\n                    new EventEntry(\n                        Guid.NewGuid(),\n                        0,\n                        string.Empty,\n                        new System.Collections.ObjectModel.ReadOnlyCollection<object>(new object[0]),\n                        DateTimeOffset.MaxValue,\n                        activityId,\n                        relatedActivityId,\n                        new EventSourceSchemaReader().GetSchema(Logger).Values.First()),\n                    writer);\n\n                var message = writer.ToString();\n\n                var activityIdMatch = Regex.Match(message, \"\\\\bActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n                var relatedActivityIdMatch = Regex.Match(message, \"\\\\bRelatedActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n\n                Assert.AreEqual(activityId.ToString(), activityIdMatch);\n                Assert.AreEqual(relatedActivityId.ToString(), relatedActivityIdMatch);\n            }\n        }\n\n        [TestMethod]\n        public void WritesNonEmptyActivityIdOnSummary()\n        {\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.Critical);\n            using (var writer = new StringWriter())\n            {\n                var activityId = Guid.NewGuid();\n\n                formatter.WriteEvent(\n                    new EventEntry(\n                        Guid.NewGuid(),\n                        0,\n                        string.Empty,\n                        new System.Collections.ObjectModel.ReadOnlyCollection<object>(new object[0]),\n                        DateTimeOffset.MaxValue,\n                        activityId,\n                        Guid.Empty,\n                        new EventSourceSchemaReader().GetSchema(Logger).Values.First()),\n                    writer);\n\n                var message = writer.ToString();\n\n                var activityIdMatch = Regex.Match(message, \"\\\\bActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n                var relatedActivityIdMatch = Regex.Match(message, \"\\\\bRelatedActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n\n                Assert.AreEqual(activityId.ToString(), activityIdMatch);\n                Assert.AreEqual(string.Empty, relatedActivityIdMatch);\n            }\n        }\n\n        [TestMethod]\n        public void WritesNonEmptyRelatedActivityIdOnSummary()\n        {\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.Critical);\n            using (var writer = new StringWriter())\n            {\n                var relatedActivityId = Guid.NewGuid();\n\n                formatter.WriteEvent(\n                    new EventEntry(\n                        Guid.NewGuid(),\n                        0,\n                        string.Empty,\n                        new System.Collections.ObjectModel.ReadOnlyCollection<object>(new object[0]),\n                        DateTimeOffset.MaxValue,\n                        Guid.Empty,\n                        relatedActivityId,\n                        new EventSourceSchemaReader().GetSchema(Logger).Values.First()),\n                    writer);\n\n                var message = writer.ToString();\n\n                var activityIdMatch = Regex.Match(message, \"\\\\bActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n                var relatedActivityIdMatch = Regex.Match(message, \"\\\\bRelatedActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n\n                Assert.AreEqual(string.Empty, activityIdMatch);\n                Assert.AreEqual(relatedActivityId.ToString(), relatedActivityIdMatch);\n            }\n        }\n\n        [TestMethod]\n        public void SkipsEmptyActivityIdsOnSummary()\n        {\n            var formatter = new EventTextFormatter(verbosityThreshold: EventLevel.Critical);\n            using (var writer = new StringWriter())\n            {\n                formatter.WriteEvent(\n                    new EventEntry(\n                        Guid.NewGuid(),\n                        0,\n                        string.Empty,\n                        new System.Collections.ObjectModel.ReadOnlyCollection<object>(new object[0]),\n                        DateTimeOffset.MaxValue,\n                        Guid.Empty,\n                        Guid.Empty,\n                        new EventSourceSchemaReader().GetSchema(Logger).Values.First()),\n                    writer);\n\n                var message = writer.ToString();\n\n                var activityIdMatch = Regex.Match(message, \"\\\\bActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n                var relatedActivityIdMatch = Regex.Match(message, \"\\\\bRelatedActivityId : (?<id>[-A-Fa-f0-9]+)\\\\w?\").Groups[\"id\"].Value;\n\n                Assert.AreEqual(string.Empty, relatedActivityIdMatch);\n                Assert.AreEqual(string.Empty, relatedActivityIdMatch);\n            }\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentNullException))]\n        public void WritingToANullWriterThrows()\n        {\n            var formatter = new EventTextFormatter();\n            formatter.WriteEvent(new EventEntry(Guid.NewGuid(), 0, string.Empty, new System.Collections.ObjectModel.ReadOnlyCollection<object>(new object[0]), DateTimeOffset.MaxValue, new EventSourceSchemaReader().GetSchema(Logger).Values.First()), null);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentNullException))]\n        public void WritingNullEntryThrows()\n        {\n            var formatter = new EventTextFormatter();\n            using (var writer = new StringWriter())\n            {\n                formatter.WriteEvent(null, writer);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Formatters/JsonEventTextFormatterFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing Newtonsoft.Json;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Formatters\n{\n    [TestClass]\n    public class given_json_event_text_formatter_configuration : ContextBase\n    {\n        [TestMethod]\n        public void when_creating_formatter_with_default_values()\n        {\n            var formatter = new JsonEventTextFormatter();\n            Assert.IsNull(formatter.DateTimeFormat);\n            Assert.AreEqual(EventTextFormatting.None, formatter.Formatting);\n        }\n\n        [TestMethod]\n        public void when_creating_formatter_with_specific_values()\n        {\n            var formatter = new JsonEventTextFormatter(EventTextFormatting.Indented) { DateTimeFormat = \"R\" };\n            Assert.AreEqual(\"R\", formatter.DateTimeFormat);\n            Assert.AreEqual(EventTextFormatting.Indented, formatter.Formatting);\n        }\n\n        [TestMethod]\n        public void when_creating_formatter_with_null_dateTimeFormat()\n        {\n            var formatter = new JsonEventTextFormatter(EventTextFormatting.Indented) { DateTimeFormat = null };\n\n            Assert.IsNull(formatter.DateTimeFormat);\n        }\n    }\n\n    public abstract class given_json_event_text_formatter : ContextBase\n    {\n        private InMemoryEventListener listener;\n        protected TestEventSource logger = TestEventSource.Log;\n        private IEnumerable<TestEventEntry> entries;\n        protected JsonEventTextFormatter formatter;\n\n        protected override void Given()\n        {\n            formatter = new JsonEventTextFormatter();\n            listener = new InMemoryEventListener() { Formatter = formatter };\n            listener.EnableEvents(logger, EventLevel.LogAlways);\n        }\n\n        protected override void OnCleanup()\n        {\n            listener.DisableEvents(logger);\n            listener.Dispose();\n        }\n\n        protected string RawOutput\n        {\n            get { return listener.ToString(); }\n        }\n\n        protected IEnumerable<TestEventEntry> Entries\n        {\n            get\n            {\n                if (entries == null)\n                {\n                    entries = JsonConvert.DeserializeObject<TestEventEntry[]>(\"[\" + this.RawOutput + \"]\");\n                }\n                return entries;\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_payload_and_message : given_json_event_text_formatter\n        {\n            protected override void When()\n            {\n                logger.EventWithPayloadAndMessage(\"Info\", 100);\n            }\n\n            [TestMethod]\n            public void then_writes_event_data()\n            {\n                var entry = this.Entries.SingleOrDefault();\n\n                var processId = System.Diagnostics.Process.GetCurrentProcess().Id;\n                var threadId = Utility.NativeMethods.GetCurrentThreadId();\n\n                Assert.IsNotNull(entry);\n                Assert.IsFalse(this.RawOutput.StartsWith(\"{\\r\\n\")); // No Formatting (Default)\n                Assert.AreEqual<int>(TestEventSource.EventWithPayloadAndMessageId, entry.EventId);\n                Assert.AreEqual<Guid>(TestEventSource.Log.Guid, entry.ProviderId);\n                Assert.AreEqual<int>((int)EventLevel.Warning, entry.Level);\n                Assert.AreEqual<long>((long)EventKeywords.None, entry.EventKeywords);\n                Assert.AreEqual<int>((int)EventOpcode.Info, entry.Opcode);\n                Assert.AreEqual<int>(0, entry.Version);\n                Assert.AreEqual<int>(65331, entry.Task);\n                Assert.AreEqual<string>(\"Test message Info 100\", entry.Message);\n                Assert.IsTrue(entry.Payload.ContainsKey(\"payload1\"));\n                Assert.AreEqual(\"Info\", entry.Payload[\"payload1\"]);\n                Assert.IsTrue(entry.Payload.ContainsKey(\"payload2\"));\n                Assert.AreEqual((long)100, entry.Payload[\"payload2\"]);\n                Assert.AreEqual(processId, entry.ProcessId);\n                Assert.AreEqual(threadId, entry.ThreadId);\n                Assert.AreEqual(Guid.Empty, entry.ActivityId);\n                Assert.AreEqual(Guid.Empty, entry.RelatedActivityId);\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_payload_and_message_with_enviroment_activity_id : given_json_event_text_formatter\n        {\n            private Guid activityId;\n            private Guid previousActivityId;\n\n            protected override void Given()\n            {\n                base.Given();\n\n                this.activityId = Guid.NewGuid();\n                EventSource.SetCurrentThreadActivityId(this.activityId, out this.previousActivityId);\n            }\n\n            protected override void When()\n            {\n                logger.EventWithPayloadAndMessage(\"Info\", 100);\n            }\n\n            protected override void OnCleanup()\n            {\n                base.OnCleanup();\n\n                EventSource.SetCurrentThreadActivityId(this.previousActivityId);\n            }\n\n            [TestMethod]\n            public void then_writes_event_data()\n            {\n                var entry = this.Entries.SingleOrDefault();\n\n                Assert.IsNotNull(entry);\n                Assert.IsFalse(this.RawOutput.StartsWith(\"{\\r\\n\")); // No Formatting (Default)\n                Assert.AreEqual<int>(TestEventSource.EventWithPayloadAndMessageId, entry.EventId);\n                Assert.AreEqual<Guid>(TestEventSource.Log.Guid, entry.ProviderId);\n                Assert.AreEqual<int>((int)EventLevel.Warning, entry.Level);\n                Assert.AreEqual<long>((long)EventKeywords.None, entry.EventKeywords);\n                Assert.AreEqual<int>((int)EventOpcode.Info, entry.Opcode);\n                Assert.AreEqual<int>(0, entry.Version);\n                Assert.AreEqual<int>(65331, entry.Task);\n                Assert.AreEqual<string>(\"Test message Info 100\", entry.Message);\n                Assert.IsTrue(entry.Payload.ContainsKey(\"payload1\"));\n                Assert.AreEqual(\"Info\", entry.Payload[\"payload1\"]);\n                Assert.IsTrue(entry.Payload.ContainsKey(\"payload2\"));\n                Assert.AreEqual((long)100, entry.Payload[\"payload2\"]);\n                Assert.AreEqual(this.activityId, entry.ActivityId);\n                Assert.AreEqual(Guid.Empty, entry.RelatedActivityId);\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_payload_and_message_with_enviroment_activity_id_and_related_activity_id : given_json_event_text_formatter\n        {\n            private Guid activityId;\n            private Guid relatedActivityId;\n            private Guid previousActivityId;\n\n            protected override void Given()\n            {\n                base.Given();\n\n                this.activityId = Guid.NewGuid();\n                this.relatedActivityId = Guid.NewGuid();\n                EventSource.SetCurrentThreadActivityId(this.activityId, out this.previousActivityId);\n            }\n\n            protected override void When()\n            {\n                logger.EventWithPayloadAndMessageAndRelatedActivityId(this.relatedActivityId, \"Info\", 100);\n            }\n\n            protected override void OnCleanup()\n            {\n                base.OnCleanup();\n\n                EventSource.SetCurrentThreadActivityId(this.previousActivityId);\n            }\n\n            [TestMethod]\n            public void then_writes_event_data()\n            {\n                var entry = this.Entries.SingleOrDefault();\n\n                Assert.IsNotNull(entry);\n                Assert.IsFalse(this.RawOutput.StartsWith(\"{\\r\\n\")); // No Formatting (Default)\n                Assert.AreEqual<int>(TestEventSource.EventWithPayloadAndMessageAndRelatedActivityIdId, entry.EventId);\n                Assert.AreEqual<Guid>(TestEventSource.Log.Guid, entry.ProviderId);\n                Assert.AreEqual<int>((int)EventLevel.Warning, entry.Level);\n                Assert.AreEqual<long>((long)EventKeywords.None, entry.EventKeywords);\n                Assert.AreEqual<int>((int)EventOpcode.Send, entry.Opcode);\n                Assert.AreEqual<int>(0, entry.Version);\n                Assert.AreEqual<int>((int)TestEventSource.Tasks.Other, entry.Task);\n                Assert.AreEqual<string>(\"Test message Info 100\", entry.Message);\n                Assert.IsTrue(entry.Payload.ContainsKey(\"payload1\"));\n                Assert.AreEqual(\"Info\", entry.Payload[\"payload1\"]);\n                Assert.IsTrue(entry.Payload.ContainsKey(\"payload2\"));\n                Assert.AreEqual((long)100, entry.Payload[\"payload2\"]);\n                Assert.AreEqual(this.activityId, entry.ActivityId);\n                Assert.AreEqual(this.relatedActivityId, entry.RelatedActivityId);\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_multiple_events : given_json_event_text_formatter\n        {\n            protected override void When()\n            {\n                logger.Informational(\"Info\");\n                logger.Write(\"test\");\n                logger.Error(\"error\");\n            }\n\n            [TestMethod]\n            public void then_writes_event_data()\n            {\n                var entries = this.Entries;\n\n                Assert.AreEqual<int>(3, entries.Count());\n                Assert.AreEqual<int>(TestEventSource.InformationalEventId, entries.ElementAt(0).EventId);\n                Assert.AreEqual<int>(TestEventSource.VerboseEventId, entries.ElementAt(1).EventId);\n                Assert.AreEqual<int>(TestEventSource.ErrorEventId, entries.ElementAt(2).EventId);\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_message : given_json_event_text_formatter\n        {\n            protected override void Given()\n            {\n                base.Given();\n                listener.Formatter = new JsonEventTextFormatter(EventTextFormatting.Indented);\n            }\n\n            protected override void When()\n            {\n                logger.Informational(\"Info\");\n                logger.Error(\"error\");\n            }\n\n            [TestMethod]\n            public void then_writes_indented_formatted_data()\n            {\n                Assert.IsNotNull(this.RawOutput);\n                Assert.IsTrue(this.RawOutput.StartsWith(\"{\\r\\n\"));\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_multiple_events_in_parallel : given_json_event_text_formatter\n        {\n            private const int MaxLoggedEntries = 20;\n\n            protected override void When()\n            {\n                Parallel.For(0, MaxLoggedEntries, i => logger.Informational(\"Info \" + i));\n            }\n\n            [TestMethod]\n            public void then_writes_multiple_events_are_formatted()\n            {\n                Assert.AreEqual<int>(MaxLoggedEntries, this.Entries.Count());\n                Assert.IsTrue(this.Entries.All(e => e.EventId == TestEventSource.InformationalEventId));\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_payload_and_null_content : given_json_event_text_formatter\n        {\n            protected override void When()\n            {\n                logger.Write(null);\n            }\n\n            [TestMethod]\n            public void then_writes_event_data()\n            {\n                var entry = this.Entries.SingleOrDefault();\n\n                Assert.IsNull(entry.Message);\n                Assert.IsTrue(string.IsNullOrEmpty((string)entry.Payload.FirstOrDefault().Value));\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_payload_and_null_formatted_message : given_json_event_text_formatter\n        {\n            protected override void When()\n            {\n                logger.EventWithPayloadAndMessage(null, 0);\n            }\n\n            [TestMethod]\n            public void then_writes_event_data()\n            {\n                var entry = this.Entries.SingleOrDefault();\n\n                Assert.AreEqual<string>(\"Test message  0\", entry.Message);\n\n                // Note in current version of EventSource: when observing through ETW, the payload will be string.Empty instead of null.\n                // https://connect.microsoft.com/VisualStudio/feedback/details/783857/eventlistener-gets-non-null-or-null-string-value-depending-if-the-same-eventsource-is-being-observed-with-etw\n                Assert.IsTrue(string.IsNullOrEmpty((string)entry.Payload.FirstOrDefault().Value));\n            }\n        }\n\n        [TestClass]\n        public class when_writing_null_entry : given_json_event_text_formatter\n        {\n            private ArgumentNullException exception;\n            protected override void When()\n            {\n                using (var writer = new System.IO.StringWriter())\n                {\n                    try\n                    {\n                        this.formatter.WriteEvent(null, writer);\n                        Assert.Fail(\"should have thrown\");\n                    }\n                    catch (ArgumentNullException e)\n                    {\n                        this.exception = e;\n                    }\n                }\n            }\n\n            [TestMethod]\n            public void then_throws_argument_null_exception()\n            {\n                Assert.IsNotNull(this.exception);\n            }\n        }\n\n        [TestClass]\n        public class when_writing_to_null_writer : given_json_event_text_formatter\n        {\n            private ArgumentNullException exception;\n            protected override void When()\n            {\n                try\n                {\n                    formatter.WriteEvent(new EventEntry(Guid.NewGuid(), 0, string.Empty, new System.Collections.ObjectModel.ReadOnlyCollection<object>(new object[0]), DateTimeOffset.MaxValue, new Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema.EventSourceSchemaReader().GetSchema(logger).Values.First()), null);\n                    Assert.Fail(\"should have thrown\");\n                }\n                catch (ArgumentNullException e)\n                {\n                    this.exception = e;\n                }\n            }\n\n            [TestMethod]\n            public void then_throws_argument_null_exception()\n            {\n                Assert.IsNotNull(this.exception);\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_multiple_payload_types : given_json_event_text_formatter\n        {\n            protected override void Given()\n            {\n                base.Given();\n                this.listener.EnableEvents(MultipleTypesEventSource.Log, EventLevel.LogAlways);\n            }\n\n            protected override void When()\n            {\n                MultipleTypesEventSource.Log.ManyTypes(1, 2, 3, 4, 5, 6, 7, 8, 9, true, \"test\", Guid.NewGuid(), MultipleTypesEventSource.Color.Blue, 10);\n            }\n\n            protected override void OnCleanup()\n            {\n                this.listener.DisableEvents(MultipleTypesEventSource.Log);\n                base.OnCleanup();\n            }\n\n            [TestMethod]\n            public void then_writes_event_data()\n            {\n                var entries = this.Entries.SingleOrDefault();\n\n                Assert.IsNotNull(entries);\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_enum_in_payload : given_json_event_text_formatter\n        {\n            protected override void Given()\n            {\n                base.Given();\n                listener.Formatter = new JsonEventTextFormatter(EventTextFormatting.Indented);\n            }\n\n            protected override void When()\n            {\n                logger.UsingEnumArguments(MyLongEnum.Value1, MyIntEnum.Value2);\n            }\n\n            [TestMethod]\n            public void then_writes_integral_value()\n            {\n                StringAssert.Contains(this.RawOutput, \"\\\"arg1\\\": 0\");\n                StringAssert.Contains(this.RawOutput, \"\\\"arg2\\\": 1\");\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_short_enum_in_payload : given_json_event_text_formatter\n        {\n            protected override void Given()\n            {\n                base.Given();\n                listener.Formatter = new JsonEventTextFormatter(EventTextFormatting.Indented);\n                listener.EnableEvents(DifferentEnumsEventSource.Log, EventLevel.LogAlways, Keywords.All);\n            }\n\n            protected override void When()\n            {\n                DifferentEnumsEventSource.Log.UsingEnumArguments(MyLongEnum.Value1, MyIntEnum.Value2, MyShortEnum.Value3);\n            }\n\n            [TestMethod]\n            public void then_writes_integral_value()\n            {\n                StringAssert.Contains(this.RawOutput, \"\\\"arg1\\\": 0\");\n                StringAssert.Contains(this.RawOutput, \"\\\"arg2\\\": 1\");\n                StringAssert.Contains(this.RawOutput, \"\\\"arg3\\\": 2\");\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_multiple_enums_in_payload : given_json_event_text_formatter\n        {\n            protected override void Given()\n            {\n                base.Given();\n                listener.Formatter = new JsonEventTextFormatter(EventTextFormatting.Indented);\n                listener.EnableEvents(DifferentEnumsEventSource.Log, EventLevel.LogAlways, Keywords.All);\n            }\n\n            protected override void When()\n            {\n                DifferentEnumsEventSource.Log.UsingAllEnumArguments(MyLongEnum.Value1, MyIntEnum.Value2, MyShortEnum.Value3,\n                    MyByteEnum.Value1, MySByteEnum.Value2, MyUShortEnum.Value3, MyUIntEnum.Value1, MyULongEnum.Value2);\n            }\n\n            [TestMethod]\n            public void then_writes_integral_value()\n            {\n                StringAssert.Contains(this.RawOutput, \"\\\"arg1\\\": 0\");\n                StringAssert.Contains(this.RawOutput, \"\\\"arg2\\\": 1\");\n                StringAssert.Contains(this.RawOutput, \"\\\"arg3\\\": 2\");\n                StringAssert.Contains(this.RawOutput, \"\\\"arg4\\\": 0\");\n                StringAssert.Contains(this.RawOutput, \"\\\"arg5\\\": 1\");\n                StringAssert.Contains(this.RawOutput, \"\\\"arg6\\\": 2\");\n                StringAssert.Contains(this.RawOutput, \"\\\"arg7\\\": 0\");\n                StringAssert.Contains(this.RawOutput, \"\\\"arg8\\\": 1\");\n            }\n        }\n\n        [TestClass]\n        public class when_formatter_configured_to_leave_off_separator : given_json_event_text_formatter\n        {\n            protected StringCollectionEventListener collectionListener;\n\n            protected override void Given()\n            {\n                formatter = new JsonEventTextFormatter() { IncludeEntrySeparator = false };\n                collectionListener = new StringCollectionEventListener(formatter);\n                collectionListener.EnableEvents(logger, EventLevel.LogAlways);\n            }\n\n            protected override void OnCleanup()\n            {\n                collectionListener.DisableEvents(logger);\n                collectionListener.Dispose();\n            }\n\n            protected override void When()\n            {\n                logger.Informational(\"Foo\");\n            }\n\n            [TestMethod]\n            public void then_event_written_should_leave_off_trailing_separator()\n            {\n                Assert.IsFalse(collectionListener.EventsWritten.Single().EndsWith(\",\"));\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Formatters/XmlEventTextFormatterFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Xml;\nusing System.Xml.Linq;\nusing System.Xml.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Formatters\n{\n    [TestClass]\n    public class given_xml_event_text_formatter_configuration : ContextBase\n    {\n        [TestMethod]\n        public void when_creating_formatter_with_default_values()\n        {\n            var formatter = new XmlEventTextFormatter();\n            Assert.IsNull(formatter.DateTimeFormat);\n            Assert.AreEqual(EventTextFormatting.None, formatter.Formatting);\n        }\n\n        [TestMethod]\n        public void when_creating_formatter_with_specific_values()\n        {\n            var formatter = new XmlEventTextFormatter(EventTextFormatting.Indented) { DateTimeFormat = \"R\" };\n            Assert.AreEqual(\"R\", formatter.DateTimeFormat);\n            Assert.AreEqual(EventTextFormatting.Indented, formatter.Formatting);\n        }\n    }\n\n    public abstract class given_xml_event_text_formatter : ContextBase\n    {\n        private const string EventNamespace = \"http://schemas.microsoft.com/win/2004/08/events/event\";\n        private const string EventNS = \"{\" + EventNamespace + \"}\";\n        protected InMemoryEventListener listener;\n        protected TestEventSource logger = TestEventSource.Log;\n        private IEnumerable<XElement> entries;\n        protected XmlEventTextFormatter formatter;\n\n        protected override void Given()\n        {\n            formatter = new XmlEventTextFormatter(EventTextFormatting.Indented);\n            listener = new InMemoryEventListener() { Formatter = formatter };\n            listener.EnableEvents(logger, EventLevel.LogAlways);\n        }\n\n        protected override void OnCleanup()\n        {\n            listener.DisableEvents(logger);\n            listener.Dispose();\n        }\n\n        protected string RawOutput\n        {\n            get { return listener.ToString(); }\n        }\n\n        protected IEnumerable<XElement> Entries\n        {\n            get { return entries ?? (entries = XDocument.Parse(\"<Events>\" + this.RawOutput + \"</Events>\").Root.Elements()); }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_payload_and_message : given_xml_event_text_formatter\n        {\n            private int processId;\n            private int threadId;\n\n            protected override void When()\n            {\n                this.processId = System.Diagnostics.Process.GetCurrentProcess().Id;\n                this.threadId = Utility.NativeMethods.GetCurrentThreadId();\n\n                logger.EventWithPayloadAndMessage(\"Info\", 100);\n            }\n\n            [TestMethod]\n            public void then_writes_event_data()\n            {\n                var element = this.Entries.Single();\n\n                var provider = element.Descendants(EventNS + \"Provider\").Single();\n                var eventId = element.Descendants(EventNS + \"EventID\").Single();\n                var version = element.Descendants(EventNS + \"Version\").Single();\n                var level = element.Descendants(EventNS + \"Level\").Single();\n                var task = element.Descendants(EventNS + \"Task\").Single();\n                var opcode = element.Descendants(EventNS + \"Opcode\").Single();\n                var keywords = element.Descendants(EventNS + \"Keywords\").Single();\n                var timeCreated = element.Descendants(EventNS + \"TimeCreated\").Single();\n                var payload = element.Descendants(EventNS + \"EventData\").Single();\n                var message = element.Descendants(EventNS + \"Message\").Single();\n                var correlation = element.Descendants(EventNS + \"Correlation\").SingleOrDefault();\n                var execution = element.Descendants(EventNS + \"Execution\").Single();\n\n                Assert.AreEqual<Guid>(TestEventSource.Log.Guid, Guid.Parse(provider.Attribute(\"Guid\").Value));\n                Assert.AreEqual<int>(TestEventSource.EventWithPayloadAndMessageId, Convert.ToInt32(eventId.Value));\n                Assert.AreEqual<byte>(0, Convert.ToByte(version.Value));\n                Assert.AreEqual<int>((int)EventLevel.Warning, Int32.Parse(level.Value));\n                Assert.AreEqual<int>(65331, Int32.Parse(task.Value));\n                Assert.AreEqual<long>((long)EventKeywords.None, Int64.Parse(keywords.Value.Replace(\"0x\", string.Empty)));\n                Assert.AreEqual<int>((int)EventOpcode.Info, Int32.Parse(opcode.Value));\n                DateTime dt;\n                Assert.IsTrue(DateTime.TryParseExact(timeCreated.Attribute(\"SystemTime\").Value, formatter.DateTimeFormat ?? EventEntry.DefaultDateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt));\n                Assert.AreEqual(2, payload.Elements().Count());\n                Assert.AreEqual(\"payload1\", payload.Elements().First().Attribute(\"Name\").Value);\n                Assert.AreEqual(\"Info\", payload.Elements().First().Value);\n                Assert.AreEqual(\"payload2\", payload.Elements().Last().Attribute(\"Name\").Value);\n                Assert.AreEqual(\"100\", payload.Elements().Last().Value);\n                Assert.AreEqual(\"Test message Info 100\", message.Value);\n                Assert.IsNull(correlation);\n                Assert.AreEqual(processId, int.Parse(execution.Attribute(\"ProcessID\").Value));\n                Assert.AreEqual(threadId, int.Parse(execution.Attribute(\"ThreadID\").Value));\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_payload_and_message_with_ambient_activity_id : given_xml_event_text_formatter\n        {\n            private Guid activityId;\n            private Guid previousActivityId;\n\n            protected override void Given()\n            {\n                base.Given();\n\n                this.activityId = Guid.NewGuid();\n                EventSource.SetCurrentThreadActivityId(this.activityId, out this.previousActivityId);\n            }\n\n            protected override void When()\n            {\n                logger.EventWithPayloadAndMessage(\"Info\", 100);\n            }\n\n            protected override void OnCleanup()\n            {\n                base.OnCleanup();\n\n                EventSource.SetCurrentThreadActivityId(this.previousActivityId);\n            }\n\n            [TestMethod]\n            public void then_writes_event_data()\n            {\n                var element = this.Entries.Single();\n\n                var provider = element.Descendants(EventNS + \"Provider\").Single();\n                var eventId = element.Descendants(EventNS + \"EventID\").Single();\n                var version = element.Descendants(EventNS + \"Version\").Single();\n                var level = element.Descendants(EventNS + \"Level\").Single();\n                var task = element.Descendants(EventNS + \"Task\").Single();\n                var opcode = element.Descendants(EventNS + \"Opcode\").Single();\n                var keywords = element.Descendants(EventNS + \"Keywords\").Single();\n                var timeCreated = element.Descendants(EventNS + \"TimeCreated\").Single();\n                var payload = element.Descendants(EventNS + \"EventData\").Single();\n                var message = element.Descendants(EventNS + \"Message\").Single();\n                var correlation = element.Descendants(EventNS + \"Correlation\").Single();\n\n                Assert.AreEqual<Guid>(TestEventSource.Log.Guid, Guid.Parse(provider.Attribute(\"Guid\").Value));\n                Assert.AreEqual<int>(TestEventSource.EventWithPayloadAndMessageId, Convert.ToInt32(eventId.Value));\n                Assert.AreEqual<byte>(0, Convert.ToByte(version.Value));\n                Assert.AreEqual<int>((int)EventLevel.Warning, Int32.Parse(level.Value));\n                Assert.AreEqual<int>(65331, Int32.Parse(task.Value));\n                Assert.AreEqual<long>((long)EventKeywords.None, Int64.Parse(keywords.Value.Replace(\"0x\", string.Empty)));\n                Assert.AreEqual<int>((int)EventOpcode.Info, Int32.Parse(opcode.Value));\n                DateTime dt;\n                Assert.IsTrue(DateTime.TryParseExact(timeCreated.Attribute(\"SystemTime\").Value, formatter.DateTimeFormat ?? EventEntry.DefaultDateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt));\n                Assert.AreEqual(2, payload.Elements().Count());\n                Assert.AreEqual(\"payload1\", payload.Elements().First().Attribute(\"Name\").Value);\n                Assert.AreEqual(\"Info\", payload.Elements().First().Value);\n                Assert.AreEqual(\"payload2\", payload.Elements().Last().Attribute(\"Name\").Value);\n                Assert.AreEqual(\"100\", payload.Elements().Last().Value);\n                Assert.AreEqual(\"Test message Info 100\", message.Value);\n                Assert.AreEqual(this.activityId, Guid.Parse(correlation.Attribute(\"ActivityID\").Value));\n                Assert.IsNull(correlation.Attribute(\"RelatedActivityID\"));\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_payload_and_message_and_related_activity_id_with_ambient_activity_id : given_xml_event_text_formatter\n        {\n            private Guid activityId;\n            private Guid relatedActivityId;\n            private Guid previousActivityId;\n\n            protected override void Given()\n            {\n                base.Given();\n\n                this.activityId = Guid.NewGuid();\n                this.relatedActivityId = Guid.NewGuid();\n                EventSource.SetCurrentThreadActivityId(this.activityId, out this.previousActivityId);\n            }\n\n            protected override void When()\n            {\n                logger.EventWithPayloadAndMessageAndRelatedActivityId(this.relatedActivityId, \"Info\", 100);\n            }\n\n            protected override void OnCleanup()\n            {\n                base.OnCleanup();\n\n                EventSource.SetCurrentThreadActivityId(this.previousActivityId);\n            }\n\n            [TestMethod]\n            public void then_writes_event_data()\n            {\n                var element = this.Entries.Single();\n\n                var provider = element.Descendants(EventNS + \"Provider\").Single();\n                var eventId = element.Descendants(EventNS + \"EventID\").Single();\n                var version = element.Descendants(EventNS + \"Version\").Single();\n                var level = element.Descendants(EventNS + \"Level\").Single();\n                var task = element.Descendants(EventNS + \"Task\").Single();\n                var opcode = element.Descendants(EventNS + \"Opcode\").Single();\n                var keywords = element.Descendants(EventNS + \"Keywords\").Single();\n                var timeCreated = element.Descendants(EventNS + \"TimeCreated\").Single();\n                var payload = element.Descendants(EventNS + \"EventData\").Single();\n                var message = element.Descendants(EventNS + \"Message\").Single();\n                var correlation = element.Descendants(EventNS + \"Correlation\").Single();\n\n                Assert.AreEqual<Guid>(TestEventSource.Log.Guid, Guid.Parse(provider.Attribute(\"Guid\").Value));\n                Assert.AreEqual<int>(TestEventSource.EventWithPayloadAndMessageAndRelatedActivityIdId, Convert.ToInt32(eventId.Value));\n                Assert.AreEqual<byte>(0, Convert.ToByte(version.Value));\n                Assert.AreEqual<int>((int)EventLevel.Warning, Int32.Parse(level.Value));\n                Assert.AreEqual<int>((int)TestEventSource.Tasks.Other, Int32.Parse(task.Value));\n                Assert.AreEqual<long>((long)EventKeywords.None, Int64.Parse(keywords.Value.Replace(\"0x\", string.Empty)));\n                Assert.AreEqual<int>((int)EventOpcode.Send, Int32.Parse(opcode.Value));\n                DateTime dt;\n                Assert.IsTrue(DateTime.TryParseExact(timeCreated.Attribute(\"SystemTime\").Value, formatter.DateTimeFormat ?? EventEntry.DefaultDateTimeFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt));\n                Assert.AreEqual(2, payload.Elements().Count());\n                Assert.AreEqual(\"payload1\", payload.Elements().First().Attribute(\"Name\").Value);\n                Assert.AreEqual(\"Info\", payload.Elements().First().Value);\n                Assert.AreEqual(\"payload2\", payload.Elements().Last().Attribute(\"Name\").Value);\n                Assert.AreEqual(\"100\", payload.Elements().Last().Value);\n                Assert.AreEqual(\"Test message Info 100\", message.Value);\n                Assert.AreEqual(this.activityId, Guid.Parse(correlation.Attribute(\"ActivityID\").Value));\n                Assert.AreEqual(this.relatedActivityId, Guid.Parse(correlation.Attribute(\"RelatedActivityID\").Value));\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_payload_and_xml_content : given_xml_event_text_formatter\n        {\n            private const string Content = \"<?xml version=\\\"1.0\\\" encoding=\\\"utf-8\\\"?>\\n<test/>\";\n\n            protected override void When()\n            {\n                logger.Write(Content);\n            }\n\n            [TestMethod]\n            public void then_writes_event_data()\n            {\n                var element = this.Entries.Single();\n\n                var payload = element.Descendants(EventNS + \"EventData\").Single();\n                Assert.AreEqual(\"message\", payload.Elements().First().Attribute(\"Name\").Value);\n                Assert.AreEqual(Content, payload.Elements().First().Value);\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_multiple_events_with_payload_and_message : given_xml_event_text_formatter\n        {\n            protected override void When()\n            {\n                logger.Informational(\"info\");\n                logger.Error(\"error\");\n            }\n\n            [TestMethod]\n            public void then_writes_multiple_events_data()\n            {\n                Assert.AreEqual(2, this.Entries.Count());\n\n                var payload1 = this.Entries.First().Descendants(EventNS + \"EventData\").Single();\n                Assert.AreEqual(\"message\", payload1.Elements().First().Attribute(\"Name\").Value);\n                Assert.AreEqual(\"info\", payload1.Elements().First().Value);\n\n                var payload2 = this.Entries.Last().Descendants(EventNS + \"EventData\").Single();\n                Assert.AreEqual(\"message\", payload2.Elements().First().Attribute(\"Name\").Value);\n                Assert.AreEqual(\"error\", payload2.Elements().First().Value);\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_enum_in_payload : given_xml_event_text_formatter\n        {\n            protected override void When()\n            {\n                logger.UsingEnumArguments(MyLongEnum.Value1, MyIntEnum.Value2);\n            }\n\n            [TestMethod]\n            public void then_writes_integral_value()\n            {\n                var entry = this.Entries.Single();\n\n                var payload = entry.Descendants(EventNS + \"EventData\").Single();\n                Assert.AreEqual(\"arg1\", payload.Elements().First().Attribute(\"Name\").Value);\n                Assert.AreEqual<long>(0, (long)payload.Elements().First());\n\n                Assert.AreEqual(\"arg2\", payload.Elements().ElementAt(1).Attribute(\"Name\").Value);\n                Assert.AreEqual<int>(1, (int)payload.Elements().ElementAt(1));\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_short_enums_in_payload : given_xml_event_text_formatter\n        {\n            protected override void When()\n            {\n                listener.EnableEvents(DifferentEnumsEventSource.Log, EventLevel.LogAlways, Keywords.All);\n                DifferentEnumsEventSource.Log.UsingEnumArguments(MyLongEnum.Value1, MyIntEnum.Value2, MyShortEnum.Value3);\n            }\n\n            [TestMethod]\n            public void then_writes_integral_value()\n            {\n                var entry = this.Entries.Single();\n\n                var payload = entry.Descendants(EventNS + \"EventData\").Single();\n                Assert.AreEqual(\"arg1\", payload.Elements().First().Attribute(\"Name\").Value);\n                Assert.AreEqual<long>(0, (long)payload.Elements().First());\n\n                Assert.AreEqual(\"arg2\", payload.Elements().ElementAt(1).Attribute(\"Name\").Value);\n                Assert.AreEqual<int>(1, (int)payload.Elements().ElementAt(1));\n\n                Assert.AreEqual(\"arg3\", payload.Elements().ElementAt(2).Attribute(\"Name\").Value);\n                Assert.AreEqual<short>(2, (short)payload.Elements().ElementAt(2));\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_multiple_enums_in_payload : given_xml_event_text_formatter\n        {\n            protected override void When()\n            {\n                listener.EnableEvents(DifferentEnumsEventSource.Log, EventLevel.LogAlways, Keywords.All);\n                DifferentEnumsEventSource.Log.UsingAllEnumArguments(MyLongEnum.Value1, MyIntEnum.Value2, MyShortEnum.Value3,\n                    MyByteEnum.Value1, MySByteEnum.Value2, MyUShortEnum.Value3, MyUIntEnum.Value1, MyULongEnum.Value2);\n            }\n\n            [TestMethod]\n            public void then_writes_integral_value()\n            {\n                var entry = this.Entries.Single();\n\n                var payload = entry.Descendants(EventNS + \"EventData\").Single();\n                Assert.AreEqual(\"arg1\", payload.Elements().First().Attribute(\"Name\").Value);\n                Assert.AreEqual<long>(0, (long)payload.Elements().First());\n\n                Assert.AreEqual(\"arg2\", payload.Elements().ElementAt(1).Attribute(\"Name\").Value);\n                Assert.AreEqual<int>(1, (int)payload.Elements().ElementAt(1));\n\n                Assert.AreEqual(\"arg3\", payload.Elements().ElementAt(2).Attribute(\"Name\").Value);\n                Assert.AreEqual<short>(2, (short)payload.Elements().ElementAt(2));\n\n                Assert.AreEqual(\"arg4\", payload.Elements().ElementAt(3).Attribute(\"Name\").Value);\n                Assert.AreEqual<byte>(0, Convert.ToByte(payload.Elements().ElementAt(3).Value));\n\n                Assert.AreEqual(\"arg5\", payload.Elements().ElementAt(4).Attribute(\"Name\").Value);\n                Assert.AreEqual<sbyte>(1, (sbyte)payload.Elements().ElementAt(4));\n\n                Assert.AreEqual(\"arg6\", payload.Elements().ElementAt(5).Attribute(\"Name\").Value);\n                Assert.AreEqual<ushort>(2, Convert.ToUInt16(payload.Elements().ElementAt(5).Value));\n\n                Assert.AreEqual(\"arg7\", payload.Elements().ElementAt(6).Attribute(\"Name\").Value);\n                Assert.AreEqual<uint>(0, (uint)payload.Elements().ElementAt(6));\n\n                Assert.AreEqual(\"arg8\", payload.Elements().ElementAt(7).Attribute(\"Name\").Value);\n                Assert.AreEqual<ulong>(1, (ulong)payload.Elements().ElementAt(7));\n            }\n        }\n\n        [TestClass]\n        public class when_setting_indentation_none : given_xml_event_text_formatter\n        {\n            protected override void Given()\n            {\n                listener = new InMemoryEventListener() { Formatter = new XmlEventTextFormatter(EventTextFormatting.None) };\n                listener.EnableEvents(logger, EventLevel.LogAlways);\n            }\n\n            protected override void When()\n            {\n                logger.Informational(\"info\");\n                logger.Error(\"error\");\n            }\n\n            [TestMethod]\n            public void then_writes_indented_xml_data()\n            {\n                Assert.AreEqual(-1, this.RawOutput.IndexOf(\"\\r\\n\")); // With no Indent, no CRs\n            }\n        }\n\n        [TestClass]\n        public class when_validating_with_event_schema : given_xml_event_text_formatter\n        {\n            protected override void Given()\n            {\n                base.Given();\n                listener.EnableEvents(MyCompanyEventSource.Log, EventLevel.LogAlways, Keywords.All);\n            }\n\n            protected override void When()\n            {\n                MyCompanyEventSource.Log.PageStart(10, \"test\");\n            }\n\n            [TestMethod]\n            public void then_generates_event_schema_compliant_xmldata()\n            {\n                XmlSchemaSet schemas = new XmlSchemaSet();\n                schemas.Add(EventNamespace, XmlReader.Create(\"Event.xsd\", new XmlReaderSettings() { CloseInput = true }));\n\n                string error = null;\n                XDocument document = XDocument.Parse(this.RawOutput);\n                document.Validate(schemas, (o, e) => error = e.Message);\n\n                Assert.IsNull(error, error);\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_payload_and_null_content : given_xml_event_text_formatter\n        {\n            protected override void When()\n            {\n                logger.Write(null);\n            }\n\n            [TestMethod]\n            public void then_writes_event_data()\n            {\n                var message = this.Entries.Single().Descendants(EventNS + \"Message\").Single();\n                Assert.AreEqual(string.Empty, message.Value);\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_payload_and_null_formatted_message : given_xml_event_text_formatter\n        {\n            protected override void When()\n            {\n                logger.EventWithPayloadAndMessage(null, 0);\n            }\n\n            [TestMethod]\n            public void then_writes_event_data()\n            {\n                var message = this.Entries.Single().Descendants(EventNS + \"Message\").Single();\n                Assert.AreEqual(\"Test message  0\", message.Value);\n            }\n        }\n\n        [TestClass]\n        public class when_writing_null_entry : given_xml_event_text_formatter\n        {\n            private ArgumentNullException exception;\n            protected override void When()\n            {\n                using (var writer = new System.IO.StringWriter())\n                {\n                    try\n                    {\n                        this.formatter.WriteEvent(null, writer);\n                        Assert.Fail(\"should have thrown\");\n                    }\n                    catch (ArgumentNullException e)\n                    {\n                        this.exception = e;\n                    }\n                }\n            }\n\n            [TestMethod]\n            public void then_throws_argument_null_exception()\n            {\n                Assert.IsNotNull(this.exception);\n            }\n        }\n\n        [TestClass]\n        public class when_writing_to_null_writer : given_xml_event_text_formatter\n        {\n            private ArgumentNullException exception;\n            protected override void When()\n            {\n                try\n                {\n                    formatter.WriteEvent(new EventEntry(Guid.NewGuid(), 0, string.Empty, new System.Collections.ObjectModel.ReadOnlyCollection<object>(new object[0]), DateTimeOffset.MaxValue, new Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema.EventSourceSchemaReader().GetSchema(logger).Values.First()), null);\n                    Assert.Fail(\"should have thrown\");\n                }\n                catch (ArgumentNullException e)\n                {\n                    this.exception = e;\n                }\n            }\n\n            [TestMethod]\n            public void then_throws_argument_null_exception()\n            {\n                Assert.IsNotNull(this.exception);\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_multiple_payload_types : given_xml_event_text_formatter\n        {\n            private Guid guidValue;\n\n            protected override void Given()\n            {\n                base.Given();\n                this.listener.EnableEvents(MultipleTypesEventSource.Log, EventLevel.LogAlways);\n            }\n\n            protected override void When()\n            {\n                this.guidValue = Guid.NewGuid();\n                MultipleTypesEventSource.Log.ManyTypes(1, 2, 3, 4, 5, 6, 7, 8, 9, true, \"test\", this.guidValue, MultipleTypesEventSource.Color.Blue, 10);\n            }\n\n            protected override void OnCleanup()\n            {\n                this.listener.DisableEvents(MultipleTypesEventSource.Log);\n                base.OnCleanup();\n            }\n\n            [TestMethod]\n            public void then_writes_event_data()\n            {\n                var element = this.Entries.Single();\n                var payload = element.Descendants(EventNS + \"EventData\").SingleOrDefault();\n\n                Assert.IsNotNull(payload);\n                Assert.IsTrue(payload.Elements().Any());\n            }\n\n            [TestMethod]\n            public void then_writes_guid_value()\n            {\n                var entry = this.Entries.Single();\n\n                var payload = entry.Descendants(EventNS + \"EventData\").Single();\n                var value = payload.Elements().Single(e => string.Equals(e.Attribute(\"Name\").Value, \"arg14\", StringComparison.Ordinal)).Value;\n                Assert.AreEqual<Guid>(this.guidValue, Guid.Parse(value));\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Observable/EventEntrySubjectFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Concurrent;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Observable\n{\n    [TestClass]\n    public class EventEntrySubjectFixture\n    {\n        [TestMethod]\n        public void ShouldCallOnNext()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                var observer = new MockObserver<EventEntry>();\n\n                subject.Subscribe(observer);\n\n                var entry1 = CreateEntry();\n                var entry2 = CreateEntry();\n                subject.OnNext(entry1);\n                subject.OnNext(entry2);\n\n                Assert.AreSame(entry1, observer.OnNextCalls.ElementAt(0));\n                Assert.AreSame(entry2, observer.OnNextCalls.ElementAt(1));\n            }\n        }\n\n        [TestMethod]\n        public void ShouldCallOnCompleted()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                var observer = new MockObserver<EventEntry>();\n                subject.Subscribe(observer);\n\n                Assert.IsFalse(observer.OnCompletedCalled);\n\n                subject.OnCompleted();\n\n                Assert.IsTrue(observer.OnCompletedCalled);\n            }\n        }\n\n        [TestMethod]\n        public void ShouldCallOnError()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                var observer = new MockObserver<EventEntry>();\n                subject.Subscribe(observer);\n                var error = new Exception();\n                subject.OnError(error);\n\n                subject.OnNext(CreateEntry());\n\n                Assert.AreSame(error, observer.OnErrorException);\n                Assert.AreEqual(0, observer.OnNextCalls.Count);\n            }\n        }\n\n        [TestMethod]\n        public void DisposeCallsOnCompleted()\n        {\n            var observer = new MockObserver<EventEntry>();\n\n            using (var subject = new EventEntrySubject())\n            {\n                subject.Subscribe(observer);\n\n                Assert.IsFalse(observer.OnCompletedCalled);\n            }\n\n            Assert.IsTrue(observer.OnCompletedCalled);\n        }\n\n        [TestMethod]\n        public void OnCompletedStopsPropagatingEvents()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                var observer = new MockObserver<EventEntry>();\n                subject.Subscribe(observer);\n\n                subject.OnCompleted();\n                subject.OnNext(CreateEntry());\n\n                Assert.AreEqual(0, observer.OnNextCalls.Count);\n            }\n        }\n\n        [TestMethod]\n        public void UnsubscribeStopsPropagatingEvents()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                var observer = new MockObserver<EventEntry>();\n                var subscription = subject.Subscribe(observer);\n\n                subscription.Dispose();\n                subject.OnNext(CreateEntry());\n\n                Assert.AreEqual(0, observer.OnNextCalls.Count);\n            }\n        }\n\n        [TestMethod]\n        public void OnErrorStopsPropagatingEvents()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                var observer = new MockObserver<EventEntry>();\n                subject.Subscribe(observer);\n                subject.OnError(new Exception());\n\n                subject.OnNext(CreateEntry());\n\n                Assert.AreEqual(0, observer.OnNextCalls.Count);\n            }\n        }\n\n        [TestMethod]\n        public void OnCompletedIsSentToAllNewSubscribersAfterItWasCompleted()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                subject.OnCompleted();\n\n                var observer = new MockObserver<EventEntry>();\n                subject.Subscribe(observer);\n\n                Assert.IsTrue(observer.OnCompletedCalled);\n            }\n        }\n\n        [TestMethod]\n        public void CanUnsubscribeNewSubscribersAfterItWasCompleted()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                subject.OnCompleted();\n\n                var observer = new MockObserver<EventEntry>();\n                var subscription = subject.Subscribe(observer);\n\n                subscription.Dispose();\n            }\n        }\n\n        [TestMethod]\n        public void ShouldCallOnCompletedInParallel()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                var observer1 = new MockBlockingObserver();\n                var observer2 = new MockBlockingObserver();\n\n                subject.Subscribe(observer1);\n                subject.Subscribe(observer2);\n\n                var task = Task.Run(() => subject.OnCompleted());\n\n                Thread.Sleep(30);\n\n                Assert.IsTrue(observer1.OnCompletedCalled);\n                Assert.IsTrue(observer2.OnCompletedCalled);\n\n                Assert.IsFalse(task.IsCompleted);\n\n                observer1.ResetEvent.Set();\n                observer2.ResetEvent.Set();\n\n                Assert.IsTrue(task.Wait(500));\n            }\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentNullException))]\n        public void SubscribingNullThrows()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                subject.Subscribe(null);\n            }\n        }\n\n        private static EventEntry CreateEntry(int id = 1)\n        {\n            return new EventEntry(Guid.Empty, id, null, null, DateTimeOffset.UtcNow, null);\n        }\n\n        private class MockObserver<T> : IObserver<T>\n        {\n            public ConcurrentQueue<T> OnNextCalls = new ConcurrentQueue<T>();\n            public bool OnCompletedCalled;\n            public Exception OnErrorException;\n\n            void IObserver<T>.OnCompleted()\n            {\n                if (OnCompletedCalled) { throw new InvalidOperationException(); }\n                this.OnCompletedCalled = true;\n            }\n\n            void IObserver<T>.OnError(Exception error)\n            {\n                if (OnErrorException != null) { throw new InvalidOperationException(); }\n                this.OnErrorException = error;\n            }\n\n            void IObserver<T>.OnNext(T value)\n            {\n                this.OnNextCalls.Enqueue(value);\n            }\n        }\n\n        private class MockBlockingObserver : IObserver<EventEntry>\n        {\n            public ManualResetEvent ResetEvent = new ManualResetEvent(false);\n            public ConcurrentQueue<EventEntry> OnNextCalls = new ConcurrentQueue<EventEntry>();\n            public bool OnCompletedCalled;\n            public Exception OnErrorException;\n\n            void IObserver<EventEntry>.OnCompleted()\n            {\n                if (OnCompletedCalled) { throw new InvalidOperationException(); }\n                this.OnCompletedCalled = true;\n                this.ResetEvent.WaitOne();\n            }\n\n            void IObserver<EventEntry>.OnError(Exception error)\n            {\n                if (OnErrorException != null) { throw new InvalidOperationException(); }\n                this.OnErrorException = error;\n                this.ResetEvent.WaitOne();\n            }\n\n            void IObserver<EventEntry>.OnNext(EventEntry value)\n            {\n                this.OnNextCalls.Enqueue(value);\n                this.ResetEvent.WaitOne();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Observable/ObservableProjectionFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Concurrent;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Observable;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Observable\n{\n    [TestClass]\n    public class ObservableProjectionFixture\n    {\n        [TestMethod]\n        public void ShouldCallOnNext()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                var observer = new MockObserver<int>();\n\n                var subscription = subject.CreateSubscription(observer, entry => entry.EventId);\n\n                var entry1 = CreateEntry(1);\n                var entry2 = CreateEntry(2);\n                subject.OnNext(entry1);\n                subject.OnNext(entry2);\n\n                Assert.AreEqual(entry1.EventId, observer.OnNextCalls.ElementAt(0));\n                Assert.AreEqual(entry2.EventId, observer.OnNextCalls.ElementAt(1));\n\n                subscription.Dispose();\n            }\n        }\n\n        [TestMethod]\n        public void ShouldCallOnComplete()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                var observer = new MockObserver<int>();\n\n                Assert.IsFalse(observer.OnCompletedCalled);\n\n                subject.CreateSubscription(observer, entry => entry.EventId);\n\n                subject.OnCompleted();\n\n                Assert.IsTrue(observer.OnCompletedCalled);\n            }\n        }\n\n        [TestMethod]\n        public void ShouldCallOnError()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                var observer = new MockObserver<int>();\n                subject.CreateSubscription(observer, entry => entry.EventId);\n                var error = new Exception();\n                subject.OnError(error);\n\n                subject.OnNext(CreateEntry());\n\n                Assert.AreSame(error, observer.OnErrorException);\n                Assert.AreEqual(0, observer.OnNextCalls.Count);\n            }\n        }\n\n        [TestMethod]\n        public void DisposeCallsOnCompleted()\n        {\n            var observer = new MockObserver<int>();\n\n            using (var subject = new EventEntrySubject())\n            {\n                subject.CreateSubscription(observer, entry => entry.EventId);\n\n                Assert.IsFalse(observer.OnCompletedCalled);\n            }\n\n            Assert.IsTrue(observer.OnCompletedCalled);\n        }\n\n        [TestMethod]\n        public void OnCompletedStopsPropagatingEvents()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                var observer = new MockObserver<int>();\n                subject.CreateSubscription(observer, entry => entry.EventId);\n\n                subject.OnCompleted();\n                subject.OnNext(CreateEntry());\n\n                Assert.AreEqual(0, observer.OnNextCalls.Count);\n            }\n        }\n\n        [TestMethod]\n        public void UnsubscribeStopsPropagatingEvents()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                var observer = new MockObserver<int>();\n                var subscription = subject.CreateSubscription(observer, entry => entry.EventId);\n\n                subscription.Dispose();\n                subject.OnNext(CreateEntry());\n\n                Assert.AreEqual(0, observer.OnNextCalls.Count);\n            }\n        }\n\n        [TestMethod]\n        public void OnErrorStopsPropagatingEvents()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                var observer = new MockObserver<int>();\n                subject.CreateSubscription(observer, entry => entry.EventId);\n                subject.OnError(new Exception());\n\n                subject.OnNext(CreateEntry());\n\n                Assert.AreEqual(0, observer.OnNextCalls.Count);\n            }\n        }\n\n        [TestMethod]\n        public void OnCompletedIsSentToAllNewSubscribersAfterItWasCompleted()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                subject.OnCompleted();\n\n                var observer = new MockObserver<int>();\n                subject.CreateSubscription(observer, entry => entry.EventId);\n\n                Assert.IsTrue(observer.OnCompletedCalled);\n            }\n        }\n\n        [TestMethod]\n        public void CanUnsubscribeNewSubscribersAfterItWasCompleted()\n        {\n            using (var subject = new EventEntrySubject())\n            {\n                subject.OnCompleted();\n\n                var observer = new MockObserver<int>();\n                var subscription = subject.CreateSubscription(observer, entry => entry.EventId);\n\n                subscription.Dispose();\n            }\n        }\n\n        private static EventEntry CreateEntry(int id = 1)\n        {\n            return new EventEntry(Guid.Empty, id, null, null, DateTimeOffset.UtcNow, null);\n        }\n\n        private class MockObserver<T> : IObserver<T>\n        {\n            public ConcurrentQueue<T> OnNextCalls = new ConcurrentQueue<T>();\n            public bool OnCompletedCalled;\n            public Exception OnErrorException;\n\n            void IObserver<T>.OnCompleted()\n            {\n                if (OnCompletedCalled) { throw new InvalidOperationException(); }\n                this.OnCompletedCalled = true;\n            }\n\n            void IObserver<T>.OnError(Exception error)\n            {\n                if (OnErrorException != null) { throw new InvalidOperationException(); }\n                this.OnErrorException = error;\n            }\n\n            void IObserver<T>.OnNext(T value)\n            {\n                this.OnNextCalls.Enqueue(value);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Properties/AssemblyInfo.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Reflection;\n\n[assembly: AssemblyTitle(\"Enterprise Library Semantic Logging Application Block\")]\n[assembly: AssemblyDescription(\"Enterprise Library Semantic Logging Application Block\")]\n\n[assembly: AssemblyVersion(\"2.0.0.0\")]\n[assembly: AssemblyFileVersion(\"2.0.1406.1\")]\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Properties/Resources.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\n// <auto-generated>\n//     This code was generated by a tool.\n//     Runtime Version:4.0.30319.34014\n//\n//     Changes to this file may cause incorrect behavior and will be lost if\n//     the code is regenerated.\n// </auto-generated>\n//------------------------------------------------------------------------------\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Properties {\n    using System;\n    \n    \n    /// <summary>\n    ///   A strongly-typed resource class, for looking up localized strings, etc.\n    /// </summary>\n    // This class was auto-generated by the StronglyTypedResourceBuilder\n    // class via a tool like ResGen or Visual Studio.\n    // To add or remove a member, edit your .ResX file then rerun ResGen\n    // with the /str option, or rebuild your VS project.\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"System.Resources.Tools.StronglyTypedResourceBuilder\", \"4.0.0.0\")]\n    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]\n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\n    internal class Resources {\n        \n        private static global::System.Resources.ResourceManager resourceMan;\n        \n        private static global::System.Globalization.CultureInfo resourceCulture;\n        \n        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute(\"Microsoft.Performance\", \"CA1811:AvoidUncalledPrivateCode\")]\n        internal Resources() {\n        }\n        \n        /// <summary>\n        ///   Returns the cached ResourceManager instance used by this class.\n        /// </summary>\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\n        internal static global::System.Resources.ResourceManager ResourceManager {\n            get {\n                if (object.ReferenceEquals(resourceMan, null)) {\n                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(\"Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Properties.Resources\", typeof(Resources).Assembly);\n                    resourceMan = temp;\n                }\n                return resourceMan;\n            }\n        }\n        \n        /// <summary>\n        ///   Overrides the current thread's CurrentUICulture property for all\n        ///   resource lookups using this strongly typed resource class.\n        /// </summary>\n        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]\n        internal static global::System.Globalization.CultureInfo Culture {\n            get {\n                return resourceCulture;\n            }\n            set {\n                resourceCulture = value;\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to CREATE PROCEDURE [dbo].[WriteTraces]\n        ///(\n        ///  @InsertTraces TracesType READONLY\n        ///)\n        ///AS\n        ///BEGIN\n        ///  INSERT INTO [Traces] (\n        ///\t\t[InstanceName],\n        ///\t\t[ProviderId],\n        ///\t\t[ProviderName],\n        ///\t\t[EventId],\n        ///\t\t[EventKeywords],\n        ///\t\t[Level],\n        ///\t\t[Opcode],\n        ///\t\t[Task],\n        ///\t\t[Timestamp],\n        ///\t\t[Version],\n        ///\t\t[FormattedMessage],\n        ///\t\t[Payload],\n        ///\t\t[ActivityId],\n        ///\t\t[RelatedActivityId],\n        ///\t\t[ProcessId],\n        ///\t\t[ThreadId]\n        ///\t)\n        ///  SELECT * FROM @InsertTraces;\n        ///END.\n        /// </summary>\n        internal static string CreateProcedureWriteTraces {\n            get {\n                return ResourceManager.GetString(\"CreateProcedureWriteTraces\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to CREATE TABLE [dbo].[Traces](\n        ///\t[id] [bigint] IDENTITY(1,1) NOT NULL,\n        ///\t[InstanceName] [nvarchar](1000) NOT NULL,\n        ///\t[ProviderId] [uniqueidentifier] NOT NULL,\n        ///\t[ProviderName] [nvarchar](500) NOT NULL,\n        ///\t[EventId] [int] NOT NULL,\n        ///\t[EventKeywords] [bigint] NOT NULL,\n        ///\t[Level] [int] NOT NULL,\n        ///\t[Opcode] [int] NOT NULL,\n        ///\t[Task] [int] NOT NULL,\n        ///\t[Timestamp] [datetimeoffset](7) NOT NULL,\n        ///\t[Version] [int] NOT NULL,\n        ///\t[FormattedMessage] [nvarchar](4000) NULL,\n        ///\t[Payload] [nvarchar](4000) NULL,\n        ///\t[ActivityId] [un [rest of string was truncated]&quot;;.\n        /// </summary>\n        internal static string CreateTracesTable {\n            get {\n                return ResourceManager.GetString(\"CreateTracesTable\", resourceCulture);\n            }\n        }\n        \n        /// <summary>\n        ///   Looks up a localized string similar to CREATE TYPE TracesType AS TABLE\n        ///(\n        ///\t[InstanceName] [nvarchar](1000),\n        ///\t[ProviderId] [uniqueidentifier],\n        ///\t[ProviderName] [nvarchar](500),\n        ///\t[EventId] [int],\n        ///\t[EventKeywords] [bigint],\n        ///\t[Level] [int],\n        ///\t[Opcode] [int],\n        ///\t[Task] [int],\n        ///\t[Timestamp] [datetimeoffset](7),\n        ///\t[Version] [int],\n        ///\t[FormattedMessage] [nvarchar](4000),\n        ///\t[Payload] [nvarchar](4000),\n        ///\t[ActivityId] [uniqueidentifier], \n        ///\t[RelatedActivityId] [uniqueidentifier],\n        ///\t[ProcessId] [int],\n        ///\t[ThreadId] [int]\n        ///);.\n        /// </summary>\n        internal static string CreateTracesType {\n            get {\n                return ResourceManager.GetString(\"CreateTracesType\", resourceCulture);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Properties/Resources.resx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The primary goals of this format is to allow a simple XML format \n    that is mostly human readable. The generation and parsing of the \n    various data types are done through the TypeConverter classes \n    associated with the data types.\n    \n    Example:\n    \n    ... ado.net/XML headers & schema ...\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\n    <resheader name=\"version\">2.0</resheader>\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\n    </data>\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\n        <comment>This is a comment</comment>\n    </data>\n                \n    There are any number of \"resheader\" rows that contain simple \n    name/value pairs.\n    \n    Each data row contains a name, and value. The row also contains a \n    type or mimetype. Type corresponds to a .NET class that support \n    text/value conversion through the TypeConverter architecture. \n    Classes that don't support this are serialized and stored with the \n    mimetype set.\n    \n    The mimetype is used for serialized objects, and tells the \n    ResXResourceReader how to depersist the object. This is currently not \n    extensible. For a given mimetype the value must be set accordingly:\n    \n    Note - application/x-microsoft.net.object.binary.base64 is the format \n    that the ResXResourceWriter will generate, however the reader can \n    read any of the formats listed below.\n    \n    mimetype: application/x-microsoft.net.object.binary.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\n            : and then encoded with base64 encoding.\n    \n    mimetype: application/x-microsoft.net.object.soap.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.bytearray.base64\n    value   : The object must be serialized into a byte array \n            : using a System.ComponentModel.TypeConverter\n            : and then encoded with base64 encoding.\n    -->\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\n      <xsd:complexType>\n        <xsd:choice maxOccurs=\"unbounded\">\n          <xsd:element name=\"metadata\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"assembly\">\n            <xsd:complexType>\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"data\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"resheader\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\n            </xsd:complexType>\n          </xsd:element>\n        </xsd:choice>\n      </xsd:complexType>\n    </xsd:element>\n  </xsd:schema>\n  <resheader name=\"resmimetype\">\n    <value>text/microsoft-resx</value>\n  </resheader>\n  <resheader name=\"version\">\n    <value>2.0</value>\n  </resheader>\n  <resheader name=\"reader\">\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <resheader name=\"writer\">\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <assembly alias=\"System.Windows.Forms\" name=\"System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\" />\n  <data name=\"CreateProcedureWriteTraces\" type=\"System.Resources.ResXFileRef, System.Windows.Forms\">\n    <value>..\\Resources\\CreateProcedureWriteTraces.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>\n  </data>\n  <data name=\"CreateTracesTable\" type=\"System.Resources.ResXFileRef, System.Windows.Forms\">\n    <value>..\\Resources\\CreateTracesTable.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>\n  </data>\n  <data name=\"CreateTracesType\" type=\"System.Resources.ResXFileRef, System.Windows.Forms\">\n    <value>..\\Resources\\CreateTracesType.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>\n  </data>\n</root>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Properties/Settings.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\n// <auto-generated>\n//     This code was generated by a tool.\n//     Runtime Version:4.0.30319.34003\n//\n//     Changes to this file may cause incorrect behavior and will be lost if\n//     the code is regenerated.\n// </auto-generated>\n//------------------------------------------------------------------------------\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Properties {\n    \n    \n    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]\n    [global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator\", \"11.0.0.0\")]\n    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {\n        \n        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));\n        \n        public static Settings Default {\n            get {\n                return defaultInstance;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Properties/Settings.settings",
    "content": "﻿<?xml version='1.0' encoding='utf-8'?>\n<SettingsFile xmlns=\"http://schemas.microsoft.com/VisualStudio/2004/01/settings\" CurrentProfile=\"(Default)\">\n  <Profiles />\n  <Settings />\n</SettingsFile>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Resources/CreateGenericTable.sql",
    "content": "CREATE TABLE [dbo].[Traces](\n\t[id] [bigint] IDENTITY(1,1) NOT NULL,\n\t[InstanceName] [nvarchar](1000) NOT NULL,\n\t[ProviderId] [char](36) NOT NULL,\n\t[ProviderName] [nvarchar](500) NOT NULL,\n\t[EventId] [int] NOT NULL,\n\t[EventKeywords] [bigint] NOT NULL,\n\t[Level] [int] NOT NULL,\n\t[Opcode] [int] NOT NULL,\n\t[Task] [int] NOT NULL,\n\t[Timestamp] [datetime2] NOT NULL,\n\t[Version] [int] NOT NULL,\n\t[FormattedMessage] [nvarchar](4000) NULL,\n\t[Payload] [nvarchar](4000) NULL,\n    [ActivityId] [char](36) NULL, \n    [RelatedActivityId] [char](36) NULL, \nCONSTRAINT [PK_Traces] PRIMARY KEY CLUSTERED \n(\n\t[id] ASC\n)WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF)\n)"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Resources/CreateProcedureWriteTraces.sql",
    "content": "CREATE PROCEDURE [dbo].[WriteTraces]\n(\n  @InsertTraces TracesType READONLY\n)\nAS\nBEGIN\n  INSERT INTO [Traces] (\n\t\t[InstanceName],\n\t\t[ProviderId],\n\t\t[ProviderName],\n\t\t[EventId],\n\t\t[EventKeywords],\n\t\t[Level],\n\t\t[Opcode],\n\t\t[Task],\n\t\t[Timestamp],\n\t\t[Version],\n\t\t[FormattedMessage],\n\t\t[Payload],\n\t\t[ActivityId],\n\t\t[RelatedActivityId],\n\t\t[ProcessId],\n\t\t[ThreadId]\n\t)\n  SELECT * FROM @InsertTraces;\nEND"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Resources/CreateTracesTable.sql",
    "content": "CREATE TABLE [dbo].[Traces](\n\t[id] [bigint] IDENTITY(1,1) NOT NULL,\n\t[InstanceName] [nvarchar](1000) NOT NULL,\n\t[ProviderId] [uniqueidentifier] NOT NULL,\n\t[ProviderName] [nvarchar](500) NOT NULL,\n\t[EventId] [int] NOT NULL,\n\t[EventKeywords] [bigint] NOT NULL,\n\t[Level] [int] NOT NULL,\n\t[Opcode] [int] NOT NULL,\n\t[Task] [int] NOT NULL,\n\t[Timestamp] [datetimeoffset](7) NOT NULL,\n\t[Version] [int] NOT NULL,\n\t[FormattedMessage] [nvarchar](4000) NULL,\n\t[Payload] [nvarchar](4000) NULL,\n\t[ActivityId] [uniqueidentifier],\n\t[RelatedActivityId] [uniqueidentifier],\n\t[ProcessId] [int],\n\t[ThreadId] [int],\n\t-- only used for testing, not in prod schema\n\t[ExtraColumn] [uniqueidentifier] NULL,\n\t[ExtraColumn2] [uniqueidentifier] NULL,\n CONSTRAINT [PK_Traces] PRIMARY KEY CLUSTERED \n\t(\n\t\t[id] ASC\n\t) WITH (STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF)\n)\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Resources/CreateTracesType.sql",
    "content": "CREATE TYPE TracesType AS TABLE\n(\n\t[InstanceName] [nvarchar](1000),\n\t[ProviderId] [uniqueidentifier],\n\t[ProviderName] [nvarchar](500),\n\t[EventId] [int],\n\t[EventKeywords] [bigint],\n\t[Level] [int],\n\t[Opcode] [int],\n\t[Task] [int],\n\t[Timestamp] [datetimeoffset](7),\n\t[Version] [int],\n\t[FormattedMessage] [nvarchar](4000),\n\t[Payload] [nvarchar](4000),\n\t[ActivityId] [uniqueidentifier], \n\t[RelatedActivityId] [uniqueidentifier],\n\t[ProcessId] [int],\n\t[ThreadId] [int]\n);"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/SemanticLogging.Tests.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"4.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{1735E7F3-65BA-4E29-B319-6C2CA03659D1}</ProjectGuid>\n    <OutputType>Library</OutputType>\n    <AppDesignerFolder>Properties</AppDesignerFolder>\n    <RootNamespace>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests</RootNamespace>\n    <AssemblyName>Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests</AssemblyName>\n    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>\n    <VisualStudioVersion Condition=\"'$(VisualStudioVersion)' == ''\">10.0</VisualStudioVersion>\n    <VSToolsPath Condition=\"'$(VSToolsPath)' == ''\">$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)</VSToolsPath>\n    <ReferencePath>$(ProgramFiles)\\Common Files\\microsoft shared\\VSTT\\$(VisualStudioVersion)\\UITestExtensionPackages</ReferencePath>\n    <IsCodedUITest>False</IsCodedUITest>\n    <TestProjectType>UnitTest</TestProjectType>\n    <TargetFrameworkProfile />\n    <NuGetPackageImportStamp>ca8500ee</NuGetPackageImportStamp>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\Debug\\</OutputPath>\n    <DefineConstants>TRACE;DEBUG</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n    <CodeAnalysisRuleSet>..\\Tests.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n    <CodeAnalysisRuleSet>..\\Tests.ruleset</CodeAnalysisRuleSet>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"Microsoft.Azure.KeyVault.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Microsoft.Azure.KeyVault.Core.1.0.0\\lib\\net40\\Microsoft.Azure.KeyVault.Core.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"Microsoft.Data.Edm, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Microsoft.Data.Edm.5.6.4\\lib\\net40\\Microsoft.Data.Edm.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"Microsoft.Data.OData, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Microsoft.Data.OData.5.6.4\\lib\\net40\\Microsoft.Data.OData.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"Microsoft.Data.Services.Client, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Microsoft.Data.Services.Client.5.6.4\\lib\\net40\\Microsoft.Data.Services.Client.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"Microsoft.Diagnostics.Tracing.TraceEvent, Version=1.0.15.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n      <SpecificVersion>False</SpecificVersion>\n      <HintPath>..\\..\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\lib\\net40\\Microsoft.Diagnostics.Tracing.TraceEvent.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.WindowsAzure.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Microsoft.WindowsAzure.ConfigurationManager.2.0.3\\lib\\net40\\Microsoft.WindowsAzure.Configuration.dll</HintPath>\n    </Reference>\n    <Reference Include=\"Microsoft.WindowsAzure.Storage, Version=7.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\WindowsAzure.Storage.7.2.1\\lib\\net40\\Microsoft.WindowsAzure.Storage.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\Newtonsoft.Json.6.0.8\\lib\\net45\\Newtonsoft.Json.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Configuration\" />\n    <Reference Include=\"System.Configuration.Install\" />\n    <Reference Include=\"System.Data\" />\n    <Reference Include=\"System.Data.Services.Client\" />\n    <Reference Include=\"System.Management\" />\n    <Reference Include=\"System.Net.Http\" />\n    <Reference Include=\"System.Spatial, Version=5.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL\">\n      <HintPath>..\\..\\packages\\System.Spatial.5.6.4\\lib\\net40\\System.Spatial.dll</HintPath>\n      <Private>True</Private>\n    </Reference>\n    <Reference Include=\"System.Transactions\" />\n    <Reference Include=\"System.Web.Extensions\" />\n    <Reference Include=\"System.Xml\" />\n    <Reference Include=\"System.Xml.Linq\" />\n  </ItemGroup>\n  <Choose>\n    <When Condition=\"('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'\">\n      <ItemGroup>\n        <Reference Include=\"Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\" />\n      </ItemGroup>\n    </When>\n    <Otherwise>\n      <ItemGroup>\n        <Reference Include=\"Microsoft.VisualStudio.QualityTools.UnitTestFramework\" />\n      </ItemGroup>\n    </Otherwise>\n  </Choose>\n  <ItemGroup>\n    <Compile Include=\"Etw\\ConfigurationReaderFixture.cs\" />\n    <Compile Include=\"Etw\\ConsoleSinkElementFixture.cs\" />\n    <Compile Include=\"Etw\\FormatterFactoryFixture.cs\" />\n    <Compile Include=\"Etw\\TraceEventServiceWorkerFixture.cs\" />\n    <Compile Include=\"Etw\\WindowsAzureTableSinkElementFixture.cs\" />\n    <Compile Include=\"Etw\\SinkSettingsFixture.cs\" />\n    <Compile Include=\"Etw\\EventSourceSettingsFixture.cs\" />\n    <Compile Include=\"Etw\\SqlDatabaseSinkElementFixture.cs\" />\n    <Compile Include=\"Etw\\XmlUtilFixture.cs\" />\n    <Compile Include=\"Observable\\ObservableProjectionFixture.cs\" />\n    <Compile Include=\"TestObjects\\DifferentEnumsEventSource.cs\" />\n    <Compile Include=\"TestObjects\\CustomSink.cs\" />\n    <Compile Include=\"TestObjects\\LargeManifestEventSource.cs\" />\n    <Compile Include=\"TestObjects\\MockEventListener.cs\" />\n    <Compile Include=\"TestObjects\\MockHttpListener.cs\" />\n    <Compile Include=\"TestObjects\\MockHttpListenerResponse.cs\" />\n    <Compile Include=\"TestObjects\\MultipleTypesEventSource.cs\" />\n    <Compile Include=\"TestObjects\\SimpleEventSource.cs\" />\n    <Compile Include=\"Observable\\EventEntrySubjectFixture.cs\" />\n    <Compile Include=\"Properties\\Settings.Designer.cs\">\n      <AutoGen>True</AutoGen>\n      <DesignTimeSharedInput>True</DesignTimeSharedInput>\n      <DependentUpon>Settings.settings</DependentUpon>\n    </Compile>\n    <Compile Include=\"Sinks\\FlatFileSinkTests.cs\" />\n    <Compile Include=\"TestObjects\\SimpleMessageFormatter.cs\" />\n    <Compile Include=\"TestObjects\\StringCollectionEventListener.cs\" />\n    <Compile Include=\"TestSupport\\AssemblyBuilder.cs\" />\n    <Compile Include=\"TestSupport\\ConfigurationHelper.cs\" />\n    <Compile Include=\"TestSupport\\DisposableDomain.cs\" />\n    <Compile Include=\"TestSupport\\EnumerableAssert.cs\" />\n    <Compile Include=\"TestSupport\\EventEntryTestHelper.cs\" />\n    <Compile Include=\"UsingEventListener\\DeferredEnablementFixture.cs\" />\n    <Compile Include=\"Utility\\EventSourceAnalyzerFixture.cs\" />\n    <Compile Include=\"UsingEventListener\\ObservableEventListenerFixture.cs\" />\n    <Compile Include=\"Utility\\GuardFixture.cs\" />\n    <Compile Include=\"Utility\\BufferedEventPublisherFixture.cs\" />\n    <Compile Include=\"Sinks\\SqlDatabaseSinkTests.cs\" />\n    <Compile Include=\"Sinks\\WindowsAzureTableSinkFixture_Integration.cs\" />\n    <Compile Include=\"TestSupport\\ArrangeActAssert.cs\" />\n    <Compile Include=\"Etw\\TraceEventServiceSettingsFixture.cs\" />\n    <Compile Include=\"Etw\\TraceEventServiceConfigurationFixture.cs\" />\n    <Compile Include=\"Etw\\ExtensionsLoaderFixture.cs\" />\n    <Compile Include=\"Etw\\ConfigurationExceptionFixture.cs\" />\n    <Compile Include=\"Sinks\\WindowsAzureTableSinkTests.cs\" />\n    <Compile Include=\"UsingEventListener\\WindowsAzureTableSinkFixture_Integration.cs\" />\n    <Compile Include=\"UsingEventListener\\EventTableEntity.cs\" />\n    <Compile Include=\"Sinks\\RollingFilePurgingTests.cs\" />\n    <Compile Include=\"Sinks\\RollingFlatFileSinkTests.cs\" />\n    <Compile Include=\"UsingEventListener\\SqlDatabaseEventListenerTests.cs\" />\n    <Compile Include=\"Sinks\\TallyKeepingFileStreamWriterTests.cs\" />\n    <Compile Include=\"UsingEventListener\\ConsoleEventListenerFixture.cs\" />\n    <Compile Include=\"Formatters\\DefaultConsoleColorMapperFixture.cs\" />\n    <Compile Include=\"Formatters\\JsonEventTextFormatterFixture.cs\" />\n    <Compile Include=\"Formatters\\XmlEventTextFormatterFixture.cs\" />\n    <Compile Include=\"TestObjects\\MockDefaultConsoleColorMapper.cs\" />\n    <Compile Include=\"TestObjects\\MockConsoleOutput.cs\" />\n    <Compile Include=\"TestObjects\\InMemoryEventListener.cs\" />\n    <Compile Include=\"EventSourceSchemaReaderFixture.cs\" />\n    <Compile Include=\"Formatters\\EventTextFormatterTests.cs\" />\n    <Compile Include=\"TestObjects\\MockColorMapper.cs\" />\n    <Compile Include=\"TestObjects\\MockFormatter.cs\" />\n    <Compile Include=\"TestObjects\\MyCompanyEventSource.cs\" />\n    <Compile Include=\"Etw\\Configuration\\MySinkElement.cs\" />\n    <Compile Include=\"TestObjects\\TestEventEntry.cs\" />\n    <Compile Include=\"Properties\\AssemblyInfo.cs\" />\n    <Compile Include=\"UsingEventListener\\FlatFileEventListenerTests.cs\" />\n    <Compile Include=\"TestObjects\\TestEventSource.cs\" />\n    <Compile Include=\"Properties\\Resources.Designer.cs\">\n      <AutoGen>True</AutoGen>\n      <DesignTime>True</DesignTime>\n      <DependentUpon>Resources.resx</DependentUpon>\n    </Compile>\n    <Compile Include=\"TestSupport\\AssertEx.cs\" />\n    <Compile Include=\"TestSupport\\ContextBase.cs\" />\n    <Compile Include=\"SemanticLoggingEventSourceFixture.cs\" />\n    <Compile Include=\"Etw\\TraceEventServiceFixture.cs\" />\n    <Compile Include=\"TestSupport\\LocalDatabaseContext.cs\" />\n    <Compile Include=\"Utility\\FileUtilFixture.cs\" />\n    <Compile Include=\"TestSupport\\PollingHelper.cs\" />\n    <Compile Include=\"Utility\\NativeMethods.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\..\\Src\\SemanticLogging.TextFile\\SemanticLogging.TextFile.csproj\">\n      <Project>{4b187511-187b-48b1-a593-18ba835b49c3}</Project>\n      <Name>SemanticLogging.TextFile</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\Src\\SemanticLogging.EventSourceAnalyzer\\SemanticLogging.EventSourceAnalyzer.csproj\">\n      <Project>{27eacc2a-ee11-420b-8760-4945412b0c4a}</Project>\n      <Name>SemanticLogging.EventSourceAnalyzer</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\Src\\SemanticLogging.WindowsAzure\\SemanticLogging.WindowsAzure.csproj\">\n      <Project>{d7979e9b-7978-48fe-b345-3c767a20f9a1}</Project>\n      <Name>SemanticLogging.WindowsAzure</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\Src\\SemanticLogging.Database\\SemanticLogging.Database.csproj\">\n      <Project>{ac34c8e7-2a5b-412c-aff7-cf7f52ee4569}</Project>\n      <Name>SemanticLogging.Database</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\Src\\SemanticLogging.Etw\\SemanticLogging.Etw.csproj\">\n      <Project>{8440aea2-cd55-42a0-8724-2ecce2b32374}</Project>\n      <Name>SemanticLogging.Etw</Name>\n    </ProjectReference>\n    <ProjectReference Include=\"..\\..\\Src\\SemanticLogging\\SemanticLogging.csproj\">\n      <Project>{2cd4105b-0dd6-4c18-9b37-05d8e8f57303}</Project>\n      <Name>SemanticLogging</Name>\n    </ProjectReference>\n  </ItemGroup>\n  <ItemGroup>\n    <Content Include=\"Etw\\Configuration\\WithDiff0.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithDiff2.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithDiff1.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithExtensionsIncompleteParams.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithExtensionsNoSchemaValidation.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithErrorOnSinkCreation.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithEmptyNonStringValues.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithManyEventSourcesWithArgumentsAndFilters.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithWarnings.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithDuplicateNames.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithEventSourceIdOnly.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithNoEventSourceNameId.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithExtensionsSchemaValidation.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithExtensions.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithBadTypes.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithEventSourceNameOnly.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithManySinks.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithManyEventSources.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Etw\\Configuration\\WithDefaultValues.xml\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <Content Include=\"Logging_log.ldf\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n      <DependentUpon>Logging.mdf</DependentUpon>\n    </Content>\n    <None Include=\"Resources\\CreateGenericTable.sql\" />\n    <None Include=\"Resources\\CreateTracesType.sql\" />\n    <None Include=\"Resources\\CreateProcedureWriteTraces.sql\" />\n    <None Include=\"..\\..\\SemanticLogging.licenseheader\">\n      <Link>SemanticLogging.licenseheader</Link>\n    </None>\n    <Content Include=\"..\\..\\Src\\SemanticLogging.Etw.WindowsService\\SemanticLogging-svc.xsd\">\n      <Link>Etw\\Configuration\\SemanticLogging-svc.xsd</Link>\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <None Include=\"Properties\\Settings.settings\">\n      <Generator>SettingsSingleFileGenerator</Generator>\n      <LastGenOutput>Settings.Designer.cs</LastGenOutput>\n    </None>\n    <None Include=\"Resources\\CreateTracesTable.sql\" />\n    <Content Include=\"Event.xsd\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <None Include=\"App.config\">\n      <SubType>Designer</SubType>\n    </None>\n    <Content Include=\"Etw\\Configuration\\MySinkElement.xsd\">\n      <SubType>Designer</SubType>\n      <CopyToOutputDirectory>Always</CopyToOutputDirectory>\n    </Content>\n    <None Include=\"packages.config\">\n      <SubType>Designer</SubType>\n    </None>\n    <Compile Include=\"UsingEventListener\\ObservableEventListenerFixture.PartialTrust.cs\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Content Include=\"Logging.mdf\">\n      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>\n    </Content>\n  </ItemGroup>\n  <ItemGroup>\n    <EmbeddedResource Include=\"Properties\\Resources.resx\">\n      <Generator>ResXFileCodeGenerator</Generator>\n      <LastGenOutput>Resources.Designer.cs</LastGenOutput>\n      <SubType>Designer</SubType>\n    </EmbeddedResource>\n  </ItemGroup>\n  <ItemGroup />\n  <Choose>\n    <When Condition=\"'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'\">\n      <ItemGroup>\n        <Reference Include=\"Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n        <Reference Include=\"Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n        <Reference Include=\"Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n        <Reference Include=\"Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL\">\n          <Private>False</Private>\n        </Reference>\n      </ItemGroup>\n    </When>\n  </Choose>\n  <Import Project=\"$(VSToolsPath)\\TeamTest\\Microsoft.TestTools.targets\" Condition=\"Exists('$(VSToolsPath)\\TeamTest\\Microsoft.TestTools.targets')\" />\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <Import Project=\"..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets\" Condition=\"Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" />\n  <Target Name=\"EnsureNuGetPackageBuildImports\" BeforeTargets=\"PrepareForBuild\">\n    <PropertyGroup>\n      <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>\n    </PropertyGroup>\n    <Error Condition=\"!Exists('..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\..\\packages\\StyleCop.MSBuild.4.7.49.0\\build\\StyleCop.MSBuild.Targets'))\" />\n    <Error Condition=\"!Exists('..\\..\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets')\" Text=\"$([System.String]::Format('$(ErrorText)', '..\\..\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets'))\" />\n  </Target>\n  <Import Project=\"..\\..\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets\" Condition=\"Exists('..\\..\\packages\\Microsoft.Diagnostics.Tracing.TraceEvent.1.0.15\\build\\Microsoft.Diagnostics.Tracing.TraceEvent.targets')\" />\n  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n       Other similar extension points exist, see Microsoft.Common.targets.\n  <Target Name=\"BeforeBuild\">\n  </Target>\n  <Target Name=\"AfterBuild\">\n  </Target>\n  -->\n</Project>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/SemanticLoggingEventSourceFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests\n{\n    [TestClass]\n    public class SemanticLoggingEventSourceFixture\n    {\n        [TestMethod]\n        public void ShouldValidateEventSource()\n        {\n            EventSourceAnalyzer.InspectAll(SemanticLoggingEventSource.Log);\n        }\n\n        [TestMethod]\n        public void ShouldWriteWithNoFiltering()\n        {\n            using (var listener = new InMemoryEventListener())\n            {\n                listener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.LogAlways, Keywords.All);\n\n                SemanticLoggingEventSource.Log.DatabaseSinkPublishEventsFailed(\"test\");\n\n                listener.DisableEvents(SemanticLoggingEventSource.Log);\n\n                StringAssert.Contains(listener.ToString(), \"EventId : 101\");\n                StringAssert.Contains(listener.ToString(), \"Level : Error\");\n                StringAssert.Contains(listener.ToString(), \"Payload : [message : test]\");\n            }\n        }\n\n        [TestMethod]\n        public void ShouldWriteByErrorLevel()\n        {\n            using (var listener = new InMemoryEventListener())\n            {\n                listener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Error, Keywords.All);\n\n                SemanticLoggingEventSource.Log.ConsoleSinkWriteFailed(\"test\");\n\n                listener.DisableEvents(SemanticLoggingEventSource.Log);\n\n                StringAssert.Contains(listener.ToString(), \"EventId : 200\");\n                StringAssert.Contains(listener.ToString(), \"Level : Critical\");\n                StringAssert.Contains(listener.ToString(), \"Payload : [message : test]\");\n            }\n        }\n\n        [TestMethod]\n        public void ShouldWriteByEventKeywords()\n        {\n            using (var listener = new InMemoryEventListener())\n            {\n                listener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.LogAlways, SemanticLoggingEventSource.Keywords.Sink);\n\n                SemanticLoggingEventSource.Log.ConsoleSinkWriteFailed(\"test\");\n\n                listener.DisableEvents(SemanticLoggingEventSource.Log);\n\n                StringAssert.Contains(listener.ToString(), \"EventId : 200\");\n                StringAssert.Contains(listener.ToString(), \"Level : Critical\");\n                StringAssert.Contains(listener.ToString(), \"Payload : [message : test]\");\n            }\n        }\n\n        [TestMethod]\n        public void ShouldFilterByEventKeywords()\n        {\n            using (var listener = new InMemoryEventListener())\n            {\n                listener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.LogAlways, SemanticLoggingEventSource.Keywords.Formatting);\n\n                SemanticLoggingEventSource.Log.ConsoleSinkWriteFailed(\"test\");\n\n                listener.DisableEvents(SemanticLoggingEventSource.Log);\n\n                Assert.AreEqual(string.Empty, listener.ToString());\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Settings.StyleCop",
    "content": "<StyleCopSettings Version=\"105\">\n  <Analyzers>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.NamingRules\">\n      <Rules>\n        <Rule Name=\"ElementMustBeginWithUpperCaseLetter\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings />\n    </Analyzer>\n    <Analyzer AnalyzerId=\"StyleCop.CSharp.ReadabilityRules\">\n      <Rules>\n        <Rule Name=\"PrefixCallsCorrectly\">\n          <RuleSettings>\n            <BooleanProperty Name=\"Enabled\">False</BooleanProperty>\n          </RuleSettings>\n        </Rule>\n      </Rules>\n      <AnalyzerSettings />\n    </Analyzer>\n  </Analyzers>\n</StyleCopSettings>"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Sinks/FlatFileSinkTests.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.IO;\nusing System.Linq;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Sinks\n{\n    [TestClass]\n    public class FlatFileSinkTests\n    {\n        private string fileName;\n        private FlatFileSink sink;\n\n        [TestInitialize]\n        public void SetUp()\n        {\n            AppDomain.CurrentDomain.SetData(\"APPBASE\", Environment.CurrentDirectory);\n            this.fileName = Path.ChangeExtension(Guid.NewGuid().ToString(\"N\"), \".log\");\n            Environment.SetEnvironmentVariable(\"TESTVAR\", \"fromtestvariable\");\n            Environment.SetEnvironmentVariable(\"INVALIDPATH\", @\"..\\..\\\");\n        }\n\n        [TestCleanup]\n        public void TearDown()\n        {\n            Environment.SetEnvironmentVariable(\"TESTVAR\", null);\n            Environment.SetEnvironmentVariable(\"INVALIDPATH\", null);\n\n            if (sink != null)\n            {\n                this.sink.Dispose();\n            }\n\n            if (File.Exists(this.fileName))\n            {\n                File.Delete(this.fileName);\n            }\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(DirectoryNotFoundException))]\n        public void ThrowOnDirectoryNotFound()\n        {\n            new FlatFileSink(@\"Z:\\Foo\\foo.log\", new SimpleMessageFormatter(), false);\n        }\n\n        [TestMethod]\n        public void ThrowOnInvalidFileChars()\n        {\n            foreach (var c in Path.GetInvalidFileNameChars())\n            {\n                AssertEx.Throws<ArgumentException>(() => new FlatFileSink(c.ToString(), new SimpleMessageFormatter(), false));\n            }\n\n            foreach (var c in Path.GetInvalidPathChars())\n            {\n                AssertEx.Throws<ArgumentException>(() => new FlatFileSink(c.ToString(), new SimpleMessageFormatter(), false));\n            }\n        }\n\n        [TestMethod]\n        public void ThrowOnInvalidOSFileNames()\n        {\n            AssertEx.Throws<ArgumentException>(() => new FlatFileSink(\"PRN.log\", new SimpleMessageFormatter(), false));\n            AssertEx.Throws<ArgumentException>(() => new FlatFileSink(\"AUX.log\", new SimpleMessageFormatter(), false));\n            AssertEx.Throws<ArgumentException>(() => new FlatFileSink(\"CON.log\", new SimpleMessageFormatter(), false));\n        }\n\n        [TestMethod]\n        public void ThrowOnPathNavigationFileName()\n        {\n            AssertEx.Throws<ArgumentException>(() => new FlatFileSink(\".\", new SimpleMessageFormatter(), false));\n            AssertEx.Throws<ArgumentException>(() => new FlatFileSink(@\"..\\\", new SimpleMessageFormatter(), false));\n            AssertEx.Throws<ArgumentException>(() => new FlatFileSink(@\"..\\..\\..\", new SimpleMessageFormatter(), false));\n            AssertEx.Throws<ArgumentException>(() => new FlatFileSink(@\"C:\\Test\\..\\\", new SimpleMessageFormatter(), false));\n        }\n\n        [TestMethod]\n        public void CreatesFlatFile()\n        {\n            sink = new FlatFileSink(this.fileName, new SimpleMessageFormatter(), false);\n            sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"|1\"));\n\n            Assert.IsTrue(File.Exists(this.fileName));\n\n            var entries = ReadFileWithoutLock(this.fileName).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);\n\n            Assert.AreEqual<int>(1, entries.Count());\n        }\n\n        [TestMethod]\n        public void AppendsEntriesToFlatFile()\n        {\n            sink = new FlatFileSink(this.fileName, new SimpleMessageFormatter(), false);\n            sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"|1\"));\n            sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"|2\"));\n            sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"|3\"));\n\n            var entries = ReadFileWithoutLock(this.fileName).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);\n            Assert.AreEqual<int>(3, entries.Length);\n            Assert.AreEqual(\"1\", entries[0]);\n            Assert.AreEqual(\"2\", entries[1]);\n            Assert.AreEqual(\"3\", entries[2]);\n        }\n\n        [TestMethod]\n        public void ConcurrentAppendsEntriesToFlatFile()\n        {\n            sink = new FlatFileSink(this.fileName, new SimpleMessageFormatter(), false);\n            const int NumberOfEntries = 100;\n\n            Parallel.For(0, NumberOfEntries, i => sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"|\" + i)));\n\n            var entries = ReadFileWithoutLock(this.fileName).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);\n            Assert.AreEqual<int>(NumberOfEntries, entries.Length);\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                CollectionAssert.Contains(entries, i.ToString());\n            }\n        }\n\n        [TestMethod]\n        [Ignore]    // TODO fix race condition\n        public void ConcurrentAppendsEntriesToFlatFileWhenUsingAsync()\n        {\n            sink = new FlatFileSink(this.fileName, new SimpleMessageFormatter(), isAsync: true);\n            const int NumberOfEntries = 100;\n\n            Parallel.For(0, NumberOfEntries, i => sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"|\" + i)));\n            sink.FlushAsync().Wait();\n            var entries = ReadFileWithoutLock(this.fileName).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);\n            Assert.AreEqual<int>(NumberOfEntries, entries.Length);\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                CollectionAssert.Contains(entries, i.ToString());\n            }\n        }\n\n        [TestMethod]\n        public void CreatesDirectoryForLogRecursively()\n        {\n            string file = @\"dir1\\dir2\\test\\patterns\\practices\\log.xt\";\n            using (var flatFileSink = new FlatFileSink(file, new SimpleMessageFormatter(), false))\n            {\n                Assert.IsTrue(new DirectoryInfo(Path.GetDirectoryName(file)).Exists);\n            }\n\n            Directory.Delete(Path.GetDirectoryName(file), true);\n        }\n\n        [TestMethod]\n        public void ExpandsExistingEnvironmentVariables()\n        {\n            var tempFileName = this.fileName;\n            this.fileName = Path.Combine(Path.Combine(Environment.CurrentDirectory, \"fromtestvariable\"), tempFileName);\n\n            this.sink = new FlatFileSink(Path.Combine(Environment.CurrentDirectory, @\"%TESTVAR%\\\") + tempFileName, new SimpleMessageFormatter(), false);\n            this.sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"|1\"));\n            this.sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"|2\"));\n            this.sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"|3\"));\n\n            var entries = ReadFileWithoutLock(this.fileName).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);\n            Assert.AreEqual<int>(3, entries.Length);\n            Assert.AreEqual(\"1\", entries[0]);\n            Assert.AreEqual(\"2\", entries[1]);\n            Assert.AreEqual(\"3\", entries[2]);\n        }\n\n        [TestMethod]\n        public void IgnoresMissingEnvironmentVariables()\n        {\n            var tempFileName = this.fileName;\n            this.fileName = Path.Combine(Environment.CurrentDirectory, tempFileName);\n\n            this.sink = new FlatFileSink(Path.Combine(Environment.CurrentDirectory, @\"%MISSINGTESTVAR%\\\") + tempFileName, new SimpleMessageFormatter(), false);\n            this.sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"|1\"));\n            this.sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"|2\"));\n            this.sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"|3\"));\n\n            var entries = ReadFileWithoutLock(this.fileName).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);\n            Assert.AreEqual<int>(3, entries.Length);\n            Assert.AreEqual(\"1\", entries[0]);\n            Assert.AreEqual(\"2\", entries[1]);\n            Assert.AreEqual(\"3\", entries[2]);\n        }\n\n        [TestMethod]\n        public void CreatingSinkWithVariableThatResultsInInvalidPathThrows()\n        {\n            AssertEx.Throws<ArgumentException>(() => new FlatFileSink(\"%INVALIDPATH%\", new SimpleMessageFormatter(), false));\n        }\n\n        private static string ReadFileWithoutLock(string fileName)\n        {\n            using (var reader = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))\n            {\n                return reader.ReadToEnd();\n            }\n        }\n    }\n\n    [TestClass]\n    public class ConcurrencyFixture\n    {\n        private string fileName;\n\n        [TestMethod]\n        [Ignore]    // TODO fix race condition\n        public void ConcurrentAppendsEntriesToFlatFileWhenUsingAsync()\n        {\n            AppDomain.CurrentDomain.SetData(\"APPBASE\", Environment.CurrentDirectory);\n            const int TimesRepeated = 50;\n            const int NumberOfEntries = 100;\n            for (int repeat = 0; repeat < TimesRepeated; repeat++)\n            {\n                this.fileName = Path.ChangeExtension(Guid.NewGuid().ToString(\"N\"), \".log\");\n\n                try\n                {\n                    using (var sink = new FlatFileSink(this.fileName, new SimpleMessageFormatter(), isAsync: true))\n                    {\n                        Parallel.For(0, NumberOfEntries, i => sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"|\" + i)));\n                        sink.FlushAsync().Wait();\n                    }\n\n                    var entriesStr = ReadFileWithoutLock(this.fileName);\n                    var entries = entriesStr.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);\n                    Assert.AreEqual<int>(NumberOfEntries, entries.Length, this.fileName + \"|\" + entries.Length + \"    \" + entriesStr);\n                }\n                finally\n                {\n                    if (File.Exists(this.fileName))\n                    {\n                        File.Delete(this.fileName);\n                    }\n                }\n            }\n        }\n\n        private static string ReadFileWithoutLock(string fileName)\n        {\n            using (var reader = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))\n            {\n                return reader.ReadToEnd();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Sinks/RollingFilePurgingTests.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.IO;\nusing System.Threading;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Sinks\n{\n    public class TemporaryFolderBasedTest : ArrangeActAssert\n    {\n        protected string BaseDirectory { get; private set; }\n\n        protected override void Arrange()\n        {\n            base.Arrange();\n\n            this.BaseDirectory = Guid.NewGuid().ToString(\"N\");\n            Directory.CreateDirectory(this.BaseDirectory);\n        }\n\n        protected override void Teardown()\n        {\n            base.Teardown();\n\n            Directory.Delete(this.BaseDirectory, true);\n        }\n    }\n\n    public class Given_a_directory_with_five_matching_files : TemporaryFolderBasedTest\n    {\n        protected string baseFileName;\n\n        protected override void Arrange()\n        {\n            base.Arrange();\n\n            this.baseFileName = \"trace.log\";\n\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.001.log\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.003.log\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.002.log\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.004.log\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.005.log\"), \"test1\");\n        }\n\n        [TestClass]\n        public class When_a_purger_with_a_cap_of_six_files_purges\n            : Given_a_directory_with_five_matching_files\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, this.baseFileName, 6).Purge();\n            }\n\n            [TestMethod]\n            public void Then_No_Files_Are_Deleted()\n            {\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.003.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.002.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.004.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.005.log\")));\n            }\n        }\n\n        [TestClass]\n        public class When_a_purger_with_a_cap_of_five_files_purges\n            : Given_a_directory_with_five_matching_files\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, this.baseFileName, 5).Purge();\n            }\n\n            [TestMethod]\n            public void Then_No_Files_Are_Deleted()\n            {\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.003.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.002.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.004.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.005.log\")));\n            }\n        }\n\n        [TestClass]\n        public class When_a_purger_with_a_cap_of_four_files_purges\n            : Given_a_directory_with_five_matching_files\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, this.baseFileName, 4).Purge();\n            }\n\n            [TestMethod]\n            public void Then_The_Oldest_File_Is_Deleted()\n            {\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.003.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.002.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.004.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.005.log\")));\n            }\n        }\n\n        [TestClass]\n        public class When_a_purger_with_a_cap_of_three_files_purges\n            : Given_a_directory_with_five_matching_files\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, this.baseFileName, 3).Purge();\n            }\n\n            [TestMethod]\n            public void Then_The_Two_Oldest_File_are_deleted()\n            {\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.log\")));\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.003.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.002.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.004.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.005.log\")));\n            }\n        }\n\n        [TestClass]\n        public class When_a_purger_with_a_cap_of_three_files_for_a_different_base_FileName_purges\n            : Given_a_directory_with_five_matching_files\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, \"some_pattern.log\", 3).Purge();\n            }\n\n            [TestMethod]\n            public void Then_No_Files_Are_Deleted()\n            {\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.003.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.002.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.004.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.005.log\")));\n            }\n        }\n\n        [TestClass]\n        public class When_a_purger_with_a_cap_of_two_files_for_a_base_FileName_with_an_extension_contained_in_the_existing_files\n            : Given_a_directory_with_five_matching_files\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, \"trace.lo\", 2).Purge();\n            }\n\n            [TestMethod]\n            public void Then_No_Files_Are_Deleted()\n            {\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.003.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.002.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.004.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.005.log\")));\n            }\n        }\n    }\n\n    public class Given_a_directory_with_five_matching_files_with_long_extensions : TemporaryFolderBasedTest\n    {\n        protected string directory;\n        protected string baseFileName;\n\n        protected override void Arrange()\n        {\n            base.Arrange();\n\n            this.baseFileName = \"trace.logged\";\n\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.001.logged\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.003.logged\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.002.logged\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.004.logged\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.005.logged\"), \"test1\");\n        }\n\n        [TestClass]\n        public class When_a_purger_with_a_cap_of_three_files_purges\n            : Given_a_directory_with_five_matching_files_with_long_extensions\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, this.baseFileName, 3).Purge();\n            }\n\n            [TestMethod]\n            public void Then_the_two_oldest_files_are_deleted()\n            {\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.logged\")));\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.003.logged\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.002.logged\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.004.logged\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.005.logged\")));\n            }\n        }\n\n        [TestClass]\n        public class When_a_purger_with_a_cap_of_three_files_for_a_base_FileName_with_an_three_chars_extension_contained_in_the_existing_files\n            : Given_a_directory_with_five_matching_files_with_long_extensions\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, \"trace.log\", 3).Purge();\n            }\n\n            [TestMethod]\n            public void Then_No_Files_Are_Deleted()\n            {\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.logged\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.003.logged\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.002.logged\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.004.logged\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.005.logged\")));\n            }\n        }\n    }\n\n    public class Given_a_directory_with_five_matching_files_one_of_them_readonly : TemporaryFolderBasedTest\n    {\n        protected string baseFileName;\n\n        protected override void Arrange()\n        {\n            base.Arrange();\n\n            this.baseFileName = \"trace.log\";\n\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.001.log\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.003.log\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.002.log\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.004.log\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.005.log\"), \"test1\");\n\n            File.SetAttributes(Path.Combine(this.BaseDirectory, \"trace.003.log\"), FileAttributes.ReadOnly);\n        }\n\n        protected override void Teardown()\n        {\n            File.SetAttributes(Path.Combine(this.BaseDirectory, \"trace.003.log\"), FileAttributes.Normal);\n\n            base.Teardown();\n        }\n\n        [TestClass]\n        public class When_a_purger_with_a_cap_of_three_files_purges\n            : Given_a_directory_with_five_matching_files_one_of_them_readonly\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, this.baseFileName, 3).Purge();\n            }\n\n            [TestMethod]\n            public void Then_only_the_non_readonly_file_is_deleted_among_the_two_oldest_files()\n            {\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.003.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.002.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.004.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.005.log\")));\n            }\n        }\n    }\n\n    public class Given_a_directory_with_five_matching_files_one_of_them_opened : TemporaryFolderBasedTest\n    {\n        private Stream stream;\n        protected string baseFileName;\n\n        protected override void Arrange()\n        {\n            base.Arrange();\n\n            this.baseFileName = \"trace.log\";\n\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.001.log\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.003.log\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.002.log\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.004.log\"), \"test1\");\n            Thread.Sleep(50);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.005.log\"), \"test1\");\n\n            stream = File.OpenWrite(Path.Combine(this.BaseDirectory, \"trace.003.log\"));\n        }\n\n        protected override void Teardown()\n        {\n            stream.Close();\n\n            base.Teardown();\n        }\n\n        [TestClass]\n        public class When_a_purger_with_a_cap_of_three_files_purges\n            : Given_a_directory_with_five_matching_files_one_of_them_opened\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, this.baseFileName, 3).Purge();\n            }\n\n            [TestMethod]\n            public void Then_only_the_non_opened_file_is_deleted_among_the_two_oldest_files()\n            {\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.003.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.002.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.004.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.005.log\")));\n            }\n        }\n    }\n\n    public class Given_a_purger_configured_for_a_non_existing_directory : ArrangeActAssert\n    {\n        private RollingFlatFilePurger purger;\n\n        protected override void Arrange()\n        {\n            base.Arrange();\n\n            this.purger = new RollingFlatFilePurger(Guid.NewGuid().ToString(\"N\"), \"trace.log\", 4);\n        }\n\n        [TestClass]\n        public class When_purging : Given_a_purger_configured_for_a_non_existing_directory\n        {\n            protected override void Act()\n            {\n                this.purger.Purge();\n            }\n\n            [TestMethod]\n            public void Then_no_exception_is_thrown()\n            {\n            }\n        }\n    }\n\n    public class Given_a_directory_with_files_with_names_containing_base_name_for_purger : TemporaryFolderBasedTest\n    {\n        protected override void Arrange()\n        {\n            base.Arrange();\n\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace001.log\"), \"test1\");\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace002.log\"), \"test1\");\n        }\n\n        [TestClass]\n        public class When_a_purger_purges_for_base_name\n            : Given_a_directory_with_files_with_names_containing_base_name_for_purger\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, \"trace.log\", 1).Purge();\n            }\n\n            [TestMethod]\n            public void Then_files_with_names_containing_base_name_are_not_deleted()\n            {\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace001.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace002.log\")));\n            }\n        }\n    }\n\n    public class Given_a_directory_with_five_matching_files_with_the_same_creation_date : TemporaryFolderBasedTest\n    {\n        protected string baseFileName;\n\n        protected override void Arrange()\n        {\n            base.Arrange();\n\n            this.baseFileName = \"trace.log\";\n            var creationTime = DateTime.Now;\n\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.001.1.log\"), \"test1\");\n            File.SetCreationTime(Path.Combine(this.BaseDirectory, \"trace.001.1.log\"), creationTime);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.001.14.log\"), \"test1\");\n            File.SetCreationTime(Path.Combine(this.BaseDirectory, \"trace.001.14.log\"), creationTime);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.001.5.log\"), \"test1\");\n            File.SetCreationTime(Path.Combine(this.BaseDirectory, \"trace.001.5.log\"), creationTime);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.001.3.log\"), \"test1\");\n            File.SetCreationTime(Path.Combine(this.BaseDirectory, \"trace.001.3.log\"), creationTime);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.001.21.log\"), \"test1\");\n            File.SetCreationTime(Path.Combine(this.BaseDirectory, \"trace.001.21.log\"), creationTime);\n        }\n\n        [TestClass]\n        public class When_a_purger_with_a_cap_of_three_files_purges\n            : Given_a_directory_with_five_matching_files_with_the_same_creation_date\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, this.baseFileName, 3).Purge();\n            }\n\n            [TestMethod]\n            public void Then_the_three_files_with_the_largest_sequence_number_are_kept()\n            {\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.1.log\")));\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.3.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.5.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.14.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.21.log\")));\n            }\n        }\n    }\n\n    public class Given_a_directory_with_five_matching_files_with_non_integer_sequences_and_the_same_creation_date : TemporaryFolderBasedTest\n    {\n        protected string baseFileName;\n\n        protected override void Arrange()\n        {\n            base.Arrange();\n\n            this.baseFileName = \"trace.log\";\n            var creationTime = DateTime.Now;\n\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.001.aaa.log\"), \"test1\");\n            File.SetCreationTime(Path.Combine(this.BaseDirectory, \"trace.001.aaa.log\"), creationTime);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.001.cc.log\"), \"test1\");\n            File.SetCreationTime(Path.Combine(this.BaseDirectory, \"trace.001.cc.log\"), creationTime);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.001.5.log\"), \"test1\");\n            File.SetCreationTime(Path.Combine(this.BaseDirectory, \"trace.001.5.log\"), creationTime);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.001.bbb.log\"), \"test1\");\n            File.SetCreationTime(Path.Combine(this.BaseDirectory, \"trace.001.bbb.log\"), creationTime);\n            File.WriteAllText(Path.Combine(this.BaseDirectory, \"trace.001.51.log\"), \"test1\");\n            File.SetCreationTime(Path.Combine(this.BaseDirectory, \"trace.001.51.log\"), creationTime);\n        }\n\n        [TestClass]\n        public class When_a_purger_with_a_cap_of_four_files_purges\n            : Given_a_directory_with_five_matching_files_with_non_integer_sequences_and_the_same_creation_date\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, this.baseFileName, 4).Purge();\n            }\n\n            [TestMethod]\n            public void Then_the_three_files_with_the_largest_sequences_compared_as_strings_are_kept()\n            {\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.aaa.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.cc.log\")));\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.5.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.bbb.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.51.log\")));\n            }\n        }\n\n        [TestClass]\n        public class When_a_purger_with_a_cap_of_three_files_purges\n            : Given_a_directory_with_five_matching_files_with_non_integer_sequences_and_the_same_creation_date\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, this.baseFileName, 3).Purge();\n            }\n\n            [TestMethod]\n            public void Then_the_three_files_with_the_largest_sequences_compared_as_strings_are_kept()\n            {\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.aaa.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.cc.log\")));\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.5.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.bbb.log\")));\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.51.log\")));\n            }\n        }\n\n        [TestClass]\n        public class When_a_purger_with_a_cap_of_two_files_purges\n            : Given_a_directory_with_five_matching_files_with_non_integer_sequences_and_the_same_creation_date\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, this.baseFileName, 2).Purge();\n            }\n\n            [TestMethod]\n            public void Then_the_three_files_with_the_largest_sequences_compared_as_strings_are_kept()\n            {\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.aaa.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.cc.log\")));\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.5.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.bbb.log\")));\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.51.log\")));\n            }\n        }\n\n        [TestClass]\n        public class When_a_purger_with_a_cap_of_one_files_purges\n            : Given_a_directory_with_five_matching_files_with_non_integer_sequences_and_the_same_creation_date\n        {\n            protected override void Act()\n            {\n                new RollingFlatFilePurger(this.BaseDirectory, this.baseFileName, 1).Purge();\n            }\n\n            [TestMethod]\n            public void Then_the_three_files_with_the_largest_sequences_compared_as_strings_are_kept()\n            {\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.aaa.log\")));\n                Assert.IsTrue(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.cc.log\")));\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.5.log\")));\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.bbb.log\")));\n                Assert.IsFalse(File.Exists(Path.Combine(this.BaseDirectory, \"trace.001.51.log\")));\n            }\n        }\n    }\n\n    [TestClass]\n    public partial class Given\n    {\n        [TestMethod]\n        public void Then_creating_a_purger_with_a_null_directory_throws()\n        {\n            AssertEx.Throws<ArgumentNullException>(() => new RollingFlatFilePurger(null, \"trace.log\", 10));\n        }\n\n        [TestMethod]\n        public void Then_creating_a_purger_with_a_null_filename_throws()\n        {\n            AssertEx.Throws<ArgumentNullException>(() => new RollingFlatFilePurger(Environment.CurrentDirectory, null, 10));\n        }\n\n        [TestMethod]\n        public void Then_creating_a_purger_with_a_negative_cap_throws()\n        {\n            AssertEx.Throws<ArgumentOutOfRangeException>(() => new RollingFlatFilePurger(Environment.CurrentDirectory, \"trace.log\", -10));\n        }\n\n        [TestMethod]\n        public void Then_creating_a_purger_with_a_zero_cap_throws()\n        {\n            AssertEx.Throws<ArgumentOutOfRangeException>(() => new RollingFlatFilePurger(Environment.CurrentDirectory, \"trace.log\", 0));\n        }\n\n        [TestMethod]\n        public void Then_creating_a_purger_with_a_cap_of_one_does_not_throw()\n        {\n            new RollingFlatFilePurger(Environment.CurrentDirectory, \"trace.log\", 1);\n        }\n    }\n\n    [TestClass]\n    public class TestPurgerSequenceExtraction\n    {\n        [TestMethod]\n        public void CanExtractSequenceFromNormalArchiveFileName()\n        {\n            var sequence = RollingFlatFilePurger.GetSequence(\"trace.zzzz.1.log\");\n\n            Assert.AreEqual(\"1\", sequence);\n        }\n\n        [TestMethod]\n        public void CanExtractMultiCharSequenceFromNormalArchiveFileName()\n        {\n            var sequence = RollingFlatFilePurger.GetSequence(\"trace.zzzz.188.log\");\n\n            Assert.AreEqual(\"188\", sequence);\n        }\n\n        [TestMethod]\n        public void ExtractingSequenceFromNameWithNoDotsReturnsEmpty()\n        {\n            var sequence = RollingFlatFilePurger.GetSequence(\"trace\");\n\n            Assert.AreEqual(string.Empty, sequence);\n        }\n\n        [TestMethod]\n        public void ExtractingSequenceFromNameWithSingleDotReturnsEmpty()\n        {\n            var sequence = RollingFlatFilePurger.GetSequence(\"trace.log\");\n\n            Assert.AreEqual(string.Empty, sequence);\n        }\n\n        [TestMethod]\n        public void ExtractingSequenceFromNameWithTrailingDotReturnsEmpty()\n        {\n            var sequence = RollingFlatFilePurger.GetSequence(\"trace.\");\n\n            Assert.AreEqual(string.Empty, sequence);\n        }\n\n        [TestMethod]\n        public void ExtractingSequenceFromNameWithConsecutiveDotsReturnsEmpty()\n        {\n            var sequence = RollingFlatFilePurger.GetSequence(\"trace..log\");\n\n            Assert.AreEqual(string.Empty, sequence);\n        }\n\n        [TestMethod]\n        public void CanExtractSequenceFromArchiveFileNameStartingWithDot()\n        {\n            var sequence = RollingFlatFilePurger.GetSequence(\".10.log\");\n\n            Assert.AreEqual(\"10\", sequence);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Sinks/RollingFlatFileSinkTests.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.IO;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Sinks\n{\n    [TestClass]\n    public class RollingFlatFileSinkTests\n    {\n        private string fileNameWithoutExtension;\n        private string fileName;\n        private const string Extension = \".log\";\n\n        private MockDateTimeProvider dateTimeProvider;\n\n        [TestInitialize]\n        public void SetUp()\n        {\n            dateTimeProvider = new MockDateTimeProvider();\n            AppDomain.CurrentDomain.SetData(\"APPBASE\", Environment.CurrentDirectory);\n            fileNameWithoutExtension = Guid.NewGuid().ToString();\n            fileName = fileNameWithoutExtension + Extension;\n        }\n\n        [TestCleanup]\n        public void TearDown()\n        {\n            foreach (string createdFileName in Directory.GetFiles(\".\", fileNameWithoutExtension + \"*\"))\n            {\n                File.Delete(createdFileName);\n            }\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentNullException))]\n        public void ThrowOnNullFileName()\n        {\n            new RollingFlatFileSink(null, 0, string.Empty, RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentException))]\n        public void ThrowOnEmptyFileName()\n        {\n            new RollingFlatFileSink(string.Empty, 0, string.Empty, RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(DirectoryNotFoundException))]\n        public void ThrowOnDirectoryNotFound()\n        {\n            new RollingFlatFileSink(@\"Z:\\Foo\\foo.log\", 0, string.Empty, RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false);\n        }\n\n        [TestMethod]\n        public void ThrowOnInvalidFileChars()\n        {\n            foreach (var c in Path.GetInvalidFileNameChars())\n            {\n                AssertEx.Throws<ArgumentException>(() => new RollingFlatFileSink(c.ToString(), 0, string.Empty, RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false));\n            }\n\n            foreach (var c in Path.GetInvalidPathChars())\n            {\n                AssertEx.Throws<ArgumentException>(() => new RollingFlatFileSink(c.ToString(), 0, string.Empty, RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false));\n            }\n        }\n\n        [TestMethod]\n        public void ThrowIfTimestampPatternIsNullOrEmpty()\n        {\n            AssertEx.Throws<ArgumentNullException>(() => new RollingFlatFileSink(\"rolling.log\", 1024, null, RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false));\n\n            AssertEx.Throws<ArgumentException>(() => new RollingFlatFileSink(\"rolling.log\", 1024, string.Empty, RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false));\n        }\n\n        [TestMethod]\n        public void ThrowIfFormatterIsNull()\n        {\n            AssertEx.Throws<ArgumentNullException>(() => new RollingFlatFileSink(\"rolling.log\", 1024, \"pattern\", RollFileExistsBehavior.Increment, RollInterval.Day, 0, null, false));\n        }\n\n        [TestMethod]\n        public void ThrowOnPathNavigationFileName()\n        {\n            AssertEx.Throws<ArgumentException>(() => new RollingFlatFileSink(\".\", 0, string.Empty, RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false));\n            AssertEx.Throws<ArgumentException>(() => new RollingFlatFileSink(@\"..\\\", 0, string.Empty, RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false));\n            AssertEx.Throws<ArgumentException>(() => new RollingFlatFileSink(@\"..\\..\\\", 0, string.Empty, RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false));\n            AssertEx.Throws<ArgumentException>(() => new RollingFlatFileSink(@\"C:\\Test\\..\\\", 0, string.Empty, RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false));\n        }\n\n        [TestMethod]\n        public void ThrowsArgumentOutOfRangeIfTimeStampUsesInvalidChars()\n        {\n            AssertEx.Throws<ArgumentException>(() => new RollingFlatFileSink(\"rolling.log\", 0, \"MM/dd/yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false));\n            AssertEx.Throws<ArgumentException>(() => new RollingFlatFileSink(\"rolling.log\", 0, \"MM:dd:yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false));\n        }\n\n        [TestMethod]\n        public void SinkForNewFileWillUseCreationDateToCalculateRollDate()\n        {\n            using (var sink\n                = new RollingFlatFileSink(fileName, 0, \"yyyy\", RollFileExistsBehavior.Overwrite, RollInterval.Day, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.DateTimeProvider = this.dateTimeProvider;\n\n                Assert.IsTrue(sink.RollingHelper.UpdateRollingInformationIfNecessary());\n\n                Assert.AreEqual(sink.RollingHelper.CalculateNextRollDate(File.GetCreationTime(fileName)), sink.RollingHelper.NextRollDateTime);\n                Assert.IsNull(sink.RollingHelper.CheckIsRollNecessary());\n            }\n        }\n\n        [TestMethod]\n        public void SinkForExistingFileWillUseCreationDateToCalculateRollDate()\n        {\n            File.WriteAllText(fileName, \"existing text\");\n            File.SetCreationTime(fileName, new DateTime(2000, 01, 01));\n\n            using (var sink\n                = new RollingFlatFileSink(fileName, 0, \"yyyy\", RollFileExistsBehavior.Overwrite, RollInterval.Day, 0, new SimpleMessageFormatter(), false))\n            {\n                this.dateTimeProvider.CurrentDateTimeField = new DateTime(2008, 01, 01);\n                sink.RollingHelper.DateTimeProvider = this.dateTimeProvider;\n\n                Assert.IsTrue(sink.RollingHelper.UpdateRollingInformationIfNecessary());\n\n                Assert.AreEqual(sink.RollingHelper.CalculateNextRollDate(File.GetCreationTime(fileName)), sink.RollingHelper.NextRollDateTime);\n                Assert.AreEqual(this.dateTimeProvider.CurrentDateTime, sink.RollingHelper.CheckIsRollNecessary());\n            }\n        }\n\n        [TestMethod]\n        public void WriterKeepsTally()\n        {\n            using (var sink\n                = new RollingFlatFileSink(fileName, 10, \"yyyy\", RollFileExistsBehavior.Overwrite, RollInterval.Day, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.DateTimeProvider = this.dateTimeProvider;\n\n                Assert.IsTrue(sink.RollingHelper.UpdateRollingInformationIfNecessary());\n\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"12345\"));\n\n                Assert.AreEqual(5L, sink.Tally);\n            }\n        }\n\n        [TestMethod]\n        public void RolledFileWillHaveCurrentDateForTimestamp()\n        {\n            using (var sink\n                = new RollingFlatFileSink(fileName, 10, \"yyyy\", RollFileExistsBehavior.Overwrite, RollInterval.Day, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"1234567890\"));\n\n                Assert.IsTrue(sink.RollingHelper.UpdateRollingInformationIfNecessary());\n\n                sink.RollingHelper.PerformRoll(new DateTime(2007, 01, 01));\n\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"12345\"));\n\n                Assert.AreEqual(5L, sink.Tally);\n            }\n\n            Assert.IsTrue(File.Exists(fileName));\n            Assert.AreEqual(\"12345\", File.ReadAllText(fileName));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".2007\" + Extension));\n            Assert.AreEqual(\"1234567890\", File.ReadAllText(fileNameWithoutExtension + \".2007\" + Extension));\n        }\n\n        ////[TestMethod]\n        ////public void FallbackFileNameIsUsedForRoll()\n        ////{\n        ////    using (FileStream fileStream = File.Open(fileName, FileMode.CreateNew, FileAccess.Write, FileShare.Read))\n        ////    {\n        ////        using (var sink\n        ////            = new RollingFlatFileSink(fileName, 10, \"yyyy\", RollFileExistsBehavior.Overwrite, RollInterval.Day, 0, new SimpleMessageFormatter(), false))\n        ////        {\n        ////            sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n        ////            sink.OnNext(\"1234567890\");\n\n        ////            Assert.IsTrue(sink.RollingHelper.UpdateRollingInformationIfNecessary());\n\n        ////            sink.RollingHelper.PerformRoll(new DateTime(2007, 01, 01));\n        ////            sink.OnNext(\"12345\");\n\n        ////            Assert.AreEqual(5L, ((RollingFlatFileSink.TallyKeepingFileStreamWriter)sink.Writer).Tally);\n        ////        }\n        ////    }\n        ////}\n\n        [TestMethod]\n        public void RolledFileWithOverwriteWillOverwriteArchiveFileIfDateTemplateMatches()\n        {\n            using (var sink\n                = new RollingFlatFileSink(fileName, 0, \"yyyy\", RollFileExistsBehavior.Overwrite, RollInterval.Day, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"1234567890\"));\n\n                Assert.IsTrue(sink.RollingHelper.UpdateRollingInformationIfNecessary());\n\n                sink.RollingHelper.PerformRoll(new DateTime(2007, 01, 01));\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"12345\"));\n\n                Assert.IsTrue(sink.RollingHelper.UpdateRollingInformationIfNecessary());\n\n                sink.RollingHelper.PerformRoll(new DateTime(2007, 01, 01));\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"abcde\"));\n            }\n\n            Assert.IsTrue(File.Exists(fileName));\n            Assert.AreEqual(\"abcde\", File.ReadAllText(fileName));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".2007\" + Extension));\n            Assert.AreEqual(\"12345\", File.ReadAllText(fileNameWithoutExtension + \".2007\" + Extension));\n\n            string[] archiveFiles = Directory.GetFiles(\".\", fileNameWithoutExtension + \".2007\" + Extension + \"*\");\n            Assert.AreEqual(1, archiveFiles.Length);\n        }\n\n        [TestMethod]\n        public void RolledFileWithOverwriteWillCreateArchiveFileIfDateTemplateDoesNotMatch()\n        {\n            using (var sink\n                = new RollingFlatFileSink(fileName, 0, \"yyyy\", RollFileExistsBehavior.Overwrite, RollInterval.Day, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"1234567890\"));\n\n                Assert.IsTrue(sink.RollingHelper.UpdateRollingInformationIfNecessary());\n\n                sink.RollingHelper.PerformRoll(new DateTime(2007, 01, 01));\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"12345\"));\n\n                Assert.IsTrue(sink.RollingHelper.UpdateRollingInformationIfNecessary());\n\n                sink.RollingHelper.PerformRoll(new DateTime(2008, 01, 01));\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"abcde\"));\n            }\n\n            Assert.IsTrue(File.Exists(fileName));\n            Assert.AreEqual(\"abcde\", File.ReadAllText(fileName));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".2008\" + Extension));\n            Assert.AreEqual(\"12345\", File.ReadAllText(fileNameWithoutExtension + \".2008\" + Extension));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".2007\" + Extension));\n            Assert.AreEqual(\"1234567890\", File.ReadAllText(fileNameWithoutExtension + \".2007\" + Extension));\n\n            string[] archiveFiles = Directory.GetFiles(\".\", fileNameWithoutExtension + \".2007\" + Extension + \"*\");\n            Assert.AreEqual(1, archiveFiles.Length);\n            archiveFiles = Directory.GetFiles(\".\", fileNameWithoutExtension + \".2008\" + Extension + \"*\");\n            Assert.AreEqual(1, archiveFiles.Length);\n        }\n\n        [TestMethod]\n        public void RolledFileWithOverwriteAndCapWillCreateArchiveFileIfDateTemplateDoesNotMatchAndKeepTheNewest()\n        {\n            using (var sink\n                = new RollingFlatFileSink(\n                    fileName,\n                    0,\n                    \"yyyy\",\n                    RollFileExistsBehavior.Overwrite,\n                    RollInterval.Day,\n                    1,\n                    new SimpleMessageFormatter(),\n                    false))\n            {\n                var testTime = new DateTime(2007, 01, 01);\n\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                dateTimeProvider.CurrentDateTimeField = testTime;\n\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"1234567890\"));\n\n                sink.RollingHelper.PerformRoll(testTime);\n\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"12345\"));\n\n                dateTimeProvider.CurrentDateTimeField = testTime.AddYears(1);\n                sink.RollingHelper.PerformRoll(testTime.AddYears(1));\n\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"abcde\"));\n\n                dateTimeProvider.CurrentDateTimeField = testTime.AddYears(2);\n                sink.RollingHelper.PerformRoll(testTime.AddYears(2));\n\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"edcbe\"));\n            }\n\n            Assert.IsTrue(File.Exists(fileName));\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(\"edcbe\"));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".2009\" + Extension));\n            Assert.IsTrue(File.ReadAllText(fileNameWithoutExtension + \".2009\" + Extension).Contains(\"abcde\"));\n            Assert.IsFalse(File.Exists(fileNameWithoutExtension + \".2008\" + Extension));\n            Assert.IsFalse(File.Exists(fileNameWithoutExtension + \".2007\" + Extension));\n        }\n\n        [TestMethod]\n        public void RolledFileWithOverwriteWillFallBackToUniqueNameIfDateTemplateMatchesButArchiveFileIsInUse()\n        {\n            string targetArchiveFile = fileNameWithoutExtension + \".2007\" + Extension;\n\n            using (FileStream stream = File.Open(targetArchiveFile, FileMode.CreateNew, FileAccess.Write, FileShare.Read))\n            {\n                using (var sink\n                    = new RollingFlatFileSink(fileName, 0, \"yyyy\", RollFileExistsBehavior.Overwrite, RollInterval.Day, 0, new SimpleMessageFormatter(), false))\n                {\n                    sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                    sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"1234567890\"));\n\n                    Assert.IsTrue(sink.RollingHelper.UpdateRollingInformationIfNecessary());\n\n                    sink.RollingHelper.PerformRoll(new DateTime(2007, 01, 01));\n                    sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"12345\"));\n                }\n            }\n\n            Assert.IsTrue(File.Exists(fileName));\n            Assert.AreEqual(\"12345\", File.ReadAllText(fileName));\n            Assert.IsTrue(File.Exists(targetArchiveFile));\n            Assert.AreEqual(string.Empty, File.ReadAllText(targetArchiveFile)); // couldn't archive\n\n            string[] archiveFiles = Directory.GetFiles(\".\", targetArchiveFile + \"*\");\n            Assert.AreEqual(2, archiveFiles.Length);\n            foreach (string archiveFile in archiveFiles)\n            {\n                if (!Path.GetFileName(archiveFile).Equals(targetArchiveFile))\n                {\n                    Assert.AreEqual(\"1234567890\", File.ReadAllText(archiveFile));\n                }\n            }\n        }\n\n        [TestMethod]\n        public void RolledFileWithIncrementWillCreateArchiveFileIfDateTemplateDoesNotMatch()\n        {\n            using (var sink\n                = new RollingFlatFileSink(fileName, 0, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"1234567890\"));\n\n                Assert.IsTrue(sink.RollingHelper.UpdateRollingInformationIfNecessary());\n\n                sink.RollingHelper.PerformRoll(new DateTime(2007, 01, 01));\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"12345\"));\n\n                Assert.IsTrue(sink.RollingHelper.UpdateRollingInformationIfNecessary());\n\n                sink.RollingHelper.PerformRoll(new DateTime(2008, 01, 01));\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"abcde\"));\n            }\n\n            Assert.IsTrue(File.Exists(fileName));\n            Assert.AreEqual(\"abcde\", File.ReadAllText(fileName));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".2008.1\" + Extension));\n            Assert.AreEqual(\"12345\", File.ReadAllText(fileNameWithoutExtension + \".2008.1\" + Extension));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".2007.1\" + Extension));\n            Assert.AreEqual(\"1234567890\", File.ReadAllText(fileNameWithoutExtension + \".2007.1\" + Extension));\n\n            string[] archiveFiles = Directory.GetFiles(\".\", fileNameWithoutExtension + \".2007*\" + Extension + \"*\");\n            Assert.AreEqual(1, archiveFiles.Length);\n            archiveFiles = Directory.GetFiles(\".\", fileNameWithoutExtension + \".2008*\" + Extension + \"*\");\n            Assert.AreEqual(1, archiveFiles.Length);\n        }\n\n        [TestMethod]\n        public void RolledFileWithIncrementWillCreateArchiveFileWithMaxSequenceIfDateTemplateDoesMatch()\n        {\n            using (var sink\n                = new RollingFlatFileSink(fileName, 0, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"1234567890\"));\n\n                Assert.IsTrue(sink.RollingHelper.UpdateRollingInformationIfNecessary());\n\n                sink.RollingHelper.PerformRoll(new DateTime(2007, 01, 01));\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"12345\"));\n\n                Assert.IsTrue(sink.RollingHelper.UpdateRollingInformationIfNecessary());\n\n                sink.RollingHelper.PerformRoll(new DateTime(2007, 01, 02));\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"abcde\"));\n            }\n\n            Assert.IsTrue(File.Exists(fileName));\n            Assert.AreEqual(\"abcde\", File.ReadAllText(fileName));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".2007.2\" + Extension));\n            Assert.AreEqual(\"12345\", File.ReadAllText(fileNameWithoutExtension + \".2007.2\" + Extension));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".2007.1\" + Extension));\n            Assert.AreEqual(\"1234567890\", File.ReadAllText(fileNameWithoutExtension + \".2007.1\" + Extension));\n\n            string[] archiveFiles = Directory.GetFiles(\".\", fileNameWithoutExtension + \".2007*\" + Extension + \"*\");\n            Assert.AreEqual(2, archiveFiles.Length);\n        }\n\n        [TestMethod]\n        public void RolledFileWithIncrementAndCapWillCreateArchiveFileWithMaxSequenceIfDateTemplateDoesMatchAndKeepTheNewest()\n        {\n            using (var sink\n                = new RollingFlatFileSink(\n                    fileName,\n                    0,\n                    \"yyyy\",\n                    RollFileExistsBehavior.Increment,\n                    RollInterval.Day,\n                    1,\n                    new SimpleMessageFormatter(),\n                    false))\n            {\n                var testTime = new DateTime(2007, 01, 01);\n\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                dateTimeProvider.CurrentDateTimeField = testTime;\n\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"1234567890\"));\n\n                dateTimeProvider.CurrentDateTimeField = testTime.AddHours(12);\n\n                sink.RollingHelper.PerformRoll(testTime.AddHours(12));\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"12345\"));\n                dateTimeProvider.CurrentDateTimeField = testTime.AddHours(24);\n\n                sink.RollingHelper.PerformRoll(testTime.AddHours(24));\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"abcde\"));\n            }\n\n            Assert.IsTrue(File.Exists(fileName));\n            Assert.AreEqual(\"abcde\", File.ReadAllText(fileName));\n            Assert.IsTrue(File.Exists(fileNameWithoutExtension + \".2007.2\" + Extension));\n            Assert.AreEqual(\"12345\", File.ReadAllText(fileNameWithoutExtension + \".2007.2\" + Extension));\n            Assert.IsFalse(File.Exists(fileNameWithoutExtension + \".2007.1\" + Extension));\n\n            string[] archiveFiles = Directory.GetFiles(\".\", fileNameWithoutExtension + \".2007*\" + Extension + \"*\");\n            Assert.AreEqual(1, archiveFiles.Length);\n        }\n\n        [TestMethod]\n        public void WillRollForDateIfEnabled()\n        {\n            using (var sink\n                = new RollingFlatFileSink(fileName, 0, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n\n                dateTimeProvider.CurrentDateTimeField = DateTime.Now;\n                sink.RollingHelper.UpdateRollingInformationIfNecessary();\n\n                dateTimeProvider.CurrentDateTimeField = DateTime.Now.AddDays(2);\n                Assert.IsNotNull(sink.RollingHelper.CheckIsRollNecessary());\n            }\n\n            using (var sink\n                = new RollingFlatFileSink(fileName, 0, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.None, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.UpdateRollingInformationIfNecessary();\n\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n\n                dateTimeProvider.CurrentDateTimeField = DateTime.Now;\n                sink.RollingHelper.UpdateRollingInformationIfNecessary();\n\n                dateTimeProvider.CurrentDateTimeField = DateTime.Now.AddDays(2);\n                Assert.IsNull(sink.RollingHelper.CheckIsRollNecessary());\n            }\n        }\n\n        [TestMethod]\n        public void WillRollForSize()\n        {\n            using (var sink\n                = new RollingFlatFileSink(fileName, 1, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Year, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.UpdateRollingInformationIfNecessary();\n\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: new string('c', 1200)));\n\n                Assert.IsNotNull(sink.RollingHelper.CheckIsRollNecessary());\n            }\n\n            using (var sink\n                = new RollingFlatFileSink(fileName, 0, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Year, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.UpdateRollingInformationIfNecessary();\n\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: new string('c', 1200)));\n\n                Assert.IsNull(sink.RollingHelper.CheckIsRollNecessary());\n            }\n        }\n\n        [TestMethod]\n        public void FindsLastSequenceOnFiles()\n        {\n            for (int i = 0; i < 15; i++)\n            {\n                if (i % 2 == 0 || i % 3 == 0)\n                {\n                    string tempfilename = fileNameWithoutExtension + \".\" + i + Extension;\n                    File.WriteAllText(tempfilename, \"some text\");\n                }\n            }\n\n            int maxSequenceNumber\n                = RollingFlatFileSink.StreamWriterRollingHelper.FindMaxSequenceNumber(\".\",\n                                                                                               fileNameWithoutExtension,\n                                                                                               Extension);\n\n            Assert.AreEqual(14, maxSequenceNumber);\n        }\n\n        [TestMethod]\n        public void WillNotRollWhenTracingIfNotOverThresholds()\n        {\n            using (var sink\n                = new RollingFlatFileSink(fileName, 0, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n            }\n        }\n\n        [TestMethod]\n        public void WillRollExistingFileIfOverSizeThreshold()\n        {\n            string existingPayload = new string('c', 5000);\n            DateTime currentDateTime = new DateTime(2007, 1, 1);\n            File.WriteAllText(fileName, existingPayload);\n            File.SetCreationTime(fileName, currentDateTime);\n\n            using (var sink\n                = new RollingFlatFileSink(fileName, 1, \"yyyy\", RollFileExistsBehavior.Overwrite, RollInterval.None, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                dateTimeProvider.CurrentDateTimeField = currentDateTime;\n\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"logged message\"));\n            }\n\n            Assert.AreEqual(existingPayload, File.ReadAllText(fileNameWithoutExtension + \".2007\" + Extension));\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(\"logged message\"));\n        }\n\n        [TestMethod]\n        public void WillRollExistingFileIfOverSizeThresholdAndNoPatternIsSpecifiedForIncrementBehavior()\n        {\n            string existingPayload = new string('c', 5000);\n            DateTime currentDateTime = new DateTime(2007, 1, 1);\n            File.WriteAllText(fileName, existingPayload);\n            File.SetCreationTime(fileName, currentDateTime);\n\n            using (var sink\n                = new RollingFlatFileSink(fileName, 1, string.Empty, RollFileExistsBehavior.Increment, RollInterval.None, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                dateTimeProvider.CurrentDateTimeField = currentDateTime;\n\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"logged message\"));\n            }\n\n            Assert.AreEqual(existingPayload, File.ReadAllText(fileNameWithoutExtension + \".1\" + Extension));\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(\"logged message\"));\n        }\n\n        [TestMethod]\n        public void WillRollExistingFileIfOverSizeThresholdAndNoPatternIsSpecifiedForIncrementBehaviorWhenUsingAsync()\n        {\n            string existingPayload = new string('c', 5000);\n            DateTime currentDateTime = new DateTime(2007, 1, 1);\n            File.WriteAllText(fileName, existingPayload);\n            File.SetCreationTime(fileName, currentDateTime);\n\n            using (var sink\n                = new RollingFlatFileSink(fileName, 1, string.Empty, RollFileExistsBehavior.Increment, RollInterval.None, 0, new SimpleMessageFormatter(), isAsync: true))\n            {\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                dateTimeProvider.CurrentDateTimeField = currentDateTime;\n\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"logged message\"));\n                sink.FlushAsync().Wait();\n            }\n\n            Assert.AreEqual(existingPayload, File.ReadAllText(fileNameWithoutExtension + \".1\" + Extension));\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(\"logged message\"));\n        }\n\n        [TestMethod]\n        public void WillTruncateExistingFileIfOverSizeThresholdAndNoPatternIsSpecifiedForOverwriteBehavior()\n        {\n            string existingPayload = new string('c', 5000);\n            DateTime currentDateTime = new DateTime(2007, 1, 1);\n            File.WriteAllText(fileName, existingPayload);\n            File.SetCreationTime(fileName, currentDateTime);\n\n            using (var sink\n                = new RollingFlatFileSink(fileName, 1, string.Empty, RollFileExistsBehavior.Overwrite, RollInterval.None, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                dateTimeProvider.CurrentDateTimeField = currentDateTime;\n\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"logged message\"));\n            }\n\n            Assert.IsFalse(File.ReadAllText(fileName).Contains(existingPayload));\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(\"logged message\"));\n        }\n\n        [TestMethod]\n        public void WillRollExistingFileIfOverDateThreshold()\n        {\n            string existingPayload = new string('c', 10);\n            DateTime currentDateTime = new DateTime(2007, 1, 1);\n            File.WriteAllText(fileName, existingPayload);\n            File.SetCreationTime(fileName, currentDateTime);\n\n            using (var sink\n                = new RollingFlatFileSink(fileName, 1, \"yyyy\", RollFileExistsBehavior.Overwrite, RollInterval.Day, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n                dateTimeProvider.CurrentDateTimeField = currentDateTime.AddDays(2);\n\n                sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"logged message\"));\n            }\n\n            Assert.AreEqual(existingPayload, File.ReadAllText(fileNameWithoutExtension + \".2007\" + Extension));\n            Assert.IsTrue(File.ReadAllText(fileName).Contains(\"logged message\"));\n        }\n\n        [TestMethod]\n        public void RolledAtMidnight()\n        {\n            DateTime rollDate = DateTime.Now.AddDays(1).Date;\n\n            using (var sink\n                = new RollingFlatFileSink(fileName, 0, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Midnight, 0, new SimpleMessageFormatter(), false))\n            {\n                sink.RollingHelper.DateTimeProvider = dateTimeProvider;\n\n                dateTimeProvider.CurrentDateTimeField = rollDate;\n\n                sink.RollingHelper.UpdateRollingInformationIfNecessary();\n\n                Assert.IsNotNull(sink.RollingHelper.NextRollDateTime);\n                Assert.IsNotNull(sink.RollingHelper.CheckIsRollNecessary());\n                Assert.AreEqual(rollDate, sink.RollingHelper.NextRollDateTime);\n            }\n        }\n\n        [TestMethod]\n        public void ConcurrentAppendsEntriesToRollingFlatFile()\n        {\n            const int NumberOfEntries = 300;\n\n            using (var sink = new RollingFlatFileSink(fileName, 0, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), false))\n            {\n                Parallel.For(0, NumberOfEntries, i => sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"Info-\" + i + \":\")));\n            }\n\n            Assert.AreEqual<int>(NumberOfEntries, File.ReadAllText(fileName).Split(new string[] { \":\" }, StringSplitOptions.RemoveEmptyEntries).Length);\n        }\n\n        [TestMethod]\n        [Ignore]    // TODO fix race condition\n        public void ConcurrentAppendsEntriesToFlatFileWhenUsingAsync()\n        {\n            const int NumberOfEntries = 300;\n\n            using (var sink = new RollingFlatFileSink(fileName, 0, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, 0, new SimpleMessageFormatter(), isAsync: true))\n            {\n                Parallel.For(0, NumberOfEntries, i => sink.OnNext(EventEntryTestHelper.Create(formattedMessage: \"|\" + i)));\n                sink.FlushAsync().Wait();\n            }\n\n            var entries = File.ReadAllText(fileName).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries);\n            Assert.AreEqual<int>(NumberOfEntries, entries.Length);\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                CollectionAssert.Contains(entries, i.ToString());\n            }\n        }\n\n        [TestMethod]\n        public void RollingFlatFileCreatesSubDirectories()\n        {\n            string file = @\"dir1\\dir2\\rolling\\patterns\\practices\\log.xt\";\n            using (var sink = new RollingFlatFileSink(file, 1024, \"yyyy\", RollFileExistsBehavior.Increment, RollInterval.Day, -1, new SimpleMessageFormatter(), false))\n            {\n                Assert.IsTrue(new DirectoryInfo(Path.GetDirectoryName(file)).Exists);\n            }\n\n            Directory.Delete(Path.GetDirectoryName(file), true);\n        }\n\n        private class MockDateTimeProvider : RollingFlatFileSink.DateTimeProvider\n        {\n            public DateTime? CurrentDateTimeField = null;\n\n            public override DateTime CurrentDateTime\n            {\n                get\n                {\n                    if (CurrentDateTimeField != null) { return CurrentDateTimeField.Value; }\n\n                    return base.CurrentDateTime;\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Sinks/SqlDatabaseSinkTests.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Configuration;\nusing System.Data.SqlClient;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Properties;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Sinks\n{\n    [TestClass]\n    public class sql_db_sink_given_configuration\n    {\n        private static readonly string ValidConnectionString = ConfigurationManager.ConnectionStrings[\"valid\"].ConnectionString;\n        private static readonly string InvalidConnectionString = ConfigurationManager.ConnectionStrings[\"invalid\"].ConnectionString;\n\n        [TestMethod]\n        public void when_creating_listener_for_null_instance_name_then_throws()\n        {\n            AssertEx.Throws<ArgumentNullException>(() => new SqlDatabaseSink(null, \"valid\", \"tableName\", \"storedProcedureName\", Buffering.DefaultBufferingInterval, Buffering.DefaultBufferingCount, Buffering.DefaultMaxBufferSize, Timeout.InfiniteTimeSpan));\n        }\n\n        [TestMethod]\n        public void when_creating_listener_for_null_connection_string_then_throws()\n        {\n            AssertEx.Throws<ArgumentNullException>(() => new SqlDatabaseSink(\"test\", null, \"tableName\", \"storedProcedureName\", Buffering.DefaultBufferingInterval, Buffering.DefaultBufferingCount, Buffering.DefaultMaxBufferSize, Timeout.InfiniteTimeSpan));\n        }\n\n        [TestMethod]\n        public void when_creating_listener_with_invalid_connection_string_then_throws()\n        {\n            AssertEx.Throws<ArgumentException>(() => new SqlDatabaseSink(\"test\", InvalidConnectionString, \"tableName\", \"storedProcedureName\", Buffering.DefaultBufferingInterval, Buffering.DefaultBufferingCount, Buffering.DefaultMaxBufferSize, Timeout.InfiniteTimeSpan));\n        }\n\n        [TestMethod]\n        public void when_cannot_connect_to_database_then_flush_should_finish_faulted()\n        {\n            const string ValidNotExisting = @\"Data Source=(localdb)\\v11.0; AttachDBFilename='|DataDirectory|\\DoesNotExist.mdf';Initial Catalog=SemanticLoggingTests;Integrated Security=True\";\n\n            using (var sink = new SqlDatabaseSink(\"test\", ValidNotExisting, \"tableName\", \"storedProcedureName\", Buffering.DefaultBufferingInterval, Buffering.DefaultBufferingCount, Buffering.DefaultMaxBufferSize, TimeSpan.FromSeconds(20)))\n            using (var collectErrorsListener = new MockEventListener())\n            {\n                collectErrorsListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Error, Keywords.All);\n\n                sink.OnNext(EventEntryTestHelper.Create());\n                try\n                {\n                    Assert.IsTrue(sink.FlushAsync().Wait(TimeSpan.FromSeconds(5)));\n                    Assert.Fail(\"Exception should be thrown.\");\n                }\n                catch (AggregateException ex)\n                {\n                    Assert.IsInstanceOfType(ex.InnerException, typeof(FlushFailedException));\n                }\n\n                Assert.IsTrue(collectErrorsListener.WrittenEntries.Any(x => x.EventId == 101));\n            }\n        }\n\n        [TestMethod]\n        public void when_cannot_connect_to_database_then_on_completed_should_not_stall_or_throw()\n        {\n            const string ValidNotExisting = @\"Data Source=(localdb)\\v11.0; AttachDBFilename='|DataDirectory|\\DoesNotExist.mdf';Initial Catalog=SemanticLoggingTests;Integrated Security=True\";\n\n            using (var sink = new SqlDatabaseSink(\"test\", ValidNotExisting, \"tableName\", \"storedProcedureName\", Buffering.DefaultBufferingInterval, Buffering.DefaultBufferingCount, Buffering.DefaultMaxBufferSize, TimeSpan.FromSeconds(20)))\n            using (var collectErrorsListener = new MockEventListener())\n            {\n                collectErrorsListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Error, Keywords.All);\n\n                sink.OnNext(EventEntryTestHelper.Create());\n                Assert.IsTrue(Task.Run(() => sink.OnCompleted()).Wait(TimeSpan.FromSeconds(5)));\n\n                Assert.IsTrue(collectErrorsListener.WrittenEntries.Any(x => x.EventId == 101));\n            }\n        }\n    }\n\n    public class given_empty_logging_database : LocalDatabaseContext\n    {\n        protected override string GetLocalDatabaseFileName()\n        {\n            return \"sqldbtests\" + new Random().Next(1000, 9999).ToString();\n        }\n\n        protected override void Given()\n        {\n            base.Given();\n\n            this.localDbConnection.ChangeDatabase(this.dbName);\n\n            using (var cmd = new SqlCommand(Resources.CreateTracesTable, this.localDbConnection))\n            {\n                cmd.ExecuteNonQuery();\n            }\n\n            using (var cmd = new SqlCommand(Resources.CreateTracesType, this.localDbConnection))\n            {\n                cmd.ExecuteNonQuery();\n            }\n\n            using (var cmd = new SqlCommand(Resources.CreateProcedureWriteTraces, this.localDbConnection))\n            {\n                cmd.ExecuteNonQuery();\n            }\n        }\n    }\n\n    [TestClass]\n    public class when_receiving_many_events_with_imperative_flush : given_empty_logging_database\n    {\n        private const int NumberOfEntries = 10000;\n        private const string InstanceName = \"instance name\";\n\n        protected SqlDatabaseSink sink;\n        protected MockEventListener collectErrorsListener;\n\n        protected override void Given()\n        {\n            base.Given();\n            this.sink = new SqlDatabaseSink(InstanceName, this.GetSqlConnectionString(), SqlDatabaseLog.DefaultTableName, SqlDatabaseLog.DefaultStoredProcedureName, Buffering.DefaultBufferingInterval, NumberOfEntries, Buffering.DefaultMaxBufferSize, Timeout.InfiniteTimeSpan);\n            this.collectErrorsListener = new MockEventListener();\n            this.collectErrorsListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Error, Keywords.All);\n        }\n\n        protected override void OnCleanup()\n        {\n            using (this.sink) { }\n            using (this.collectErrorsListener) { }\n            base.OnCleanup();\n        }\n\n        [TestMethod]\n        public void then_all_events_should_be_flushed()\n        {\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                var entry =\n                    EventEntryTestHelper.Create(\n                        providerId: Guid.NewGuid(),\n                        providerName: \"TestName\",\n                        eventId: 50,\n                        level: EventLevel.Verbose,\n                        opcode: (EventOpcode)5,\n                        task: (EventTask)6,\n                        timestamp: DateTimeOffset.UtcNow,\n                        version: 2,\n                        formattedMessage: \"Test\" + i,\n                        payloadNames: new string[] { \"arg0\" },\n                        payload: new object[] { \"Test\" },\n                        activityId: Guid.NewGuid(),\n                        relatedActivityId: Guid.NewGuid());\n\n                this.sink.OnNext(entry);\n            }\n\n            Thread.Sleep(50);\n\n            this.sink.FlushAsync().Wait();\n\n            int count;\n\n            using (var cmd = new SqlCommand(\"SELECT COUNT(*) FROM Traces\", this.localDbConnection))\n            {\n                count = (int)cmd.ExecuteScalar();\n            }\n\n            Assert.AreEqual<int>(NumberOfEntries, count);\n        }\n\n        [TestMethod]\n        public void then_should_write_properties()\n        {\n            var entry = CreateValidEntry(\n                processId: 300,\n                threadId: 500);\n            this.sink.OnNext(entry);\n\n            this.sink.FlushAsync().Wait();\n\n            using (var cmd = new SqlCommand(\"SELECT * FROM Traces\", this.localDbConnection))\n            {\n                using (var reader = cmd.ExecuteReader())\n                {\n                    Assert.IsTrue(reader.Read());\n\n                    Assert.AreEqual<Guid>(entry.ProviderId, (Guid)reader[\"ProviderId\"]);\n                    Assert.AreEqual<string>(entry.Schema.ProviderName, (string)reader[\"ProviderName\"]);\n                    Assert.AreEqual<int>(entry.EventId, (int)reader[\"EventId\"]);\n                    Assert.AreEqual<int>((int)entry.Schema.Level, (int)reader[\"Level\"]);\n                    Assert.AreEqual<int>((int)entry.Schema.Opcode, (int)reader[\"Opcode\"]);\n                    Assert.AreEqual<int>((int)entry.Schema.Task, (int)reader[\"Task\"]);\n                    Assert.AreEqual<DateTimeOffset>(entry.Timestamp, (DateTimeOffset)reader[\"Timestamp\"]);\n                    Assert.AreEqual<int>(entry.Schema.Version, (int)reader[\"Version\"]);\n                    Assert.AreEqual<string>(InstanceName, (string)reader[\"InstanceName\"]);\n                    Assert.AreEqual<string>(entry.FormattedMessage, (string)reader[\"FormattedMessage\"]);\n                    //Assert.AreEqual<string>(entry.Payload, (string)reader[\"Payload\"]);\n                    Assert.AreEqual<Guid>(Guid.Empty, (Guid)reader[\"ActivityId\"]);\n                    Assert.AreEqual<Guid>(Guid.Empty, (Guid)reader[\"RelatedActivityId\"]);\n                    Assert.AreEqual<int>(entry.ProcessId, (int)reader[\"ProcessId\"]);\n                    Assert.AreEqual<int>(entry.ThreadId, (int)reader[\"ThreadId\"]);\n                }\n            }\n        }\n\n        [TestMethod]\n        public void then_should_write_properties_with_activity_id()\n        {\n            var entry = CreateValidEntry(\n                activityId: Guid.Parse(\"{D6A8536E-398F-4AD5-BB0A-3BFFD05EF5CB}\"),\n                relatedActivityId: Guid.Parse(\"{28ED52F1-1AB2-4B8C-9F30-4382BE2928AA}\"));\n            this.sink.OnNext(entry);\n\n            this.sink.FlushAsync().Wait();\n\n            using (var cmd = new SqlCommand(\"SELECT * FROM Traces\", this.localDbConnection))\n            {\n                using (var reader = cmd.ExecuteReader())\n                {\n                    Assert.IsTrue(reader.Read());\n\n                    Assert.AreEqual<Guid>(entry.ProviderId, (Guid)reader[\"ProviderId\"]);\n                    Assert.AreEqual<string>(entry.Schema.ProviderName, (string)reader[\"ProviderName\"]);\n                    Assert.AreEqual<int>(entry.EventId, (int)reader[\"EventId\"]);\n                    Assert.AreEqual<int>((int)entry.Schema.Level, (int)reader[\"Level\"]);\n                    Assert.AreEqual<int>((int)entry.Schema.Opcode, (int)reader[\"Opcode\"]);\n                    Assert.AreEqual<int>((int)entry.Schema.Task, (int)reader[\"Task\"]);\n                    Assert.AreEqual<DateTimeOffset>(entry.Timestamp, (DateTimeOffset)reader[\"Timestamp\"]);\n                    Assert.AreEqual<int>(entry.Schema.Version, (int)reader[\"Version\"]);\n                    Assert.AreEqual<string>(InstanceName, (string)reader[\"InstanceName\"]);\n                    Assert.AreEqual<string>(entry.FormattedMessage, (string)reader[\"FormattedMessage\"]);\n                    //Assert.AreEqual<string>(entry.Payload, (string)reader[\"Payload\"]);\n                    Assert.AreEqual<Guid>(entry.ActivityId, (Guid)reader[\"ActivityId\"]);\n                    Assert.AreEqual<Guid>(entry.RelatedActivityId, (Guid)reader[\"RelatedActivityId\"]);\n                }\n            }\n        }\n\n        ////[TestMethod]\n        ////public void then_should_not_log_cancelled_error()\n        ////{\n        ////    for (int i = 0; i < NumberOfEntries - 1; i++)\n        ////    {\n        ////        this.sink.OnNext(CreateValidEntry());\n        ////    }\n\n        ////    this.sink.FlushAsync();\n        ////    Thread.Sleep(1000);\n        ////    this.sink.Dispose();\n\n        ////    Assert.IsFalse(collectErrorsListener.WrittenEntries.Any(x => x.EventId == 101));\n        ////}\n\n        [TestMethod]\n        public void then_defaults_EventSourceName_property()\n        {\n            var entry = CreateValidEntry(providerName: null);\n\n            sink.OnNext(entry);\n            sink.FlushAsync().Wait(TimeSpan.FromSeconds(5));\n\n            using (var cmd = new SqlCommand(\"SELECT [ProviderName] FROM Traces\", this.localDbConnection))\n            {\n                Assert.AreEqual(string.Empty, (string)cmd.ExecuteScalar());\n            }\n        }\n\n        [TestMethod]\n        public void then_should_truncate_longer_properties()\n        {\n            var entry = CreateValidEntry(\n                providerName: new string('a', 5000));\n            //entry.InstanceName = new string('b', 5000);\n\n            sink.OnNext(entry);\n            sink.FlushAsync().Wait(TimeSpan.FromSeconds(5));\n\n            using (var cmd = new SqlCommand(\"SELECT * FROM Traces\", this.localDbConnection))\n            {\n                using (var reader = cmd.ExecuteReader())\n                {\n                    Assert.IsTrue(reader.Read());\n\n                    Assert.AreEqual<string>(entry.Schema.ProviderName.Substring(0, 500), (string)reader[\"ProviderName\"]);\n                    //Assert.AreEqual<string>(entry.InstanceName.Substring(0, 1000), (string)reader[\"InstanceName\"]);\n                }\n            }\n        }\n\n        private static EventEntry CreateValidEntry(string providerName = \"TestName\", int processId = 0, int threadId = 0, Guid activityId = default(Guid), Guid relatedActivityId = default(Guid))\n        {\n            var record =\n                EventEntryTestHelper.Create(\n                    providerId: Guid.NewGuid(),\n                    providerName: providerName,\n                    eventId: 50,\n                    level: EventLevel.Verbose,\n                    opcode: (EventOpcode)5,\n                    task: (EventTask)6,\n                    timestamp: DateTimeOffset.UtcNow,\n                    version: 2,\n                    formattedMessage: \"Formatted message\",\n                    payloadNames: new string[] { \"arg0\" },\n                    payload: new object[] { \"Test\" },\n                    processId: processId,\n                    threadId: threadId,\n                    activityId: activityId,\n                    relatedActivityId: relatedActivityId);\n\n            return record;\n        }\n    }\n\n    [TestClass]\n    public class when_using_small_buffering_count : given_empty_logging_database\n    {\n        private const int BufferingCount = 5;\n\n        protected SqlDatabaseSink sink;\n\n        protected override void Given()\n        {\n            base.Given();\n            this.sink = new SqlDatabaseSink(\n                \"TestInstanceName\",\n                this.GetSqlConnectionString(),\n                SqlDatabaseLog.DefaultTableName,\n                SqlDatabaseLog.DefaultStoredProcedureName,\n                TimeSpan.FromMinutes(1),\n                BufferingCount,\n                Buffering.DefaultMaxBufferSize,\n                Timeout.InfiniteTimeSpan);\n        }\n\n        protected override void OnCleanup()\n        {\n            this.sink.Dispose();\n            base.OnCleanup();\n        }\n\n        [TestMethod]\n        public void then_writing_more_events_should_flush_only_the_batch_size()\n        {\n            for (int i = 0; i < BufferingCount + 2; i++)\n            {\n                var entry =\n                    EventEntryTestHelper.Create(\n                        providerId: Guid.NewGuid(),\n                        providerName: \"TestName\",\n                        eventId: 50,\n                        level: EventLevel.Verbose,\n                        opcode: (EventOpcode)5,\n                        task: (EventTask)6,\n                        timestamp: DateTimeOffset.UtcNow,\n                        version: 2,\n                        formattedMessage: \"Test\" + i,\n                        payloadNames: new string[] { \"arg0\" },\n                        payload: new object[] { \"Test\" });\n\n                this.sink.OnNext(entry);\n                Thread.Sleep(10);\n            }\n\n            int count = PollingHelper.WaitUntil(() =>\n                {\n                    using (var cmd = new SqlCommand(\"SELECT COUNT(*) FROM Traces\", this.localDbConnection))\n                    {\n                        return (int)cmd.ExecuteScalar();\n                    }\n                },\n                c => c > 0,\n                TimeSpan.FromSeconds(30));\n\n            this.sink.Dispose();\n\n            Assert.AreEqual(BufferingCount, count);\n        }\n\n        //[TestClass]\n        //public class when_single_invalid_record_in_batch : given_empty_logging_database\n        //{\n        //    private const int BufferingCount = 129;\n\n        //    protected SqlDatabaseSink sink;\n\n        //    protected override void Given()\n        //    {\n        //        base.Given();\n        //        this.sink = new SqlDatabaseSink(\n        //            \"TestInstanceName\",\n        //            this.GetSqlConnectionString(),\n        //            SqlDatabaseLog.DefaultTableName,\n        //            Timeout.InfiniteTimeSpan,\n        //            BufferingCount,\n        //            Buffering.DefaultMaxBufferSize,\n        //            Timeout.InfiniteTimeSpan);\n        //    }\n\n        //    protected override void When()\n        //    {\n        //        // how do we create an invalid entry??\n        //        var invalid = new EventRecord();\n        //        this.sink.OnNext(invalid);\n\n        //        for (int i = 1; i < BufferingCount; i++)\n        //        {\n        //            var entry = new EventRecord\n        //            {\n        //                ProviderId = Guid.NewGuid(),\n        //                ProviderName = \"TestName\",\n        //                EventId = 50,\n        //                Level = \"Verbose\",\n        //                Opcode = 5,\n        //                Task = 6,\n        //                Timestamp = DateTimeOffset.UtcNow,\n        //                Version = 2,\n        //                InstanceName = \"Custom instance name\",\n        //                FormattedMessage = \"Test\" + i,\n        //                Payload = \"{arg0:Test}\"\n        //            };\n\n        //            this.sink.OnNext(entry);\n        //        }\n        //    }\n\n        //    protected override void OnCleanup()\n        //    {\n        //        this.sink.Dispose();\n        //        base.OnCleanup();\n        //    }\n\n        //    [TestMethod]\n        //    public void then_all_valid_records_should_flush()\n        //    {\n        //        int count = PollingHelper.WaitUntil(() =>\n        //        {\n        //            using (var cmd = new SqlCommand(\"SELECT COUNT(*) FROM Traces\", this.LocalDbConnection))\n        //            {\n        //                return (int)cmd.ExecuteScalar();\n        //            }\n        //        }, c => c > 0, TimeSpan.FromSeconds(5));\n\n        //        Assert.AreEqual(BufferingCount - 1, count);\n        //    }\n        //}\n\n        //[TestClass]\n        //public class when_multiple_invalid_record_in_batch : given_empty_logging_database\n        //{\n        //    private const int BufferingCount = 129;\n        //    protected SqlDatabaseSink sink;\n        //    protected InMemoryEventListener listener = new InMemoryEventListener();\n\n        //    protected override void Given()\n        //    {\n        //        base.Given();\n        //        this.sink = new SqlDatabaseSink(\n        //            \"TestInstanceName\",\n        //            this.GetSqlConnectionString(),\n        //            SqlDatabaseLog.DefaultTableName,\n        //            Timeout.InfiniteTimeSpan,\n        //            BufferingCount,\n        //            Buffering.DefaultMaxBufferSize,\n        //            Timeout.InfiniteTimeSpan);\n\n        //        this.listener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Error, Keywords.All);\n        //    }\n\n        //    protected override void When()\n        //    {\n        //        for (int i = 0; i < 4; i++)\n        //        {\n        //            // how do we create an invalid entry??\n        //            var invalid = new EventRecord();\n        //            this.sink.OnNext(invalid);\n        //        }\n\n        //        for (int i = 4; i < BufferingCount; i++)\n        //        {\n        //            var entry = new EventRecord\n        //            {\n        //                ProviderId = Guid.NewGuid(),\n        //                ProviderName = \"TestName\",\n        //                EventId = 50,\n        //                Level = (int)EventLevel.Verbose,\n        //                Opcode = 5,\n        //                Task = 6,\n        //                Timestamp = DateTimeOffset.UtcNow,\n        //                Version = 2,\n        //                InstanceName = \"Custom instance name\",\n        //                FormattedMessage = \"Test\" + i,\n        //                Payload = \"{arg0:Test}\"\n        //            };\n\n        //            this.sink.OnNext(entry);\n        //        }\n        //    }\n\n        //    protected override void OnCleanup()\n        //    {\n        //        this.listener.DisableEvents(SemanticLoggingEventSource.Log);\n        //        this.listener.Dispose();\n        //        this.sink.Dispose();\n        //        base.OnCleanup();\n        //    }\n\n        //    [TestMethod]\n        //    public void then_no_records_should_flush()\n        //    {\n        //        this.listener.WaitSignalCondition = () => this.listener.EventWrittenCount == 4;\n        //        bool signaled = this.listener.WaitOnAsyncEvents.WaitOne(3000);\n\n        //        Assert.IsTrue(signaled);\n        //    }\n        //}\n    }\n}"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Sinks/TallyKeepingFileStreamWriterTests.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.IO;\nusing System.Text;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.EventListeners\n{\n    [TestClass]\n    public class TallyKeepingFileStreamWriterTests\n    {\n        private string fileName = Guid.NewGuid().ToString();\n\n        [TestCleanup]\n        public void TearDown()\n        {\n            if (File.Exists(fileName))\n            {\n                File.Delete(fileName);\n            }\n        }\n\n        [TestMethod]\n        public void InitializesTallyForNewFile()\n        {\n            using (var writer\n                = new TallyKeepingFileStreamWriter(File.Open(fileName, FileMode.Append, FileAccess.Write, FileShare.Read)))\n            {\n                Assert.AreEqual(0L, writer.Tally);\n            }\n        }\n\n        [TestMethod]\n        public void InitializesTallyForExistingFile()\n        {\n            File.WriteAllText(fileName, \"12345\");\n            using (var writer\n                = new TallyKeepingFileStreamWriter(File.Open(fileName, FileMode.Append, FileAccess.Write, FileShare.Read)))\n            {\n                Assert.AreEqual(5L, writer.Tally);\n            }\n\n            File.WriteAllText(fileName, \"12345\");\n            using (var writer\n                = new TallyKeepingFileStreamWriter(File.Open(fileName, FileMode.Create, FileAccess.Write, FileShare.Read)))\n            {\n                Assert.AreEqual(0L, writer.Tally);\n            }\n\n            File.WriteAllText(fileName, \"12345\");\n            using (var writer\n                = new TallyKeepingFileStreamWriter(File.Open(fileName, FileMode.Truncate, FileAccess.Write, FileShare.Read)))\n            {\n                Assert.AreEqual(0L, writer.Tally);\n            }\n        }\n\n        [TestMethod]\n        public void WritingToFileUpdatesTally()\n        {\n            using (var writer\n                = new TallyKeepingFileStreamWriter(File.Open(fileName, FileMode.Append, FileAccess.Write, FileShare.Read)))\n            {\n                writer.Write(\"12345\");\n                writer.Flush();\n\n                Assert.AreEqual(5L, writer.Tally);\n            }\n        }\n\n        [TestMethod]\n        public void WritingToFileWithEncodingUpdatesTally()\n        {\n            using (var writer\n                = new TallyKeepingFileStreamWriter(File.Open(fileName, FileMode.Append, FileAccess.Write, FileShare.Read),\n                                                                                Encoding.UTF32))\n            {\n                writer.Write(\"12345\");\n                writer.Flush();\n\n                Assert.AreEqual(20L, writer.Tally); // BOM is not part of tally - minimal fidelity loss on new files.\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Sinks/WindowsAzureTableSinkFixture_Integration.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Threading;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.WindowsAzure;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.EventListeners;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing Microsoft.WindowsAzure.Storage;\nusing Microsoft.WindowsAzure.Storage.Table;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Sinks.WindowsAzureTableSinkFixture_Integration\n{\n    public class given_empty_account : ArrangeActAssert\n    {\n        protected string connectionString;\n        private CloudStorageAccount account;\n        protected CloudTableClient client;\n        protected string tableName;\n        protected WindowsAzureTableSink sink;\n\n        protected virtual string InstanceName\n        {\n            get { return \"TestInstanceName\"; }\n        }\n\n        protected override void Arrange()\n        {\n            this.connectionString = ConfigurationHelper.GetSetting(\"StorageConnectionString\");\n\n            if (string.IsNullOrEmpty(connectionString)\n                || connectionString.Contains(\"[AccountName]\")\n                || connectionString.Contains(\"[AccountKey]\"))\n            {\n                Assert.Inconclusive(\"Cannot run tests because the Azure Storage credentials are not configured\");\n            }\n\n            this.account = CloudStorageAccount.Parse(connectionString);\n            this.client = this.account.CreateCloudTableClient();\n            this.tableName = \"AzureTableEventListenerTests\" +\n                             new Random(unchecked((int)DateTime.Now.Ticks)).Next(10000).ToString();\n\n            this.sink = new WindowsAzureTableSink(InstanceName, connectionString, tableName, TimeSpan.FromSeconds(1),\n                5000, Timeout.InfiniteTimeSpan);\n        }\n\n        protected override void Teardown()\n        {\n            base.Teardown();\n            this.sink.Dispose();\n\n            if (this.tableName != null)\n            {\n                this.account.CreateCloudTableClient().GetTableReference(tableName).DeleteIfExists();\n            }\n        }\n    }\n\n    public class time_consuming_test : given_empty_account\n    {\n        protected override void Arrange()\n        {\n            var runSlowTests = ConfigurationHelper.GetSetting(\"RunSlowIntegrationTests\");\n\n            if (string.IsNullOrEmpty(runSlowTests) || runSlowTests.Equals(\"false\", StringComparison.OrdinalIgnoreCase) ||\n                runSlowTests.Equals(\"0\"))\n            {\n                Assert.Inconclusive(\n                    \"Skipping integration tests that are time-consuming because the RunSlowIntegrationTests setting is not set to true in the app.config file.\");\n            }\n\n            base.Arrange();\n        }\n    }\n\n    [TestClass]\n    public class when_writing_to_in_ascending_order : given_empty_account\n    {\n        protected override void Act()\n        {\n            base.Act();\n\n            sink.SortKeysAscending = true;\n\n            sink.OnNext(\n                new CloudEventEntry(EventEntryTestHelper.Create(\n                    eventId: 1,\n                    payloadNames: new string[] { \"arg1\" },\n                    payload: new object[] { \"value arg1\" })));\n\n            sink.OnNext(\n                new CloudEventEntry(EventEntryTestHelper.Create(\n                    eventId: 2,\n                    payloadNames: new string[] { \"arg2\" },\n                    payload: new object[] { \"value arg2\" })));\n\n            sink.OnNext(\n                new CloudEventEntry(EventEntryTestHelper.Create(\n                    eventId: 3,\n                    payloadNames: new string[] { \"arg3\" },\n                    payload: new object[] { \"value arg3\" })));\n        }\n\n        [TestMethod]\n        public void then_orders_them_in_ascending_order()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual<int>(3, list.Count());\n            Assert.AreEqual<int>(1, list.ElementAt(0).EventId);\n            Assert.AreEqual<int>(2, list.ElementAt(1).EventId);\n            Assert.AreEqual<int>(3, list.ElementAt(2).EventId);\n        }\n    }\n\n    [TestClass]\n    public class when_writing_single_entry : given_empty_account\n    {\n        private CloudEventEntry entry;\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"StyleCop.CSharp.LayoutRules\", \"SA1500:CurlyBracketsForMultiLineStatementsMustNotShareLine\", Justification = \"inline array ok\")]\n        protected override void Act()\n        {\n            base.Act();\n            this.entry = new CloudEventEntry(EventEntryTestHelper.Create(\n                eventId: 12,\n                providerId: Guid.NewGuid(),\n                providerName: \"Provider Name\",\n                timestamp: new DateTimeOffset(2013, 4, 10, 16, 0, 0, TimeSpan.Zero),\n                keywords: (EventKeywords)16L,\n                level: EventLevel.Informational,\n                formattedMessage: \"My message\",\n                opcode: (EventOpcode)4,\n                task: (EventTask)24,\n                version: 2,\n                payloadNames: new string[] { \"arg1\" },\n                payload: new object[] { \"value arg1\" },\n                processId: 200,\n                threadId: 300,\n                activityId: Guid.Parse(\"{562D0422-F427-4849-A6CD-7990A46F1223}\"),\n                relatedActivityId: Guid.Parse(\"{23408E19-3133-47E1-9307-C99A4F9AC8CC}\")))\n            {\n                InstanceName = \"Instance Name\"\n            };\n            sink.OnNext(this.entry);\n        }\n\n        [TestMethod]\n        public void then_all_properties_are_written()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var actual = table.ExecuteQuery(query).Single();\n\n            Assert.AreEqual(entry.EventId, actual.EventId);\n            Assert.AreEqual(entry.ProviderId, actual.ProviderId);\n            Assert.AreEqual(entry.ProviderName, actual.ProviderName);\n            Assert.AreEqual(entry.EventDate, actual.EventDate);\n            Assert.AreEqual(entry.Keywords, actual.Keywords);\n            Assert.AreEqual(entry.InstanceName, actual.InstanceName);\n            Assert.AreEqual(entry.Level, actual.Level);\n            Assert.AreEqual(entry.Message, actual.Message);\n            Assert.AreEqual(entry.Opcode, actual.Opcode);\n            Assert.AreEqual(entry.Task, actual.Task);\n            Assert.AreEqual(entry.Version, actual.Version);\n            StringAssert.Contains(actual.Payload, \"arg1\");\n            StringAssert.Contains(actual.Payload, (string)entry.Payload[\"arg1\"]);\n            Assert.AreEqual(\"value arg1\", actual.RawPayloadProperties[\"Payload_arg1\"].StringValue);\n            Assert.AreEqual(entry.ProcessId, actual.ProcessId);\n            Assert.AreEqual(entry.ThreadId, actual.ThreadId);\n            Assert.AreEqual(entry.ActivityId, actual.ActivityId.Value);\n            Assert.AreEqual(entry.RelatedActivityId, actual.RelatedActivityId.Value);\n        }\n    }\n\n    [TestClass]\n    public class when_writing_single_entry_without_activity_ids : given_empty_account\n    {\n        private CloudEventEntry entry;\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"StyleCop.CSharp.LayoutRules\", \"SA1500:CurlyBracketsForMultiLineStatementsMustNotShareLine\", Justification = \"inline array ok\")]\n        protected override void Act()\n        {\n            base.Act();\n            this.entry =\n                new CloudEventEntry(EventEntryTestHelper.Create(\n                    eventId: 12,\n                    providerId: Guid.NewGuid(),\n                    providerName: \"Provider Name\",\n                    timestamp: new DateTimeOffset(2013, 4, 10, 16, 0, 0, TimeSpan.Zero),\n                    keywords: (EventKeywords)16,\n                    level: EventLevel.Informational,\n                    formattedMessage: \"My message\",\n                    opcode: (EventOpcode)4,\n                    task: (EventTask)24,\n                    version: 2,\n                    payloadNames: new string[] { \"arg1\" },\n                    payload: new object[] { \"value arg1\" }))\n                {\n                    InstanceName = \"Instance Name\",\n                };\n            sink.OnNext(this.entry);\n        }\n\n        [TestMethod]\n        public void then_all_properties_are_written()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var actual = table.ExecuteQuery(query).Single();\n\n            Assert.AreEqual(entry.EventId, actual.EventId);\n            Assert.AreEqual(entry.ProviderId, actual.ProviderId);\n            Assert.AreEqual(entry.ProviderName, actual.ProviderName);\n            Assert.AreEqual(entry.EventDate, actual.EventDate);\n            Assert.AreEqual(entry.Keywords, actual.Keywords);\n            Assert.AreEqual(entry.InstanceName, actual.InstanceName);\n            Assert.AreEqual(entry.Level, actual.Level);\n            Assert.AreEqual(entry.Message, actual.Message);\n            Assert.AreEqual(entry.Opcode, actual.Opcode);\n            Assert.AreEqual(entry.Task, actual.Task);\n            Assert.AreEqual(entry.Version, actual.Version);\n            StringAssert.Contains(actual.Payload, \"arg1\");\n            StringAssert.Contains(actual.Payload, (string)entry.Payload[\"arg1\"]);\n            Assert.AreEqual(\"value arg1\", actual.RawPayloadProperties[\"Payload_arg1\"].StringValue);\n            Assert.AreEqual(null, actual.ActivityId);\n            Assert.AreEqual(null, actual.RelatedActivityId);\n        }\n    }\n\n    [TestClass]\n    public class when_writing_single_entry_with_activity_id : given_empty_account\n    {\n        private CloudEventEntry entry;\n\n        [System.Diagnostics.CodeAnalysis.SuppressMessage(\"StyleCop.CSharp.LayoutRules\", \"SA1500:CurlyBracketsForMultiLineStatementsMustNotShareLine\", Justification = \"inline array ok\")]\n        protected override void Act()\n        {\n            base.Act();\n            this.entry = new CloudEventEntry(EventEntryTestHelper.Create(\n                eventId: 12,\n                providerId: Guid.NewGuid(),\n                providerName: \"Provider Name\",\n                timestamp: new DateTimeOffset(2013, 4, 10, 16, 0, 0, TimeSpan.Zero),\n                keywords: (EventKeywords)16,\n                level: EventLevel.Informational,\n                formattedMessage: \"My message\",\n                opcode: (EventOpcode)4,\n                task: (EventTask)24,\n                version: 2,\n                payloadNames: new string[] { \"arg1\" },\n                payload: new object[] { \"value arg1\" },\n                activityId: Guid.Parse(\"{562D0422-F427-4849-A6CD-7990A46F1223}\")))\n            {\n                InstanceName = \"Instance Name\",\n            };\n            sink.OnNext(this.entry);\n        }\n\n        [TestMethod]\n        public void then_all_properties_are_written()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var actual = table.ExecuteQuery(query).Single();\n\n            Assert.AreEqual(entry.EventId, actual.EventId);\n            Assert.AreEqual(entry.ProviderId, actual.ProviderId);\n            Assert.AreEqual(entry.ProviderName, actual.ProviderName);\n            Assert.AreEqual(entry.EventDate, actual.EventDate);\n            Assert.AreEqual(entry.Keywords, actual.Keywords);\n            Assert.AreEqual(entry.InstanceName, actual.InstanceName);\n            Assert.AreEqual(entry.Level, actual.Level);\n            Assert.AreEqual(entry.Message, actual.Message);\n            Assert.AreEqual(entry.Opcode, actual.Opcode);\n            Assert.AreEqual(entry.Task, actual.Task);\n            Assert.AreEqual(entry.Version, actual.Version);\n            StringAssert.Contains(actual.Payload, \"arg1\");\n            StringAssert.Contains(actual.Payload, (string)entry.Payload[\"arg1\"]);\n            Assert.AreEqual(\"value arg1\", actual.RawPayloadProperties[\"Payload_arg1\"].StringValue);\n            Assert.AreEqual(entry.ActivityId, actual.ActivityId.Value);\n            Assert.AreEqual(null, actual.RelatedActivityId);\n        }\n    }\n\n    [TestClass]\n    [Ignore]\n    public class when_deleting_table_while_its_running : time_consuming_test\n    {\n        protected override void Act()\n        {\n            base.Act();\n            sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create(eventId: 1, payloadNames: new[] { \"arg1\" },\n                payload: new object[] { \"value arg1\" })));\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n        }\n\n        [TestMethod]\n        public void then_sink_recreates_table_on_new_entry()\n        {\n            var table = client.GetTableReference(tableName);\n\n            table.Delete();\n            sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create(eventId: 4, payloadNames: new[] { \"arg4\" },\n                payload: new object[] { \"value arg4\" })));\n\n            // wait for long, as deleting a table and then recreating it can take very long\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromMinutes(3)));\n\n            var query = new TableQuery<TestCloudTableEntry>();\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual<int>(1, list.Count());\n            Assert.AreEqual<int>(4, list.ElementAt(0).EventId);\n        }\n    }\n\n    [TestClass]\n    public class when_writing_to_storage : given_empty_account\n    {\n        protected override void Act()\n        {\n            base.Act();\n\n            sink.OnNext(\n                new CloudEventEntry(EventEntryTestHelper.Create(\n                    eventId: 1,\n                    payloadNames: new string[] { \"arg1\" },\n                    payload: new object[] { \"value arg1\" })));\n\n            sink.OnNext(\n                new CloudEventEntry(EventEntryTestHelper.Create(\n                    eventId: 2,\n                    payloadNames: new string[] { \"arg2\" },\n                    payload: new object[] { \"value arg2\" })));\n\n            sink.OnNext(\n                new CloudEventEntry(EventEntryTestHelper.Create(\n                    eventId: 3,\n                    payloadNames: new string[] { \"arg3\" },\n                    payload: new object[] { \"value arg3\" })));\n\n            sink.OnNext(\n                new CloudEventEntry(EventEntryTestHelper.Create(\n                    eventId: 4)));\n        }\n\n        [TestMethod]\n        public void writes_to_azure_tables()\n        {\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n\n            table.CreateIfNotExists();\n\n            var list = PollingHelper.WaitUntil(() => table.ExecuteQuery(query).ToArray(), l => l.Length >= 4,\n                TimeSpan.FromSeconds(20));\n\n            Assert.AreEqual<int>(4, list.Count());\n            Assert.IsTrue(list.Any(x => x.EventId == 1));\n            Assert.IsTrue(list.Any(x => x.EventId == 2));\n            Assert.IsTrue(list.Any(x => x.EventId == 3));\n            Assert.IsTrue(list.Any(x => x.EventId == 4));\n        }\n\n        [TestMethod]\n        public void then_can_force_flush_messages()\n        {\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual<int>(4, list.Count());\n            Assert.IsTrue(list.Any(x => x.EventId == 1));\n            Assert.IsTrue(list.Any(x => x.EventId == 2));\n            Assert.IsTrue(list.Any(x => x.EventId == 3));\n            Assert.IsTrue(list.Any(x => x.EventId == 4));\n        }\n\n        [TestMethod]\n        public void then_orders_them_from_newer_to_older()\n        {\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var list = table.ExecuteQuery<TestCloudTableEntry>(query).ToArray();\n\n            Assert.AreEqual<int>(4, list.Count());\n            Assert.AreEqual<int>(4, list.ElementAt(0).EventId);\n            Assert.AreEqual<int>(3, list.ElementAt(1).EventId);\n            Assert.AreEqual<int>(2, list.ElementAt(2).EventId);\n            Assert.AreEqual<int>(1, list.ElementAt(3).EventId);\n        }\n    }\n\n    [TestClass]\n    public class when_writing_multiple_simultaneous_entries_with_ascending_key : given_empty_account\n    {\n        protected const int NumberOfEntries = 5;\n        protected DateTimeOffset eventDate = DateTimeOffset.UtcNow;\n\n        protected override void Act()\n        {\n            base.Act();\n\n            sink.SortKeysAscending = true;\n\n            for (int i = 0; i < 5; i++)\n            {\n                sink.OnNext(\n                    new CloudEventEntry(EventEntryTestHelper.Create(\n                        eventId: 10,\n                        timestamp: this.eventDate,\n                        payloadNames: new string[] { \"arg\" },\n                        payload: new object[] { i })));\n            }\n        }\n\n        [TestMethod]\n        public void then_entries_are_idempotent_but_unique_and_ordered()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual<int>(NumberOfEntries, list.Length);\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                Assert.AreEqual<int>(i, Convert.ToInt32(list[i].DeserializedPayload[\"arg\"]));\n            }\n        }\n    }\n\n    [TestClass]\n    public class when_writing_multiple_simultaneous_entries_with_descending_key : given_empty_account\n    {\n        protected const int NumberOfEntries = 5;\n        protected DateTimeOffset eventDate = DateTimeOffset.UtcNow;\n\n        protected override void Act()\n        {\n            base.Act();\n\n            sink.SortKeysAscending = false;\n\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                sink.OnNext(\n                    new CloudEventEntry(EventEntryTestHelper.Create(\n                        eventId: 10,\n                        timestamp: this.eventDate,\n                        payloadNames: new string[] { \"arg\" },\n                        payload: new object[] { i })));\n            }\n        }\n\n        [TestMethod]\n        public void then_entries_are_idempotent_but_unique_and_ordered()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual<int>(NumberOfEntries, list.Length);\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                Assert.AreEqual<int>(NumberOfEntries - i - 1, Convert.ToInt32(list[i].DeserializedPayload[\"arg\"]));\n            }\n        }\n    }\n\n    [TestClass]\n    public class when_writing_200_entries_with_descending_key : time_consuming_test\n    {\n        protected const int NumberOfEntries = 200;\n\n        protected override void Act()\n        {\n            base.Act();\n\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                sink.OnNext(\n                    new CloudEventEntry(EventEntryTestHelper.Create(\n                        eventId: 10,\n                        payloadNames: new string[] { \"arg\" },\n                        payload: new object[] { i })));\n            }\n        }\n\n        [TestMethod]\n        public void then_all_entries_are_written()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual<int>(NumberOfEntries, list.Length);\n\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                Assert.AreEqual<int>(NumberOfEntries - i - 1, Convert.ToInt32(list[i].DeserializedPayload[\"arg\"]));\n            }\n        }\n    }\n\n    [TestClass]\n    public class when_writing_several_entries_with_descending_key : time_consuming_test\n    {\n        protected const int NumberOfEntries = 550;\n\n        protected override void Act()\n        {\n            base.Act();\n\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                sink.OnNext(\n                    new CloudEventEntry(EventEntryTestHelper.Create(\n                        eventId: 10,\n                        payloadNames: new string[] { \"arg\" },\n                        payload: new object[] { i })));\n            }\n        }\n\n        [TestMethod]\n        public void then_all_entries_are_written()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual<int>(NumberOfEntries, list.Length);\n\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                Assert.AreEqual<int>(NumberOfEntries - i - 1, Convert.ToInt32(list[i].DeserializedPayload[\"arg\"]));\n            }\n        }\n    }\n\n    [TestClass]\n    public class when_writing_200_entries_with_ascending_key : time_consuming_test\n    {\n        protected const int NumberOfEntries = 200;\n\n        protected override void Act()\n        {\n            base.Act();\n\n            sink.SortKeysAscending = true;\n\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                sink.OnNext(\n                    new CloudEventEntry(EventEntryTestHelper.Create(\n                        eventId: 10,\n                        payloadNames: new string[] { \"arg\" },\n                        payload: new object[] { i })));\n            }\n        }\n\n        [TestMethod]\n        public void then_all_entries_are_written()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual<int>(NumberOfEntries, list.Length);\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                Assert.AreEqual<int>(i, Convert.ToInt32(list[i].DeserializedPayload[\"arg\"]));\n            }\n        }\n    }\n\n    [TestClass]\n    public class when_writing_several_entries_with_ascending_key : time_consuming_test\n    {\n        protected const int NumberOfEntries = 550;\n\n        protected override void Act()\n        {\n            base.Act();\n\n            sink.SortKeysAscending = true;\n\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                sink.OnNext(\n                    new CloudEventEntry(EventEntryTestHelper.Create(\n                        eventId: 10,\n                        payloadNames: new string[] { \"arg\" },\n                        payload: new object[] { i })));\n            }\n        }\n\n        [TestMethod]\n        public void then_all_entries_are_written()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual<int>(NumberOfEntries, list.Length);\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                Assert.AreEqual<int>(i, Convert.ToInt32(list[i].DeserializedPayload[\"arg\"]));\n            }\n        }\n    }\n\n    [TestClass]\n    public class when_writing_with_version_opcode_level : given_empty_account\n    {\n        protected override void Act()\n        {\n            base.Act();\n\n            sink.OnNext(\n                new CloudEventEntry(EventEntryTestHelper.Create(\n                    eventId: 10,\n                    opcode: EventOpcode.Reply,\n                    level: EventLevel.Informational,\n                    version: 2,\n                    payloadNames: new string[] { \"arg1\", \"arg2\", \"arg3\" },\n                    payload: new object[] { 1, \"2\", true })));\n        }\n\n        [TestMethod]\n        public void then_all_entries_with_version_opcode_level_are_written()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var list = table.ExecuteQuery(query).ToArray();\n\n            var entry = list.Single();\n            Assert.AreEqual<int>(2, entry.Version);\n            Assert.AreEqual<int>((int)EventOpcode.Reply, entry.Opcode);\n            Assert.AreEqual<int>((int)EventLevel.Informational, entry.Level);\n        }\n    }\n\n    [TestClass]\n    public class when_writing_with_enum_payload : given_empty_account\n    {\n        protected override void Act()\n        {\n            base.Act();\n\n            sink.OnNext(\n                new CloudEventEntry(EventEntryTestHelper.Create(\n                    eventId: 10,\n                    payloadNames: new[] { \"arg1\", \"arg2\", \"arg3\" },\n                    payload: new object[] { MyLongEnum.Value1, MyIntEnum.Value2, MyShortEnum.Value3 })));\n        }\n\n        [TestMethod]\n        public void then_writes_integral_value()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var list = table.ExecuteQuery(query).ToArray();\n\n            var entry = list.Single();\n\n            StringAssert.Contains(entry.Payload, \"\\\"arg1\\\": 0\");\n            StringAssert.Contains(entry.Payload, \"\\\"arg2\\\": 1\");\n            StringAssert.Contains(entry.Payload, \"\\\"arg3\\\": 2\");\n\n            Assert.AreEqual<long>(0, entry.RawPayloadProperties[\"Payload_arg1\"].Int64Value.Value);\n            Assert.AreEqual<int>(1, entry.RawPayloadProperties[\"Payload_arg2\"].Int32Value.Value);\n            Assert.AreEqual<int>(2, entry.RawPayloadProperties[\"Payload_arg3\"].Int32Value.Value);\n        }\n    }\n\n    [TestClass]\n    public class when_having_a_non_standard_instance_name_entries : given_empty_account\n    {\n        protected override string InstanceName\n        {\n            get { return @\"1#2@3/4\\\" + new string('a', 1000); }\n        }\n\n        protected override void Act()\n        {\n            base.Act();\n\n            // check not running on the emulator\n            if (\n                string.Compare(this.connectionString, \"UseDevelopmentStorage=true\", StringComparison.OrdinalIgnoreCase) ==\n                0)\n            {\n                Assert.Inconclusive(\"This test cannot be run with the storage emulator\");\n            }\n\n            sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create(eventId: 10)));\n            sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create(eventId: 20)) { InstanceName = \"Custom@#Name\" });\n        }\n\n        [TestMethod]\n        public void then_instance_name_is_normalized()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual<string>(\"1_2_3_4_\" + new string('a', 255 - \"1_2_3_4_\".Length),\n                list.Single(x => x.EventId == 10).InstanceName);\n            Assert.AreEqual<string>(\"Custom__Name\", list.Single(x => x.EventId == 20).InstanceName);\n        }\n    }\n\n    [TestClass]\n    public class when_sending_entries_with_big_payloads : time_consuming_test\n    {\n        protected override void Act()\n        {\n            base.Act();\n\n            sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create(eventId: 10,\n                payloadNames: Enumerable.Range(0, 500).Select(x => \"arg\" + x),\n                payload: Enumerable.Range(0, 500).Select(x => (object)x))));\n            sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create(eventId: 20, payloadNames: new string[] { \"Large\" },\n                payload: new object[] { new string('a', 500000) })));\n            sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create(eventId: 30, formattedMessage: new string('b', 500000))));\n            sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create(eventId: 40,\n                payloadNames: Enumerable.Range(0, 50).Select(x => \"arg\" + x),\n                payload: Enumerable.Range(0, 50).Select(x => (object)new string('c', 1000)))));\n        }\n\n        [TestMethod]\n        public void then_entries_are_truncated()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n            sink.Dispose();\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var list = table.ExecuteQuery(query).ToArray();\n\n            var entry1 = list.Single(x => x.EventId == 10);\n            for (int i = 0; i < 500; i++)\n            {\n                StringAssert.Contains(entry1.Payload, string.Format(\"\\\"arg{0}\\\": {0}\", i));\n            }\n            Assert.IsTrue(entry1.RawPayloadProperties.Count >= 200);\n\n            var entry2 = list.Single(x => x.EventId == 20);\n            Assert.AreEqual(1, entry2.DeserializedPayload.Count);\n            Assert.IsTrue(entry2.DeserializedPayload.ContainsKey(\"payload_serialization_error\"));\n            Assert.AreEqual(0, entry2.RawPayloadProperties.Count);\n\n            var entry3 = list.Single(x => x.EventId == 30);\n            Assert.AreEqual(new string('b', 30000) + \"--TRUNCATED--\", entry3.Message);\n\n            var entry4 = list.Single(x => x.EventId == 20);\n            Assert.AreEqual(1, entry4.DeserializedPayload.Count);\n            Assert.IsTrue(entry4.DeserializedPayload.ContainsKey(\"payload_serialization_error\"));\n            Assert.AreEqual(0, entry4.RawPayloadProperties.Count);\n        }\n    }\n\n    [TestClass]\n    public class when_sending_large_entries_that_exceed_batch_size : time_consuming_test\n    {\n        protected override void Act()\n        {\n            base.Act();\n\n            for (int i = 0; i < 100; i++)\n            {\n                sink.OnNext(\n                    new CloudEventEntry(EventEntryTestHelper.Create(\n                        eventId: 30,\n                        formattedMessage: new string('b', 30000),\n                        payloadNames: new string[] { \"Medium\" },\n                        payload: new object[] { new string('a', 20000) })));\n            }\n        }\n\n        [TestMethod]\n        public void then_entries_are_sent_in_smaller_batches()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromMinutes(2)));\n            sink.Dispose();\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual(100, list.Length);\n\n            Assert.AreEqual(30, list[0].EventId);\n            Assert.AreEqual(new string('b', 30000), list[0].Message);\n            Assert.AreEqual(new string('a', 20000), list[0].DeserializedPayload[\"Medium\"]);\n            Assert.AreEqual(new string('a', 20000), list[0].RawPayloadProperties[\"Payload_Medium\"].StringValue);\n        }\n    }\n}"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Sinks/WindowsAzureTableSinkTests.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks.WindowsAzure;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing Microsoft.WindowsAzure.Storage.Table;\nusing Newtonsoft.Json;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Sinks\n{\n    [TestClass]\n    public class given_configuration\n    {\n        private const string DevelopmentStorageConnectionString = \"UseDevelopmentStorage=true\";\n\n        [TestMethod]\n        public void when_creating_sink_for_null_connection_string_then_throws()\n        {\n            AssertEx.Throws<ArgumentNullException>(() => new WindowsAzureTableSink(\"instanceName\", null, \"Table\", TimeSpan.FromSeconds(1), 10000, Timeout.InfiniteTimeSpan));\n        }\n\n        [TestMethod]\n        public void when_creating_sink_with_invalid_connection_string_then_throws()\n        {\n            AssertEx.Throws<ArgumentException>(() => new WindowsAzureTableSink(\"instanceName\", \"InvalidConnection\", \"Table\", TimeSpan.FromSeconds(1), 10000, Timeout.InfiniteTimeSpan));\n        }\n\n        [TestMethod]\n        public void when_creating_sink_with_small_buffer_size_then_throws()\n        {\n            AssertEx.Throws<ArgumentException>(() => new WindowsAzureTableSink(\"instanceName\", DevelopmentStorageConnectionString, \"Table\", TimeSpan.FromSeconds(1), 10, Timeout.InfiniteTimeSpan));\n        }\n\n        [TestMethod]\n        public void when_creating_sink_sort_is_descending_by_default()\n        {\n            Assert.IsFalse(new WindowsAzureTableSink(\"instanceName\", DevelopmentStorageConnectionString, \"Table\", TimeSpan.FromSeconds(1), 10000, Timeout.InfiniteTimeSpan).SortKeysAscending);\n        }\n\n        [TestMethod]\n        public void tablename_is_invalid_if_starts_with_number()\n        {\n            AssertEx.Throws<ArgumentException>(() => new WindowsAzureTableSink(\"instanceName\", DevelopmentStorageConnectionString, \"123dfadfasfdasfd\", TimeSpan.FromSeconds(1), 10000, Timeout.InfiniteTimeSpan));\n        }\n\n        [TestMethod]\n        public void tablename_is_invalid_if_longer_than_64()\n        {\n            AssertEx.Throws<ArgumentException>(() => new WindowsAzureTableSink(\"instanceName\", DevelopmentStorageConnectionString, \"windowsazurewindowsazurewindowsazurewindowsazurewindowsazurewind\", TimeSpan.FromSeconds(1), 10000, Timeout.InfiniteTimeSpan));\n        }\n\n        [TestMethod]\n        [Ignore]\n        // Ignoring because the storage client library considers inexistant account as transient so it retries and the exponential back-off could take time\n        public void when_cannot_connect_to_storage_account_then_flush_should_finish_faulted()\n        {\n            const string ValidNotExisting = \"DefaultEndpointsProtocol=https;AccountName=InexistantDoesntReallyMatter;AccountKey=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa==\";\n\n            using (var sink = new WindowsAzureTableSink(\"instanceName\", ValidNotExisting, \"Table\", TimeSpan.FromSeconds(1), 5000, TimeSpan.FromSeconds(20)))\n            using (var collectErrorsListener = new MockEventListener())\n            {\n                collectErrorsListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Error, Keywords.All);\n\n                sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create()));\n                try\n                {\n                    Assert.IsTrue(sink.FlushAsync().Wait(TimeSpan.FromSeconds(15)));\n                    Assert.Fail(\"Exception should be thrown.\");\n                }\n                catch (AggregateException ex)\n                {\n                    Assert.IsInstanceOfType(ex.InnerException, typeof(FlushFailedException));\n                }\n\n                Assert.IsTrue(collectErrorsListener.WrittenEntries.Any(x => x.EventId == 500));\n            }\n        }\n\n        [TestMethod]\n        [Ignore]\n        // Ignoring because the storage client library considers inexistant account as transient so it retries and the exponential back-off could take time\n        public void when_cannot_connect_to_storage_account_then_on_completed_should_not_stall_or_throw()\n        {\n            const string ValidNotExisting = \"DefaultEndpointsProtocol=https;AccountName=InexistantDoesntReallyMatter;AccountKey=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa==\";\n\n            using (var sink = new WindowsAzureTableSink(\"instanceName\", ValidNotExisting, \"Table\", TimeSpan.FromSeconds(1), 5000, TimeSpan.FromSeconds(20)))\n            using (var collectErrorsListener = new MockEventListener())\n            {\n                collectErrorsListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Error, Keywords.All);\n\n                sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create()));\n                Assert.IsTrue(Task.Run(() => sink.OnCompleted()).Wait(TimeSpan.FromSeconds(15)));\n\n                Assert.IsTrue(collectErrorsListener.WrittenEntries.Any(x => x.EventId == 500));\n            }\n        }\n    }\n\n    [TestClass]\n    public class given_azure_table_event_entry\n    {\n        [TestMethod]\n        public void when_writing_entity_adds_payload_to_dictionary()\n        {\n            var entity = new CloudEventEntry(EventEntryTestHelper.Create(payloadNames: new string[] { \"message1\", \"message2\" }, payload: new object[] { \"value1\", \"value2\" }));\n            entity.CreateKey(true, 0);\n\n            var dict = entity.CreateTableEntity().WriteEntity(null);\n\n            Assert.IsTrue(dict.ContainsKey(\"Payload_message1\"));\n            Assert.IsTrue(dict.ContainsKey(\"Payload_message2\"));\n        }\n\n        [TestMethod]\n        public void when_writing_entity_keeps_proper_type()\n        {\n            var guid = Guid.NewGuid();\n            var binary = new byte[] { 1, 2, 3, 4 };\n\n            var entity = new CloudEventEntry(EventEntryTestHelper.Create(\n                payloadNames: new string[] { \"string1\", \"int1\", \"long1\", \"double1\", \"bool1\", \"bool2\", \"guid1\", \"binary1\" },\n                payload: new object[] { \"This is a string\", 123456, 123456L, 123456D, true, false, guid, binary }));\n            entity.CreateKey(true, 0);\n\n            var dict = entity.CreateTableEntity().WriteEntity(null);\n\n            Assert.AreEqual<string>(\"This is a string\", dict[\"Payload_string1\"].StringValue);\n            Assert.AreEqual<int>(123456, dict[\"Payload_int1\"].Int32Value.Value);\n            Assert.AreEqual<long>(123456L, dict[\"Payload_long1\"].Int64Value.Value);\n            Assert.AreEqual<double>(123456D, dict[\"Payload_double1\"].DoubleValue.Value);\n            Assert.AreEqual<Guid>(guid, dict[\"Payload_guid1\"].GuidValue.Value);\n            Assert.AreEqual<bool>(true, dict[\"Payload_bool1\"].BooleanValue.Value);\n            Assert.AreEqual<bool>(false, dict[\"Payload_bool2\"].BooleanValue.Value);\n            Assert.AreEqual<byte[]>(binary, dict[\"Payload_binary1\"].BinaryValue);\n        }\n\n        [TestMethod]\n        public void when_generating_key_then_prefixes_with_instance_name()\n        {\n            var entity = new CloudEventEntry(EventEntryTestHelper.Create(\n                timestamp: DateTimeOffset.UtcNow))\n            {\n                InstanceName = \"MyInstanceName\"\n            };\n\n            entity.CreateKey(false, 0);\n\n            StringAssert.StartsWith(entity.RowKey, \"MyInstanceName\");\n        }\n\n        [TestMethod]\n        public void when_having_big_message_value_then_truncates()\n        {\n            var entity = new CloudEventEntry(EventEntryTestHelper.Create(formattedMessage: new string('a', 500000)));\n            entity.CreateKey(true, 0);\n\n            var dict = entity.CreateTableEntity().WriteEntity(null);\n\n            Assert.AreEqual(new string('a', 30000) + \"--TRUNCATED--\", dict[\"Message\"].StringValue);\n        }\n\n        [TestMethod]\n        public void when_having_big_payload_value_then_stores_warning_and_does_not_contain_payload()\n        {\n            var entity = new CloudEventEntry(EventEntryTestHelper.Create(\n                payloadNames: new string[] { \"arg1\" },\n                payload: new object[] { new string('a', 500000) }));\n            entity.CreateKey(true, 0);\n\n            var dict = entity.CreateTableEntity().WriteEntity(null);\n\n            StringAssert.Contains(dict[\"Payload\"].StringValue, \"'payload_serialization_error'\");\n            Assert.IsFalse(dict.ContainsKey(\"Payload_arg1\"));\n        }\n\n        [TestMethod]\n        public void when_having_big_payload_then_truncates()\n        {\n            var entity = new CloudEventEntry(EventEntryTestHelper.Create(payloadNames: new string[] { \"arg1\" }, payload: new object[] { new string('a', 500000) }));\n            entity.CreateKey(true, 0);\n\n            var dict = entity.CreateTableEntity().WriteEntity(null);\n\n            StringAssert.Contains(dict[\"Payload\"].StringValue, \"'payload_serialization_error'\");\n            Assert.IsFalse(dict.ContainsKey(\"Payload_arg1\"));\n        }\n\n        [TestMethod]\n        public void when_having_big_overall_payloads_then_stores_warning_and_does_not_contain_payload()\n        {\n            var entity = new CloudEventEntry(EventEntryTestHelper.Create(payloadNames: Enumerable.Range(0, 50).Select(i => \"arg\" + i), payload: Enumerable.Range(0, 50).Select(i => new string('a', 2000))));\n            entity.CreateKey(true, 0);\n\n            var dict = entity.CreateTableEntity().WriteEntity(null);\n\n            StringAssert.Contains(dict[\"Payload\"].StringValue, \"'payload_serialization_error'\");\n\n            Assert.AreEqual(0, dict.Keys.Count(x => x.StartsWith(\"Payload_\")));\n        }\n\n        [TestMethod]\n        public void when_several_payload_values_then_takes_first_ones_as_columns()\n        {\n            int numberOfAllowedItems = 200;\n\n            var entity = new CloudEventEntry(EventEntryTestHelper.Create(\n                payloadNames: Enumerable.Range(0, 300).Select(i => \"arg\" + i),\n                payload: Enumerable.Range(0, 300).Select(i => (object)i)));\n            entity.CreateKey(true, 0);\n\n            var dict = entity.CreateTableEntity().WriteEntity(null);\n\n            for (int i = 0; i < numberOfAllowedItems; i++)\n            {\n                Assert.IsTrue(dict.ContainsKey(\"Payload_arg\" + i), i.ToString());\n                Assert.AreEqual<int>(i, dict[\"Payload_arg\" + i].Int32Value.Value);\n            }\n\n            for (int i = numberOfAllowedItems; i < 300; i++)\n            {\n                Assert.IsFalse(dict.ContainsKey(\"Payload_arg\" + i), i.ToString());\n            }\n\n            var deserializedPayloadField = JsonConvert.DeserializeObject<Dictionary<string, object>>(dict[\"Payload\"].StringValue);\n\n            foreach (var payloadItem in entity.Payload)\n            {\n                Assert.IsTrue(deserializedPayloadField.ContainsKey(payloadItem.Key));\n                Assert.AreEqual<int>((int)payloadItem.Value, (int)(long)deserializedPayloadField[payloadItem.Key]);\n            }\n        }\n    }\n\n    [TestClass]\n    public class given_bounded_windows_azure_table_sink : ContextBase\n    {\n        private const int BufferSize = 500;\n\n        private TestableWindowsAzureTableSink sink;\n        private MockEventListener collectErrorsListener;\n\n        protected override void Given()\n        {\n            this.collectErrorsListener = new MockEventListener();\n            this.collectErrorsListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Informational, SemanticLoggingEventSource.Keywords.Sink);\n\n            this.sink = new TestableWindowsAzureTableSink(\"TestName\", maxBufferSize: BufferSize);\n            sink.WaitHandle.Reset();\n        }\n\n        protected override void OnCleanup()\n        {\n            this.sink.Dispose();\n            this.collectErrorsListener.Dispose();\n        }\n\n        [TestMethod]\n        public void when_overflowing_buffer_capacity_then_sends_only_buffer_capacity()\n        {\n            const int NumberOfEntries = 1200;\n\n            sink.WaitHandle.Reset();\n\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create(eventId: 10, payloadNames: new string[] { \"arg\" }, payload: new object[] { i })));\n            }\n\n            sink.WaitHandle.Set();\n\n            Assert.IsTrue(sink.FlushAsync().Wait(TimeSpan.FromSeconds(10)));\n\n            Assert.AreEqual(BufferSize, sink.SentEntriesCount);\n        }\n\n        [TestMethod]\n        public void when_overflowing_buffer_capacity_then_notifies_once()\n        {\n            const int NumberOfEntries = 600;\n\n            sink.WaitHandle.Reset();\n\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create(eventId: 10, payloadNames: new string[] { \"arg\" }, payload: new object[] { i })));\n            }\n\n            sink.WaitHandle.Set();\n\n            Assert.IsTrue(sink.FlushAsync().Wait(TimeSpan.FromSeconds(10)));\n\n            Assert.AreEqual(1, collectErrorsListener.WrittenEntries.Count(e => e.EventId == 900));\n        }\n\n        [TestMethod]\n        public void when_restoring_buffer_capacity_then_writes_events()\n        {\n            const int NumberOfNewEntries = 200;\n\n            sink.WaitHandle.Reset();\n\n            for (int i = 0; i < 600; i++)\n            {\n                sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create(eventId: 10, payloadNames: new string[] { \"arg\" }, payload: new object[] { i })));\n            }\n\n            sink.WaitHandle.Set();\n\n            Assert.IsTrue(sink.FlushAsync().Wait(TimeSpan.FromSeconds(10)));\n\n            for (int i = 0; i < NumberOfNewEntries; i++)\n            {\n                sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create(eventId: 10, payloadNames: new string[] { \"arg\" }, payload: new object[] { i })));\n            }\n\n            Assert.IsTrue(sink.FlushAsync().Wait(TimeSpan.FromSeconds(10)));\n            Assert.AreEqual(BufferSize + NumberOfNewEntries, sink.SentEntriesCount);\n        }\n\n        [TestMethod]\n        public void when_restoring_buffer_capacity_then_notifies_once()\n        {\n            const int NumberOfEntries = 600;\n\n            sink.WaitHandle.Reset();\n\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create(eventId: 10, payloadNames: new string[] { \"arg\" }, payload: new object[] { i })));\n            }\n\n            sink.WaitHandle.Set();\n\n            Assert.IsTrue(sink.FlushAsync().Wait(TimeSpan.FromSeconds(10)));\n\n            Assert.AreEqual(1, collectErrorsListener.WrittenEntries.Count(e => e.EventId == 901));\n        }\n    }\n\n    [TestClass]\n    public class given_sink_with_onCompleted_timeout : ContextBase\n    {\n        [TestMethod]\n        public void when_sending_on_completed_blocks_for_timeout_period_only()\n        {\n            var timeout = TimeSpan.FromSeconds(1.75);\n            var delta = TimeSpan.FromSeconds(.5);\n            using (var sink = new TestableWindowsAzureTableSink(\"TestName\", onCompletedTimeout: timeout))\n            {\n                sink.WaitHandle.Reset();\n\n                sink.OnNext(new CloudEventEntry(EventEntryTestHelper.Create(eventId: 10)));\n\n                var stopWatch = Stopwatch.StartNew();\n                sink.OnCompleted();\n                stopWatch.Stop();\n\n                Assert.IsTrue(stopWatch.Elapsed >= timeout - delta, \"Elapsed: {0}. Expected at least {1}\", stopWatch.Elapsed, timeout - delta);\n                Assert.IsTrue(stopWatch.Elapsed <= timeout + delta, \"Elapsed: {0}. Expected at most {1}\", stopWatch.Elapsed, timeout + delta);\n\n                sink.WaitHandle.Set();\n            }\n        }\n    }\n\n    internal class TestableWindowsAzureTableSink : WindowsAzureTableSink\n    {\n        public int SentEntriesCount = 0;\n\n        public ManualResetEventSlim WaitHandle = new ManualResetEventSlim(true);\n\n        public TestableWindowsAzureTableSink(string instanceName, int maxBufferSize = 500, TimeSpan? onCompletedTimeout = null)\n            : base(instanceName, \"UseDevelopmentStorage=true\", \"LogsTableAddess\", TimeSpan.FromSeconds(5), maxBufferSize, onCompletedTimeout ?? Timeout.InfiniteTimeSpan)\n        {\n        }\n\n        internal override Task<IList<TableResult>> ExecuteBatchAsync(TableBatchOperation batch)\n        {\n            SentEntriesCount += batch.Count;\n            return Task.Run(() =>\n            {\n                WaitHandle.Wait();\n                return (IList<TableResult>)new List<TableResult>();\n            });\n        }\n\n        internal override async Task<bool> EnsureTableExistsAsync()\n        {\n            await Task.Yield();\n            return true;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/CustomSink.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    public class CustomSink : IObserver<EventEntry>\n    {\n        public CustomSink(string required, int? optional)\n        {\n            this.Required = required;\n            this.Optional = optional;\n        }\n\n        public string Required { get; set; }\n\n        public int? Optional { get; set; }\n\n        public void OnCompleted()\n        {\n        }\n\n        public void OnError(Exception error)\n        {\n        }\n\n        public void OnNext(EventEntry value)\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/DifferentEnumsEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    [EventSource]\n    public sealed class DifferentEnumsEventSource : EventSource\n    {\n        public static readonly DifferentEnumsEventSource Log = new DifferentEnumsEventSource();\n\n        [Event(306)]\n        public void UsingEnumArguments(MyLongEnum arg1, MyIntEnum arg2, MyShortEnum arg3)\n        {\n            if (IsEnabled()) { WriteEvent(306, arg1, arg2, arg3); }\n        }\n\n        [Event(307)]\n        public void UsingAllEnumArguments(MyLongEnum arg1, MyIntEnum arg2, MyShortEnum arg3,\n            MyByteEnum arg4, MySByteEnum arg5, MyUShortEnum arg6, MyUIntEnum arg7, MyULongEnum arg8)\n        {\n            if (IsEnabled()) { WriteEvent(307, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); }\n        }\n    }\n\n    public enum MyIntEnum { Value1, Value2, Value3 }\n\n    public enum MyLongEnum : long { Value1, Value2, Value3 }\n\n    public enum MyShortEnum : short { Value1, Value2, Value3 }\n\n    public enum MyByteEnum : byte { Value1, Value2, Value3 }\n\n    public enum MySByteEnum : sbyte { Value1, Value2, Value3 }\n\n    public enum MyUShortEnum : ushort { Value1, Value2, Value3 }\n\n    public enum MyUIntEnum : uint { Value1, Value2, Value3 }\n\n    public enum MyULongEnum : uint { Value1, Value2, Value3 }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/InMemoryEventListener.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Threading;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    public class InMemoryEventListener : EventListener, IObserver<EventEntry>\n    {\n        private readonly EventSourceSchemaCache schemaCache = EventSourceSchemaCache.Instance;\n        private readonly object lockObject = new object();\n        private MemoryStream memory;\n        private StreamWriter writer;\n        private long writenBytes;\n        private ManualResetEventSlim waitOnAsync;\n\n        public InMemoryEventListener()\n            : this(null)\n        {\n        }\n\n        public InMemoryEventListener(IEventTextFormatter formatter = null)\n        {\n            this.Formatter = formatter ?? new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways);\n            this.memory = new MemoryStream();\n            this.writer = new StreamWriter(this.memory) { AutoFlush = false };\n            this.waitOnAsync = new ManualResetEventSlim();\n        }\n\n        public IEventTextFormatter Formatter { get; set; }\n        public int EventWrittenCount { get; private set; }\n        public Func<bool> WaitSignalCondition { get; set; }\n\n        public override string ToString()\n        {\n            this.memory.Position = 0;\n            return new StreamReader(this.memory).ReadToEnd();\n        }\n\n        public WaitHandle WaitOnAsyncEvents { get { return this.waitOnAsync.WaitHandle; } }\n\n        public override void Dispose()\n        {\n            base.Dispose();\n            this.writer.Dispose();\n            this.waitOnAsync.Dispose();\n        }\n\n        protected override void OnEventWritten(EventWrittenEventArgs eventData)\n        {\n            var entry = EventEntry.Create(eventData, this.schemaCache.GetSchema(eventData.EventId, eventData.EventSource));\n\n            OnNext(entry);\n        }\n\n        public void OnCompleted()\n        {\n        }\n\n        public void OnError(Exception error)\n        {\n        }\n\n        public void OnNext(EventEntry value)\n        {\n            lock (this.lockObject)\n            {\n                try\n                {\n                    this.writer.Write(this.Formatter.WriteEvent(value));\n                    this.EventWrittenCount++;\n                    this.writer.Flush();\n                    writenBytes = this.memory.Length;\n                }\n                finally\n                {\n                    // mark any async event as done       \n                    if (WaitSignalCondition == null ||\n                        WaitSignalCondition())\n                    {\n                        this.waitOnAsync.Set();\n                    }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/LargeManifestEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    [EventSource]\n    internal sealed class LargeManifestEventSource : EventSource\n    {\n        internal static readonly LargeManifestEventSource Log = new LargeManifestEventSource();\n\n        public class Keywords\n        {\n            public const EventKeywords Page = (EventKeywords)1;\n            public const EventKeywords DataBase = (EventKeywords)2;\n            public const EventKeywords Diagnostic = (EventKeywords)4;\n            public const EventKeywords Perf = (EventKeywords)8;\n        }\n\n        public class Tasks\n        {\n            public const EventTask Page = (EventTask)1;\n            public const EventTask DBQuery = (EventTask)2;\n        }\n\n        [Event(11, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords11(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) \n        {\n            if (this.IsEnabled())\n            {\n                this.WriteEvent(11, argument1, argument2, argument3, argument4, argument5, argument6, argument7, argument8, argument9, argument10, argument11);\n            }\n        }\n\n        [Event(12, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords12(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(13, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords13(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(14, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords14(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(15, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords15(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(16, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords16(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(17, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords17(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(18, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords18(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(21, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords21(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(22, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords22(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(23, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords23(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(24, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords24(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(25, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords25(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(26, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords26(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(27, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords27(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(28, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords28(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(111, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords111(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(112, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords112(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(113, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords113(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(114, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords114(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(115, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords115(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(116, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords116(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(117, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords117(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(118, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords118(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(121, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords121(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(122, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords122(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(123, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords123(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(124, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords124(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(125, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords125(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(126, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords126(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(127, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords127(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(128, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords128(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(311, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords311(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(312, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords312(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(313, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords313(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(314, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords314(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(315, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords315(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(316, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords316(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(317, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords317(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(318, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords318(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(321, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords321(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(322, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords322(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(323, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords323(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(324, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords324(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(325, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords325(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(326, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords326(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(327, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords327(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(328, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords328(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3111, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3111(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3112, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3112(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3113, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3113(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3114, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3114(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3115, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3115(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3116, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3116(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3117, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3117(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3118, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3118(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3121, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3121(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3122, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3122(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3123, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3123(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3124, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3124(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3125, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3125(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3126, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3126(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3127, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3127(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(3128, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords3128(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(411, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords411(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(412, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords412(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(413, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords413(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(414, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords414(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(415, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords415(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(416, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords416(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(417, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords417(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(418, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords418(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(421, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords421(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(422, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords422(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(423, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords423(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(424, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords424(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(425, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords425(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(426, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords426(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(427, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords427(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(428, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords428(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4111, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4111(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4112, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4112(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4113, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4113(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4114, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4114(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4115, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4115(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4116, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4116(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4117, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4117(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4118, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4118(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4121, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4121(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4122, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4122(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4123, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4123(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4124, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4124(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4125, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4125(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4126, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4126(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4127, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4127(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4128, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4128(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4311, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4311(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4312, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4312(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4313, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4313(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4314, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4314(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4315, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4315(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4316, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4316(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4317, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4317(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4318, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4318(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4321, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4321(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4322, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4322(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4323, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4323(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4324, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4324(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4325, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4325(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4326, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4326(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4327, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4327(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(4328, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords4328(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43111, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43111(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43112, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43112(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43113, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43113(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43114, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43114(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43115, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43115(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43116, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43116(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43117, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43117(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43118, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43118(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43121, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43121(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43122, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43122(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43123, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43123(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43124, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43124(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43125, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43125(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43126, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43126(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43127, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43127(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n\n        [Event(43128, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords43128(int argument1, int argument2, int argument3, int argument4, int argument5, int argument6, int argument7, int argument8, int argument9, int argument10, int argument11) { }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/MockColorMapper.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    public class MockColorMapper : IConsoleColorMapper\n    {\n        public MockColorMapper()\n        {\n            Instance = this;\n        }\n\n        public const ConsoleColor Error = ConsoleColor.DarkRed;\n\n        public ConsoleColor? Color { get; private set; }\n\n        public ConsoleColor? Map(EventLevel eventLevel)\n        {\n            if (eventLevel == EventLevel.Error)\n            {\n                this.Color = Error;\n            }\n            return this.Color;\n        }\n\n        public static MockColorMapper Instance { get; private set; }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/MockConsoleOutput.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.IO;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    public class MockConsoleOutput : IDisposable\n    {\n        private TextWriter writer;  \n        private TextWriter originalOutput;\n\n        public MockConsoleOutput() \n        {\n            writer = new StringWriter();\n            originalOutput = Console.Out; \n            Console.SetOut(writer); \n        }\n\n        public string Ouput\n        {\n            get { return writer.ToString(); }\n        }\n\n        public void Dispose() \n        { \n            Console.SetOut(originalOutput); \n            writer.Dispose();\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/MockDefaultConsoleColorMapper.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    public class MockDefaultConsoleColorMapper : DefaultConsoleColorMapper\n    {\n        public ConsoleColor? Color { get; private set; }\n\n        public override ConsoleColor? Map(EventLevel eventLevel)\n        {\n            this.Color = base.Map(eventLevel);\n            return this.Color;\n        } \n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/MockEventListener.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Collections.Concurrent;\nusing System.Diagnostics.Tracing;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    public class MockEventListener : EventListener\n    {\n        public ConcurrentBag<EventEntry> WrittenEntries = new ConcurrentBag<EventEntry>();\n\n        protected override void OnEventWritten(EventWrittenEventArgs eventData)\n        {\n            WrittenEntries.Add(EventEntry.Create(eventData, EventSourceSchemaCache.Instance.GetSchema(eventData.EventId, eventData.EventSource)));\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/MockFormatter.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing System;\nusing System.Collections.Generic;\nusing System.IO;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    public class MockFormatter : IEventTextFormatter\n    {\n        public List<EventEntry> WriteEventCalls = new List<EventEntry>();\n        public Action<MockFormatter> BeforeWriteEventAction { get; set; }\n        public Action<MockFormatter> AfterWriteEventAction { get; set; }\n\n        public void WriteEvent(EventEntry eventData, TextWriter writer)\n        {\n            this.WriteEventCalls.Add(eventData);\n\n            if (BeforeWriteEventAction != null)\n            {\n                BeforeWriteEventAction(this);\n            }\n\n            if (!string.IsNullOrWhiteSpace(eventData.FormattedMessage)) { writer.Write(eventData.FormattedMessage); }\n\n            writer.Write(string.Join(\",\", eventData.Payload));\n\n            if (AfterWriteEventAction != null) { AfterWriteEventAction(this); }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/MockHttpListener.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Net;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    public class MockHttpListener\n    {\n        private readonly HttpListener listener = new HttpListener();\n\n        private readonly int portTryRange;\n\n        private int port;\n\n        private Task contextTask;\n\n        public MockHttpListener(int port = 3620, int portTryRange = 100)\n        {\n            this.port = port;\n\n            this.portTryRange = portTryRange;\n        }\n\n        public void Stop()\n        {\n            if (this.listener != null)\n            {\n                this.listener.Close();\n            }\n        }\n\n        public string Start(MockHttpListenerResponse message)\n        {\n            string endpoint = null;\n\n            for (int i = 0; i < this.portTryRange; i++)\n            {\n                try\n                {\n                    var ep = string.Format(\"http://localhost:{0}/\", port);\n                    this.listener.Prefixes.Clear();\n                    this.listener.Prefixes.Add(ep);\n                    this.listener.Start();\n\n                    endpoint = ep;\n                    break;\n                }\n                catch (HttpListenerException)\n                {\n                    Debug.WriteLine(\"Failed to listen on port: {0}\", port);\n                    port++;\n                }\n            }\n\n            if (endpoint == null)\n            {\n                throw new ApplicationException(\"Cannot open a port on localhost to listen on.\");\n            }\n\n            this.contextTask = Task.Run(\n                async () =>\n                {\n                    for (;;)\n                    {\n                        var ctx = await this.listener.GetContextAsync();\n\n                        // Stop() was called - exit\n                        if (!listener.IsListening)\n                        {\n                            break;\n                        }\n\n                        ctx.Response.StatusCode = message.ResponseCode;\n                        ctx.Response.ContentType = message.ContentType;\n\n                        if (message.Headers != null)\n                        {\n                            foreach (var header in message.Headers)\n                            {\n                                ctx.Response.Headers.Add(header);\n                            }\n                        }\n\n                        byte[] buffer = Encoding.UTF8.GetBytes(message.Content);\n                        ctx.Response.ContentLength64 = buffer.Length;\n                        await ctx.Response.OutputStream.WriteAsync(buffer, 0, buffer.Length);\n                        ctx.Response.Close();\n                    }\n                });\n\n            return endpoint;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/MockHttpListenerResponse.cs",
    "content": "﻿using System.Collections.Generic;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    public class MockHttpListenerResponse\n    {\n        public MockHttpListenerResponse()\n        {\n            this.Headers = new List<string>();\n        }\n\n        public int ResponseCode { get; set; }\n\n        public string Content { get; set; }\n\n        public string ContentType { get; set; }\n\n        public List<string> Headers { get; set; }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/MultipleTypesEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    [EventSource]\n    internal sealed class MultipleTypesEventSource : EventSource\n    {\n        public enum Color\n        {\n            Red,\n            Blue,\n            Gree\n        }\n\n        internal static readonly MultipleTypesEventSource Log = new MultipleTypesEventSource();\n\n        [Event(1)]\n        internal void ManyTypes(byte arg0, int arg1, uint arg11, long arg2, ulong arg22, double arg3, short arg5, ushort arg6, SByte arg7, bool arg8, string arg9,\n            Guid arg14, Color arg16, Single arg17)\n        {\n            WriteEvent(1, arg0, arg1, arg11, arg2, arg22, arg3, arg5, arg6, arg7, arg8, arg9,\n                arg14, arg16, arg17);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/MyCompanyEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    public enum MyColor { Red, Yellow, Blue }\n\n    [EventSource(Name = \"MyCompany\")]\n    public sealed class MyCompanyEventSource : EventSource\n    {\n        public class Keywords\n        {\n            public const EventKeywords Page = (EventKeywords)1;\n            public const EventKeywords DataBase = (EventKeywords)2;\n            public const EventKeywords Diagnostic = (EventKeywords)4;\n            public const EventKeywords Perf = (EventKeywords)8;\n        }\n\n        public class Tasks\n        {\n            public const EventTask Page = (EventTask)1;\n            public const EventTask DBQuery = (EventTask)2;\n        }\n\n        [Event(1, Message = \"Application Failure: {0}\", Level = EventLevel.Error, Keywords = Keywords.Diagnostic)]\n        public void Failure(string message) { WriteEvent(1, message); }\n\n        [Event(2, Message = \"Starting up.\", Keywords = Keywords.Perf, Level = EventLevel.Informational)]\n        public void Startup() { WriteEvent(2); }\n\n        [Event(3, Message = \"loading page {1} activityID={0}\", Opcode = EventOpcode.Start,\n            Task = Tasks.Page, Keywords = Keywords.Page, Level = EventLevel.Informational)]\n        public void PageStart(int id, string url) { if (IsEnabled()) { WriteEvent(3, id, url); } }\n\n        [Event(4, Opcode = EventOpcode.Stop, Task = Tasks.Page, Keywords = Keywords.Page, Level = EventLevel.Informational)]\n        public void PageStop(int id) { if (IsEnabled()) { WriteEvent(4, id); } }\n\n        [Event(5, Opcode = EventOpcode.Start, Task = Tasks.DBQuery, Keywords = Keywords.DataBase, Level = EventLevel.Informational)]\n        public void DBQueryStart(string sqlQuery) { WriteEvent(5, sqlQuery); }\n\n        [Event(6, Opcode = EventOpcode.Stop, Task = Tasks.DBQuery, Keywords = Keywords.DataBase, Level = EventLevel.Informational)]\n        public void DBQueryStop() { WriteEvent(6); }\n\n        [Event(7, Level = EventLevel.Verbose, Keywords = Keywords.DataBase)]\n        public void Mark(int id) { if (IsEnabled()) { WriteEvent(7, id); } }\n\n        [Event(8)]\n        public void LogColor(MyColor color) { WriteEvent(8, (int)color); }\n\n#if !EVENT_SOURCE_PACKAGE\n        // This will be invalid in new versions of EventSource - if you have an opcode you must have a task\n        [Event(9, Opcode = EventOpcode.Start)]\n        public void WithOpcodeAndNoTaskSpecfied(int arg1) { WriteEvent(9, arg1); }\n#endif\n\n        [Event(10, Keywords = Keywords.DataBase | Keywords.Perf)]\n        public void MultipleKeywords(int arg1) { WriteEvent(10, arg1); }\n\n        [Event(11, Task = Tasks.Page, Opcode = EventOpcode.Send)]\n        public void WithRelatedActivityId(Guid relatedActivityId) { WriteEventWithRelatedActivityId(11, relatedActivityId); }\n\n        public static readonly MyCompanyEventSource Log = new MyCompanyEventSource();\n\n        public MyCompanyEventSource()\n        {\n        }\n\n        protected override void OnEventCommand(EventCommandEventArgs command)\n        {\n            base.OnEventCommand(command);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/SimpleEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    [EventSource(Name = \"SimpleEventSource-CustomName\")]\n    public sealed class SimpleEventSource : EventSource\n    {\n        public static class Opcodes\n        {\n            public const EventOpcode Opcode1 = (EventOpcode)100;\n            public const EventOpcode Opcode2 = (EventOpcode)101;\n        }\n\n        public static class Tasks\n        {\n            public const EventTask Custom = (EventTask)1;\n            public const EventTask Opcode = (EventTask)2;\n        }\n\n        public static class Keywords\n        {\n            public const EventKeywords LongKeyword = (EventKeywords)(1L << 33);\n        }\n\n        public static readonly SimpleEventSource Log = new SimpleEventSource();\n\n        [Event(1, Level = EventLevel.Warning, Version = 1)]\n        public void MyEvent1(string event1Arg0, int event1Arg1)\n        {\n            if (IsEnabled(EventLevel.Informational, EventKeywords.None)) { WriteEvent(1, event1Arg0, event1Arg1); }\n        }\n\n        public void MyEvent2(string event2Arg0, int event2Arg1)\n        {\n            WriteEvent(2, event2Arg0, event2Arg1);\n        }\n\n#if !EVENT_SOURCE_PACKAGE\n        [Event(3, Opcode = EventOpcode.Start)]\n        public void NoTaskSpecfied(int event3Arg0, int event3Arg1, int event3Arg2) { }\n#endif\n\n        [Event(4, Task = Tasks.Opcode, Opcode = EventOpcode.Info)]\n        public void OpcodeInfo() { }\n\n        [Event(5, Task = Tasks.Opcode, Opcode = EventOpcode.Start)]\n        public void OpcodeStart() { }\n\n        [Event(6, Task = Tasks.Opcode, Opcode = EventOpcode.Stop)]\n        public void OpcodeStop() { }\n\n        [Event(7, Task = Tasks.Opcode, Opcode = EventOpcode.DataCollectionStart)]\n        public void OpcodeDataCollectionStart() { }\n\n        [Event(8, Task = Tasks.Opcode, Opcode = EventOpcode.DataCollectionStop)]\n        public void OpcodeDataCollectionStop() { }\n\n        [Event(9, Task = Tasks.Opcode, Opcode = EventOpcode.Extension)]\n        public void OpcodeExtension() { }\n\n        [Event(10, Task = Tasks.Opcode, Opcode = EventOpcode.Reply)]\n        public void OpcodeReply() { }\n\n        [Event(11, Task = Tasks.Opcode, Opcode = EventOpcode.Resume)]\n        public void OpcodeResume() { }\n\n        [Event(12, Task = Tasks.Opcode, Opcode = EventOpcode.Suspend)]\n        public void OpcodeSuspend() { }\n\n        [Event(13, Task = Tasks.Opcode, Opcode = EventOpcode.Send)]\n        public void OpcodeSend() { }\n\n        [Event(14, Task = Tasks.Opcode, Opcode = EventOpcode.Receive)]\n        public void OpcodeReceive() { }\n\n        [Event(15, Task = Tasks.Custom, Opcode = Opcodes.Opcode1)]\n        public void CustomOpcode1() { }\n\n        [Event(16, Task = Tasks.Custom, Opcode = Opcodes.Opcode2)]\n        public void CustomOpcode2() { }\n\n        [Event(21, Level = EventLevel.LogAlways)]\n        public void LevelLogAlways() { }\n\n        [Event(22, Level = EventLevel.Critical)]\n        public void LevelCritical() { }\n\n        [Event(23, Level = EventLevel.Error)]\n        public void LevelError() { }\n\n        [Event(24, Level = EventLevel.Warning)]\n        public void LevelWarning() { }\n\n        [Event(25, Level = EventLevel.Informational)]\n        public void LevelInformational() { }\n\n        [Event(26, Level = EventLevel.Verbose)]\n        public void LevelVerbose() { }\n\n        [Event(27, Keywords = Keywords.LongKeyword)]\n        public void EventWithLongKeywords() { }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/SimpleMessageFormatter.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.IO;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    internal class SimpleMessageFormatter : IEventTextFormatter\n    {\n        public void WriteEvent(EventEntry eventEntry, TextWriter writer)\n        {\n            writer.Write(eventEntry.FormattedMessage);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/StringCollectionEventListener.cs",
    "content": "using System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    public class StringCollectionEventListener : EventListener, IObserver<EventEntry>\n    {\n        private readonly EventSourceSchemaCache schemaCache = EventSourceSchemaCache.Instance;\n        private IEventTextFormatter formatter;\n\n        public List<string> EventsWritten { get; set; }\n\n        public StringCollectionEventListener(IEventTextFormatter formatter = null)\n        {\n            this.formatter = formatter ?? new JsonEventTextFormatter();\n            EventsWritten = new List<string>();\n        }\n\n        protected override void OnEventWritten(EventWrittenEventArgs eventData)\n        {\n            var entry = EventEntry.Create(eventData, this.schemaCache.GetSchema(eventData.EventId, eventData.EventSource));\n            OnNext(entry);\n        }\n\n        public void OnNext(EventEntry value)\n        {\n            EventsWritten.Add(formatter.WriteEvent(value));\n        }\n\n        public void OnError(Exception error)\n        {\n        }\n\n        public void OnCompleted()\n        {\n        }\n    }\n}"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/TestEventEntry.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    public class TestEventEntry\n    {\n        public int EventId { get; set; }\n\n        public Guid ProviderId { get; set; }\n\n        public string EventSourceName { get; set; }\n\n        public string Message { get; set; }\n\n        public long EventKeywords { get; set; }\n\n        public int Level { get; set; }\n\n        public int Opcode { get; set; }\n\n        public int Task { get; set; }\n\n        public int Version { get; set; }\n\n        public Dictionary<string, object> Payload { get; set; }\n\n        public DateTimeOffset Timestamp { get; set; }\n\n        public int ProcessId { get; set; }\n\n        public int ThreadId { get; set; }\n\n        public Guid ActivityId { get; set; }\n\n        public Guid RelatedActivityId { get; set; }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestObjects/TestEventSource.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects\n{\n    [EventSource(Name = \"Test\")]\n    public sealed class TestEventSource : EventSource\n    {\n        public const int InformationalEventId = 4;\n        public const int ErrorEventId = 5;\n        public const int CriticalEventId = 6;\n        public const int VerboseEventId = 100;\n        public const int NonDefaultOpcodeNonDefaultVersionEventId = 103;\n        public const int EventWithoutPayloadNorMessageId = 200;\n        public const int EventWithPayloadId = 201;\n        public const int EventWithMessageId = 202;\n        public const int EventWithPayloadAndMessageId = 203;\n        public const int EventWithPayloadAndMessageAndRelatedActivityIdId = 204;\n        public const int EventWithHighIdId = (int)ushort.MaxValue + 100;\n        public const int EventWithLowIdId = -100;\n\n        [Event(InformationalEventId, Level = EventLevel.Informational)]\n        public void Informational(string message)\n        {\n            if (IsEnabled(EventLevel.Informational, EventKeywords.None)) { WriteEvent(InformationalEventId, message); }\n        }\n\n        [Event(ErrorEventId, Level = EventLevel.Error)]\n        public void Error(string message)\n        {\n            if (IsEnabled(EventLevel.Error, EventKeywords.None)) { WriteEvent(ErrorEventId, message); }\n        }\n\n        [Event(CriticalEventId, Level = EventLevel.Critical)]\n        public void Critical(string message)\n        {\n            if (IsEnabled(EventLevel.Critical, EventKeywords.None)) { WriteEvent(CriticalEventId, message); }\n        }\n\n        [Event(VerboseEventId, Level = EventLevel.Verbose)]\n        public void Write(string message) { WriteEvent(VerboseEventId, message); }\n\n        [Event(EventWithoutPayloadNorMessageId, Level = EventLevel.Warning)]\n        public void EventWithoutPayloadNorMessage()\n        {\n            if (IsEnabled(EventLevel.Warning, EventKeywords.None)) { WriteEvent(EventWithoutPayloadNorMessageId); }\n        }\n\n        [Event(EventWithPayloadId, Level = EventLevel.Warning)]\n        public void EventWithPayload(string payload1, int payload2)\n        {\n            if (IsEnabled(EventLevel.Warning, EventKeywords.None)) { WriteEvent(EventWithPayloadId, payload1, payload2); }\n        }\n\n        [Event(EventWithMessageId, Level = EventLevel.Warning, Message = \"Test message\")]\n        public void EventWithMessage()\n        {\n            if (IsEnabled(EventLevel.Warning, EventKeywords.None)) { WriteEvent(EventWithMessageId); }\n        }\n\n        [Event(EventWithPayloadAndMessageId, Level = EventLevel.Warning, Keywords = EventKeywords.None, Message = \"Test message {0} {1}\")]\n        public void EventWithPayloadAndMessage(string payload1, int payload2)\n        {\n            if (IsEnabled()) { WriteEvent(EventWithPayloadAndMessageId, payload1, payload2); }\n        }\n\n        [Event(EventWithPayloadAndMessageAndRelatedActivityIdId, Level = EventLevel.Warning, Keywords = EventKeywords.None, Message = \"Test message {0} {1}\", Task = Tasks.Other, Opcode = EventOpcode.Send)]\n        public void EventWithPayloadAndMessageAndRelatedActivityId(Guid relatedActivityId, string payload1, int payload2)\n        {\n            if (IsEnabled()) { WriteEventWithRelatedActivityId(EventWithPayloadAndMessageAndRelatedActivityIdId, relatedActivityId, payload1, payload2); }\n        }\n\n        [Event(NonDefaultOpcodeNonDefaultVersionEventId, Opcode = EventOpcode.Reply, Version = 0x02, Task = Tasks.DBQuery,\n            Message = \"arg1- {0},arg2- {1},arg3- {2}\")]\n        public void NonDefaultOpcodeNonDefaultVersionEvent(int arg1, int arg2, int arg3)\n        {\n            if (IsEnabled()) { WriteEvent(NonDefaultOpcodeNonDefaultVersionEventId, arg1, arg2, arg3); }\n        }\n\n        [Event(305)]\n        public void UsingEnumArguments(MyLongEnum arg1, MyIntEnum arg2)\n        {\n            if (IsEnabled()) { WriteEvent(305, arg1, arg2); }\n        }\n\n        [Event(50)]\n        public void FastEvent(int arg)\n        {\n            WriteEvent(50, arg);\n        }\n\n        public static readonly TestEventSource Log = new TestEventSource();\n\n        public class Tasks\n        {\n            public const EventTask Page = (EventTask)1;\n            public const EventTask DBQuery = (EventTask)2;\n            public const EventTask Other = (EventTask)3;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestSupport/ArrangeActAssert.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport\n{\n    /// <summary>\n    /// A base class for tests written in the BDD style that provide standard\n    /// methods to set up test actions and the \"when\" statements. \"Then\" is\n    /// encapsulated by the [TestMethod]s themselves.\n    /// </summary>\n    [TestClass]\n    public abstract class ArrangeActAssert\n    {\n        /// <summary>\n        /// When overridden in a derived class, this method is used to\n        /// set up the current state of the specs context.\n        /// </summary>\n        /// <remarks>This method is called automatically before every test,\n        /// before the <see cref=\"Act\"/> method.</remarks>\n        protected virtual void Arrange()\n        {\n        }\n\n        /// <summary>\n        /// When overridden in a derived class, this method is used to\n        /// perform interactions against the system under test.\n        /// </summary>\n        /// <remarks>This method is called automatically after <see cref=\"Arrange\"/>\n        /// and before each test method runs.</remarks>\n        protected virtual void Act()\n        {\n        }\n\n        /// <summary>\n        /// When overridden in a derived class, this method is used to\n        /// reset the state of the system after a test method has completed.\n        /// </summary>\n        /// <remarks>This method is called automatically after each TestMethod has run.</remarks>\n        protected virtual void Teardown()\n        {\n        }\n\n        #region MSTEST integration methods\n\n        [TestInitialize]\n        public void MainSetup()\n        {\n            Arrange();\n            Act();\n        }\n\n        [TestCleanup]\n        public void MainTeardown()\n        {\n            Teardown();\n        }\n\n        #endregion\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestSupport/AssemblyBuilder.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.CodeDom.Compiler;\nusing System.Linq;\nusing System.Text;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport\n{\n    internal class AssemblyBuilder\n    {\n        public static CompilerResults CompileFromSource(string source, bool generateInMemory = true)\n        {\n            CompilerParameters parameters = new CompilerParameters()\n            {\n                TempFiles = new TempFileCollection(\".\", false),\n                GenerateInMemory = generateInMemory,\n                TreatWarningsAsErrors = true,\n            };\n\n            foreach (string location in AppDomain.CurrentDomain.GetAssemblies().\n                Where(a => !a.IsDynamic && !string.IsNullOrWhiteSpace(a.Location)).\n                Select(a => a.Location))\n            {\n                if (!parameters.ReferencedAssemblies.Contains(location))\n                {\n                    parameters.ReferencedAssemblies.Add(location);\n                }\n            }\n\n            using (CodeDomProvider provider = new CSharp.CSharpCodeProvider())\n            {\n                return provider.CompileAssemblyFromSource(parameters, source);\n            }\n        }\n\n        public static string DumpOnErrors(CompilerResults results)\n        {\n            if (results.Errors.HasErrors)\n            {\n                StringBuilder sb = new StringBuilder();\n                foreach (CompilerError error in results.Errors)\n                {\n                    sb.AppendFormat(\"{0}. Line: {1}, Col: {2}\", error.ErrorText, error.Line, error.Column);\n                    sb.AppendLine();\n                }\n                return sb.ToString();\n            }\n            return string.Empty;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestSupport/AssertEx.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport\n{\n    public static class AssertEx\n    {\n        public static TException Throws<TException>(Action action)\n            where TException : Exception\n        {\n            try\n            {\n                action();                \n            }\n            catch (TException e)\n            {\n                return e;\n            }\n\n            Assert.Fail(\"Exception of type {0} should be thrown.\", typeof(TException));\n            \n            return default(TException);\n        }\n\n        public static TException ThrowsInner<TException>(Action action)\n            where TException : Exception\n        {\n            try\n            {\n                action();\n            }\n            catch (Exception e)\n            {\n                for (Exception x = e; x != null; x = x.InnerException)\n                {\n                    if (x.GetType() == typeof(TException)) { return (TException)e; }\n                }\n            }\n\n            Assert.Fail(\"Exception of type {0} should be thrown.\", typeof(TException));\n            \n            return default(TException);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestSupport/ConfigurationHelper.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Configuration;\nusing Microsoft.Win32;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport\n{\n    internal class ConfigurationHelper\n    {\n        public static string GetSetting(string settingName)\n        {\n            string value = null;\n            using (var subKey = Registry.CurrentUser.OpenSubKey(@\"Software\\Microsoft\\EntLib\") ?? Registry.CurrentUser)\n            {\n                var keyValue = subKey.GetValue(settingName);\n                if (keyValue != null)\n                {\n                    value = keyValue.ToString();\n                }\n            }\n\n            if (string.IsNullOrEmpty(value))\n            {\n                value = ConfigurationManager.AppSettings[settingName];\n            }\n\n            return value;\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestSupport/ContextBase.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport\n{\n    [TestClass]\n    public abstract class ContextBase\n    {\n        [TestInitialize]\n        public void Initialize()\n        {\n            this.Given();\n            this.When();\n        }\n\n        [TestCleanup]\n        public void Cleanup()\n        {\n            this.OnCleanup();\n        }\n\n        protected virtual void Given()\n        {\n        }\n\n        protected virtual void When()\n        {\n        }\n\n        protected virtual void OnCleanup()\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestSupport/DisposableDomain.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport\n{\n    internal sealed class DisposableDomain : IDisposable\n    {\n        private AppDomain domain = AppDomain.CreateDomain(Guid.NewGuid().ToString(), AppDomain.CurrentDomain.Evidence, AppDomain.CurrentDomain.SetupInformation);\n\n        public void DoCallBack(CrossAppDomainDelegate action)\n        {\n            this.domain.DoCallBack(action);\n        }\n\n        public void Dispose()\n        {\n            AppDomain.Unload(this.domain);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestSupport/EnumerableAssert.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Collections.Generic;\nusing System.Linq;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport\n{\n    public static class EnumerableAssert\n    {\n        public static void AreEqual<T>(IEnumerable<T> expected, IEnumerable<T> actual)\n        {\n            CollectionAssert.AreEqual(expected.ToList(), actual.ToList());\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestSupport/EventEntryTestHelper.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport\n{\n    internal static class EventEntryTestHelper\n    {\n        public static EventEntry Create(\n            int eventId = 0,\n            Guid providerId = default(Guid),\n            string providerName = null,\n            EventLevel level = default(EventLevel),\n            EventTask task = default(EventTask),\n            string taskName = null,\n            EventOpcode opcode = default(EventOpcode),\n            string opcodeName = null,\n            EventKeywords keywords = default(EventKeywords),\n            string keywordsDescription = null,\n            int version = 0,\n            IEnumerable<string> payloadNames = null,\n            string formattedMessage = null,\n            IEnumerable<object> payload = null,\n            DateTimeOffset timestamp = default(DateTimeOffset),\n            Guid activityId = default(Guid),\n            Guid relatedActivityId = default(Guid),\n            int processId = 0,\n            int threadId = 0)\n        {\n            return\n                new EventEntry(\n                    providerId,\n                    eventId,\n                    formattedMessage,\n                    new ReadOnlyCollection<object>((payload ?? Enumerable.Empty<object>()).ToList()),\n                    timestamp != default(DateTimeOffset) ? timestamp : DateTimeOffset.UtcNow,\n                    processId,\n                    threadId,\n                    activityId,\n                    relatedActivityId,\n                    new EventSchema(\n                        eventId, \n                        providerId, \n                        providerName, \n                        level, \n                        task, \n                        taskName, \n                        opcode, \n                        opcodeName,\n                        keywords, \n                        keywordsDescription, \n                        version, \n                        (payloadNames ?? Enumerable.Empty<string>())));\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestSupport/LocalDatabaseContext.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Data.SqlClient;\nusing System.IO;\nusing System.Reflection;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport\n{\n    public abstract class LocalDatabaseContext : ContextBase\n    {\n        protected const string LocalDbConnectionString = @\"Data Source=(LocalDB)\\v11.0;Initial Catalog=master;Integrated Security=True\";\n\n        protected string dbFileName;\n        protected string dbLogFileName;\n\n        protected string dbName;\n        protected SqlConnection localDbConnection = new SqlConnection(LocalDbConnectionString);\n\n        protected abstract string GetLocalDatabaseFileName();\n\n        protected override void Given()\n        {\n            this.dbName = this.GetLocalDatabaseFileName();\n\n            if (string.IsNullOrWhiteSpace(dbName))\n            {\n                Assert.Inconclusive(\"You must specify a valid database name\");\n            }\n\n            var output = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);\n\n            this.dbFileName = Path.Combine(output, dbName + \".mdf\");\n            this.dbLogFileName = Path.Combine(output, string.Format(\"{0}_log.ldf\", dbName));\n\n            this.localDbConnection.Open();\n\n            // Recover from failed run\n            this.DetachDatabase();\n\n            File.Delete(this.dbFileName);\n            File.Delete(this.dbLogFileName);\n\n            using (var cmd = new SqlCommand(string.Format(\"CREATE DATABASE {0} ON (NAME = N'{0}', FILENAME = '{1}')\", this.dbName, this.dbFileName), this.localDbConnection))\n            {\n                cmd.ExecuteNonQuery();\n            }\n        }\n\n        protected override void OnCleanup()\n        {\n            using (var cmd = new SqlCommand(string.Format(\"ALTER DATABASE {0} SET SINGLE_USER WITH ROLLBACK IMMEDIATE\", this.dbName), this.localDbConnection))\n            {\n                cmd.ExecuteNonQuery();\n            }\n\n            this.localDbConnection.ChangeDatabase(\"master\");\n            this.DetachDatabase();\n            this.localDbConnection.Dispose();\n\n            File.Delete(this.dbFileName);\n            File.Delete(this.dbLogFileName);\n        }\n\n        protected string GetSqlConnectionString()\n        {\n            var cs = string.Format(@\"Data Source=(LocalDB)\\v11.0;AttachDBFileName={1};Initial Catalog={0};Integrated Security=True;\", this.dbName, this.dbFileName);\n\n            return cs;\n        }\n\n        protected void DetachDatabase()\n        {\n            using (var cmd = new SqlCommand(string.Format(\"IF EXISTS (SELECT * FROM sys.databases WHERE Name = N'{0}') exec sp_detach_db N'{0}'\", dbName), this.localDbConnection))\n            {\n                cmd.ExecuteNonQuery();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/TestSupport/PollingHelper.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Threading;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport\n{\n    internal class PollingHelper\n    {\n        public static T WaitUntil<T>(Func<T> action, Func<T, bool> condition, TimeSpan timeout)\n        {\n            var waitTime = (int)Math.Max(timeout.TotalMilliseconds / 20.5d, 150d);\n            var deadline = DateTime.UtcNow.Add(timeout);\n            while (true)\n            {\n                T result = action();\n                if (condition(result))\n                {\n                    return result;\n                }\n\n                if (DateTime.UtcNow > deadline)\n                {\n                    Assert.Fail(\"Timeout time exceeded and condition was not met. Current result: {0}\", result);\n                }\n\n                Thread.Sleep(waitTime);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/UsingEventListener/ConsoleEventListenerFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.EventListeners\n{\n    public abstract class given_console_event_listener : ContextBase\n    {\n        protected MockDefaultConsoleColorMapper colorMapper;\n        protected MockConsoleOutput mockConsole;\n        protected ObservableEventListener listener;\n        protected EventTextFormatter formatter;\n        protected IEnumerable<string> entries\n        {\n            get { return Regex.Split(mockConsole.Ouput, formatter.Header + \"\\r\\n\").Where(c => !string.IsNullOrWhiteSpace(c)); }\n        }\n\n        protected override void Given()\n        {\n            colorMapper = new MockDefaultConsoleColorMapper();\n            mockConsole = new MockConsoleOutput();\n            formatter = new EventTextFormatter(EventTextFormatter.DashSeparator) { VerbosityThreshold = EventLevel.Informational };\n            listener = new ObservableEventListener();\n            listener.LogToConsole(formatter, colorMapper);\n            listener.EnableEvents(TestEventSource.Log, EventLevel.LogAlways);\n        }\n\n        protected override void OnCleanup()\n        {\n            base.OnCleanup();\n            mockConsole.Dispose();\n            listener.DisableEvents(TestEventSource.Log);\n            listener.Dispose();\n        }\n\n        [TestClass]\n        public class when_receiving_event_without_payload_nor_message : given_console_event_listener\n        {\n            protected override void When()\n            {\n                TestEventSource.Log.EventWithoutPayloadNorMessage();\n            }\n\n            [TestMethod]\n            public void then_writes_event_to_console()\n            {\n                var entry = this.entries.SingleOrDefault();\n\n                Assert.IsNotNull(entry);\n                Assert.AreEqual(DefaultConsoleColorMapper.Warning, colorMapper.Color);\n\n                StringAssert.Contains(entry.ToString(), \"EventId : 200\");\n                StringAssert.Contains(entry.ToString(), \"Level : Warning\");\n                StringAssert.Contains(entry.ToString(), \"Message : \");\n                StringAssert.Contains(entry.ToString(), \"Payload :\");\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_payload : given_console_event_listener\n        {\n            protected override void When()\n            {\n                TestEventSource.Log.EventWithPayload(\"payload\", 100);\n            }\n\n            [TestMethod]\n            public void then_writes_event_to_console()\n            {\n                var entry = this.entries.SingleOrDefault();\n\n                Assert.IsNotNull(entry);\n                StringAssert.Contains(entry, TestEventSource.EventWithPayloadId.ToString());\n                Assert.AreEqual(DefaultConsoleColorMapper.Warning, colorMapper.Color);\n                StringAssert.Contains(entry.ToString(), \"EventId : 201\");\n                StringAssert.Contains(entry.ToString(), \"Level : Warning\");\n                StringAssert.Contains(entry.ToString(), \"Payload : [payload1 : payload] [payload2 : 100]\");\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_message : given_console_event_listener\n        {\n            protected override void When()\n            {\n                TestEventSource.Log.EventWithMessage();\n            }\n\n            [TestMethod]\n            public void then_writes_event_to_console()\n            {\n                var entry = this.entries.SingleOrDefault();\n\n                Assert.IsNotNull(entry);\n                StringAssert.Contains(entry, TestEventSource.EventWithMessageId.ToString());\n                Assert.AreEqual(DefaultConsoleColorMapper.Warning, colorMapper.Color);\n\n                StringAssert.Contains(entry.ToString(), \"EventId : 202\");\n                StringAssert.Contains(entry.ToString(), \"Level : Warning\");\n                StringAssert.Contains(entry.ToString(), \"Message : Test message\");\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_event_with_payload_and_message : given_console_event_listener\n        {\n            protected override void When()\n            {\n                TestEventSource.Log.EventWithPayloadAndMessage(\"payload\", 100);\n            }\n\n            [TestMethod]\n            public void then_writes_event_to_console()\n            {\n                var entry = this.entries.SingleOrDefault();\n\n                Assert.IsNotNull(entry);\n                StringAssert.Contains(entry, TestEventSource.EventWithPayloadAndMessageId.ToString());\n                Assert.AreEqual(DefaultConsoleColorMapper.Warning, colorMapper.Color);\n\n                StringAssert.Contains(entry.ToString(), \"EventId : 203\");\n                StringAssert.Contains(entry.ToString(), \"Level : Warning\");\n                StringAssert.Contains(entry.ToString(), \"Message : Test message payload 100\");\n                StringAssert.Contains(entry.ToString(), \"Payload : [payload1 : payload] [payload2 : 100]\");\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_multiple_events_with_message : given_console_event_listener\n        {\n            protected override void When()\n            {\n                TestEventSource.Log.EventWithMessage();\n                TestEventSource.Log.EventWithMessage();\n                TestEventSource.Log.EventWithMessage();\n            }\n\n            [TestMethod]\n            public void then_writes_event_to_console()\n            {\n                Assert.AreEqual(3, this.entries.Count());\n                Assert.IsTrue(this.entries.All(e => e.Contains(\"Test message\")));\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_information_event_with_message : given_console_event_listener\n        {\n            private ConsoleColor color;\n\n            protected override void When()\n            {\n                color = Console.ForegroundColor;\n                TestEventSource.Log.Informational(\"Test\");\n            }\n\n            [TestMethod]\n            public void then_writes_event_to_console_with_information_foreground_color()\n            {\n                var entry = this.entries.SingleOrDefault();\n\n                Assert.IsNotNull(entry);\n                StringAssert.Contains(entry, TestEventSource.InformationalEventId.ToString());\n                Assert.AreEqual(color, colorMapper.Color);\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_verbose_event_with_message : given_console_event_listener\n        {\n            protected override void When()\n            {\n                TestEventSource.Log.Write(\"Test\");\n            }\n\n            [TestMethod]\n            public void then_writes_event_to_console_with_verbose_foreground_color()\n            {\n                var entry = this.entries.SingleOrDefault();\n\n                Assert.IsNotNull(entry);\n                StringAssert.Contains(entry, TestEventSource.VerboseEventId.ToString());\n                Assert.AreEqual(DefaultConsoleColorMapper.Verbose, colorMapper.Color);\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_error_event_with_message : given_console_event_listener\n        {\n            protected override void When()\n            {\n                TestEventSource.Log.Error(\"Test\");\n            }\n\n            [TestMethod]\n            public void then_writes_event_to_console_with_error_foreground_color()\n            {\n                var entry = this.entries.SingleOrDefault();\n\n                Assert.IsNotNull(entry);\n                StringAssert.Contains(entry, TestEventSource.ErrorEventId.ToString());\n                Assert.AreEqual(DefaultConsoleColorMapper.Error, colorMapper.Color);\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_critical_event_with_message : given_console_event_listener\n        {\n            protected override void When()\n            {\n                TestEventSource.Log.Critical(\"Test\");\n            }\n\n            [TestMethod]\n            public void then_writes_event_to_console_with_critical_foreground_color()\n            {\n                var entry = this.entries.SingleOrDefault();\n\n                Assert.IsNotNull(entry);\n                StringAssert.Contains(entry, TestEventSource.CriticalEventId.ToString());\n                Assert.AreEqual(DefaultConsoleColorMapper.Critical, colorMapper.Color);\n            }\n        }\n\n        [TestClass]\n        public class when_providing_a_custom_formatter_with_payload : given_console_event_listener\n        {\n            protected override void Given()\n            {\n                this.mockConsole = new MockConsoleOutput();\n                this.listener = new ObservableEventListener();\n                this.listener.LogToConsole(new MockFormatter());\n                this.listener.EnableEvents(TestEventSource.Log, EventLevel.LogAlways);\n            }\n\n            protected override void When()\n            {\n                TestEventSource.Log.EventWithPayload(\"payload1\", 100);\n            }\n\n            [TestMethod]\n            public void then_writes_event_to_console()\n            {\n                Assert.AreEqual(\"payload1,100\", this.mockConsole.Ouput);\n            }\n        }\n\n        [TestClass]\n        public class when_providing_a_custom_colormapper_with_error : given_console_event_listener\n        {\n            private MockColorMapper mockColorMapper;\n\n            protected override void Given()\n            {\n                this.mockColorMapper = new MockColorMapper();\n                this.mockConsole = new MockConsoleOutput();\n                this.listener = new ObservableEventListener();\n                this.listener.LogToConsole(null, this.mockColorMapper);\n                this.listener.EnableEvents(TestEventSource.Log, EventLevel.LogAlways);\n            }\n\n            protected override void When()\n            {\n                TestEventSource.Log.Error(\"error\");\n            }\n\n            [TestMethod]\n            public void then_writes_event_to_console()\n            {\n                Assert.AreEqual(MockColorMapper.Error, this.mockColorMapper.Color);\n            }\n        }\n\n        [TestClass]\n        public class when_receiving_concurrent_events_with_message : given_console_event_listener\n        {\n            private const int MaxLoggedEntries = 20;\n\n            protected override void When()\n            {\n                Parallel.For(0, MaxLoggedEntries, i => TestEventSource.Log.Informational(\"Info \" + i));\n            }\n\n            [TestMethod]\n            public void then_writes_multiple_events_to_console()\n            {\n                Assert.AreEqual<int>(MaxLoggedEntries, this.entries.Count());\n            }\n        }\n\n        [TestClass]\n        public class when_providing_a_failed_formatter_with_payload : given_console_event_listener\n        {\n            private InMemoryEventListener collectErrorsListener;\n\n            protected override void Given()\n            {\n                this.mockConsole = new MockConsoleOutput();\n                // Will always throw\n                this.listener = new ObservableEventListener();\n                this.listener.LogToConsole(new MockFormatter() { BeforeWriteEventAction = (f) => { throw new InvalidOperationException(); } });\n                this.listener.EnableEvents(TestEventSource.Log, EventLevel.LogAlways);\n                collectErrorsListener = new InMemoryEventListener();\n                collectErrorsListener.EnableEvents(SemanticLoggingEventSource.Log, EventLevel.Error, SemanticLoggingEventSource.Keywords.Sink);\n            }\n\n            protected override void When()\n            {\n                TestEventSource.Log.EventWithPayload(\"payload1\", 100);\n            }\n\n            protected override void OnCleanup()\n            {\n                base.OnCleanup();\n                collectErrorsListener.Dispose();\n            }\n\n            [TestMethod]\n            public void then_writes_event_to_errors_source()\n            {\n                StringAssert.Contains(collectErrorsListener.ToString(), \"EventId : 1100\");\n                StringAssert.Contains(collectErrorsListener.ToString(), \"Level : Critical\");\n                StringAssert.Contains(collectErrorsListener.ToString(), \"Payload : [message : System.InvalidOperationException\");\n            }\n\n            [TestMethod]\n            public void then_does_not_write_to_console()\n            {\n                Assert.AreEqual(string.Empty, this.mockConsole.Ouput);\n            }\n        }\n\n        [TestClass]\n        public class when_a_formatter_fails_flush_should_not_dump_invalid_output : given_console_event_listener\n        {\n            protected override void Given()\n            {\n                this.mockConsole = new MockConsoleOutput();\n                // Will throw on first write only\n                this.listener = new ObservableEventListener();\n                this.listener.LogToConsole(new MockFormatter() { AfterWriteEventAction = (f) => { if (f.WriteEventCalls.Count == 1) { throw new InvalidOperationException(); } } });\n                this.listener.EnableEvents(TestEventSource.Log, EventLevel.LogAlways);\n            }\n\n            protected override void When()\n            {\n                // First log will fail\n                TestEventSource.Log.EventWithPayload(\"payload1\", 100);\n                // Second log will succeed and first error log should not be flushed \n                TestEventSource.Log.EventWithPayloadAndMessage(\"payload2\", 10);\n            }\n\n            [TestMethod]\n            public void then_only_non_faulted_event_is_written()\n            {\n                Assert.IsTrue(this.mockConsole.Ouput.StartsWith(\"Test message payload2 10\"));\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/UsingEventListener/DeferredEnablementFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.UsingEventListener\n{\n    [TestClass]\n    public class DeferredEnablementFixture\n    {\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentNullException))]\n        public void EnablingNullEventSourceNameThrows()\n        {\n            using (var listener = new ObservableEventListener())\n            {\n                listener.EnableEvents((string)null, EventLevel.LogAlways);\n            }\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentException))]\n        public void EnablingEmptyEventSourceNameThrows()\n        {\n            using (var listener = new ObservableEventListener())\n            {\n                listener.EnableEvents(string.Empty, EventLevel.LogAlways);\n            }\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentException))]\n        public void EnablingNonObservableEventListenerThrows()\n        {\n            using (var listener = new NotObservableEventListener())\n            {\n                listener.EnableEvents(\"some source name\", EventLevel.LogAlways);\n            }\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentException))]\n        public void DisablingNonObservableEventListenerThrows()\n        {\n            using (var listener = new NotObservableEventListener())\n            {\n                listener.DisableEvents(\"some source name\");\n            }\n        }\n\n        [TestMethod]\n        public void EnablingOnExistingEventSourceIsImmediateUsingSuppliedParameters()\n        {\n            ExecuteWithHelperInAppDomain(\n                helper => helper.EnablingOnExistingEventSourceIsImmediateUsingSuppliedParameters());\n        }\n\n        [TestMethod]\n        public void EnablingWithoutKeywordsDefaultsToNone()\n        {\n            ExecuteWithHelperInAppDomain(\n                helper => helper.EnablingWithoutKeywordsDefaultsToNone());\n        }\n\n        [TestMethod]\n        public void EnablingOnNonExistingEventSourceIsDeferredUsingSuppliedParameters()\n        {\n            ExecuteWithHelperInAppDomain(\n                helper => helper.EnablingOnNonExistingEventSourceIsDeferredUsingSuppliedParameters());\n        }\n\n        [TestMethod]\n        public void OnlyLastDeferredEnableRequestIsHonored()\n        {\n            ExecuteWithHelperInAppDomain(\n                helper => helper.OnlyLastDeferredEnableRequestIsHonored());\n        }\n\n        [TestMethod]\n        public void AllNonDeferredEnableRequestAreHonored()\n        {\n            ExecuteWithHelperInAppDomain(\n                helper => helper.AllNonDeferredEnableRequestAreHonored());\n        }\n\n        [TestMethod]\n        public void DeferredRequestCopiesDictionaryValues()\n        {\n            ExecuteWithHelperInAppDomain(\n                helper => helper.DeferredRequestCopiesDictionaryValues());\n        }\n\n        [TestMethod]\n        public void CanDisableEventsOnNonEnabledNonCreatedEventSource()\n        {\n            ExecuteWithHelperInAppDomain(\n                helper => helper.CanDisableEventsOnNonEnabledNonCreatedEventSource());\n        }\n\n        [TestMethod]\n        public void CanDisableEventsOnNonEnabledCreatedEventSource()\n        {\n            ExecuteWithHelperInAppDomain(\n                helper => helper.CanDisableEventsOnNonEnabledCreatedEventSource());\n        }\n\n        [TestMethod]\n        public void CanDisableEventsOnEnabledEventSourceBeforeItIsCreated()\n        {\n            ExecuteWithHelperInAppDomain(\n                helper => helper.CanDisableEventsOnEnabledEventSourceBeforeItIsCreated());\n        }\n\n        [TestMethod]\n        public void CanDisableEventsOnEnabledEventSourceAfterItIsCreated()\n        {\n            ExecuteWithHelperInAppDomain(\n                helper => helper.CanDisableEventsOnEnabledEventSourceAfterItIsCreated());\n        }\n\n        [TestMethod]\n        public void CanDeferRequestsForMultipleSources()\n        {\n            ExecuteWithHelperInAppDomain(\n                helper => helper.CanDeferRequestsForMultipleSources());\n        }\n\n        public static void ExecuteWithHelperInAppDomain(Action<DeferredEnablementFixtureTestHelper> testAction)\n        {\n            var appDomain = AppDomain.CreateDomain(\"test app domain\", AppDomain.CurrentDomain.Evidence, AppDomain.CurrentDomain.SetupInformation);\n            try\n            {\n                var helper =\n                    (DeferredEnablementFixtureTestHelper)appDomain.CreateInstanceAndUnwrap(\n                        typeof(DeferredEnablementFixtureTestHelper).Assembly.FullName,\n                        typeof(DeferredEnablementFixtureTestHelper).FullName);\n\n                testAction(helper);\n            }\n            finally\n            {\n                AppDomain.Unload(appDomain);\n            }\n        }\n    }\n\n    public class DeferredEnablementFixtureTestHelper : MarshalByRefObject\n    {\n        public void EnablingOnExistingEventSourceIsImmediateUsingSuppliedParameters()\n        {\n            var eventSourceName = SensingEventSource.Log.Name;\n\n            using (EventListener listener = new ObservableEventListener())\n            {\n                var immediate = listener.EnableEvents(eventSourceName, EventLevel.Error, EventKeywords.AuditSuccess | EventKeywords.AuditFailure);\n\n                Assert.IsTrue(immediate);\n\n                Assert.IsTrue(SensingEventSource.Log.IsEnabled(EventLevel.Error, EventKeywords.AuditFailure));\n                Assert.IsFalse(SensingEventSource.Log.IsEnabled(EventLevel.Error, EventKeywords.EventLogClassic));\n                Assert.IsFalse(SensingEventSource.Log.IsEnabled(EventLevel.Warning, EventKeywords.AuditFailure));\n            }\n        }\n\n        public void EnablingWithoutKeywordsDefaultsToNone()\n        {\n            var eventSourceName = SensingEventSource.Log.Name;\n\n            using (EventListener listener = new ObservableEventListener())\n            {\n                var immediate = listener.EnableEvents(eventSourceName, EventLevel.Error);\n\n                Assert.IsTrue(immediate);\n\n                Assert.IsTrue(SensingEventSource.Log.IsEnabled(EventLevel.Error, EventKeywords.None));\n                Assert.IsTrue(SensingEventSource.Log.IsEnabled(EventLevel.Error, EventKeywords.AuditFailure));\n                Assert.IsFalse(SensingEventSource.Log.IsEnabled(EventLevel.Warning, EventKeywords.None));\n            }\n        }\n\n        public void EnablingOnNonExistingEventSourceIsDeferredUsingSuppliedParameters()\n        {\n            var eventSourceName = \"SensingEventSource\";\n\n            using (EventListener listener = new ObservableEventListener())\n            {\n                var immediate = listener.EnableEvents(eventSourceName, EventLevel.Error, EventKeywords.AuditSuccess | EventKeywords.AuditFailure);\n\n                Assert.IsFalse(immediate);\n\n                Assert.IsTrue(SensingEventSource.Log.IsEnabled(EventLevel.Error, EventKeywords.AuditFailure));\n                Assert.IsFalse(SensingEventSource.Log.IsEnabled(EventLevel.Error, EventKeywords.EventLogClassic));\n                Assert.IsFalse(SensingEventSource.Log.IsEnabled(EventLevel.Warning, EventKeywords.AuditFailure));\n            }\n        }\n\n        public void OnlyLastDeferredEnableRequestIsHonored()\n        {\n            var eventSourceName = \"SensingEventSource\";\n\n            using (EventListener listener = new ObservableEventListener())\n            {\n                listener.EnableEvents(eventSourceName, EventLevel.Error, EventKeywords.AuditSuccess | EventKeywords.AuditFailure);\n                listener.EnableEvents(eventSourceName, EventLevel.Informational, EventKeywords.Sqm, new Dictionary<string, string> { { \"key1\", \"value1\" } });\n                listener.EnableEvents(eventSourceName, EventLevel.Warning, EventKeywords.EventLogClassic, new Dictionary<string, string> { { \"key2\", \"value2\" } });\n\n                Assert.IsTrue(SensingEventSource.Log.IsEnabled(EventLevel.Warning, EventKeywords.EventLogClassic));\n                Assert.AreEqual(1, SensingEventSource.Log.Commands.Count);\n                Assert.AreEqual(1, SensingEventSource.Log.Commands[0].Count);\n                Assert.AreEqual(\"value2\", SensingEventSource.Log.Commands[0][\"key2\"]);\n            }\n        }\n\n        public void AllNonDeferredEnableRequestAreHonored()\n        {\n            var eventSourceName = SensingEventSource.Log.Name;\n\n            using (EventListener listener = new ObservableEventListener())\n            {\n                listener.EnableEvents(eventSourceName, EventLevel.Error, EventKeywords.AuditSuccess | EventKeywords.AuditFailure);\n                listener.EnableEvents(eventSourceName, EventLevel.Informational, EventKeywords.Sqm, new Dictionary<string, string> { { \"key1\", \"value1\" } });\n                listener.EnableEvents(eventSourceName, EventLevel.Warning, EventKeywords.EventLogClassic, new Dictionary<string, string> { { \"key2\", \"value2\" } });\n\n                Assert.IsTrue(SensingEventSource.Log.IsEnabled(EventLevel.Warning, EventKeywords.EventLogClassic));\n                Assert.AreEqual(3, SensingEventSource.Log.Commands.Count);\n                Assert.AreEqual(0, SensingEventSource.Log.Commands[0].Count);\n                Assert.AreEqual(1, SensingEventSource.Log.Commands[1].Count);\n                Assert.AreEqual(\"value1\", SensingEventSource.Log.Commands[1][\"key1\"]);\n                Assert.AreEqual(1, SensingEventSource.Log.Commands[2].Count);\n                Assert.AreEqual(\"value2\", SensingEventSource.Log.Commands[2][\"key2\"]);\n            }\n        }\n\n        public void DeferredRequestCopiesDictionaryValues()\n        {\n            var eventSourceName = \"SensingEventSource\";\n\n            using (EventListener listener = new ObservableEventListener())\n            {\n                var commands = new Dictionary<string, string>();\n                commands[\"key\"] = \"oldvalue\";\n                var immediate = listener.EnableEvents(eventSourceName, EventLevel.Warning, EventKeywords.EventLogClassic, commands);\n\n                Assert.IsFalse(immediate);\n                commands[\"key\"] = \"newvalue\";\n                Assert.AreEqual(\"oldvalue\", SensingEventSource.Log.Commands[0][\"key\"]);\n            }\n        }\n\n        public void CanDisableEventsOnNonEnabledNonCreatedEventSource()\n        {\n            var eventSourceName = \"SensingEventSource\";\n\n            using (EventListener listener = new ObservableEventListener())\n            {\n                listener.DisableEvents(eventSourceName);\n\n                Assert.IsFalse(SensingEventSource.Log.IsEnabled());\n            }\n        }\n\n        public void CanDisableEventsOnNonEnabledCreatedEventSource()\n        {\n            var eventSourceName = SensingEventSource.Log.Name;\n\n            using (EventListener listener = new ObservableEventListener())\n            {\n                listener.DisableEvents(eventSourceName);\n\n                Assert.IsFalse(SensingEventSource.Log.IsEnabled());\n            }\n        }\n\n        public void CanDisableEventsOnEnabledEventSourceBeforeItIsCreated()\n        {\n            var eventSourceName = \"SensingEventSource\";\n\n            using (EventListener listener = new ObservableEventListener())\n            {\n                listener.EnableEvents(eventSourceName, EventLevel.Error, EventKeywords.AuditSuccess | EventKeywords.AuditFailure);\n                listener.EnableEvents(eventSourceName, EventLevel.Informational, EventKeywords.Sqm, new Dictionary<string, string> { { \"key1\", \"value1\" } });\n                listener.EnableEvents(eventSourceName, EventLevel.Warning, EventKeywords.EventLogClassic, new Dictionary<string, string> { { \"key2\", \"value2\" } });\n                listener.DisableEvents(eventSourceName);\n\n                Assert.IsFalse(SensingEventSource.Log.IsEnabled());\n                Assert.AreEqual(0, SensingEventSource.Log.Commands.Count);\n            }\n        }\n\n        public void CanDisableEventsOnEnabledEventSourceAfterItIsCreated()\n        {\n            var eventSourceName = \"SensingEventSource\";\n\n            using (EventListener listener = new ObservableEventListener())\n            {\n                listener.EnableEvents(eventSourceName, EventLevel.Error, EventKeywords.AuditSuccess | EventKeywords.AuditFailure);\n                listener.EnableEvents(eventSourceName, EventLevel.Informational, EventKeywords.Sqm, new Dictionary<string, string> { { \"key1\", \"value1\" } });\n                listener.EnableEvents(eventSourceName, EventLevel.Warning, EventKeywords.EventLogClassic, new Dictionary<string, string> { { \"key2\", \"value2\" } });\n\n                Assert.IsTrue(SensingEventSource.Log.IsEnabled());\n                Assert.AreEqual(1, SensingEventSource.Log.Commands.Count);\n\n                listener.DisableEvents(eventSourceName);\n\n                Assert.IsFalse(SensingEventSource.Log.IsEnabled());\n                Assert.AreEqual(2, SensingEventSource.Log.Commands.Count);\n            }\n        }\n\n        public void CanDeferRequestsForMultipleSources()\n        {\n            using (EventListener listener = new ObservableEventListener())\n            {\n                listener.EnableEvents(\"DeferredEventSource1\", EventLevel.Error, EventKeywords.AuditSuccess | EventKeywords.AuditFailure);\n                listener.EnableEvents(\"DeferredEventSource2\", EventLevel.Informational, EventKeywords.Sqm, new Dictionary<string, string> { { \"key1\", \"value1\" } });\n                listener.EnableEvents(\"DeferredEventSource3\", EventLevel.Warning, EventKeywords.EventLogClassic, new Dictionary<string, string> { { \"key2\", \"value2\" } });\n                listener.EnableEvents(\"DeferredEventSource2\", EventLevel.Warning, EventKeywords.EventLogClassic, new Dictionary<string, string> { { \"key2\", \"value2\" } });\n                listener.EnableEvents(\"DeferredEventSource1\", EventLevel.Warning, EventKeywords.EventLogClassic, new Dictionary<string, string> { { \"key2\", \"value2\" } });\n                listener.EnableEvents(\"DeferredEventSource1\", EventLevel.Informational, EventKeywords.Sqm, new Dictionary<string, string> { { \"key1\", \"value1\" } });\n                listener.DisableEvents(\"DeferredEventSource2\");\n                listener.EnableEvents(\"DeferredEventSource2\", EventLevel.Error, EventKeywords.AuditSuccess | EventKeywords.AuditFailure);\n                listener.DisableEvents(\"DeferredEventSource3\");\n\n                Assert.IsTrue(DeferredEventSource1.Log.IsEnabled(EventLevel.Informational, EventKeywords.Sqm));\n                Assert.IsFalse(DeferredEventSource1.Log.IsEnabled(EventLevel.Verbose, EventKeywords.Sqm));\n                Assert.IsTrue(DeferredEventSource2.Log.IsEnabled(EventLevel.Error, EventKeywords.AuditSuccess));\n                Assert.IsFalse(DeferredEventSource2.Log.IsEnabled(EventLevel.Warning, EventKeywords.AuditSuccess));\n                Assert.IsFalse(DeferredEventSource3.Log.IsEnabled());\n            }\n        }\n    }\n\n    public class NotObservableEventListener : EventListener\n    {\n        protected override void OnEventWritten(EventWrittenEventArgs eventData)\n        {\n            throw new NotImplementedException();\n        }\n    }\n\n    [EventSource(Name = \"SensingEventSource\")]\n    public sealed class SensingEventSource : EventSource\n    {\n        public static SensingEventSource Log { get { return logHolder.Value; } }\n        private static Lazy<SensingEventSource> logHolder = new Lazy<SensingEventSource>(() => new SensingEventSource());\n\n        public readonly List<IDictionary<string, string>> Commands = new List<IDictionary<string, string>>();\n\n        private SensingEventSource()\n        {\n        }\n\n        protected override void OnEventCommand(EventCommandEventArgs command)\n        {\n            base.OnEventCommand(command);\n\n            this.Commands.Add(command.Arguments);\n        }\n    }\n\n    [EventSource(Name = \"DeferredEventSource1\")]\n    public sealed class DeferredEventSource1 : EventSource\n    {\n        public static DeferredEventSource1 Log { get { return logHolder.Value; } }\n        private static Lazy<DeferredEventSource1> logHolder = new Lazy<DeferredEventSource1>(() => new DeferredEventSource1());\n\n        private DeferredEventSource1()\n        {\n        }\n    }\n\n    [EventSource(Name = \"DeferredEventSource2\")]\n    public sealed class DeferredEventSource2 : EventSource\n    {\n        public static DeferredEventSource2 Log { get { return logHolder.Value; } }\n        private static Lazy<DeferredEventSource2> logHolder = new Lazy<DeferredEventSource2>(() => new DeferredEventSource2());\n\n        private DeferredEventSource2()\n        {\n        }\n    }\n\n    [EventSource(Name = \"DeferredEventSource3\")]\n    public sealed class DeferredEventSource3 : EventSource\n    {\n        public static DeferredEventSource3 Log { get { return logHolder.Value; } }\n        private static Lazy<DeferredEventSource3> logHolder = new Lazy<DeferredEventSource3>(() => new DeferredEventSource3());\n\n        private DeferredEventSource3()\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/UsingEventListener/EventTableEntity.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.WindowsAzure.Storage;\nusing Microsoft.WindowsAzure.Storage.Table;\nusing Newtonsoft.Json;\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.EventListeners\n{\n    /// <summary>\n    /// Represents a log entry in an Azure Table.\n    /// </summary>\n    internal class TestCloudTableEntry : TableEntity\n    {\n        public int EventId { get; set; }\n        public DateTime EventDate { get; set; }\n        public long Keywords { get; set; }\n        public Guid ProviderId { get; set; }\n        public string ProviderName { get; set; }\n        public string InstanceName { get; set; }\n        public int Level { get; set; }\n        public string Message { get; set; }\n        public int Opcode { get; set; }\n        public int Task { get; set; }\n        public int Version { get; set; }\n        public string Payload { get; set; }\n        public Dictionary<string, object> DeserializedPayload { get; private set; }\n        public Dictionary<string, EntityProperty> RawPayloadProperties { get; private set; }\n        public int ProcessId { get; set; }\n        public int ThreadId { get; set; }\n        public Guid? ActivityId { get; set; }\n        public Guid? RelatedActivityId { get; set; }\n\n        public override void ReadEntity(IDictionary<string, EntityProperty> properties, OperationContext operationContext)\n        {\n            base.ReadEntity(properties, operationContext);\n            if (this.Payload != null)\n            {\n                this.DeserializedPayload = JsonConvert.DeserializeObject<Dictionary<string, object>>(this.Payload);\n            }\n            else\n            {\n                this.DeserializedPayload = new Dictionary<string, object>();\n            }\n\n            RawPayloadProperties = properties.Where(x => x.Key.StartsWith(\"Payload_\")).ToDictionary(x => x.Key, x => x.Value);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/UsingEventListener/FlatFileEventListenerTests.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Formatters;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing Newtonsoft.Json;\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.IO;\nusing System.Linq;\nusing System.Text.RegularExpressions;\nusing System.Threading.Tasks;\nusing System.Xml.Linq;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.EventListeners\n{\n    [TestClass]\n    public class FlatFileEventListenerTests\n    {\n        private static readonly TestEventSource Logger = TestEventSource.Log;\n        private string fileName;\n        private EventTextFormatter eventTextFormatter;\n        private ObservableEventListener listener;\n\n        [TestInitialize]\n        public void SetUp()\n        {\n            AppDomain.CurrentDomain.SetData(\"APPBASE\", Environment.CurrentDirectory);\n            this.fileName = Path.ChangeExtension(Guid.NewGuid().ToString(\"N\"), \".log\");\n            this.eventTextFormatter = new EventTextFormatter(EventTextFormatter.DashSeparator);\n            this.listener = new ObservableEventListener();\n        }\n\n        [TestCleanup]\n        public void TearDown()\n        {\n            this.listener.Dispose();\n            if (File.Exists(this.fileName)) { File.Delete(this.fileName); }\n        }\n\n        //[TestMethod]\n        //[ExpectedException(typeof(ArgumentNullException))]\n        //public void ThrowOnNullFileName()\n        //{\n        //    listener.LogToFlatFile(null);\n        //}\n\n        //[TestMethod]\n        //[ExpectedException(typeof(ArgumentException))]\n        //public void ThrowOnEmptyFileName()\n        //{\n        //    listener.LogToFlatFile(string.Empty);\n        //}\n\n        [TestMethod]\n        [ExpectedException(typeof(DirectoryNotFoundException))]\n        public void ThrowOnDirectoryNotFound()\n        {\n            listener.LogToFlatFile(@\"Z:\\Foo\\foo.log\");\n        }\n\n        [TestMethod]\n        public void ThrowOnInvalidFileChars()\n        {\n            foreach (var c in Path.GetInvalidFileNameChars())\n            {\n                AssertEx.Throws<ArgumentException>(() => listener.LogToFlatFile(c.ToString()));\n            }\n\n            foreach (var c in Path.GetInvalidPathChars())\n            {\n                AssertEx.Throws<ArgumentException>(() => listener.LogToFlatFile(c.ToString()));\n            }\n        }\n\n        [TestMethod]\n        public void ThrowOnInvalidOSFileNames()\n        {\n            AssertEx.Throws<ArgumentException>(() => listener.LogToFlatFile(\"PRN.log\"));\n            AssertEx.Throws<ArgumentException>(() => listener.LogToFlatFile(\"AUX.log\"));\n            AssertEx.Throws<ArgumentException>(() => listener.LogToFlatFile(\"CON.log\"));\n        }\n\n        [TestMethod]\n        public void ThrowOnPathNavigationFileName()\n        {\n            AssertEx.Throws<ArgumentException>(() => listener.LogToFlatFile(\".\"));\n            AssertEx.Throws<ArgumentException>(() => listener.LogToFlatFile(@\"..\\\"));\n            AssertEx.Throws<ArgumentException>(() => listener.LogToFlatFile(@\"..\\..\\..\"));\n            AssertEx.Throws<ArgumentException>(() => listener.LogToFlatFile(@\"C:\\Test\\..\\\"));\n        }\n\n        [TestMethod]\n        public void CreatesFlatFile()\n        {\n            listener.LogToFlatFile(this.fileName, this.eventTextFormatter);\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n            Logger.Informational(\"Test payload\");\n\n            Assert.IsTrue(File.Exists(this.fileName));\n\n            var entries = Regex.Split(ReadFileWithoutLock(this.fileName), this.eventTextFormatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n\n            Assert.AreEqual<int>(1, entries.Count());\n        }\n\n        [TestMethod]\n        public void AppendsEntriesToFlatFile()\n        {\n            listener.LogToFlatFile(this.fileName, this.eventTextFormatter);\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            Logger.Informational(\"First message\");\n            Logger.Informational(\"Second message\");\n            Logger.Informational(\"Third message\");\n\n            var entries = Regex.Split(ReadFileWithoutLock(this.fileName), this.eventTextFormatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(3, entries.Count());\n        }\n\n        [TestMethod]\n        public void ConcurrentAppendsEntriesToFlatFile()\n        {\n            const int MaxLoggedEntries = 10;\n\n            listener.LogToFlatFile(this.fileName, this.eventTextFormatter);\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            Parallel.For(0, MaxLoggedEntries, i => Logger.Informational(\"Info \" + i));\n\n            var entries = Regex.Split(ReadFileWithoutLock(this.fileName), this.eventTextFormatter.Header).Where(c => !string.IsNullOrWhiteSpace(c));\n            Assert.AreEqual<int>(MaxLoggedEntries, entries.Count());\n        }\n\n        [TestMethod]\n        public void AppendsEntriesFromDifferentSourcesToFlatFile()\n        {\n            var formatter = new MockFormatter();\n            listener.LogToFlatFile(this.fileName, formatter);\n            listener.EnableEvents(Logger, EventLevel.LogAlways, EventKeywords.None);\n            listener.EnableEvents(MyCompanyEventSource.Log, EventLevel.LogAlways, Keywords.All);\n\n            Logger.Informational(\"From TestEventSource\");\n            Logger.EventWithoutPayloadNorMessage();\n            MyCompanyEventSource.Log.PageStart(5, \"http://test\");\n\n            Assert.AreEqual<int>(3, formatter.WriteEventCalls.Count);\n        }\n\n        [TestMethod]\n        public void AppendsEntriesFromDifferentSourcesUsesCorrectSchema()\n        {\n            var formatter = new MockFormatter();\n            listener.LogToFlatFile(this.fileName, formatter);\n            listener.EnableEvents(Logger, EventLevel.LogAlways, EventKeywords.None);\n            listener.EnableEvents(MyCompanyEventSource.Log, EventLevel.LogAlways, Keywords.All);\n\n            Logger.Informational(\"From TestEventSource\");\n            Logger.EventWithoutPayloadNorMessage();\n            MyCompanyEventSource.Log.PageStart(5, \"http://test\");\n\n            Assert.AreEqual(EventSourceSchemaCache.Instance.GetSchema(TestEventSource.InformationalEventId, Logger), formatter.WriteEventCalls[0].Schema);\n            Assert.AreEqual(EventSourceSchemaCache.Instance.GetSchema(TestEventSource.EventWithoutPayloadNorMessageId, Logger), formatter.WriteEventCalls[1].Schema);\n            Assert.AreEqual(EventSourceSchemaCache.Instance.GetSchema(3, MyCompanyEventSource.Log), formatter.WriteEventCalls[2].Schema);\n        }\n\n        [TestMethod]\n        public void NonDefaultMessageIsLogged()\n        {\n            listener.LogToFlatFile(this.fileName, new EventTextFormatter(verbosityThreshold: EventLevel.LogAlways));\n            listener.EnableEvents(Logger, EventLevel.Verbose);\n            Logger.NonDefaultOpcodeNonDefaultVersionEvent(1, 3, 5);\n\n            var fileContent = ReadFileWithoutLock(this.fileName);\n            StringAssert.Contains(fileContent, \"Message : arg1- 1,arg2- 3,arg3- 5\");\n            StringAssert.Contains(fileContent, \"Task : 2\");\n        }\n\n        [TestMethod]\n        public void AppendsEntriesToFlatFileWithJsonFormatter()\n        {\n            listener.LogToFlatFile(this.fileName, new JsonEventTextFormatter());\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            Logger.Informational(\"First message\");\n            Logger.Informational(\"Second message\");\n            Logger.Informational(\"Third message\");\n\n            var entries = JsonConvert.DeserializeObject<TestEventEntry[]>(\"[\" + ReadFileWithoutLock(this.fileName) + \"]\");\n            Assert.AreEqual<int>(3, entries.Count());\n        }\n\n        [TestMethod]\n        public void AppendsEntriesToFlatFileWithXmlFormatter()\n        {\n            listener.LogToFlatFile(this.fileName, new XmlEventTextFormatter());\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            Logger.Informational(\"First message\");\n            Logger.Informational(\"Second message\");\n            Logger.Informational(\"Third message\");\n\n            var entries = XDocument.Parse(\"<Events>\" + ReadFileWithoutLock(this.fileName) + \"</Events>\").Root.Elements();\n            Assert.AreEqual<int>(3, entries.Count());\n        }\n\n        [TestMethod]\n        public void AppendsEntriesToFlatFileWithNoInvalidEntries()\n        {\n            var formatter = new MockFormatter() { AfterWriteEventAction = (f) => { if (f.WriteEventCalls.Count == 1) { throw new InvalidOperationException(); } } };\n            listener.LogToFlatFile(this.fileName, formatter);\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            Logger.Informational(\"Will throw error\");\n            Logger.Informational(\"Valid message\");\n\n            Assert.AreEqual(\"Valid message\", ReadFileWithoutLock(this.fileName));\n        }\n\n        private static string ReadFileWithoutLock(string fileName)\n        {\n            using (var reader = new StreamReader(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))\n            {\n                return reader.ReadToEnd();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/UsingEventListener/ObservableEventListenerFixture.PartialTrust.cs",
    "content": "﻿using System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Diagnostics;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Security;\nusing System.Security.Permissions;\nusing System.Security.Policy;\nusing System.Text;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.UsingEventListener\n{\n    [TestClass]\n    public class ObservableEventListenerFixturePartialTrust\n    {\n        [TestMethod]\n        public void CanGetThreadIdAndProcessidOnFullTrust()\n        {\n            var evidence = new Evidence();\n            evidence.AddHostEvidence(new Zone(SecurityZone.MyComputer));\n            var permissionSet = SecurityManager.GetStandardSandbox(evidence);\n\n            var appDomain =\n                AppDomain.CreateDomain(\n                    \"full trust\",\n                    evidence,\n                    new AppDomainSetup { ApplicationBase = Environment.CurrentDirectory },\n                    permissionSet);\n\n            try\n            {\n                var tester = (ProcessIdAndThreadIdTester)appDomain\n                    .CreateInstanceAndUnwrap(\n                        typeof(ProcessIdAndThreadIdTester).Assembly.GetName().Name,\n                        typeof(ProcessIdAndThreadIdTester).FullName);\n\n                var result = tester.GetProcessIdAndThreadIdThoughEvent();\n\n                Assert.AreEqual(Process.GetCurrentProcess().Id, result.Item1);\n                Assert.AreNotEqual(0, result.Item2);\n            }\n            finally\n            {\n                AppDomain.Unload(appDomain);\n            }\n        }\n\n#if !EVENT_SOURCE_PACKAGE\n        // Partial trust not supported with the NuGet package\n        [TestMethod]\n        public void CannotGetThreadIdAndProcessidOnPartialTrust()\n        {\n            var evidence = new Evidence();\n            evidence.AddHostEvidence(new Zone(SecurityZone.Intranet));\n            var permissionSet = SecurityManager.GetStandardSandbox(evidence);\n\n            var appDomain =\n                AppDomain.CreateDomain(\n                    \"partial trust\",\n                    evidence,\n                    new AppDomainSetup { ApplicationBase = Environment.CurrentDirectory },\n                    permissionSet);\n\n            try\n            {\n                var tester = (ProcessIdAndThreadIdTester)appDomain\n                    .CreateInstanceAndUnwrap(\n                        typeof(ProcessIdAndThreadIdTester).Assembly.GetName().Name,\n                        typeof(ProcessIdAndThreadIdTester).FullName);\n\n                var result = tester.GetProcessIdAndThreadIdThoughEvent();\n\n                Assert.AreEqual(0, result.Item1);\n                Assert.AreEqual(0, result.Item2);\n            }\n            finally\n            {\n                AppDomain.Unload(appDomain);\n            }\n        }\n\n        [TestMethod]\n        public void CannotGetThreadIdAndProcessidOnPartialTrustIfFullyTrusted()\n        {\n            var slabAssemblyName = typeof(EventEntry).Assembly.GetName();\n            if (slabAssemblyName.GetPublicKeyToken().Length == 0)\n            {\n                Assert.Inconclusive(\"Can only be run if assemblies are signed\");\n            }\n\n            var evidence = new Evidence();\n            evidence.AddHostEvidence(new Zone(SecurityZone.Intranet));\n            var permissionSet = SecurityManager.GetStandardSandbox(evidence);\n\n            var appDomain =\n                AppDomain.CreateDomain(\n                    \"partial trust\",\n                    evidence,\n                    new AppDomainSetup { ApplicationBase = Environment.CurrentDirectory },\n                    permissionSet,\n                    new StrongName(new StrongNamePublicKeyBlob(slabAssemblyName.GetPublicKey()), slabAssemblyName.Name, slabAssemblyName.Version));\n\n            try\n            {\n                var tester = (ProcessIdAndThreadIdTester)appDomain\n                    .CreateInstanceAndUnwrap(\n                        typeof(ProcessIdAndThreadIdTester).Assembly.GetName().Name,\n                        typeof(ProcessIdAndThreadIdTester).FullName);\n\n                var result = tester.GetProcessIdAndThreadIdThoughEvent();\n\n                Assert.AreEqual(0, result.Item1);\n                Assert.AreEqual(0, result.Item2);\n            }\n            finally\n            {\n                AppDomain.Unload(appDomain);\n            }\n        }\n#endif\n    }\n\n    public class ProcessIdAndThreadIdTester : MarshalByRefObject\n    {\n        public Tuple<int, int> GetProcessIdAndThreadIdThoughEvent()\n        {\n            using (var listener = new ObservableEventListener())\n            {\n                var observer = new SimpleObserver<EventEntry>();\n\n                listener.EnableEvents(TestEventSource.Log, EventLevel.Informational, EventKeywords.None);\n                listener.Subscribe(observer);\n\n                TestEventSource.Log.Informational(\"some info\");\n\n                EventEntry entry;\n                if (observer.Elements.TryTake(out entry, TimeSpan.FromSeconds(10)))\n                {\n                    return Tuple.Create(entry.ProcessId, entry.ThreadId);\n                }\n\n                throw new TimeoutException(\"timed out waiting for envent\");\n            }\n        }\n\n        private class SimpleObserver<T> : IObserver<T>\n        {\n            private readonly BlockingCollection<T> elements = new BlockingCollection<T>();\n\n            public void OnCompleted()\n            {\n                this.elements.CompleteAdding();\n            }\n\n            public void OnError(Exception error)\n            {\n                this.elements.CompleteAdding();\n            }\n\n            public void OnNext(T value)\n            {\n                this.elements.Add(value);\n            }\n\n            public BlockingCollection<T> Elements\n            {\n                get { return this.elements; }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/UsingEventListener/ObservableEventListenerFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Schema;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System;\nusing System.Collections.Concurrent;\nusing System.Collections.Generic;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing System.Threading;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.EventListeners\n{\n    [TestClass]\n    public class ObservableEventListenerFixture : ArrangeActAssert\n    {\n        private static readonly TestEventSource Logger = TestEventSource.Log;\n        private ObservableEventListener listener;\n\n        protected override void Arrange()\n        {\n            this.listener = new ObservableEventListener();\n        }\n\n        protected override void Teardown()\n        {\n            this.listener.Dispose();\n        }\n\n        [TestMethod]\n        public void when_subscribing_then_receives_events()\n        {\n            var processId = System.Diagnostics.Process.GetCurrentProcess().Id;\n            var threadId = Utility.NativeMethods.GetCurrentThreadId();\n\n            var sink = new MockSink();\n            listener.Subscribe(sink);\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            Logger.Informational(\"Test\");\n\n            Assert.AreEqual(1, sink.OnNextCalls.Count());\n            Assert.AreEqual(TestEventSource.InformationalEventId, sink.OnNextCalls.ElementAt(0).EventId);\n            Assert.AreEqual(EventLevel.Informational, sink.OnNextCalls.ElementAt(0).Schema.Level);\n            Assert.AreEqual(processId, sink.OnNextCalls.ElementAt(0).ProcessId);\n            Assert.AreEqual(threadId, sink.OnNextCalls.ElementAt(0).ThreadId);\n        }\n\n        [TestMethod]\n        public void when_subscribing_then_receives_parsed_schema()\n        {\n            var sink = new MockSink();\n            listener.Subscribe(sink);\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            Logger.Informational(\"Test\");\n\n            var expectedSchema = EventSourceSchemaCache.Instance.GetSchema(TestEventSource.InformationalEventId, Logger);\n            Assert.AreEqual(expectedSchema, sink.OnNextCalls.ElementAt(0).Schema);\n        }\n\n        [TestMethod]\n        public void when_subscribing_then_receives_raw_payload()\n        {\n            var sink = new MockSink();\n            listener.Subscribe(sink);\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            Logger.Informational(\"Test\");\n\n            Assert.AreEqual(1, sink.OnNextCalls.ElementAt(0).Payload.Count);\n            Assert.AreEqual(\"Test\", sink.OnNextCalls.ElementAt(0).Payload[0]);\n        }\n\n        [TestMethod]\n        public void when_subscribing_then_receives_activity_id()\n        {\n            var sink = new MockSink();\n            listener.Subscribe(sink);\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            var activityId = Guid.NewGuid();\n            Guid previousActivityId;\n            EventSource.SetCurrentThreadActivityId(activityId, out previousActivityId);\n\n            try\n            {\n                Logger.Informational(\"Test\");\n            }\n            finally\n            {\n                EventSource.SetCurrentThreadActivityId(previousActivityId);\n            }\n\n            Assert.AreEqual(activityId, sink.OnNextCalls.ElementAt(0).ActivityId);\n            Assert.AreEqual(Guid.Empty, sink.OnNextCalls.ElementAt(0).RelatedActivityId);\n        }\n\n        [TestMethod]\n        public void when_subscribing_then_receives_related_activity_id()\n        {\n            var sink = new MockSink();\n            listener.Subscribe(sink);\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            var activityId = Guid.NewGuid();\n            var relatedActivityId = Guid.NewGuid();\n            Guid previousActivityId;\n            EventSource.SetCurrentThreadActivityId(activityId, out previousActivityId);\n\n            try\n            {\n                Logger.EventWithPayloadAndMessageAndRelatedActivityId(relatedActivityId, \"Test\", 100);\n            }\n            finally\n            {\n                EventSource.SetCurrentThreadActivityId(previousActivityId);\n            }\n\n            Assert.AreEqual(activityId, sink.OnNextCalls.ElementAt(0).ActivityId);\n            Assert.AreEqual(relatedActivityId, sink.OnNextCalls.ElementAt(0).RelatedActivityId);\n        }\n\n        [TestMethod]\n        public void can_subscribe_multiple_sinks()\n        {\n            var sink1 = new MockSink();\n            var sink2 = new MockSink();\n            listener.Subscribe(sink1);\n            listener.Subscribe(sink2);\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            Logger.Informational(\"Test\");\n\n            Assert.AreEqual(1, sink1.OnNextCalls.Count());\n            Assert.AreEqual(1, sink2.OnNextCalls.Count());\n        }\n\n        [TestMethod]\n        public void when_disposing_listener_then_calls_OnCompleted_on_sinks()\n        {\n            var sink1 = new MockSink();\n            var sink2 = new MockSink();\n            listener.Subscribe(sink1);\n            listener.Subscribe(sink2);\n\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            Assert.AreEqual(0, sink1.OnCompletedCalls);\n            Assert.AreEqual(0, sink2.OnCompletedCalls);\n\n            listener.Dispose();\n\n            Assert.AreEqual(1, sink1.OnCompletedCalls);\n            Assert.AreEqual(1, sink2.OnCompletedCalls);\n        }\n\n        //TODO: Validate: is this the expected behavior?\n        [TestMethod]\n        public void when_disposing_listener_then_does_not_dispose_sinks()\n        {\n            var sink1 = new MockSink();\n            var sink2 = new MockSink();\n            listener.Subscribe(sink1);\n            listener.Subscribe(sink2);\n\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            Assert.IsFalse(sink1.DisposeCalled);\n            Assert.IsFalse(sink2.DisposeCalled);\n\n            listener.Dispose();\n\n            Assert.IsFalse(sink1.DisposeCalled);\n            Assert.IsFalse(sink2.DisposeCalled);\n        }\n\n        [TestMethod]\n        public void when_unsubscribing_then_stops_receiving_events()\n        {\n            var sink = new MockSink();\n            var subscription = listener.Subscribe(sink);\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            subscription.Dispose();\n\n            Logger.Informational(\"Test\");\n\n            Assert.AreEqual(0, sink.OnNextCalls.Count());\n        }\n\n        //TODO: Validate: is this the expected behavior?\n        [TestMethod]\n        public void when_unsubscribing_then_does_not_send_OnCompleted_to_sink()\n        {\n            var sink = new MockSink();\n            var subscription = listener.Subscribe(sink);\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            subscription.Dispose();\n\n            Assert.AreEqual(0, sink.OnCompletedCalls);\n        }\n\n        [TestMethod]\n        public void when_disposing_listener_then_stops_publishing_events()\n        {\n            var sink = new MockSink();\n            listener.Subscribe(sink);\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n            listener.Dispose();\n\n            Logger.Informational(\"Test\");\n\n            Assert.AreEqual(0, sink.OnNextCalls.Count());\n        }\n\n        [TestMethod]\n        public void when_disposing_listener_then_sends_OnCompleted()\n        {\n            var sink = new MockSink();\n            listener.Subscribe(sink);\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n            Assert.AreEqual(0, sink.OnCompletedCalls);\n\n            listener.Dispose();\n\n            Assert.AreEqual(1, sink.OnCompletedCalls);\n        }\n\n        // TODO: tests on ObservableProjection\n\n        private sealed class MockSink : IObserver<EventEntry>, IDisposable\n        {\n            private int onCompletedCalls;\n            private int onErrorCalls;\n            private ConcurrentBag<EventEntry> onNextCalls = new ConcurrentBag<EventEntry>();\n\n            public int OnCompletedCalls { get { return this.onCompletedCalls; } }\n            public int OnErrorCalls { get { return this.onErrorCalls; } }\n            public IEnumerable<EventEntry> OnNextCalls { get { return this.onNextCalls; } }\n            public bool DisposeCalled { get; private set; }\n\n            void IObserver<EventEntry>.OnCompleted()\n            {\n                Interlocked.Increment(ref this.onCompletedCalls);\n            }\n\n            void IObserver<EventEntry>.OnError(Exception error)\n            {\n                Interlocked.Increment(ref this.onErrorCalls);\n            }\n\n            void IObserver<EventEntry>.OnNext(EventEntry value)\n            {\n                this.onNextCalls.Add(value);\n            }\n\n            public void Dispose()\n            {\n                this.DisposeCalled = true;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/UsingEventListener/SqlDatabaseEventListenerTests.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Properties;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing System.Data.SqlClient;\nusing System.Diagnostics.Tracing;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.EventListeners\n{\n    [TestClass]\n    public class when_receiving_many_events_with_imperative_flush : LocalDatabaseContext\n    {\n        private const int NumberOfEntries = 10000;\n\n        protected ObservableEventListener eventListener;\n        protected SinkSubscription<SqlDatabaseSink> subscription;\n\n        protected override string GetLocalDatabaseFileName()\n        {\n            return \"sqldbtests\";\n        }\n\n        protected override void Given()\n        {\n            base.Given();\n\n            this.localDbConnection.ChangeDatabase(this.dbName);\n\n            using (var cmd = new SqlCommand(Resources.CreateTracesTable, this.localDbConnection))\n            {\n                cmd.ExecuteNonQuery();\n            }\n\n            this.eventListener = new ObservableEventListener();\n            this.subscription = this.eventListener.LogToSqlDatabase(\"test\", this.GetSqlConnectionString(), bufferingCount: NumberOfEntries); //@\"Data Source=.\\sqlexpress;Initial Catalog=SemanticLoggingTests;Integrated Security=True\"\n            this.eventListener.EnableEvents(TestEventSource.Log, EventLevel.LogAlways);\n        }\n\n        protected override void OnCleanup()\n        {\n            this.eventListener.DisableEvents(TestEventSource.Log);\n            this.eventListener.Dispose();\n            base.OnCleanup();\n        }\n\n        [TestMethod]\n        public void then_all_events_should_be_flushed()\n        {\n            for (int i = 0; i < NumberOfEntries; i++)\n            {\n                TestEventSource.Log.FastEvent(i);\n            }\n\n            this.subscription.Sink.FlushAsync().Wait();\n\n            var count = 0;\n\n            using (var cmd = new SqlCommand(\"SELECT COUNT(*) FROM Traces\", this.localDbConnection))\n            {\n                count = (int)cmd.ExecuteScalar();\n            }\n\n            Assert.AreEqual<int>(NumberOfEntries, count);\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/UsingEventListener/WindowsAzureTableSinkFixture_Integration.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\nusing System.Linq;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\nusing Microsoft.WindowsAzure.Storage;\nusing Microsoft.WindowsAzure.Storage.Table;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.EventListeners.WindowsAzureTableSinkFixture_Integration\n{\n    public class given_empty_account : ArrangeActAssert\n    {\n        protected readonly TestEventSource Logger = TestEventSource.Log;\n        protected string connectionString;\n        private CloudStorageAccount account;\n        protected CloudTableClient client;\n        protected string tableName;\n        protected WindowsAzureTableSink sink;\n        protected ObservableEventListener listener;\n\n        protected override void Arrange()\n        {\n            this.connectionString = ConfigurationHelper.GetSetting(\"StorageConnectionString\");\n\n            if (string.IsNullOrEmpty(connectionString)\n                || connectionString.Contains(\"[AccountName]\")\n                || connectionString.Contains(\"[AccountKey]\"))\n            {\n                Assert.Inconclusive(\"Cannot run tests because the Azure Storage credentials are not configured\");\n            }\n\n            this.account = CloudStorageAccount.Parse(connectionString);\n            this.client = this.account.CreateCloudTableClient();\n            this.tableName = \"AzureTableEventListenerTests\" + new Random(unchecked((int)DateTime.Now.Ticks)).Next(10000).ToString();\n\n            this.listener = new ObservableEventListener();\n            this.sink = this.listener.LogToWindowsAzureTable(\"TestInstanceName\", connectionString, tableName).Sink;\n        }\n\n        protected override void Teardown()\n        {\n            base.Teardown();\n            this.listener.Dispose();\n\n            if (this.tableName != null)\n            {\n                this.account.CreateCloudTableClient().GetTableReference(tableName).DeleteIfExists();\n            }\n        }\n    }\n\n    [TestClass]\n    public class when_writing_to_in_ascending_order : given_empty_account\n    {\n        protected override void Act()\n        {\n            base.Act();\n\n            sink.SortKeysAscending = true;\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            Logger.Informational(\"Information message\");\n            Logger.Error(\"Error message\");\n            Logger.Critical(\"Critical message\");\n        }\n\n        [TestMethod]\n        public void then_orders_them_in_ascending_order()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual<int>(3, list.Count());\n            Assert.AreEqual<int>(TestEventSource.InformationalEventId, list.First().EventId);\n            Assert.AreEqual<int>(TestEventSource.ErrorEventId, list.ElementAt(1).EventId);\n            Assert.AreEqual<int>(TestEventSource.CriticalEventId, list.Last().EventId);\n        }\n    }\n\n    [TestClass]\n    public class when_writing_to_storage : given_empty_account\n    {\n        protected override void Act()\n        {\n            base.Act();\n\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            Logger.Informational(\"Information message\");\n            Logger.Error(\"Error message\");\n            Logger.Critical(\"Critical message\");\n\n            Logger.EventWithoutPayloadNorMessage();\n        }\n\n        [TestMethod]\n        public void then_can_force_flush_messages()\n        {\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual<int>(4, list.Count());\n            Assert.IsTrue(list.Any(x => x.EventId == TestEventSource.InformationalEventId));\n            Assert.IsTrue(list.Any(x => x.EventId == TestEventSource.CriticalEventId));\n        }\n\n        [TestMethod]\n        public void then_orders_them_from_newer_to_older()\n        {\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var list = table.ExecuteQuery<TestCloudTableEntry>(query).ToArray();\n\n            Assert.AreEqual<int>(4, list.Count());\n            Assert.AreEqual<int>(TestEventSource.EventWithoutPayloadNorMessageId, list.ElementAt(0).EventId);\n            Assert.AreEqual<int>(TestEventSource.CriticalEventId, list.ElementAt(1).EventId);\n            Assert.AreEqual<int>(TestEventSource.ErrorEventId, list.ElementAt(2).EventId);\n            Assert.AreEqual<int>(TestEventSource.InformationalEventId, list.ElementAt(3).EventId);\n        }\n\n        [TestMethod]\n        public void then_includes_process_and_thread_id()\n        {\n            var processId = System.Diagnostics.Process.GetCurrentProcess().Id;\n            var threadId = Utility.NativeMethods.GetCurrentThreadId();\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var list = table.ExecuteQuery<TestCloudTableEntry>(query).ToArray();\n\n            Assert.AreEqual<int>(4, list.Count());\n            foreach (var entry in list)\n            {\n                Assert.AreEqual(processId, entry.ProcessId);\n                Assert.AreEqual(threadId, entry.ThreadId);\n            }\n        }\n    }\n\n    [TestClass]\n    public class when_writing_to_storage_with_activity_id : given_empty_account\n    {\n        private Guid activityId, relatedActivityId, previousActivityId;\n\n        protected override void Arrange()\n        {\n            base.Arrange();\n\n            this.activityId = Guid.NewGuid();\n            this.relatedActivityId = Guid.NewGuid();\n\n            EventSource.SetCurrentThreadActivityId(this.activityId, out this.previousActivityId);\n        }\n\n        protected override void Act()\n        {\n            base.Act();\n\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            Logger.Informational(\"Information message\");\n            Logger.EventWithPayloadAndMessageAndRelatedActivityId(this.relatedActivityId, string.Empty, 0);\n        }\n\n        protected override void Teardown()\n        {\n            base.Teardown();\n\n            EventSource.SetCurrentThreadActivityId(this.previousActivityId);\n        }\n\n        [TestMethod]\n        public void then_includes_activity_id_in_all_events()\n        {\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual<int>(2, list.Count());\n            Assert.IsTrue(list.All(x => x.ActivityId == this.activityId));\n        }\n\n        [TestMethod]\n        public void then_includes_related_activity_id_in_event()\n        {\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual<int>(2, list.Count());\n            Assert.AreEqual(this.relatedActivityId, list.First(x => x.EventId == TestEventSource.EventWithPayloadAndMessageAndRelatedActivityIdId).RelatedActivityId);\n        }\n    }\n\n    [TestClass]\n    public class when_writing_with_version_opcode_level : given_empty_account\n    {\n        protected override void Act()\n        {\n            base.Act();\n\n            listener.EnableEvents(Logger, EventLevel.LogAlways);\n\n            Logger.NonDefaultOpcodeNonDefaultVersionEvent(1, 2, 3);\n        }\n\n        [TestMethod]\n        public void then_all_entries_with_version_opcode_level_are_written()\n        {\n            Assert.IsTrue(this.sink.FlushAsync().Wait(TimeSpan.FromSeconds(45)));\n\n            var table = client.GetTableReference(tableName);\n            var query = new TableQuery<TestCloudTableEntry>();\n            var list = table.ExecuteQuery(query).ToArray();\n\n            Assert.AreEqual<int>(1, list.Count());\n            Assert.AreEqual<int>(2, list.First().Version);\n            Assert.AreEqual<int>((int)EventOpcode.Reply, list.First().Opcode);\n            Assert.AreEqual<int>((int)EventLevel.Informational, list.First().Level);\n        }\n    }    \n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Utility/BufferedEventPublisherFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Sinks;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Utility\n{\n    [TestClass]\n    public class bufferedEventPublisher_given_configuration\n    {\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentNullException))]\n        public void when_null_sinkId_throws()\n        {\n            BufferedEventPublisher<int>.CreateAndStart(null, b => { return Task.FromResult(b.Count); }, TimeSpan.Zero, 1, 1000, CancellationToken.None);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentNullException))]\n        public void when_null_eventPublisherAction_throws()\n        {\n            BufferedEventPublisher<int>.CreateAndStart(\"sink\", null, TimeSpan.Zero, 1, 1000, CancellationToken.None);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentOutOfRangeException))]\n        public void when_negative_bufferingInterval_throws()\n        {\n            BufferedEventPublisher<int>.CreateAndStart(\"sink\", b => { return Task.FromResult(b.Count); }, TimeSpan.FromSeconds(-1), 1, 1000, CancellationToken.None);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentOutOfRangeException))]\n        public void when_overrange_bufferingInterval_throws()\n        {\n            BufferedEventPublisher<int>.CreateAndStart(\"sink\", b => { return Task.FromResult(b.Count); }, TimeSpan.FromMilliseconds(Convert.ToInt64(int.MaxValue) + 1L), 1, 1000, CancellationToken.None);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentOutOfRangeException))]\n        public void when_negative_bufferingCount_throw()\n        {\n            BufferedEventPublisher<int>.CreateAndStart(\"sink\", b => { return Task.FromResult(b.Count); }, TimeSpan.FromSeconds(5), -1, 1000, CancellationToken.None);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentException))]\n        public void when_no_interval_and_no_count_throw()\n        {\n            BufferedEventPublisher<int>.CreateAndStart(\"sink\", b => { return Task.FromResult(b.Count); }, Timeout.InfiniteTimeSpan, 0, 1000, CancellationToken.None);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentException))]\n        public void when_maxBufferSize_smaller_than_3times_count_throw()\n        {\n            BufferedEventPublisher<int>.CreateAndStart(\"sink\", b => { return Task.FromResult(b.Count); }, Timeout.InfiniteTimeSpan, 1000, 2999, CancellationToken.None);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentOutOfRangeException))]\n        public void when_overrange_maxbuffering_throws()\n        {\n            BufferedEventPublisher<int>.CreateAndStart(\"sink\", b => { return Task.FromResult(b.Count); }, Timeout.InfiniteTimeSpan, 1, 499, CancellationToken.None);\n        }\n\n        [TestMethod]\n        public void when_zero_interval_is_set_default_minimum()\n        {\n            var sut = BufferedEventPublisher<int>.CreateAndStart(\"sink\", b => { return Task.FromResult(b.Count); }, TimeSpan.Zero, 0, 1000, CancellationToken.None);\n            Assert.IsNotNull(sut);\n        }\n    }\n\n    public abstract class given_bufferedEventPublisher : ContextBase\n    {\n        private BufferedEventPublisher<int> sut;\n        private TimeSpan bufferingInterval = TimeSpan.FromSeconds(1);\n        private int totalEventsToPublish;\n        private List<int> publishedEvents = new List<int>();\n        private TaskCompletionSource<bool> completionSource = new TaskCompletionSource<bool>();\n        private TimeSpan waitTimeout = TimeSpan.FromSeconds(5);\n\n        public bool ShouldThrowOnPublish { get; set; }\n\n        protected override void Given()\n        {\n            this.sut = BufferedEventPublisher<int>.CreateAndStart(\"sink\", PublishEventsAsync, bufferingInterval, 0, 1000, new CancellationToken());\n        }\n\n        protected override void OnCleanup()\n        {\n            this.sut.Dispose();\n        }\n\n        private Task<bool> Completed\n        {\n            get { return this.completionSource.Task; }\n        }\n\n        private async Task<int> PublishEventsAsync(IList<int> batch)\n        {\n            await Task.Yield();\n            publishedEvents.AddRange(batch);\n\n            if (this.totalEventsToPublish == 0 || this.publishedEvents.Count >= this.totalEventsToPublish)\n            {\n                this.completionSource.TrySetResult(true);\n            }\n\n            if (this.ShouldThrowOnPublish)\n            {\n                throw new InvalidOperationException(\"Thrown by text fixture.\");    \n            }\n\n            return batch.Count;\n        }\n\n        [TestClass]\n        public class when_post_events_and_interval_expire : given_bufferedEventPublisher\n        {\n            protected override void Given()\n            {\n                this.totalEventsToPublish = 10;\n                base.Given();\n            }\n\n            protected override void When()\n            {\n                for (int i = 0; i < this.totalEventsToPublish; i++)\n                {\n                    this.sut.TryPost(i);\n                    Thread.Sleep(10);\n                }\n            }\n\n            [TestMethod]\n            public void then_all_events_are_published()\n            {\n                Assert.IsTrue(this.Completed.Wait(waitTimeout));\n\n                Assert.AreEqual(this.totalEventsToPublish, this.publishedEvents.Count);\n\n                for (int i = 0; i < this.totalEventsToPublish; i++)\n                {\n                    Assert.AreEqual(i, this.publishedEvents[i]);\n                }\n            }\n        }\n\n        [TestClass]\n        public class when_post_events_and_flushAsync : given_bufferedEventPublisher\n        {\n            protected override void Given()\n            {\n                this.totalEventsToPublish = 10;\n                base.Given();\n            }\n\n            protected override void When()\n            {\n                for (int i = 0; i < this.totalEventsToPublish; i++)\n                {\n                    this.sut.TryPost(i);\n                    Thread.Sleep(10);\n                }\n            }\n\n            [TestMethod]\n            public void then_all_events_are_published()\n            {\n                Assert.IsTrue(this.sut.FlushAsync().Wait(waitTimeout));\n\n                Assert.AreEqual(this.totalEventsToPublish, this.publishedEvents.Count);\n            }\n        }\n\n        [TestClass]\n        public class when_post_events_before_and_after_retry_started : given_bufferedEventPublisher\n        {\n            private readonly TimeSpan interval = TimeSpan.FromMilliseconds(100);\n\n            protected override void Given()\n            {\n                this.sut = BufferedEventPublisher<int>.CreateAndStart(\"sink\", PublishEventsAsync, interval, 0, 1000, new CancellationToken());\n                this.totalEventsToPublish = 3;\n            }\n\n            protected override void When()\n            {\n                for (int i = 0; i < this.totalEventsToPublish - 1; i++)\n                {\n                    this.sut.TryPost(i);\n                    Thread.Sleep(10);\n                }\n\n                Thread.Sleep(interval + TimeSpan.FromSeconds(1));\n                // Post an event after timeout fired\n\n                this.sut.TryPost(0);\n            }\n\n            [TestMethod]\n            public void then_all_events_posted_before_and_after_retry_should_be_published()\n            {\n                Assert.IsTrue(this.Completed.Wait(waitTimeout));\n\n                Assert.AreEqual(this.totalEventsToPublish, this.publishedEvents.Count);\n            }\n        }\n\n        [TestClass]\n        public class when_post_events_with_count_only : given_bufferedEventPublisher\n        {\n            protected override void Given()\n            {\n                this.totalEventsToPublish = 2;\n                this.sut = BufferedEventPublisher<int>.CreateAndStart(\"sink\", PublishEventsAsync, Timeout.InfiniteTimeSpan, this.totalEventsToPublish, 1000, new CancellationToken());\n            }\n\n            protected override void When()\n            {\n                for (int i = 0; i < this.totalEventsToPublish; i++)\n                {\n                    this.sut.TryPost(i);\n                    Thread.Sleep(30);\n                }\n            }\n\n            [TestMethod]\n            public void then_all_events_are_published()\n            {\n                Assert.IsTrue(this.Completed.Wait(waitTimeout));\n                Assert.AreEqual(this.totalEventsToPublish, this.publishedEvents.Count);\n            }\n        }\n\n        [TestClass]\n        public class when_post_events_with_interval_only : given_bufferedEventPublisher\n        {\n            protected override void Given()\n            {\n                this.totalEventsToPublish = 100;\n                this.sut = BufferedEventPublisher<int>.CreateAndStart(\"sink\", PublishEventsAsync, TimeSpan.FromMilliseconds(1), 0, 1000, new CancellationToken());\n            }\n\n            protected override void When()\n            {\n                for (int i = 0; i < this.totalEventsToPublish; i++)\n                {\n                    this.sut.TryPost(i);\n                    Thread.Sleep(30);\n                }\n            }\n\n            [TestMethod]\n            public void then_all_events_are_published()\n            {\n                Assert.IsTrue(this.Completed.Wait(waitTimeout));\n                \n                for (int i = 0; i < this.totalEventsToPublish; i++)\n                {\n                    Assert.AreEqual(i, this.publishedEvents[i], string.Join(\", \", this.publishedEvents));\n                }\n\n                Assert.AreEqual(this.totalEventsToPublish, this.publishedEvents.Count);\n            }\n        }\n\n        [TestClass]\n        public class when_post_events_with_count_only_and_flush : given_bufferedEventPublisher\n        {\n            protected override void Given()\n            {\n                this.totalEventsToPublish = 2;\n                this.sut = BufferedEventPublisher<int>.CreateAndStart(\"sink\", PublishEventsAsync, Timeout.InfiniteTimeSpan, this.totalEventsToPublish, 1000, new CancellationToken());\n            }\n\n            protected override void When()\n            {\n                for (int i = 0; i < this.totalEventsToPublish; i++)\n                {\n                    this.sut.TryPost(i);\n                    Thread.Sleep(30);\n                }\n            }\n\n            [TestMethod]\n            public void then_all_events_are_published()\n            {\n                Assert.IsTrue(this.sut.FlushAsync().Wait(waitTimeout));\n                Assert.IsTrue(this.Completed.Wait(waitTimeout));\n\n                Assert.AreEqual(this.totalEventsToPublish, this.publishedEvents.Count);\n            }\n        }\n\n        [TestClass]\n        public class when_post_events_with_internval_only_and_flush : given_bufferedEventPublisher\n        {\n            protected override void Given()\n            {\n                this.totalEventsToPublish = 100;\n                this.sut = BufferedEventPublisher<int>.CreateAndStart(\"sink\", PublishEventsAsync, TimeSpan.FromMilliseconds(1), 0, 1000, new CancellationToken());\n            }\n\n            protected override void When()\n            {\n                for (int i = 0; i < this.totalEventsToPublish; i++)\n                {\n                    this.sut.TryPost(i);\n                    Thread.Sleep(30);\n                }\n            }\n\n            [TestMethod]\n            public void then_all_events_are_published()\n            {\n                Assert.IsTrue(this.sut.FlushAsync().Wait(waitTimeout));\n                Assert.IsTrue(this.Completed.Wait(waitTimeout));\n\n                for (int i = 0; i < this.totalEventsToPublish; i++)\n                {\n                    Assert.AreEqual(i, this.publishedEvents[i]);\n                }\n\n                Assert.AreEqual(this.totalEventsToPublish, this.publishedEvents.Count);\n            }\n        }\n\n        [TestClass]\n        public class when_post_events_with_count_only_and_multi_flush : given_bufferedEventPublisher\n        {\n            protected override void Given()\n            {\n                this.totalEventsToPublish = 2;\n                this.sut = BufferedEventPublisher<int>.CreateAndStart(\"sink\", PublishEventsAsync, Timeout.InfiniteTimeSpan, this.totalEventsToPublish, 1000, new CancellationToken());\n            }\n\n            protected override void When()\n            {\n                for (int i = 0; i < this.totalEventsToPublish; i++)\n                {\n                    this.sut.TryPost(i);\n                    Thread.Sleep(30);\n                }\n\n                // First flush\n                Assert.IsTrue(this.sut.FlushAsync().Wait(waitTimeout));\n                Assert.AreEqual(TaskStatus.RanToCompletion, this.Completed.Status);\n\n                Assert.AreEqual(this.totalEventsToPublish, this.publishedEvents.Count);\n\n                // Reset\n                this.completionSource = new TaskCompletionSource<bool>();\n                this.publishedEvents.Clear();\n\n                for (int i = 0; i < this.totalEventsToPublish; i++)\n                {\n                    this.sut.TryPost(i);\n                    Thread.Sleep(30);\n                }\n            }\n\n            [TestMethod]\n            public void then_all_events_are_published_after_each_flush()\n            {\n                // Second Flush\n                Assert.IsTrue(this.sut.FlushAsync().Wait(waitTimeout));\n                Assert.AreEqual(TaskStatus.RanToCompletion, this.Completed.Status);\n\n                Assert.IsTrue(this.Completed.Result);\n                Assert.AreEqual(this.totalEventsToPublish, this.publishedEvents.Count);\n            }\n        }\n\n        [TestClass]\n        public class when_post_events_with_count_and_interval_with_count_first : given_bufferedEventPublisher\n        {\n            protected override void Given()\n            {\n                this.totalEventsToPublish = 2;\n                this.sut = BufferedEventPublisher<int>.CreateAndStart(\"sink\", PublishEventsAsync, TimeSpan.FromSeconds(10), this.totalEventsToPublish, 1000, new CancellationToken());\n            }\n\n            protected override void When()\n            {\n                for (int i = 0; i < this.totalEventsToPublish; i++)\n                {\n                    this.sut.TryPost(i);\n                    Thread.Sleep(30);\n                }\n            }\n\n            [TestMethod]\n            public void then_all_events_are_published()\n            {\n                Assert.IsTrue(this.Completed.Wait(waitTimeout));\n                Assert.AreEqual(this.totalEventsToPublish, this.publishedEvents.Count);\n            }\n        }\n\n        [TestClass]\n        public class when_post_events_with_count_and_interval_with_interval_first : given_bufferedEventPublisher\n        {\n            protected override void Given()\n            {\n                this.totalEventsToPublish = 2;\n                this.sut = BufferedEventPublisher<int>.CreateAndStart(\"sink\", PublishEventsAsync, TimeSpan.FromMilliseconds(500), this.totalEventsToPublish + 1, 1000, new CancellationToken());\n            }\n\n            protected override void When()\n            {\n                for (int i = 0; i < this.totalEventsToPublish; i++)\n                {\n                    this.sut.TryPost(i);\n                    Thread.Sleep(30);\n                }\n            }\n\n            [TestMethod]\n            public void then_all_events_are_published()\n            {\n                Assert.IsTrue(this.Completed.Wait(waitTimeout));\n                Assert.AreEqual(this.totalEventsToPublish, this.publishedEvents.Count);\n            }\n        }\n\n        [TestClass]\n        public class when_publishing_more_than_buffering_count : given_bufferedEventPublisher\n        {\n            private int bufferingCount;\n\n            protected override void Given()\n            {\n                this.bufferingCount = 10;\n                this.totalEventsToPublish = 0;\n                var automaticFlushingInterval = TimeSpan.FromMinutes(30);\n                this.sut = BufferedEventPublisher<int>.CreateAndStart(\"sink\", PublishEventsAsync, automaticFlushingInterval, bufferingCount, 1000, new CancellationToken());\n                Thread.Sleep(200);\n            }\n\n            protected override void When()\n            {\n                for (int i = 0; i < bufferingCount + 5; i++)\n                {\n                    this.sut.TryPost(i);\n                    Thread.Sleep(10);\n                }\n            }\n\n            [TestMethod]\n            public void then_only_batch_size_number_of_events_are_published()\n            {\n                Assert.IsTrue(this.Completed.Wait(TimeSpan.FromSeconds(30)));\n                Assert.AreEqual(this.bufferingCount, this.publishedEvents.Count);\n            }\n        }\n\n        [TestClass]\n        public class when_throwing_exception_on_publish : given_bufferedEventPublisher\n        {\n            private int bufferingCount;\n\n            protected override void Given()\n            {\n                this.ShouldThrowOnPublish = true;\n                this.bufferingCount = 10;\n                this.totalEventsToPublish = 0;\n                var automaticFlushingInterval = TimeSpan.FromMilliseconds(1);\n                this.sut = BufferedEventPublisher<int>.CreateAndStart(\"sink\", PublishEventsAsync, automaticFlushingInterval, bufferingCount, 1000, new CancellationToken());\n            }\n\n            protected override void When()\n            {\n                for (int i = 0; i < bufferingCount; i++)\n                {\n                    this.sut.TryPost(i);\n                    Thread.Sleep(10);\n                }\n            }\n\n            [TestMethod]\n            public void then_buffering_count_does_not_attempt_to_flush()\n            {\n                Assert.IsTrue(this.Completed.Wait(TimeSpan.FromSeconds(10)));\n                Assert.AreEqual(this.bufferingCount, this.publishedEvents.Count);\n\n                // Reset\n                this.completionSource = new TaskCompletionSource<bool>();\n\n                for (int i = 0; i < bufferingCount; i++)\n                {\n                    this.sut.TryPost(i);\n                    Thread.Sleep(10);\n                }\n\n                Assert.IsFalse(this.Completed.Wait(TimeSpan.FromSeconds(3)));\n                Assert.AreEqual(this.bufferingCount, this.publishedEvents.Count);\n            }\n\n            [TestMethod]\n            public void then_flushing_returns_failure()\n            {\n                Assert.IsTrue(this.Completed.Wait(TimeSpan.FromSeconds(10)));\n\n                try\n                {\n                    Assert.IsTrue(this.sut.FlushAsync().Wait(TimeSpan.FromSeconds(3)));\n                    Assert.Fail(\"Exception should be thrown.\");\n                }\n                catch (AggregateException ex)\n                {\n                    Assert.IsInstanceOfType(ex.InnerException, typeof(FlushFailedException));\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Utility/EventSourceAnalyzerFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.Diagnostics.Tracing;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestObjects;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Utility\n{\n    [TestClass]\n    public class given_eventSourceAnalyzer\n    {\n        [TestMethod]\n        [ExpectedException(typeof(EventSourceAnalyzerException))]\n        public void when_inspecting_event_with_bad_format()\n        {\n            EventSourceAnalyzer.InspectAll(BadFormatEventSource.Log);\n        }\n\n#if !EVENT_SOURCE_PACKAGE\n        [TestMethod] //Note: type in error message comes from ETW internal API\n        [ExpectedException(typeof(ArgumentException))]\n        public void when_inspecting_event_with_eventId_mismatch()\n        {\n            EventSourceAnalyzer.InspectAll(EventIdMismatchEventSource.Log);\n        }\n#endif\n\n        [TestMethod]\n        [ExpectedException(typeof(EventSourceAnalyzerException))]\n        public void when_inspecting_event_with_missing_writeEvent_call()\n        {\n            EventSourceAnalyzer.InspectAll(MissingWriteEventCallEventSource.Log);\n        }\n\n#if !EVENT_SOURCE_PACKAGE\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentException))]\n        public void when_inspecting_event_with_duplicate_events()\n        {\n            EventSourceAnalyzer.InspectAll(DuplicateEventsEventSource.Log);\n        }\n#endif\n\n        [TestMethod]\n        [ExpectedException(typeof(EventSourceAnalyzerException))]\n        public void when_inspecting_source_with_no_events()\n        {\n            EventSourceAnalyzer.InspectAll(NoEventsEventSource.Log);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(EventSourceAnalyzerException))]\n        public void when_inspecting_source_with_argument_order_mismatch_of_same_type()\n        {\n            EventSourceAnalyzer.InspectAll(SameTypeArgumentsOrderMismatchEventSource.Log);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(EventSourceAnalyzerException))]\n        public void when_inspecting_source_with_argument_order_mismatch_of_same_type_mixed()\n        {\n            EventSourceAnalyzer.InspectAll(BooleanTypeArgumentsOrderMismatchEventSource.Log);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(EventSourceAnalyzerException))]\n        public void when_inspecting_source_with_argument_order_mismatch_of_different_type()\n        {\n            EventSourceAnalyzer.InspectAll(DifferentTypeArgumentsOrderMismatchEventSource.Log);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(EventSourceAnalyzerException))]\n        public void when_inspecting_event_with_incorrect_level_filtering()\n        {\n            EventSourceAnalyzer.InspectAll(IncorrectLevelFilterEventSource.Log);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(EventSourceAnalyzerException))]\n        public void when_inspecting_event_with_incorrect_keywords_filtering()\n        {\n            EventSourceAnalyzer.InspectAll(IncorrectKeywordsFilterEventSource.Log);\n        }\n\n#if !EVENT_SOURCE_PACKAGE\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentException))]\n        public void when_not_defined_opcode()\n        {\n            EventSourceAnalyzer.InspectAll(NonDefinedOpcodeEventSource.Log);\n        }\n#endif\n\n        [TestMethod]\n        [ExpectedException(typeof(EventSourceAnalyzerException))]\n        public void when_inspecting_event_with_null_argument_in_writeEvent()\n        {\n            EventSourceAnalyzer.InspectAll(NullTypeArgumentEventSource.Log);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(EventSourceAnalyzerException))]\n        public void when_inspecting_event_with_less_writeEvent_arguments()\n        {\n            EventSourceAnalyzer.InspectAll(LessWriteEventArgumentsEventSource.Log);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(EventSourceAnalyzerException))]\n        public void when_inspecting_event_with_more_writeEvent_arguments()\n        {\n            EventSourceAnalyzer.InspectAll(MoreWriteEventArgumentsEventSource.Log);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(EventSourceAnalyzerException))]\n        public void when_inspecting_event_with_differentTypeArguments_in_writeEvent()\n        {\n            EventSourceAnalyzer.InspectAll(DifferentTypeArgumentsWriteEventEventSource.Log);\n        }\n\n        [TestMethod]\n        [ExpectedException(typeof(EventSourceAnalyzerException))]\n        public void when_inspecting_event_enum_types_that_generates_invalid_manifest()\n        {\n            EventSourceAnalyzer.InspectAll(DifferentEnumsEventSource.Log);\n        }\n\n        [TestMethod]\n        public void when_inspecting_valid_eventSources()\n        {\n            EventSourceAnalyzer.InspectAll(MultipleTypesEventSource.Log);\n            EventSourceAnalyzer.InspectAll(TestEventSource.Log);\n            EventSourceAnalyzer.InspectAll(MyCompanyEventSource.Log);\n            EventSourceAnalyzer.InspectAll(SemanticLoggingEventSource.Log);\n        }\n\n        [TestMethod]\n        public void when_inspecting_eventSource_with_more_than_one_method_argument_use_nondefault_values()\n        {\n            EventSourceAnalyzer.InspectAll(NonDefaultArgumentValuesEventSource.Log);\n        }\n\n        #region Test EventSource classes\n\n        [EventSource]\n        private sealed class BadFormatEventSource : EventSource\n        {\n            internal static readonly BadFormatEventSource Log = new BadFormatEventSource();\n\n            [Event(1, Message = \"<bad message>\")]\n            public void EventWithBadMessage()\n            {\n            }\n        }\n\n        [EventSource]\n        private sealed class NoSingletonEventSource : EventSource\n        {\n            [Event(1)]\n            public void SimpleEvent()\n            {\n                if (IsEnabled()) { WriteEvent(1); }\n            }\n        }\n\n#if !EVENT_SOURCE_PACKAGE\n        [EventSource]\n        private sealed class EventIdMismatchEventSource : EventSource\n        {\n            internal static readonly EventIdMismatchEventSource Log = new EventIdMismatchEventSource();\n\n            [Event(1)]\n            public void EventWithIdMismatch()\n            {\n                if (IsEnabled()) { WriteEvent(2); }\n            }\n        }\n#endif\n\n        [EventSource]\n        private sealed class NoEventsEventSource : EventSource\n        {\n            internal static readonly NoEventsEventSource Log = new NoEventsEventSource();\n\n            [NonEvent]\n            public void NoEvent()\n            {\n            }\n        }\n\n#if !EVENT_SOURCE_PACKAGE\n        [EventSource]\n        private sealed class DuplicateEventsEventSource : EventSource\n        {\n            internal static readonly DuplicateEventsEventSource Log = new DuplicateEventsEventSource();\n\n            [Event(1)]\n            public void Event1()\n            {\n                if (IsEnabled()) { WriteEvent(1); }\n            }\n\n            [Event(1)]\n            public void DuplicateEvent1()\n            {\n                if (IsEnabled()) { WriteEvent(1); }\n            }\n        }\n#endif\n\n        [EventSource]\n        private sealed class NotDecoratedPublicMethodsEventSource : EventSource\n        {\n            internal static readonly NotDecoratedPublicMethodsEventSource Log = new NotDecoratedPublicMethodsEventSource();\n\n            [NonEvent]\n            public void NotAnEvent()\n            {\n            }\n\n            public void MissingEventAttribute1()\n            {\n                WriteEvent(1);\n            }\n\n            public void MissingEventAttribute2()\n            {\n                WriteEvent(2);\n            }\n        }\n\n        [EventSource]\n        private sealed class MissingWriteEventCallEventSource : EventSource\n        {\n            internal static readonly MissingWriteEventCallEventSource Log = new MissingWriteEventCallEventSource();\n\n            [Event(1)]\n            public void MissingWriteEventCall()\n            {\n            }\n        }\n\n        [EventSource]\n        private sealed class IncorrectLevelFilterEventSource : EventSource\n        {\n            internal static readonly IncorrectLevelFilterEventSource Log = new IncorrectLevelFilterEventSource();\n\n            [Event(1, Level = EventLevel.Critical)]\n            public void IncorrectEventLevelFilter()\n            {\n                if (this.IsEnabled(EventLevel.Informational, EventKeywords.None))\n                {\n                    WriteEvent(1);\n                }\n            }\n        }\n\n        [EventSource]\n        private sealed class IncorrectKeywordsFilterEventSource : EventSource\n        {\n            public class Keywords\n            {\n                public const EventKeywords CustomKeyword = (EventKeywords)0x0001;\n            }\n\n            internal static readonly IncorrectKeywordsFilterEventSource Log = new IncorrectKeywordsFilterEventSource();\n\n            [Event(1, Level = EventLevel.Error, Keywords = Keywords.CustomKeyword)]\n            public void IncorrectEventKeywordsFilter()\n            {\n                if (this.IsEnabled(EventLevel.Error, EventKeywords.None))\n                {\n                    WriteEvent(1);\n                }\n            }\n        }\n\n        [EventSource]\n        private sealed class SameTypeArgumentsOrderMismatchEventSource : EventSource\n        {\n            internal static readonly SameTypeArgumentsOrderMismatchEventSource Log = new SameTypeArgumentsOrderMismatchEventSource();\n\n            [Event(1)]\n            internal void AllSameType(int arg0, int arg1, int arg2)\n            {\n                WriteEvent(1, arg1, arg2, arg0);\n            }\n        }\n\n        [EventSource]\n        private sealed class BooleanTypeArgumentsOrderMismatchEventSource : EventSource\n        {\n            internal static readonly BooleanTypeArgumentsOrderMismatchEventSource Log = new BooleanTypeArgumentsOrderMismatchEventSource();\n\n            [Event(1)]\n            internal void MixedAndSameType(int i0, bool b1, bool b2, int i3)\n            {\n                WriteEvent(1, i0, Convert.ToInt32(b2), Convert.ToInt32(b1), i3);\n            }\n        }\n\n        [EventSource]\n        private sealed class DifferentTypeArgumentsOrderMismatchEventSource : EventSource\n        {\n            internal static readonly DifferentTypeArgumentsOrderMismatchEventSource Log = new DifferentTypeArgumentsOrderMismatchEventSource();\n\n            [Event(1)]\n            internal void AllDifferentType(int arg0, string arg1, byte arg2)\n            {\n                WriteEvent(1, arg0, arg2, arg1);\n            }\n        }\n\n#if !EVENT_SOURCE_PACKAGE\n        [EventSource]\n        private sealed class NonDefinedOpcodeEventSource : EventSource\n        {\n            internal static readonly NonDefinedOpcodeEventSource Log = new NonDefinedOpcodeEventSource();\n\n            [Event(1, Opcode = (EventOpcode)13)]\n            public void IncorrectOpcodeValue()\n            {\n                WriteEvent(1);\n            }\n        }\n#endif\n\n        [EventSource]\n        private sealed class NullTypeArgumentEventSource : EventSource\n        {\n            internal static readonly NullTypeArgumentEventSource Log = new NullTypeArgumentEventSource();\n\n            [Event(1)]\n            internal void WriteEventWithNull(int arg0, string arg1, long arg2)\n            {\n                arg1 = null;\n                WriteEvent(1, arg0, arg1, arg2);\n            }\n        }\n\n        [EventSource]\n        private sealed class LessWriteEventArgumentsEventSource : EventSource\n        {\n            internal static readonly LessWriteEventArgumentsEventSource Log = new LessWriteEventArgumentsEventSource();\n\n            [Event(1)]\n            internal void LessWriteEventArgs(int arg0, string arg1, long arg2)\n            {\n                WriteEvent(1, arg0, arg1);\n            }\n        }\n\n        [EventSource]\n        private sealed class MoreWriteEventArgumentsEventSource : EventSource\n        {\n            internal static readonly MoreWriteEventArgumentsEventSource Log = new MoreWriteEventArgumentsEventSource();\n\n            [Event(1)]\n            internal void MoreWriteEventArgs(int arg0, string arg1)\n            {\n                long arg2 = 1;\n                WriteEvent(1, arg0, arg1, arg2);\n            }\n        }\n\n        [EventSource]\n        private sealed class DifferentTypeArgumentsWriteEventEventSource : EventSource\n        {\n            internal static readonly DifferentTypeArgumentsWriteEventEventSource Log = new DifferentTypeArgumentsWriteEventEventSource();\n\n            [Event(1)]\n            internal void IntMappedToEnum(int id)\n            {\n                WriteEvent(1, EventKeywords.AuditFailure);\n            }\n        }\n\n        [EventSource]\n        private sealed class NonDefaultArgumentValuesEventSource : EventSource\n        {\n            internal static readonly NonDefaultArgumentValuesEventSource Log = new NonDefaultArgumentValuesEventSource();\n\n            [Event(1)]\n            public void AllValues(byte[] ba, DateTime d, string s, Guid g, bool b)\n            {\n                WriteEvent(1, ba, d, s, g, b);\n            }\n        }\n\n        #endregion\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Utility/FileUtilFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing System.IO;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Utility\n{\n    [TestClass]\n    public class FileUtilFixture\n    {\n        [TestMethod]\n        public void ThrowOnInvalidFileChars()\n        {\n            foreach (var c in Path.GetInvalidFileNameChars())\n            {\n                AssertEx.Throws<ArgumentException>(() => FileUtil.ValidFile(c.ToString()));\n            }\n\n            foreach (var c in Path.GetInvalidPathChars())\n            {\n                AssertEx.Throws<ArgumentException>(() => FileUtil.ValidFile(c.ToString()));\n            }\n        }\n\n        [TestMethod]\n        public void ThrowOnInvalidOSFileNames()\n        {\n            AssertEx.Throws<ArgumentException>(() => FileUtil.ValidFile(\"PRN.log\"));\n            AssertEx.Throws<ArgumentException>(() => FileUtil.ValidFile(\"AUX.log\"));\n            AssertEx.Throws<ArgumentException>(() => FileUtil.ValidFile(\"CON.log\"));\n        }\n\n        [TestMethod]\n        public void ThrowOnPathNavigationFileName()\n        {\n            AssertEx.Throws<ArgumentException>(() => FileUtil.ValidFile(\".\"));\n            AssertEx.Throws<ArgumentException>(() => FileUtil.ValidFile(@\"..\\\"));\n            AssertEx.Throws<ArgumentException>(() => FileUtil.ValidFile(@\"..\\..\\..\"));\n            AssertEx.Throws<ArgumentException>(() => FileUtil.ValidFile(@\"C:\\Test\\..\\\"));\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Utility/GuardFixture.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.TestSupport;\nusing Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility;\nusing Microsoft.VisualStudio.TestTools.UnitTesting;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Utility\n{\n    [TestClass]\n    public class GuardFixture\n    {\n        [TestMethod]\n        [ExpectedException(typeof(ArgumentException))]\n        public void ThrowOnInvalidDateTimeFormat()\n        {\n            Guard.ValidDateTimeFormat(\"0\", \"dtf\");\n        }\n\n        [TestMethod]\n        public void CheckForInvalidFileNameChars()\n        {\n            AssertEx.Throws<ArgumentException>(() => Guard.ValidateTimestampPattern(\"MM/dd/yyyy\", \"timestampPattern\"));\n            AssertEx.Throws<ArgumentException>(() => Guard.ValidateTimestampPattern(\"MM:dd:yyyy\", \"timestampPattern\"));\n        }\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/Utility/NativeMethods.cs",
    "content": "﻿// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.\n\nusing System.Runtime.InteropServices;\n\nnamespace Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Tests.Utility\n{\n    internal static class NativeMethods\n    {\n        [DllImport(\"kernel32.dll\")]\n        public static extern int GetCurrentThreadId();\n    }\n}\n"
  },
  {
    "path": "source/Tests/SemanticLogging.Tests/packages.config",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<packages>\n  <package id=\"Microsoft.Azure.KeyVault.Core\" version=\"1.0.0\" targetFramework=\"net451\" />\n  <package id=\"Microsoft.Data.Edm\" version=\"5.6.4\" targetFramework=\"net451\" />\n  <package id=\"Microsoft.Data.OData\" version=\"5.6.4\" targetFramework=\"net451\" />\n  <package id=\"Microsoft.Data.Services.Client\" version=\"5.6.4\" targetFramework=\"net451\" />\n  <package id=\"Microsoft.Diagnostics.Tracing.TraceEvent\" version=\"1.0.15\" targetFramework=\"net451\" />\n  <package id=\"Microsoft.WindowsAzure.ConfigurationManager\" version=\"2.0.3\" targetFramework=\"net451\" />\n  <package id=\"Newtonsoft.Json\" version=\"6.0.8\" targetFramework=\"net451\" />\n  <package id=\"StyleCop.MSBuild\" version=\"4.7.49.0\" targetFramework=\"net451\" developmentDependency=\"true\" />\n  <package id=\"System.Spatial\" version=\"5.6.4\" targetFramework=\"net451\" />\n  <package id=\"WindowsAzure.Storage\" version=\"7.2.1\" targetFramework=\"net451\" />\n</packages>"
  },
  {
    "path": "source/Tests/Tests.ruleset",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RuleSet Name=\"Tests\" ToolsVersion=\"11.0\">\n  <Include Path=\"managedminimumrules.ruleset\" Action=\"Default\" />\n  <Rules AnalyzerId=\"Microsoft.Analyzers.ManagedCodeAnalysis\" RuleNamespace=\"Microsoft.Rules.Managed\">\n    <Rule Id=\"CA1001\" Action=\"None\" />\n    <Rule Id=\"CA1821\" Action=\"None\" />\n    <Rule Id=\"CA2213\" Action=\"None\" />\n  </Rules>\n</RuleSet>"
  }
]