本文整理汇总了C#中UpdateType类的典型用法代码示例。如果您正苦于以下问题:C# UpdateType类的具体用法?C# UpdateType怎么用?C# UpdateType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UpdateType类属于命名空间,在下文中一共展示了UpdateType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DocumentRequest
protected DocumentRequest(UpdateType type, string id)
{
if (id == null) throw new ArgumentNullException(nameof(id));
Type = type;
Id = id;
}
示例2: UpdateRequest
// constructors
/// <summary>
/// Initializes a new instance of the <see cref="UpdateRequest" /> class.
/// </summary>
/// <param name="updateType">The update type.</param>
/// <param name="filter">The filter.</param>
/// <param name="update">The update.</param>
public UpdateRequest(UpdateType updateType, BsonDocument filter, BsonDocument update)
: base(WriteRequestType.Update)
{
_updateType = updateType;
_filter = Ensure.IsNotNull(filter, nameof(filter));
_update = Ensure.IsNotNull(update, nameof(update));
}
示例3: UpdateRequest
// constructors
/// <summary>
/// Initializes a new instance of the <see cref="UpdateRequest" /> class.
/// </summary>
/// <param name="updateType">The type.</param>
/// <param name="criteria">The criteria.</param>
/// <param name="update">The update.</param>
public UpdateRequest(UpdateType updateType, BsonDocument criteria, BsonDocument update)
: base(WriteRequestType.Update)
{
_updateType = updateType;
_criteria = Ensure.IsNotNull(criteria, "criteria");
_update = Ensure.IsNotNull(update, "update");
}
示例4: SetRowState
/// <summary>
/// 更新记录状态
/// </summary>
/// <param name="dataRow">记录</param>
/// <param name="updateType">操作类型</param>
private void SetRowState(DataRow dataRow, UpdateType updateType)
{
if (dataRow.RowState != DataRowState.Unchanged) return;
if (updateType == UpdateType.Add)
dataRow.SetAdded();
if (updateType == UpdateType.Modify)
dataRow.SetModified();
}
示例5: Reset
public override void Reset()
{
gameObject = null;
targetObject = null;
maxSpeed = 10f;
finishDistance = 1f;
finishEvent = null;
updateType = UpdateType.Update;
}
示例6: GetUpdateBlocks
/// <summary>
/// Gets the last received update blocks of the object with the given id and of the given Type
/// </summary>
/// <param name="type"></param>
/// <returns></returns>
public ICollection<UpdateBlock> GetUpdateBlocks(EntityId id, UpdateType type)
{
var blocks = new List<UpdateBlock>();
foreach (var packet in UpdatePackets)
{
packet.GetBlocks(id, type, blocks);
}
return blocks;
}
示例7: CreateDataset
/// <summary>
/// 创建原始数据用于更新. 由DataTable转换为DataSet
/// </summary>
protected DataSet CreateDataset(DataTable data, UpdateType updateType)
{
DataSet ds = new DataSet();
data.AcceptChanges(); //保存缓存数据
foreach (DataRow row in data.Rows)
this.SetRowState(row, updateType); //设置记录状态
ds.Tables.Add(data.Copy()); //加到新的DataSet
return ds;
}
示例8: ImportToSitecore
/// <summary>
/// This method will import / update a list of videos into the Brightcove Video Library
/// </summary>
/// <param name="Videos">
/// The Videos to import / update
/// </param>
/// <returns>
/// returns a list of the new videos imported
/// </returns>
public static UpdateInsertPair<VideoItem> ImportToSitecore(this AccountItem account, List<BCVideo> Videos, UpdateType utype) {
UpdateInsertPair<VideoItem> uip = new UpdateInsertPair<VideoItem>();
//set all BCVideos into hashtable for quick access
Hashtable ht = new Hashtable();
foreach (VideoItem exVid in account.VideoLib.Videos) {
if (!ht.ContainsKey(exVid.VideoID.ToString())) {
//set as string, Item pair
ht.Add(exVid.VideoID.ToString(), exVid);
}
}
//Loop through the data source and add them
foreach (BCVideo vid in Videos) {
try {
//remove access filter
using (new Sitecore.SecurityModel.SecurityDisabler()) {
VideoItem currentItem;
//if it exists then update it
if (ht.ContainsKey(vid.id.ToString()) && (utype.Equals(UpdateType.BOTH) || utype.Equals(UpdateType.UPDATE))) {
currentItem = (VideoItem)ht[vid.id.ToString()];
//add it to the new items
uip.UpdatedItems.Add(currentItem);
using (new EditContext(currentItem.videoItem, true, false)) {
SetVideoFields(ref currentItem.videoItem, vid);
}
}
//else just add it
else if (!ht.ContainsKey(vid.id.ToString()) && (utype.Equals(UpdateType.BOTH) || utype.Equals(UpdateType.NEW))) {
//Create new item
TemplateItem templateType = account.Database.Templates["Modules/Brightcove/Brightcove Video"];
currentItem = new VideoItem(account.VideoLib.videoLibraryItem.Add(vid.name.StripInvalidChars(), templateType));
//add it to the new items
uip.NewItems.Add(currentItem);
using (new EditContext(currentItem.videoItem, true, false)) {
SetVideoFields(ref currentItem.videoItem, vid);
}
}
}
} catch (System.Exception ex) {
//HttpContext.Current.Response.Write(vid.name + "<br/>");
throw new Exception("Failed on video: " + vid.name + ". " + ex.ToString());
}
}
return uip;
}
示例9: Update
public Update(string theTitle, string theAuthor, UIImage theAvatar, UpdateType theType, string theText)
{
title = theTitle;
author = theAuthor;
avatar = theAvatar;
updateText = theText;
string picture = string.Format ("{0}.png", theType == UpdateType.FacebookUpdate ? "fb" : "tweet");
updateTypeImage = UIImage.FromFile (picture);
}
示例10: RaiseStatusUpdate
internal void RaiseStatusUpdate(UpdateType type, uint processedItems)
{
if (StatusUpdate == null)
return;
if(type == UpdateType.Output)
StatusUpdate(UpdateType.Output, this, processedItems);
if (type == UpdateType.Input)
StatusUpdate(UpdateType.Input, this, processedItems);
}
示例11: WorkOrderUpdate
public WorkOrderUpdate(int _workOrderId, UpdateType _updateType, int _modifiedBy, DateTime? _compStartTime, DateTime? _compEndTime, String _resultJson = "", decimal? _requestDeserialisation = null, decimal? _resultSerialisation = null)
{
this.WorkOrderId = _workOrderId;
this.WorkOrderUpdateType = _updateType;
this.ModifiedBy = _modifiedBy;
this.ResultJson = _resultJson;
this.ComputationStartTime = _compStartTime;
this.ComputationEndTime = _compEndTime;
this.RequestDeserialisationTime = _requestDeserialisation;
this.ResultSerialisationTime = _resultSerialisation;
}
示例12: ImportToSitecore
public static UpdateInsertPair<PlaylistItem> ImportToSitecore(this AccountItem account, List<BCPlaylist> Playlists, UpdateType utype) {
UpdateInsertPair<PlaylistItem> uip = new UpdateInsertPair<PlaylistItem>();
//set all BCVideos into hashtable for quick access
Hashtable ht = new Hashtable();
foreach (PlaylistItem exPlay in account.PlaylistLib.Playlists) {
if (!ht.ContainsKey(exPlay.playlistItem.ToString())) {
//set as string, Item pair
ht.Add(exPlay.PlaylistID.ToString(), exPlay);
}
}
//Loop through the data source and add them
foreach (BCPlaylist play in Playlists) {
try {
//remove access filter
using (new Sitecore.SecurityModel.SecurityDisabler()) {
PlaylistItem currentItem;
//if it exists then update it
if (ht.ContainsKey(play.id.ToString()) && (utype.Equals(UpdateType.BOTH) || utype.Equals(UpdateType.UPDATE))) {
currentItem = (PlaylistItem)ht[play.id.ToString()];
//add it to the new items
uip.UpdatedItems.Add(currentItem);
using (new EditContext(currentItem.playlistItem, true, false)) {
SetPlaylistFields(ref currentItem.playlistItem, play);
}
}
//else just add it
else if (!ht.ContainsKey(play.id.ToString()) && (utype.Equals(UpdateType.BOTH) || utype.Equals(UpdateType.NEW))) {
//Create new item
TemplateItem templateType = account.Database.Templates["Modules/Brightcove/Brightcove Playlist"];
currentItem = new PlaylistItem(account.PlaylistLib.playlistLibraryItem.Add(play.name.StripInvalidChars(), templateType));
//add it to the new items
uip.NewItems.Add(currentItem);
using (new EditContext(currentItem.playlistItem, true, false)) {
SetPlaylistFields(ref currentItem.playlistItem, play);
}
}
}
} catch (System.Exception ex) {
throw new Exception("Failed on playlist: " + play.name + ". " + ex.ToString());
}
}
return uip;
}
示例13: UpdateRequest
// constructors
/// <summary>
/// Initializes a new instance of the <see cref="UpdateRequest" /> class.
/// </summary>
/// <param name="updateType">The update type.</param>
/// <param name="filter">The filter.</param>
/// <param name="update">The update.</param>
public UpdateRequest(UpdateType updateType, BsonDocument filter, BsonDocument update)
: base(WriteRequestType.Update)
{
_updateType = updateType;
_filter = Ensure.IsNotNull(filter, nameof(filter));
_update = Ensure.IsNotNull(update, nameof(update));
if (updateType == UpdateType.Update && _update.ElementCount == 0)
{
throw new ArgumentException("Updates must have at least 1 update operator.", nameof(update));
}
}
示例14: UpdateBlock
public UpdateBlock(ParsedUpdatePacket parser, int index)
{
this.index = index;
packet = parser;
//Offset = parser.index;
Type = (UpdateType)ReadByte();
if (!Enum.IsDefined(typeof(UpdateType), (byte)Type))
{
throw new Exception("Invalid UpdateType '" + Type + "' in Block " + this);
}
// Console.WriteLine("Reading {0}-Block...", Type);
if (Type == UpdateType.OutOfRange ||
Type == UpdateType.Near)
{
var count = ReadUInt();
EntityIds = new EntityId[count];
for (var i = 0; i < count; i++)
{
EntityIds[i] = ReadPackedEntityId();
}
}
else
{
EntityId = ReadPackedEntityId();
if (Type == UpdateType.Create ||
Type == UpdateType.CreateSelf)
{
ObjectType = (ObjectTypeId)ReadByte();
}
if (Type == UpdateType.Create ||
Type == UpdateType.CreateSelf ||
Type == UpdateType.Movement)
{
m_movement = ReadMovementBlock();
}
if (Type != UpdateType.Movement)
{
Values = ReadValues();
}
}
if (Type != UpdateType.Create && Type != UpdateType.CreateSelf)
{
ObjectType = EntityId.ObjectType;
}
}
示例15: PrepareUpdateData
public override void PrepareUpdateData( byte []data, ref int offset, UpdateType type, bool forOther )
{
int o = offset;
/* int offset = 4;
Converter.ToBytes( 1, tempBuff, ref offset );
Converter.ToBytes( (byte)0, tempBuff, ref offset ); */
tempBuff[ offset++ ] = 2;
Converter.ToBytes( Guid, tempBuff, ref offset );
ResetBitmap();
Converter.ToBytes( (byte)7, tempBuff, ref offset );
Converter.ToBytes( (int)0, tempBuff, ref offset );
Converter.ToBytes( (int)0, tempBuff, ref offset );// Movement flags
Converter.ToBytes( X, tempBuff, ref offset );
Converter.ToBytes( Y, tempBuff, ref offset );
Converter.ToBytes( Z, tempBuff, ref offset );
Converter.ToBytes( Orientation, tempBuff, ref offset );
Converter.ToBytes( 0, tempBuff, ref offset );
Converter.ToBytes( 2.5f, tempBuff, ref offset );
Converter.ToBytes( 7f, tempBuff, ref offset );
Converter.ToBytes( 2.5f, tempBuff, ref offset );
Converter.ToBytes( (float)4.5f, tempBuff, ref offset );// vitesse encore ?
Converter.ToBytes( (float)4.7222f, tempBuff, ref offset );// vitesse encore ?
Converter.ToBytes( (float)Math.PI, tempBuff, ref offset );// turn rate
Converter.ToBytes( (uint)0, tempBuff, ref offset );
Converter.ToBytes( (uint)1, tempBuff, ref offset );
Converter.ToBytes( (uint)0, tempBuff, ref offset );
Converter.ToBytes( (uint)0, tempBuff, ref offset );
Converter.ToBytes( (uint)0, tempBuff, ref offset );
setUpdateValue( Const.OBJECT_FIELD_GUID, Guid );
setUpdateValue( Const.OBJECT_FIELD_TYPE, 0x81 );
setUpdateValue( Const.OBJECT_FIELD_SCALE_X, (float)1.0f );
setUpdateValue( 6, owner );
setUpdateValue( 8, Orientation );
setUpdateValue( 9, X );
setUpdateValue( 10, Y );
setUpdateValue( 11, Z );
int last = 0;
setUpdateValue( last = (int)UpdateFields.CORPSE_FIELD_DISPLAY_ID, Model );
setUpdateValue( (int)UpdateFields.CORPSE_FIELD_BYTES_1, bytes2 );
setUpdateValue( (int)UpdateFields.CORPSE_FIELD_BYTES_2, bytes3 );
setUpdateValue( last = (int)UpdateFields.CORPSE_FIELD_FLAGS, 4 );
FlushUpdateData( tempBuff, ref offset, 2 + ( last / 32 ) );
/*Console.WriteLine("teleport");
string s = "";
for(int t = o;t < offset;t++ )
s += tempBuff[ t ].ToString( "X2" ) + " ";
Debug.WriteLine(s);
*/
//World.ToNearestPlayer( this, tempBuff, offset );
}