本文整理汇总了C#中WriterState类的典型用法代码示例。如果您正苦于以下问题:C# WriterState类的具体用法?C# WriterState怎么用?C# WriterState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WriterState类属于命名空间,在下文中一共展示了WriterState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnWriterState
void OnWriterState(Writer writer, WriterState writerState)
{
if (writerState == WriterState.Start && correctTagCount != 0)
{
IntegrationTest.Fail();
}
if (writerState == WriterState.Pause && correctTagCount != 2)
{
IntegrationTest.Fail();
}
if (writerState == WriterState.Resume && correctTagCount != 2)
{
IntegrationTest.Fail();
}
else if (writerState == WriterState.End && correctTagCount != 4)
{
IntegrationTest.Fail();
}
if (writerState == WriterState.End)
{
if (!receivedInput)
{
IntegrationTest.Fail();
}
if (glyphCount != 6)
{
IntegrationTest.Fail();
}
IntegrationTest.Pass();
}
}
示例2: Attribute
public Sgml.ISgmlWriter Attribute(string name, object value)
{
if (_state == WriterState.startElem) _writer.Object();
_writer.Prop("@" + name, value);
_state = WriterState.elemData;
return this;
}
示例3: GraphVizWriter
public GraphVizWriter(System.IO.StreamWriter streamwriter)
{
if (streamwriter == null)
{
throw new System.ArgumentNullException("streamwriter");
}
this.streamwriter = streamwriter;
this.state = WriterState.Begin;
}
示例4: Element
public Sgml.ISgmlWriter Element(string name)
{
if (!(_tags.Count > 0 && _tags.Peek().Group && _tags.Peek().Name == name))
{
if (_state == WriterState.startElem) _writer.Object();
_writer.Prop(name);
}
_tags.Push(new Tag() { Group = false, Name = name });
_state = WriterState.startElem;
return this;
}
示例5: HtmlMobileTextWriter
/// <include file='doc\HtmlMobileTextWriter.uex' path='docs/doc[@for="HtmlMobileTextWriter.HtmlMobileTextWriter"]/*' />
public HtmlMobileTextWriter(TextWriter writer, MobileCapabilities device)
: base(writer, device)
{
RenderBold = device.SupportsBold;
RenderItalic = device.SupportsItalic;
RenderFontSize = device.SupportsFontSize;
RenderFontName = device.SupportsFontName;
RenderFontColor = device.SupportsFontColor;
RenderBodyColor = device.SupportsBodyColor;
RenderDivAlign = device.SupportsDivAlign;
RenderDivNoWrap = device.SupportsDivNoWrap;
RequiresNoBreakInFormatting = device.RequiresNoBreakInFormatting;
_currentState = new WriterState(this);
}
示例6: EnterScope
private void EnterScope(WriterState newState, ODataItem item)
{
this.InterceptException(() => this.ValidateTransition(newState));
bool skipWriting = this.SkipWriting;
Scope currentScope = this.CurrentScope;
if (((currentScope.State == WriterState.Entry) && (newState == WriterState.NavigationLink)) && !skipWriting)
{
ProjectedPropertiesAnnotation projectedProperties = currentScope.Item.GetAnnotation<ProjectedPropertiesAnnotation>();
ODataNavigationLink link = (ODataNavigationLink) item;
skipWriting = projectedProperties.ShouldSkipProperty(link.Name);
}
else if ((currentScope.State == WriterState.Feed) && (newState == WriterState.Entry))
{
FeedScope scope1 = (FeedScope) currentScope;
scope1.EntryCount++;
}
this.PushScope(newState, item, skipWriting);
}
示例7: JsonLightDeltaLinkScope
/// <summary>
/// Constructor to create a new delta link scope.
/// </summary>
/// <param name="state">The writer state of this scope.</param>
/// <param name="link">The link for the new scope.</param>
/// <param name="serializationInfo">The serialization info for the current entry.</param>
/// <param name="navigationSource">The navigation source we are going to write entities for.</param>
/// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param>
/// <param name="writerBehavior">The <see cref="ODataWriterBehavior"/> instance controlling the behavior of the writer.</param>
/// <param name="selectedProperties">The selected properties of this scope.</param>
/// <param name="odataUri">The ODataUri info of this scope.</param>
internal JsonLightDeltaLinkScope(WriterState state, ODataItem link, ODataDeltaSerializationInfo serializationInfo, IEdmNavigationSource navigationSource, IEdmEntityType entityType, ODataWriterBehavior writerBehavior, SelectedPropertiesNode selectedProperties, ODataUri odataUri)
: base(state, link, serializationInfo, navigationSource, entityType, writerBehavior, selectedProperties, odataUri)
{
}
示例8: DeltaEntryScope
/// <summary>
/// Constructor to create a new entry scope.
/// </summary>
/// <param name="state">The writer state of this scope.</param>
/// <param name="entry">The entry for the new scope.</param>
/// <param name="serializationInfo">The serialization info for the current entry.</param>
/// <param name="navigationSource">The navigation source we are going to write entities for.</param>
/// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param>
/// <param name="writerBehavior">The <see cref="ODataWriterBehavior"/> instance controlling the behavior of the writer.</param>
/// <param name="selectedProperties">The selected properties of this scope.</param>
/// <param name="odataUri">The ODataUri info of this scope.</param>
protected DeltaEntryScope(WriterState state, ODataItem entry, ODataFeedAndEntrySerializationInfo serializationInfo, IEdmNavigationSource navigationSource, IEdmEntityType entityType, ODataWriterBehavior writerBehavior, SelectedPropertiesNode selectedProperties, ODataUri odataUri)
: base(state, entry, navigationSource, entityType, selectedProperties, odataUri)
{
Debug.Assert(entry != null, "entry != null");
Debug.Assert(
state == WriterState.DeltaEntry && entry is ODataEntry ||
state == WriterState.DeltaDeletedEntry && entry is ODataDeltaDeletedEntry,
"entry must be either DeltaEntry or DeltaDeletedEntry.");
Debug.Assert(writerBehavior != null, "writerBehavior != null");
this.duplicatePropertyNamesChecker = new DuplicatePropertyNamesChecker(writerBehavior.AllowDuplicatePropertyNames, /*writingResponse*/ true);
this.serializationInfo = serializationInfo;
}
示例9: IsErrorState
/// <summary>
/// Determines whether a given writer state is considered an error state.
/// </summary>
/// <param name="state">The writer state to check.</param>
/// <returns>True if the writer state is an error state; otherwise false.</returns>
private static bool IsErrorState(WriterState state)
{
return state == WriterState.Error;
}
示例10: PushScope
/// <summary>
/// Create a new writer scope.
/// </summary>
/// <param name="state">The writer state of the scope to create.</param>
/// <param name="item">The item attached to the scope to create.</param>
/// <param name="navigationSource">The navigation source we are going to write entities for.</param>
/// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param>
/// <param name="selectedProperties">The selected properties of this scope.</param>
/// <param name="odataUri">The OdataUri info of this scope.</param>
private void PushScope(WriterState state, ODataItem item, IEdmNavigationSource navigationSource, IEdmEntityType entityType, SelectedPropertiesNode selectedProperties, ODataUri odataUri)
{
Debug.Assert(
state == WriterState.Error ||
state == WriterState.DeltaEntry && item is ODataEntry ||
state == WriterState.DeltaDeletedEntry && item is ODataDeltaDeletedEntry ||
state == WriterState.DeltaFeed && item is ODataDeltaFeed ||
state == WriterState.DeltaLink && item is ODataDeltaLink ||
state == WriterState.DeltaDeletedLink && item is ODataDeltaDeletedLink ||
state == WriterState.Start && item == null ||
state == WriterState.Completed && item == null,
"Writer state and associated item do not match.");
Scope scope;
switch (state)
{
case WriterState.DeltaEntry:
scope = this.CreateDeltaEntryScope(WriterState.DeltaEntry, item, navigationSource, entityType, selectedProperties, odataUri);
break;
case WriterState.DeltaDeletedEntry:
scope = this.CreateDeltaEntryScope(WriterState.DeltaDeletedEntry, item, navigationSource, entityType, selectedProperties, odataUri);
break;
case WriterState.DeltaFeed:
scope = this.CreateDeltaFeedScope(item, navigationSource, entityType, selectedProperties, odataUri);
break;
case WriterState.DeltaLink:
scope = this.CreateDeltaLinkScope(WriterState.DeltaLink, item, navigationSource, entityType, selectedProperties, odataUri);
break;
case WriterState.DeltaDeletedLink:
scope = this.CreateDeltaLinkScope(WriterState.DeltaDeletedLink, item, navigationSource, entityType, selectedProperties, odataUri);
break;
case WriterState.Start: // fall through
case WriterState.Completed: // fall through
case WriterState.Error:
scope = new Scope(state, item, navigationSource, entityType, selectedProperties, odataUri);
break;
default:
string errorMessage = Strings.General_InternalError(InternalErrorCodes.ODataWriterCore_Scope_Create_UnreachableCodePath);
Debug.Assert(false, errorMessage);
throw new ODataException(errorMessage);
}
this.scopes.Push(scope);
}
示例11: JsonLightNavigationLinkScope
/// <summary>
/// Constructor to create a new JSON Light navigation link scope.
/// </summary>
/// <param name="writerState">The writer state for the new scope.</param>
/// <param name="navLink">The navigation link for the new scope.</param>
/// <param name="navigationSource">The navigation source we are going to write entities for.</param>
/// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param>
/// <param name="skipWriting">true if the content of the scope to create should not be written.</param>
/// <param name="selectedProperties">The selected properties of this scope.</param>
/// <param name="odataUri">The ODataUri info of this scope.</param>
internal JsonLightNavigationLinkScope(WriterState writerState, ODataNavigationLink navLink, IEdmNavigationSource navigationSource, IEdmEntityType entityType, bool skipWriting, SelectedPropertiesNode selectedProperties, ODataUri odataUri)
: base(writerState, navLink, navigationSource, entityType, skipWriting, selectedProperties, odataUri)
{
}
示例12: Clone
/// <summary>
/// Clones this JSON Light navigation link scope and sets a new writer state.
/// </summary>
/// <param name="newWriterState">The writer state to set.</param>
/// <returns>The cloned navigation link scope with the specified writer state.</returns>
internal override NavigationLinkScope Clone(WriterState newWriterState)
{
return new JsonLightNavigationLinkScope(newWriterState, (ODataNavigationLink)this.Item, this.NavigationSource, this.EntityType, this.SkipWriting, this.SelectedProperties, this.ODataUri)
{
EntityReferenceLinkWritten = this.entityReferenceLinkWritten,
FeedWritten = this.feedWritten,
};
}
示例13: Push
public void Push(WriterState state)
{
if (_states == null)
{
_states = new WriterState[6];
}
else if (_count == _states.Length)
{
WriterState[] items = new WriterState[_states.Length * 2];
_states.CopyTo(items, 0);
_states = items;
}
_states[_count++] = state;
}
示例14: JsonWriterBase
protected JsonWriterBase()
{
_state = new WriterState(JsonWriterBracket.Pending);
}
示例15: CreateNavigationLinkScope
/// <summary>
/// Creates a new JSON Light navigation link scope.
/// </summary>
/// <param name="writerState">The writer state for the new scope.</param>
/// <param name="navLink">The navigation link for the new scope.</param>
/// <param name="navigationSource">The navigation source we are going to write entities for.</param>
/// <param name="entityType">The entity type for the entries in the feed to be written (or null if the entity set base type should be used).</param>
/// <param name="skipWriting">true if the content of the scope to create should not be written.</param>
/// <param name="selectedProperties">The selected properties of this scope.</param>
/// <param name="odataUri">The ODataUri info of this scope.</param>
/// <returns>The newly created JSON Light navigation link scope.</returns>
protected override NavigationLinkScope CreateNavigationLinkScope(WriterState writerState, ODataNavigationLink navLink, IEdmNavigationSource navigationSource, IEdmEntityType entityType, bool skipWriting, SelectedPropertiesNode selectedProperties, ODataUri odataUri)
{
return new JsonLightNavigationLinkScope(writerState, navLink, navigationSource, entityType, skipWriting, selectedProperties, odataUri);
}