<commit_before>#region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010 FUJIWARA, Yusuke
//
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//
//        http://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.
//
#endregion -- License Terms --

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using MsgPack.Rpc.Server.Dispatch.SvcFileInterop;

namespace MsgPack.Rpc.Server.Dispatch
{
	/// <summary>
	///		Implements <see cref="ServiceTypeLocator"/> which uses WCF compatible *.svc file and the directory.
	/// </summary>
	public class FileBasedServiceTypeLocator : ServiceTypeLocator
	{
		/// <summary>
		///		Gets or sets the base directory.
		/// </summary>
		/// <value>
		///		The base directory to locate *.svc files.
		///		If the value is <c>null</c> or empty, the <see cref="P:AppDomain.BaseDirectory"/> will be used.
		/// </value>
		public string BaseDirectory { get; set; }

		/// <summary>
		/// Find services types with implementation specific way and returns them as <see cref="ServiceDescription"/>.
		/// </summary>
		/// <returns>
		/// The collection of <see cref="ServiceDescription"/>.<commit_msg>Improve property validation.<commit_after>#region -- License Terms --
//
// MessagePack for CLI
//
// Copyright (C) 2010 FUJIWARA, Yusuke
//
//    Licensed under the Apache License, Version 2.0 (the "License");
//    you may not use this file except in compliance with the License.
//    You may obtain a copy of the License at
//
//        http://www.apache.org/licenses/LICENSE-2.0
//
//    Unless required by applicable law or agreed to in writing, software
//    distributed under the License is distributed on an "AS IS" BASIS,
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//    See the License for the specific language governing permissions and
//    limitations under the License.
//
#endregion -- License Terms --

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using MsgPack.Rpc.Server.Dispatch.SvcFileInterop;

namespace MsgPack.Rpc.Server.Dispatch
{
	/// <summary>
	///		Implements <see cref="ServiceTypeLocator"/> which uses WCF compatible *.svc file and the directory.
	/// </summary>
	public class FileBasedServiceTypeLocator : ServiceTypeLocator
	{
		private string _baseDirectory;

		/// <summary>
		///		Gets or sets the base directory.
		/// </summary>
		/// <value>
		///		The base directory to locate *.svc files.
		///		If the value is <c>null</c> or empty, the <see cref="P:AppDomain.BaseDirectory"/> will be used.
		/// </value>
		public string BaseDirectory
		{
			get { return this._baseDirectory; }
			set
			{
				if ( String.IsNullOrWhiteSpace( value ) )
				{
					this._baseDirectory = null;
				}
				else
				{
					try
					{
						this._baseDirectory = Path.GetFullPath( value );
					}
					catch ( ArgumentException ex )
					{
						throw new ArgumentException( "Invalid directory path.", "value", ex );
					}
					catch ( NotSupportedException ex )
					{
						throw new ArgumentException( "Invalid directory path.", "value", ex );
					}
					catch ( PathTooLongException ex )
					{
						throw new ArgumentException( "Invalid directory path.", "value", ex );
					}
				}
			}
		}

		/// <summary>
		/// Find services types with implementation specific way and returns them as <see cref="ServiceDescription"/>.
		/// </summary>
		/// <returns>
		/// The collection of <see cref="ServiceDescription"/>.
{'fraction_non_alphanumeric': 0.12081550465643091, 'fraction_numerical': 0.004027183488547697, 'mean_word_length': 2.7739791073124405, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4266189', 'n_tokens_mistral': 1262, 'n_tokens_neox': 1121, 'n_words': 405}