本文整理汇总了C#中ErrorList类的典型用法代码示例。如果您正苦于以下问题:C# ErrorList类的具体用法?C# ErrorList怎么用?C# ErrorList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ErrorList类属于命名空间,在下文中一共展示了ErrorList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BplDocumentFormatter
/// <summary>Creates a new <see cref="BplDocumentFormatter"/> instance.</summary>
public BplDocumentFormatter() {
Errors = new ErrorList();
IndentChars = " ";
NewLineChars = "\r\n";
PrettyPrint = false;
SkipDefaults = true;
}
示例2: ParseEmptyPrimitive
public void ParseEmptyPrimitive()
{
string xmlString = "<someString xmlns='http://hl7.org/fhir' id='4' />";
ErrorList errors = new ErrorList();
FhirString result = (FhirString)FhirParser.ParseElementFromXml(xmlString, errors);
Assert.IsTrue(errors.Count() == 0, errors.ToString());
Assert.IsNotNull(result);
Assert.IsNull(result.Value);
Assert.AreEqual("4", result.LocalId.ToString());
xmlString = "<someString xmlns='http://hl7.org/fhir' id='4' value='' />";
errors.Clear();
result = (FhirString)FhirParser.ParseElementFromXml(xmlString, errors);
Assert.IsTrue(errors.Count() == 0, errors.ToString());
Assert.IsNotNull(result);
Assert.IsNull(result.Value);
Assert.AreEqual("4", result.LocalId.ToString());
string jsonString = "{ \"someString\" : { \"_id\" : \"4\" } }";
errors.Clear();
result = (FhirString)FhirParser.ParseElementFromJson(jsonString, errors);
Assert.IsTrue(errors.Count() == 0, errors.ToString());
Assert.IsNotNull(result);
Assert.IsNull(result.Value);
Assert.AreEqual("4", result.LocalId.ToString());
jsonString = "{ \"someString\" : { \"_id\" : \"4\", \"value\" : \"\" } }";
errors.Clear();
result = (FhirString)FhirParser.ParseElementFromJson(jsonString, errors);
Assert.IsTrue(errors.Count() == 0, errors.ToString());
Assert.IsNotNull(result);
Assert.IsNull(result.Value);
Assert.AreEqual("4", result.LocalId.ToString());
}
示例3: BaseScripter
internal BaseScripter(CSLite_Scripter owner)
{
this.Owner = owner;
this.symbol_table = new SymbolTable(this);
this.code = new Code(this);
this.module_list = new ModuleList(this);
this.parser_list = new ParserList();
this.Error_List = new ErrorList(this);
this.Warning_List = new ErrorList(this);
this.PPDirectiveList = new StringList(false);
this.RegisteredTypes = new RegisteredTypeList();
this.RegisteredNamespaces = new StringList(false);
this.UserTypes = new Hashtable();
this.UserNamespaces = new StringList(false);
this.ForbiddenNamespaces = new StringList(false);
this.UserInstances = new Hashtable();
this.UserVariables = new Hashtable();
this.OperatorHelpers = new Hashtable();
this.available_types = new StringList(false);
this.ForbiddenTypes = new StringList(false);
this.EntryId = 0;
this.event_dispatcher = new EventDispatcher(this, "CSLiteEventDispatcher");
if (CSLite_Scripter.AUTO_IMPORTING_SWITCH)
{
this.RegisterAvailableNamespaces();
}
}
示例4: BinaryParsing
public void BinaryParsing()
{
string xmlString = @"<Binary id='pic1' contentType='image/gif' xmlns='http://hl7.org/fhir'>R0lGODlhEwARAPcAAAAAAAAA/+9aAO+1AP/WAP/eAP/eCP/eEP/eGP/nAP/nCP/nEP/nIf/nKf/nUv/nWv/vAP/vCP/vEP/vGP/vIf/vKf/vMf/vOf/vWv/vY//va//vjP/3c//3lP/3nP//tf//vf///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////yH5BAEAAAEALAAAAAATABEAAAi+AAMIDDCgYMGBCBMSvMCQ4QCFCQcwDBGCA4cLDyEGECDxAoAQHjxwyKhQAMeGIUOSJJjRpIAGDS5wCDly4AALFlYOgHlBwwOSNydM0AmzwYGjBi8IHWoTgQYORg8QIGDAwAKhESI8HIDgwQaRDI1WXXAhK9MBBzZ8/XDxQoUFZC9IiCBh6wEHGz6IbNuwQoSpWxEgyLCXL8O/gAnylNlW6AUEBRIL7Og3KwQIiCXb9HsZQoIEUzUjNEiaNMKAAAA7</Binary>";
ErrorList errors = new ErrorList();
Binary result = (Binary)FhirParser.ParseResourceFromXml(xmlString, errors);
Assert.IsTrue(errors.Count() == 0, errors.ToString());
Assert.AreEqual("image/gif", result.ContentType);
Assert.AreEqual(993, result.Content.Length);
Assert.IsTrue(Encoding.ASCII.GetString(result.Content).StartsWith("GIF89a"));
byte[] data = result.Content;
File.WriteAllBytes(@"c:\temp\test.gif", data);
string json = "{ Binary: { contentType : \"image/gif\", " +
"content: \"R0lGODlhEwARAPcAAAAAAAAA/+9aAO+1AP/WAP/eAP/eCP/eEP/eGP/nAP/nCP/nEP/nIf/nKf/nUv/nWv/vAP/vCP/vEP/vGP/vIf/vKf/vMf/vOf/vWv/vY//va//vjP/3c//3lP/3nP//tf//vf///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////yH5BAEAAAEALAAAAAATABEAAAi+AAMIDDCgYMGBCBMSvMCQ4QCFCQcwDBGCA4cLDyEGECDxAoAQHjxwyKhQAMeGIUOSJJjRpIAGDS5wCDly4AALFlYOgHlBwwOSNydM0AmzwYGjBi8IHWoTgQYORg8QIGDAwAKhESI8HIDgwQaRDI1WXXAhK9MBBzZ8/XDxQoUFZC9IiCBh6wEHGz6IbNuwQoSpWxEgyLCXL8O/gAnylNlW6AUEBRIL7Og3KwQIiCXb9HsZQoIEUzUjNEiaNMKAAAA7\" } }";
errors.Clear();
result = (Binary)FhirParser.ParseResourceFromJson(json, errors);
Assert.IsTrue(errors.Count() == 0, errors.ToString());
Assert.AreEqual("image/gif", result.ContentType);
Assert.AreEqual(993, result.Content.Length);
Assert.IsTrue(Encoding.ASCII.GetString(result.Content).StartsWith("GIF89a"));
}
示例5: ParseTags
internal static IList<Tag> ParseTags(XmlReader xr, ErrorList errors)
{
xr.MoveToContent();
try
{
var taglist = (XElement)XElement.ReadFrom(xr);
if (taglist.Name == BundleXmlParser.XFHIRNS + TagListSerializer.TAGLIST_ROOT)
{
if (taglist.Elements().All(xe => xe.Name == BundleXmlParser.XFHIRNS + BundleXmlParser.XATOM_CATEGORY))
return ParseTags(taglist.Elements());
else
errors.Add("TagList contains unexpected child elements");
}
else
errors.Add(String.Format("Unexpected element name {0} found at start of TagList", taglist.Name));
}
catch (Exception exc)
{
errors.Add("Exception while loading taglist: " + exc.Message);
}
return null;
}
示例6: GenerateSet
public ErrorList GenerateSet(Context ctx, Action<Context> exp)
{
Ctx = ctx;
Errors.Clear();
var errors = new ErrorList();
if (T.Type == 0)
{
var error = (CommonErrorNode) T;
errors.ErrorParse(error);
return Errors;
}
var child = (CommonTree) T.Children[0];
switch (child.Type)
{
case 0:
{
var error = (CommonErrorNode) child;
errors.ErrorParse(error);
break;
}
case TemplateLexer.MStart:
case TemplateLexer.EStart:
{
EmitSet(child, exp);
//pop off voidtype from final function in chain
break;
}
default:
{
break;
}
}
return Errors;
}
示例7: ParseIdentifier
/// <summary>
/// Parse Identifier
/// </summary>
public static Hl7.Fhir.Model.Identifier ParseIdentifier(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Identifier existingInstance = null )
{
Hl7.Fhir.Model.Identifier result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Identifier();
string currentElementName = reader.CurrentElementName;
reader.EnterElement();
while (reader.HasMoreElements())
{
var atName = reader.CurrentElementName;
// Parse element extension
if( atName == "extension" )
{
result.Extension = new List<Hl7.Fhir.Model.Extension>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "extension") )
result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
reader.LeaveArray();
}
// Parse element _id
else if( atName == "_id" )
result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
// Parse element use
else if( atName == "use" )
result.UseElement = CodeParser.ParseCode<Hl7.Fhir.Model.Identifier.IdentifierUse>(reader, errors);
// Parse element label
else if( atName == "label" )
result.LabelElement = FhirStringParser.ParseFhirString(reader, errors);
// Parse element system
else if( atName == "system" )
result.SystemElement = FhirUriParser.ParseFhirUri(reader, errors);
// Parse element key
else if( atName == "key" )
result.KeyElement = FhirStringParser.ParseFhirString(reader, errors);
// Parse element period
else if( atName == "period" )
result.Period = PeriodParser.ParsePeriod(reader, errors);
// Parse element assigner
else if( atName == "assigner" )
result.Assigner = ResourceReferenceParser.ParseResourceReference(reader, errors);
else
{
errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
reader.SkipSubElementsFor(currentElementName);
result = null;
}
}
reader.LeaveElement();
return result;
}
示例8: Execute
public override void Execute()
{
try
{
DTE service = (DTE)this.GetService(typeof(DTE));
list = new ErrorList(service);
if (IsDisposeCheckerInstalled())
{
string disposeCheckerPath = "";
string[] folders = new string[] {
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Microsoft\SharePoint Dispose Check\SPDisposeCheck.exe") };
bool disposeCheckerFound = false;
foreach (string path in folders)
{
if (File.Exists(path))
{
disposeCheckerFound = true;
disposeCheckerPath = path;
break;
}
}
if (!disposeCheckerFound)
{
MessageBox.Show("SPDisposeCheck not found at installation location");
}
//first check for rebuild
foreach (Project project in Helpers.GetSelectedProjects(service))
{
if (DeploymentHelpers.CheckRebuildForProject(service, project))
{
}
}
foreach (Project project in Helpers.GetSelectedProjects(service))
{
currentProject = project;
string projectpath = project.FullName;
projectpath = projectpath.Substring(0, projectpath.LastIndexOf('\\', projectpath.Length - 2));
RunProcess(service, disposeCheckerPath, "\"" + projectpath + "\"");
}
}
else
{
if (MessageBox.Show("SPDisposeCheck is not installed. Go to download page?", "Not installed", MessageBoxButtons.YesNo) == DialogResult.Yes)
{
Window win = service.Windows.Item(EnvDTE.Constants.vsWindowKindCommandWindow);
CommandWindow comwin = (CommandWindow)win.Object;
comwin.SendInput("nav \"http://code.msdn.microsoft.com/SPDisposeCheck\"", true);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
示例9: Validate
public override ErrorList Validate()
{
var result = new ErrorList();
result.AddRange(base.Validate());
return result;
}
示例10: ParseInterestOfCare
/// <summary>
/// Parse InterestOfCare
/// </summary>
public static Hl7.Fhir.Model.InterestOfCare ParseInterestOfCare(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.InterestOfCare existingInstance = null )
{
Hl7.Fhir.Model.InterestOfCare result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.InterestOfCare();
string currentElementName = reader.CurrentElementName;
reader.EnterElement();
while (reader.HasMoreElements())
{
var atName = reader.CurrentElementName;
// Parse element extension
if( atName == "extension" )
{
result.Extension = new List<Hl7.Fhir.Model.Extension>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "extension") )
result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
reader.LeaveArray();
}
// Parse element language
else if( atName == "language" )
result.LanguageElement = CodeParser.ParseCode(reader, errors);
// Parse element text
else if( atName == "text" )
result.Text = NarrativeParser.ParseNarrative(reader, errors);
// Parse element contained
else if( atName == "contained" )
{
result.Contained = new List<Hl7.Fhir.Model.Resource>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "contained") )
result.Contained.Add(ParserUtils.ParseContainedResource(reader,errors));
reader.LeaveArray();
}
// Parse element _id
else if( atName == "_id" )
result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
else
{
errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
reader.SkipSubElementsFor(currentElementName);
result = null;
}
}
reader.LeaveElement();
return result;
}
示例11: ParseCodeableConcept
/// <summary>
/// Parse CodeableConcept
/// </summary>
public static Hl7.Fhir.Model.CodeableConcept ParseCodeableConcept(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.CodeableConcept existingInstance = null )
{
Hl7.Fhir.Model.CodeableConcept result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.CodeableConcept();
string currentElementName = reader.CurrentElementName;
reader.EnterElement();
while (reader.HasMoreElements())
{
var atName = reader.CurrentElementName;
// Parse element extension
if( atName == "extension" )
{
result.Extension = new List<Hl7.Fhir.Model.Extension>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "extension") )
result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
reader.LeaveArray();
}
// Parse element _id
else if( atName == "_id" )
result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
// Parse element coding
else if( atName == "coding" )
{
result.Coding = new List<Hl7.Fhir.Model.Coding>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "coding") )
result.Coding.Add(CodingParser.ParseCoding(reader, errors));
reader.LeaveArray();
}
// Parse element text
else if( atName == "text" )
result.TextElement = FhirStringParser.ParseFhirString(reader, errors);
// Parse element primary
else if( atName == "primary" )
result.PrimaryElement = IdRefParser.ParseIdRef(reader, errors);
else
{
errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
reader.SkipSubElementsFor(currentElementName);
result = null;
}
}
reader.LeaveElement();
return result;
}
示例12: ParseQuantity
/// <summary>
/// Parse Quantity
/// </summary>
public static Hl7.Fhir.Model.Quantity ParseQuantity(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Quantity existingInstance = null )
{
Hl7.Fhir.Model.Quantity result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Quantity();
string currentElementName = reader.CurrentElementName;
reader.EnterElement();
while (reader.HasMoreElements())
{
var atName = reader.CurrentElementName;
// Parse element extension
if( atName == "extension" )
{
result.Extension = new List<Hl7.Fhir.Model.Extension>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "extension") )
result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
reader.LeaveArray();
}
// Parse element _id
else if( atName == "_id" )
result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
// Parse element value
else if( atName == "value" )
result.ValueElement = FhirDecimalParser.ParseFhirDecimal(reader, errors);
// Parse element comparator
else if( atName == "comparator" )
result.ComparatorElement = CodeParser.ParseCode<Hl7.Fhir.Model.Quantity.QuantityCompararator>(reader, errors);
// Parse element units
else if( atName == "units" )
result.UnitsElement = FhirStringParser.ParseFhirString(reader, errors);
// Parse element system
else if( atName == "system" )
result.SystemElement = FhirUriParser.ParseFhirUri(reader, errors);
// Parse element code
else if( atName == "code" )
result.CodeElement = CodeParser.ParseCode(reader, errors);
else
{
errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
reader.SkipSubElementsFor(currentElementName);
result = null;
}
}
reader.LeaveElement();
return result;
}
示例13: ParseChoice
/// <summary>
/// Parse Choice
/// </summary>
public static Hl7.Fhir.Model.Choice ParseChoice(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Choice existingInstance = null )
{
Hl7.Fhir.Model.Choice result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Choice();
string currentElementName = reader.CurrentElementName;
reader.EnterElement();
while (reader.HasMoreElements())
{
var atName = reader.CurrentElementName;
// Parse element extension
if( atName == "extension" )
{
result.Extension = new List<Hl7.Fhir.Model.Extension>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "extension") )
result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
reader.LeaveArray();
}
// Parse element _id
else if( atName == "_id" )
result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
// Parse element code
else if( atName == "code" )
result.CodeElement = CodeParser.ParseCode(reader, errors);
// Parse element option
else if( atName == "option" )
{
result.Option = new List<Hl7.Fhir.Model.Choice.ChoiceOptionComponent>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "option") )
result.Option.Add(ChoiceParser.ParseChoiceOptionComponent(reader, errors));
reader.LeaveArray();
}
// Parse element isOrdered
else if( atName == "isOrdered" )
result.IsOrderedElement = FhirBooleanParser.ParseFhirBoolean(reader, errors);
else
{
errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
reader.SkipSubElementsFor(currentElementName);
result = null;
}
}
reader.LeaveElement();
return result;
}
示例14: ValidateRules
internal override ErrorList ValidateRules()
{
var result = new ErrorList();
string dummy;
if (!TryParseValue( Value, out dummy ))
result.Add("Not a correctly formatted date value");
return result;
}
示例15: ParseSchedule
/// <summary>
/// Parse Schedule
/// </summary>
public static Hl7.Fhir.Model.Schedule ParseSchedule(IFhirReader reader, ErrorList errors, Hl7.Fhir.Model.Schedule existingInstance = null )
{
Hl7.Fhir.Model.Schedule result = existingInstance != null ? existingInstance : new Hl7.Fhir.Model.Schedule();
string currentElementName = reader.CurrentElementName;
reader.EnterElement();
while (reader.HasMoreElements())
{
var atName = reader.CurrentElementName;
// Parse element extension
if( atName == "extension" )
{
result.Extension = new List<Hl7.Fhir.Model.Extension>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "extension") )
result.Extension.Add(ExtensionParser.ParseExtension(reader, errors));
reader.LeaveArray();
}
// Parse element _id
else if( atName == "_id" )
result.LocalIdElement = Id.Parse(reader.ReadPrimitiveContents(typeof(Id)));
// Parse element event
else if( atName == "event" )
{
result.Event = new List<Hl7.Fhir.Model.Period>();
reader.EnterArray();
while( ParserUtils.IsAtArrayElement(reader, "event") )
result.Event.Add(PeriodParser.ParsePeriod(reader, errors));
reader.LeaveArray();
}
// Parse element repeat
else if( atName == "repeat" )
result.Repeat = ScheduleParser.ParseScheduleRepeatComponent(reader, errors);
else
{
errors.Add(String.Format("Encountered unknown element {0} while parsing {1}", reader.CurrentElementName, currentElementName), reader);
reader.SkipSubElementsFor(currentElementName);
result = null;
}
}
reader.LeaveElement();
return result;
}