BamlLocalization.BamlStream.IsResourceEntryBamlStream C# (CSharp) Метод

IsResourceEntryBamlStream() статический приватный Метод

Helper method which determines whether a stream name and value pair indicates a baml stream
static private IsResourceEntryBamlStream ( string name, object value ) : bool
name string
value object
Результат bool
        internal static bool IsResourceEntryBamlStream(string name, object value)
        {
            string extension = Path.GetExtension(name);
            if (string.Compare(
                    extension,
                    "." + FileType.BAML.ToString(),
                    true,
                    CultureInfo.InvariantCulture
                    ) == 0
                )
            {
                   //it has .Baml at the end
                Type type = value.GetType();

                if (typeof(Stream).IsAssignableFrom(type))
                return true;
            }
            return false;
        }

Usage Example

Пример #1
0
 //--------------------------------
 // private function
 //--------------------------------
 /// <summary>
 /// Enumerate baml streams in a resources file
 /// </summary>
 private void EnumerateBamlInResources(ResourceReader reader, string resourceName)
 {
     foreach (DictionaryEntry entry in reader)
     {
         string name = entry.Key as string;
         if (BamlStream.IsResourceEntryBamlStream(name, entry.Value))
         {
             _bamlStreams.Add(
                 new BamlStream(
                     BamlStream.CombineBamlStreamName(resourceName, name),
                     (Stream)entry.Value
                     )
                 );
         }
     }
 }
All Usage Examples Of BamlLocalization.BamlStream::IsResourceEntryBamlStream