/// <summary>
 /// ?InternalSerializeString@@YAHPAGPAUIWzArchive@@EE@Z
 /// </summary>
 /// <param name="s"></param>
 /// <param name="withoutOffset">0x73</param>
 /// <param name="withOffset">0x1B</param>
 public void WriteStringValue(string s, int withoutOffset, int withOffset)
 {
     if (s.Length > 4 && StringCache.ContainsKey(s))
     {
         Write((byte)withOffset);
         Write((int)StringCache[s]);
     }
     else
     {
         Write((byte)withoutOffset);
         int sOffset = (int)this.BaseStream.Position;
         Write(s);
         if (!StringCache.ContainsKey(s))
         {
             StringCache[s] = sOffset;
         }
     }
 }
Exemple #2
0
 public void WriteStringValue(string pString, int pWithoutOffset, int pWithOffset)
 {
     if (pString.Length > 4 && StringCache.ContainsKey(pString))
     {
         Write((byte)pWithOffset);
         Write((int)StringCache[pString]);
     }
     else
     {
         Write((byte)pWithoutOffset);
         int sOffset = (int)BaseStream.Position;
         Write(pString);
         if (!StringCache.ContainsKey(pString))
         {
             StringCache[pString] = sOffset;
         }
     }
 }
        public void WriteWzObjectValue(string s, byte type)
        {
            string storeName = string.Format("{0}_{1}", type, s);

            if (s.Length > 4 && StringCache.ContainsKey(storeName))
            {
                Write((byte)2);
                Write((int)StringCache[storeName]);
            }
            else
            {
                int sOffset = (int)(this.BaseStream.Position - Header.FStart);
                Write(type);
                Write(s);
                if (!StringCache.ContainsKey(storeName))
                {
                    StringCache[storeName] = sOffset;
                }
            }
        }
Exemple #4
0
        public void WriteWzObjectValue(string s, byte type)
        {
            var storeName = type + "_" + s;

            if (s.Length > 4 && StringCache.ContainsKey(storeName))
            {
                Write((byte)2);
                Write((int)StringCache[storeName]);
            }
            else
            {
                var sOffset = (int)(BaseStream.Position - Header.FStart);
                Write(type);
                Write(s);
                if (!StringCache.ContainsKey(storeName))
                {
                    StringCache[storeName] = sOffset;
                }
            }
        }
Exemple #5
0
        public void WriteWzObjectValue(string pString, byte pType)
        {
            string storeName = pType + "_" + pString;

            if (pString.Length > 4 && StringCache.ContainsKey(storeName))
            {
                Write((byte)2);
                Write((int)StringCache[storeName]);
            }
            else
            {
                int sOffset = (int)(BaseStream.Position - Header.FStart);
                Write(pType);
                Write(pString);
                if (!StringCache.ContainsKey(storeName))
                {
                    StringCache[storeName] = sOffset;
                }
            }
        }
        /// <inheritdoc />
        public virtual SqlQuery GetUpdate(Expression <Func <TEntity, bool> > predicate, TEntity entity, object userId)
        {
            var query = new SqlQuery(entity);

            var cacheKey = _sqlCacheKey + "GetUpdateByExpression";

            if (StringCache.ContainsKey(cacheKey))
            {
                query.SqlBuilder.Append(StringCache[cacheKey]);
            }
            else
            {
                var properties = SqlProperties.Where(p => !KeySqlProperties.Any(k => k.Name.Equals(p.Name, StringComparison.OrdinalIgnoreCase)));
                query.SqlBuilder.Append($"UPDATE {TableName} SET {string.Join(", ", properties.Select(p => $"{GetPropertyName(p.Name)} = @{p.Name}"))} ");

                StringCache.TryAdd(cacheKey, query.GetSql());
            }

            AppendWherePredicateQuery(query, predicate);

            //处理公共字段
            var commonValues = Config.UpdateCommonProperty(userId);

            foreach (var common in commonValues)
            {
                if (query.Param.Keys.Contains(common.Key))
                {
                    query.Param[common.Key] = common.Value;
                }
                else
                {
                    query.Param.Add(common.Key, common.Value);
                }
            }

            return(query);
        }