<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Xemio.GameLibrary.Common
{
    public class ObjectStorage
    {
        #region Constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="ObjectStorage"/> class.
        /// </summary>
        public ObjectStorage()
        {
            this._values = new Dictionary<string, object>();
        }
        #endregion

        #region Fields
        private readonly Dictionary<string, object> _values;
        #endregion

        #region Properties

        /// <summary>
        /// Gets or sets a value indicating whether to automatically convert strings.
        /// </summary>
        public bool AutoConversion { get; set; }
        #endregion

        #region Methods
        /// <summary>
        /// Stores the specified value into an internal dictionary.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        public virtual void Store(string key, object value)
        {
            if (!this._values.ContainsKey(key))
            {
                this._values.Add(key, value);
            }

            this._values[key] = value;
        }
        /// <summary>
        /// Retrieves the specified key.
        /// </summary>
        /// <param name="key">The key.</param>
        public virtual object Retrieve(string key)
        {
            return this._values[key];
        }
        /// <summary>
        /// Retrieves the specified key.
        /// </summary>
        /// <param name="key">The key.</param>
        public virtual T Retrieve<T>(string key)
        {
            if (this.Contains(key))
            {
                object value = this.Retrieve(key);
                if (value is string)
                {
                    
                }

                return (T)value;
            }

            return default(T);
        }
        /// <summary>
        /// Determines whether the invokation store contains the specified key.
        /// </summary>
        /// <param name="key">The key.</param>
        public virtual bool Contains(string key)
        {
            return this._values.ContainsKey(key);
        }
        /// <summary>
        /// Clears all stored values.
        /// </summary>
        public virtual void Clear()
        {
            this._values.Clear();
        }
        #endregion
    }
}
<commit_msg>Implemented a type parsing system for the object storage.<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Xemio.GameLibrary.Common.TypeParsers;

namespace Xemio.GameLibrary.Common
{
    public class ObjectStorage
    {
        #region Constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="ObjectStorage"/> class.
        /// </summary>
        public ObjectStorage()
        {
            this._typeParser = new TypeParser();
            this._values = new Dictionary<string, object>();
        }
        #endregion

        #region Fields
        private readonly TypeParser _typeParser;
        private readonly Dictionary<string, object> _values;
        #endregion
        
        #region Methods
        /// <summary>
        /// Stores the specified value into an internal dictionary.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        public virtual void Store(string key, object value)
        {
            if (!this._values.ContainsKey(key))
            {
                this._values.Add(key, value);
            }

            this._values[key] = value;
        }
        /// <summary>
        /// Retrieves the specified key.
        /// </summary>
        /// <param name="key">The key.</param>
        public virtual object Retrieve(string key)
        {
            return this._values[key];
        }
        /// <summary>
        /// Retrieves the specified key.
        /// </summary>
        /// <param name="key">The key.</param>
        public virtual T Retrieve<T>(string key)
        {
            if (this.Contains(key))
            {
                object value = this.Retrieve(key);
                if (value is string)
                {
                    return (T)this._typeParser.Parse(value as string);
                }

                return (T)value;
            }

            return default(T);
        }
        /// <summary>
        /// Determines whether the invokation store contains the specified key.
        /// </summary>
        /// <param name="key">The key.</param>
        public virtual bool Contains(string key)
        {
            return this._values.ContainsKey(key);
        }
        /// <summary>
        /// Clears all stored values.
        /// </summary>
        public virtual void Clear()
        {
            this._values.Clear();
        }
        #endregion
    }
}

{'fraction_non_alphanumeric': 0.11765873015873016, 'fraction_numerical': 0.0, 'mean_word_length': 1.4119617224880383, 'pattern_counts': {'":': 0, '<': 57, '<?xml version=': 0, '>': 57, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2136967', 'n_tokens_mistral': 1276, 'n_tokens_neox': 1250, 'n_words': 342}