Exemplo n.º 1
0
        /// <summary>
        ///  Descomprime o ticked
        /// </summary>
        /// <param name="compressedString"></param>
        /// <returns></returns>
        public static string TicketDecompress(string compressedString)
        {
            compressedString = new StringCompressor().Decompress(compressedString);

            string[] arrModules = compressedString.Split('|');

            for (int pos = 0; pos < arrModules.Length; pos++)
            {
                string moduleName = arrModules[pos].Split('.')[0];
                arrModules[pos] = arrModules[pos].Replace(",", "|" + moduleName + ".");
            }

            return string.Join("|", arrModules);
        }
Exemplo n.º 2
0
        /// <summary>
        ///  Comprime o Ticket
        /// </summary>
        /// <param name="uncompressedString"></param>
        /// <returns></returns>
        public static string TicketCompress(string uncompressedString)
        {
            string[] arrModules = uncompressedString.Split('|');

            int pos = 0;

            string oldModuleName = arrModules[pos].Split('.')[0];

            for (pos = 1; pos < arrModules.Length; pos++)
            {
                string newModuleName = arrModules[pos].Split('.')[0];

                if (oldModuleName == newModuleName)
                    arrModules[pos] = arrModules[pos].Replace(oldModuleName + ".", ",");
                else
                {
                    arrModules[pos] = "|" + arrModules[pos];
                    oldModuleName = newModuleName;
                }
            }

            string compressedString = new StringCompressor().Compress(string.Join(string.Empty, arrModules));

            return compressedString;
        }