public ImportError(ImportErrorCode errorCode, string errorDetail = null, int?lineNumber = null, string lineDetail = null) { this.ErrorCode = errorCode; this.ErrorDetail = errorDetail; this.LineNumber = lineNumber; this.LineDetail = lineDetail; }
/// <summary> /// Begin walking subdirectories starting at the parameter directory. Filter /// all file results by the file filter string. /// </summary> /// <param name="baseDir">Directory to begin in.</param> /// <param name="fileFilter">A standard file filter string (such as *.*).</param> public void WalkDirectories ( string baseDir, string fileFilter) { try { WalkFiles ( baseDir, fileFilter); if (_errorCode == ImportErrorCode.None) { foreach (string dirName in Directory.GetDirectories(baseDir)) { WalkDirectories ( dirName, fileFilter); if (_errorCode != ImportErrorCode.None) { break; } } } } catch (IOException) { _errorCode = ImportErrorCode.GeneralError; } }
public static void AddError(ImportErrorCode error, Collection<ImportErrorCode> errorCode) { if ((error != ImportErrorCode.Ok) && (!errorCode.Contains(error))) { errorCode.Add(error); } }
public ImportError(ImportErrorCode errorCode, string errorDetail = null, int? lineNumber = null, string lineDetail = null) { ErrorCode = errorCode; ErrorDetail = errorDetail; LineNumber = lineNumber; LineDetail = lineDetail; }
public Error(ImportErrorType error, ImportErrorCode code, object context, Level level, string filePath, IXmlLineInfo xmlLineInfo) { this.xmlLineInfo = xmlLineInfo; this.error = error; this.code = code; this.context = context; this.level = level; this.filePath = filePath; }
private static string ErrorMessage(ImportErrorCode errorCode) { switch (errorCode) { case ImportErrorCode.InvalidXml: return("Xml is not valid, exception during parsing: {0}"); case ImportErrorCode.InvalidRootElement: return("Expected the XML Root element name to be '" + k_RootNode + "', found '{0}'"); case ImportErrorCode.TemplateHasEmptyName: return("'" + k_TemplateNode + "' declaration requires a non-empty '" + k_TemplateNameAttr + "' attribute"); case ImportErrorCode.TemplateInstanceHasEmptySource: return("'" + k_TemplateInstanceNode + "' declaration requires a non-empty '" + k_TemplateInstanceSourceAttr + "' attribute"); case ImportErrorCode.MissingPathAttributeOnTemplate: return("'" + k_TemplateNode + "' declaration requires a '" + k_TemplatePathAttr + "' attribute referencing another uxml file"); case ImportErrorCode.DuplicateTemplateName: return("Duplicate name '{0}'"); case ImportErrorCode.UnknownTemplate: return("Unknown template name '{0}'"); case ImportErrorCode.UnknownElement: return("Unknown element name '{0}'"); case ImportErrorCode.UnknownAttribute: return("Unknown attribute: '{0}'"); case ImportErrorCode.InvalidCssInStyleAttribute: return("USS in 'style' attribute is invalid: {0}"); case ImportErrorCode.StyleReferenceEmptyOrMissingPathAttr: return("USS in 'style' attribute is invalid: {0}"); case ImportErrorCode.DuplicateSlotDefinition: return("Slot definition '{0}' is defined more than once"); case ImportErrorCode.SlotUsageInNonTemplate: return("Element has an assigned slot, but its parent '{0}' is not a template reference"); case ImportErrorCode.SlotDefinitionHasEmptyName: return("Slot definition has an empty name"); case ImportErrorCode.SlotUsageHasEmptyName: return("Slot usage has an empty name"); case ImportErrorCode.DuplicateContentContainer: return("'contentContainer' attribute must be defined once at most"); default: throw new ArgumentOutOfRangeException("Unhandled error code " + errorCode); } }
void LogError(VisualTreeAsset asset, ImportErrorType errorType, ImportErrorCode code, object context, IXmlLineInfo xmlLineInfo) { // If we ever want to use the AssetDatabase error reporting APIs, use m_Context.LogImportError() here logger.LogError(errorType, code, context, Error.Level.Fatal, xmlLineInfo); if (asset != null) { asset.importedWithErrors = true; } }
/// <summary> /// Get all files at this directory. Matches all files according to the filter /// passed in. /// </summary> /// <param name="baseDir">Start at this directory.</param> /// <param name="fileFilter">Use this filter.</param> public void WalkFiles ( string baseDir, string fileFilter) { foreach (string fileName in Directory.GetFiles ( baseDir, fileFilter)) { if (_fileList.Count >= MaxFileNumber) { _errorCode = ImportErrorCode.TooManyFiles; return; } _fileList.Add(fileName); Debug.WriteLine(fileName); } _errorCode = (_fileList.Count >= MaxFileNumber) ? ImportErrorCode.TooManyFiles : ImportErrorCode.None; }
public void AppendError(ImportErrorCode errorCode, string errorDetail = null, int?lineNumber = null, string lineDetail = null) { errors.Add(new ImportError(errorCode, errorDetail, lineNumber, lineDetail)); }
internal virtual void LogError(ImportErrorType error, ImportErrorCode code, object context, Error.Level level, IXmlLineInfo xmlLineInfo) { m_Errors.Add(new Error(error, code, context, level, m_Path, xmlLineInfo)); }
private static string ErrorMessage(ImportErrorCode errorCode) { switch (errorCode) { case ImportErrorCode.InvalidXml: return("Xml is not valid, exception during parsing: {0}"); case ImportErrorCode.InvalidRootElement: return("Expected the XML Root element name to be '" + k_RootNode + "', found '{0}'"); case ImportErrorCode.TemplateHasEmptyName: return("'" + k_TemplateNode + "' declaration requires a non-empty '" + k_TemplateNameAttr + "' attribute"); case ImportErrorCode.TemplateInstanceHasEmptySource: return("'" + k_TemplateInstanceNode + "' declaration requires a non-empty '" + k_TemplateInstanceSourceAttr + "' attribute"); case ImportErrorCode.TemplateMissingPathOrSrcAttribute: return("'" + k_TemplateNode + "' declaration requires a '" + k_GenericPathAttr + "' or '" + k_GenericSrcAttr + "' attribute referencing another UXML file"); case ImportErrorCode.TemplateSrcAndPathBothSpecified: return("'" + k_TemplateNode + "' declaration does not accept both '" + k_GenericSrcAttr + "' and '" + k_GenericPathAttr + "' attributes"); case ImportErrorCode.DuplicateTemplateName: return("Duplicate name '{0}'"); case ImportErrorCode.UnknownTemplate: return("Unknown template name '{0}'"); case ImportErrorCode.UnknownElement: return("Unknown element name '{0}'"); case ImportErrorCode.UnknownAttribute: return("Unknown attribute: '{0}'"); case ImportErrorCode.InvalidCssInStyleAttribute: return("USS in 'style' attribute is invalid: {0}"); case ImportErrorCode.StyleReferenceEmptyOrMissingPathOrSrcAttr: return("'" + k_StyleReferenceNode + "' declaration requires a '" + k_GenericPathAttr + "' or '" + k_GenericSrcAttr + "' attribute referencing a USS file"); case ImportErrorCode.StyleReferenceSrcAndPathBothSpecified: return("'" + k_StyleReferenceNode + "' declaration does not accept both '" + k_GenericSrcAttr + "' and '" + k_GenericPathAttr + "' attributes"); case ImportErrorCode.SlotsAreExperimental: return("Slot are an experimental feature. Syntax and semantic may change in the future."); case ImportErrorCode.DuplicateSlotDefinition: return("Slot definition '{0}' is defined more than once"); case ImportErrorCode.SlotUsageInNonTemplate: return("Element has an assigned slot, but its parent '{0}' is not a template reference"); case ImportErrorCode.SlotDefinitionHasEmptyName: return("Slot definition has an empty name"); case ImportErrorCode.SlotUsageHasEmptyName: return("Slot usage has an empty name"); case ImportErrorCode.DuplicateContentContainer: return("'contentContainer' attribute must be defined once at most"); case ImportErrorCode.DeprecatedAttributeName: return("'{0}' attribute name is deprecated"); case ImportErrorCode.ReplaceByAttributeName: return("Please use '{0}' instead"); case ImportErrorCode.AttributeOverridesMissingElementNameAttr: return("AttributeOverrides node missing 'element-name' attribute."); case ImportErrorCode.ReferenceInvalidURILocation: return("The specified URL is empty or invalid : {0}"); case ImportErrorCode.ReferenceInvalidURIScheme: return("The scheme specified for the URI is invalid : {0}"); case ImportErrorCode.ReferenceInvalidURIProjectAssetPath: return("The specified URI does not exist in the current project : {0}"); case ImportErrorCode.ReferenceInvalidAssetType: return("The specified URI refers to an invalid asset : {0}"); default: throw new ArgumentOutOfRangeException("Unhandled error code " + errorCode); } }
private static string ErrorMessage(ImportErrorCode errorCode) { string result; switch (errorCode) { case ImportErrorCode.InvalidRootElement: result = "Expected the XML Root element name to be 'UXML', found '{0}'"; break; case ImportErrorCode.DuplicateUsingAlias: result = "Duplicate alias '{0}'"; break; case ImportErrorCode.UnknownElement: result = "Unknown element name '{0}'"; break; case ImportErrorCode.UnknownAttribute: result = "Unknown attribute: '{0}'"; break; case ImportErrorCode.InvalidXml: result = "Xml is not valid, exception during parsing: {0}"; break; case ImportErrorCode.InvalidCssInStyleAttribute: result = "USS in 'style' attribute is invalid: {0}"; break; case ImportErrorCode.MissingPathAttributeOnUsing: result = "'Using' declaration requires a 'path' attribute referencing another uxml file"; break; case ImportErrorCode.UsingHasEmptyAlias: result = "'Using' declaration requires a non-empty 'alias' attribute"; break; case ImportErrorCode.StyleReferenceEmptyOrMissingPathAttr: result = "USS in 'style' attribute is invalid: {0}"; break; case ImportErrorCode.DuplicateSlotDefinition: result = "Slot definition '{0}' is defined more than once"; break; case ImportErrorCode.SlotUsageInNonTemplate: result = "Element has an assigned slot, but its parent '{0}' is not a template reference"; break; case ImportErrorCode.SlotDefinitionHasEmptyName: result = "Slot definition has an empty name"; break; case ImportErrorCode.SlotUsageHasEmptyName: result = "Slot usage has an empty name"; break; case ImportErrorCode.DuplicateContentContainer: result = "'contentContainer' attribute must be defined once at most"; break; default: throw new ArgumentOutOfRangeException("Unhandled error code " + errorCode); } return(result); }
internal virtual void LogError(ImportErrorType error, ImportErrorCode code, object context, UIElementsViewImporter.Error.Level level, IXmlLineInfo xmlLineInfo) { this.m_Errors.Add(new UIElementsViewImporter.Error(error, code, context, level, this.m_Path, xmlLineInfo)); }
protected void AddError(ImportErrorCode error) { if ((error != ImportErrorCode.Ok) && (!errorCode.Contains(error))) { errorCode.Add(error); } }
/// <summary> /// Get all files at this directory. Matches all files according to the filter /// passed in. /// </summary> /// <param name="baseDir">Start at this directory.</param> /// <param name="fileFilter">Use this filter.</param> public void WalkFiles( string baseDir, string fileFilter) { foreach (string fileName in Directory.GetFiles ( baseDir, fileFilter)) { if (_fileList.Count >= MaxFileNumber) { _errorCode = ImportErrorCode.TooManyFiles; return; } _fileList.Add(fileName); Debug.WriteLine(fileName); } _errorCode = (_fileList.Count >= MaxFileNumber) ? ImportErrorCode.TooManyFiles : ImportErrorCode.None; }
/// <summary> /// Begin walking subdirectories starting at the parameter directory. Filter /// all file results by the file filter string. /// </summary> /// <param name="baseDir">Directory to begin in.</param> /// <param name="fileFilter">A standard file filter string (such as *.*).</param> public void WalkDirectories( string baseDir, string fileFilter) { try { WalkFiles ( baseDir, fileFilter); if (_errorCode == ImportErrorCode.None) { foreach (string dirName in Directory.GetDirectories(baseDir)) { WalkDirectories ( dirName, fileFilter); if (_errorCode != ImportErrorCode.None) { break; } } } } catch (IOException) { _errorCode = ImportErrorCode.GeneralError; } }