private TextReader OpenText(SqlManifestResourceAttribute attribute, string optionalPrefix, out string manifestStreamKey) { return new StreamReader(OpenStream(attribute, optionalPrefix, out manifestStreamKey), true); }
private TextReader OpenText(SqlManifestResourceAttribute attribute, string optionalPrefix) { string key; return OpenText(attribute, optionalPrefix, out key); }
private Stream OpenStream(SqlManifestResourceAttribute attribute, string optionalPrefix, out string manifestStreamKey) { if (attribute.ManifestResourceType == null) { manifestStreamKey = attribute.ManifestResourceName; } else { manifestStreamKey = attribute.ManifestResourceType.Namespace+Type.Delimiter+attribute.ManifestResourceName; } Stream result = assembly.GetManifestResourceStream(null, manifestStreamKey); if ((result == null) && (attribute.ManifestResourceType == null) && (!string.IsNullOrEmpty(optionalPrefix))) { manifestStreamKey = optionalPrefix+Type.Delimiter+attribute.ManifestResourceName; result = assembly.GetManifestResourceStream(null, manifestStreamKey); } if (result == null) { log.ErrorFormat("The embedded SQL file {0} was not found", attribute.ManifestResourceName); throw new FileNotFoundException("The embedded SQL file was not found", attribute.ManifestResourceName); } return result; }