Esempio n. 1
0
        public void Destruct()
        {
            if (this.m_compressibleGlobalJson != null)
            {
                this.m_compressibleGlobalJson.Destruct();
                this.m_compressibleGlobalJson = null;
            }

            if (this.m_compressibleCalendarJson != null)
            {
                this.m_compressibleCalendarJson.Destruct();
                this.m_compressibleCalendarJson = null;
            }

            if (this.m_compressibleHomeJson != null)
            {
                this.m_compressibleHomeJson.Destruct();
                this.m_compressibleHomeJson = null;
            }

            if (this.m_listener != null)
            {
                this.m_listener.Destruct();
                this.m_listener = null;
            }

            this.m_homeId = null;
        }
Esempio n. 2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="LogicClientHome" /> class.
 /// </summary>
 public LogicClientHome()
 {
     this._homeId = new LogicLong();
     this._compressibleHomeJson     = new LogicCompressibleString();
     this._compressibleGlobalJson   = new LogicCompressibleString();
     this._compressibleCalendarJson = new LogicCompressibleString();
 }
        public static LogicCompressibleString ReadCompressableStringOrNull(ByteStream stream)
        {
            if (stream.ReadBoolean())
            {
                return(null);
            }

            LogicCompressibleString compressibleString = new LogicCompressibleString();

            compressibleString.Decode(stream);
            return(compressibleString);
        }
 public static void WriteCompressableStringOrNull(ChecksumEncoder encoder, LogicCompressibleString compressibleString)
 {
     if (compressibleString == null)
     {
         encoder.WriteBoolean(false);
     }
     else
     {
         encoder.WriteBoolean(true);
         compressibleString.Encode(encoder);
     }
 }
        public static void Uncompress(LogicCompressibleString str)
        {
            if (str.IsCompressed())
            {
                ZLibHelper.DecompressInMySQLFormat(str.RemoveCompressed(), out byte[] output);

                if (output != null)
                {
                    str.Set(Encoding.UTF8.GetString(output), str.GetCompressed());
                }
            }
        }
        public static void Compress(LogicCompressibleString str)
        {
            if (!str.IsCompressed())
            {
                int length = ZLibHelper.CompressInZLibFormat(Encoding.UTF8.GetBytes(str.Get()), out byte[] output);

                if (output != null)
                {
                    str.Set(output);
                }
            }
        }
        /// <summary>
        ///     Uncompresses the <see cref="LogicCompressibleString" /> instance.
        /// </summary>
        public static void Uncompress(LogicCompressibleString str)
        {
            if (str.IsCompressed())
            {
                int    compressedLength   = str.GetCompressedLength();
                byte[] compressedData     = str.RemoveCompressed();
                int    uncompressedLength = ZLibHelper.DecompressInMySQLFormat(compressedData, compressedLength, out byte[] uncompressedData);

                if (uncompressedLength > 0)
                {
                    str.Set(LogicStringUtil.CreateString(uncompressedData, 0, uncompressedLength));
                }
            }
        }
        /// <summary>
        ///     Compresses the <see cref="LogicCompressibleString" /> instance.
        /// </summary>
        public static void Compress(LogicCompressibleString str)
        {
            string strInstance = str.Get();

            if (strInstance != null)
            {
                byte[] uncompressedData = LogicStringUtil.GetBytes(strInstance);
                int    compressedLength = ZLibHelper.CompressInZLibFormat(uncompressedData, out byte[] compressedData);

                if (compressedLength > 0)
                {
                    str.Set(compressedData, compressedLength);
                }
            }
        }