Example #1
0
        // Load the list of classes that are present in all region assemblies.
        private void LoadClassList()
        {
            Stream stream;

            // Look for "I18N-handlers.def" in the manifest resources.
            try
            {
                stream = Assembly.GetExecutingAssembly()
                         .GetManifestResourceStream("I18N-handlers.def");
                if (stream == null)
                {
                    return;
                }
            }
            catch (FileNotFoundException)
            {
                // The file does not exist.
                return;
            }

            // Load the class list from the stream.
            StreamReader reader = new StreamReader(stream);
            String       line;
            int          posn;

            while ((line = reader.ReadLine()) != null)
            {
                // Skip comment lines in the input.
                if (line.Length == 0 || line[0] == '#')
                {
                    continue;
                }

                // Split the line into namespace and name.  We assume
                // that the line has the form "I18N.<Region>.<Name>".
                posn = line.LastIndexOf('.');
                if (posn != -1)
                {
                    // Add the namespace to the "handlers" hash,
                    // attached to the name of the handler class.
                    String name = line.Substring(posn + 1);
                    handlers.Add(name, line.Substring(0, posn));
                }
            }
            reader.Close();
        }