예제 #1
0
        protected override string ProcessDataString(string dataString)
        {
            byte[] bytes = GetEncoding(ENCODING).GetBytes(dataString);

            bytes = _gZipCompression.Decompress(bytes);

            return(GetEncoding(ENCODING).GetString(bytes));
        }
        public override IWhazzup GetIVAOData()
        {
            if (string.IsNullOrWhiteSpace(Path) || !File.Exists(Path))
            {
                return(Whazzup.Null);
            }

            byte[] bytes = File.ReadAllBytes(Path);

            bytes = _gZipCompression.Decompress(bytes);

            string dataString = GetEncoding(ENCODING).GetString(bytes);

            string[] data = _regex.Split(dataString)
                            .Where(d => !string.IsNullOrWhiteSpace(d))
                            .ToArray();

            return(new Whazzup(data));
        }
예제 #3
0
        /// <summary>
        /// Retrieve a content item by specifying the unique identifier for the content.
        /// </summary>
        /// <param name="identifier">The identifier of the content to retrieve.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">If the identifier is null or empty, then throw an
        /// ArgumentNullException.</exception>
        public string RetrieveContentItem(string identifier)
        {
            if (string.IsNullOrEmpty(identifier))
            {
                throw new ArgumentNullException(nameof(identifier));
            }

            if (_content.ContainsKey(identifier))
            {
                if (TextCompressed)
                {
                    return(_compressor.Decompress(_content[identifier]));
                }
                else
                {
                    return(_content[identifier]);
                }
            }

            return(string.Empty);
        }