예제 #1
0
 public string ToCsv()
 {
     return(string.Join(",", new List <string>
     {
         LootEventId.ToString(),
         Timestamp.ToString(),
         TerritoryTypeId.ToString(),
         ContentId.ToString(),
         LootEventTypeName,
         LootMessage.ItemId.ToString(),
         LootMessage.ItemName,
         LootMessage.IsHq.ToString(),
         PlayerName,
         Roll.ToString()
     }));
 }
예제 #2
0
        public void Feed(string portal, string ns, string block, Atom isolang, bool nocache = false, bool buffered = false)
        {
            ContentId id = default(ContentId);

            try
            {
                id = new ContentId(portal, ns, block);
            }
            catch (Exception error)
            {
                throw HTTPStatusException.BadRequest_400(error.Message);
            }

            var content = m_Cms.GetContentAsync(id, isolang, nocache.NoOrDefaultCache())
                          .GetAwaiter().GetResult();

            if (content == null)
            {
                throw HTTPStatusException.NotFound_404(id.ToString());
            }

            var compressionThreshold = App.ConfigRoot[SysConsts.CONFIG_WAVE_SECTION]
                                       .Of("cms-source-feeder-compressor-threshold-bytes").ValueAsInt(8000);

            var compress = (content.StringContent != null && content.StringContent.Length > compressionThreshold) ||
                           (content.BinaryContent != null && content.BinaryContent.Length > compressionThreshold);

            WorkContext.Response.Buffered          = buffered;
            WorkContext.Response.StatusCode        = 200;
            WorkContext.Response.StatusDescription = "Found CMS content";
            WorkContext.Response.ContentType       = compress ? CTP_COMPRESSED : CTP_UNCOMPRESSED;
            var httpStream = WorkContext.Response.GetDirectOutputStreamForWriting();

            if (compress)
            {
                using (var zipStream = new GZipStream(httpStream, CompressionLevel.Optimal))
                {
                    content.WriteToStream(zipStream);
                }
            }
            else
            {
                content.WriteToStream(httpStream);
            }
        }
예제 #3
0
        public List <KeyValuePair <string, string> > ToKeyValuePairs()
        {
            var result = new List <KeyValuePair <string, string> >(10);

            // leave out null values, but string.Empty is preserved
            if (FileName != null)
            {
                result.Add("FileName", FileName);
            }

            if (ContentId > 0)
            {
                result.Add("ContentId", ContentId.ToString());
            }

            if (ContentType != null)
            {
                result.Add("ContentType", ContentType);
            }
            if (PropertyName != null)
            {
                result.Add("PropertyName", PropertyName);
            }

            result.Add("UseChunk", UseChunk.ToString());
            result.Add("Overwrite", Overwrite.ToString());
            result.Add("FileLength", FileLength.ToString());

            if (ChunkToken != null)
            {
                result.Add("ChunkToken", ChunkToken);
            }

            if (FileText != null)
            {
                result.Add("FileText", FileText);
            }

            return(result);
        }
예제 #4
0
 public virtual void SaveTo(ViewFormat viewFormat)
 {
     _Model.UpdateDocument(ContentId.ToString("N"), ContentSummary, ContentXml, IsMasterView, Tags);
 }
예제 #5
0
 public string GetId()
 {
     return(ContentId.ToString());
 }
예제 #6
0
        public DbCommand GetDbCommand()
        {
            var cmd = new SqlCommand
            {
                CommandText = "qp_GetContentPage",
                CommandType = CommandType.StoredProcedure
            };

            if (UseSecurity)
            {
                cmd.Parameters.Add(new SqlParameter {
                    ParameterName = "@use_security", DbType = DbType.Int32, Value = "1"
                });
                cmd.Parameters.Add(new SqlParameter {
                    ParameterName = "@user_id", DbType = DbType.Decimal, Value = UserId
                });
                cmd.Parameters.Add(new SqlParameter {
                    ParameterName = "@group_id", DbType = DbType.Decimal, Value = GroupId
                });

                cmd.Parameters.Add(new SqlParameter {
                    ParameterName = "@start_level", DbType = DbType.Int32, Value = StartLevel
                });
                cmd.Parameters.Add(new SqlParameter {
                    ParameterName = "@end_level", DbType = DbType.Int32, Value = EndLevel
                });
                cmd.Parameters.Add(new SqlParameter {
                    ParameterName = "@entity_name", DbType = DbType.String, Value = "content_item"
                });
                cmd.Parameters.Add(new SqlParameter {
                    ParameterName = "@parent_entity_name", DbType = DbType.String, Value = "content"
                });
                cmd.Parameters.Add(new SqlParameter {
                    ParameterName = "@parent_entity_id", DbType = DbType.Decimal, Value = ContentId.ToString()
                });
                cmd.Parameters.Add(new SqlParameter {
                    ParameterName = "@insert_key", DbType = DbType.String, Value = InsertKey
                });
            }

            cmd.Parameters.Add(new SqlParameter {
                ParameterName = "@Select", DbType = DbType.String, Value = Select
            });
            cmd.Parameters.Add(new SqlParameter {
                ParameterName = "@From", DbType = DbType.String, Value = From
            });
            cmd.Parameters.Add(new SqlParameter {
                ParameterName = "@Where", DbType = DbType.String, Value = Utils.CleanSql(Where)
            });
            cmd.Parameters.Add(new SqlParameter {
                ParameterName = "@OrderBy", DbType = DbType.String, Value = Utils.CleanSql(OrderBy)
            });
            cmd.Parameters.Add(new SqlParameter {
                ParameterName = "@StartRow", DbType = DbType.Int32, Value = StartRow
            });
            cmd.Parameters.Add(new SqlParameter {
                ParameterName = "@PageSize", DbType = DbType.Int32, Value = PageSize
            });

            cmd.Parameters.Add(new SqlParameter {
                ParameterName = "@GetCount", DbType = DbType.Int32, Value = GetCount
            });
            cmd.Parameters.Add(new SqlParameter {
                ParameterName = "@TotalRecords", DbType = DbType.Int32, Direction = ParameterDirection.Output
            });

            return(cmd);
        }