LoadFrom() public static method

public static LoadFrom ( Stream stream ) : ColorScheme
stream Stream
return ColorScheme
Exemplo n.º 1
0
        static void LoadStyle(string name)
        {
            if (!styleLookup.ContainsKey(name))
            {
                throw new System.ArgumentException("Style " + name + " not found", "name");
            }
            var provider = styleLookup [name];
            var stream   = provider.Open();

            try {
                if (provider is UrlStreamProvider)
                {
                    var usp = provider as UrlStreamProvider;
                    if (usp.Url.EndsWith(".vssettings", StringComparison.Ordinal))
                    {
                        styles [name] = ColorScheme.Import(usp.Url, stream);
                    }
                    else
                    {
                        styles [name] = ColorScheme.LoadFrom(stream);
                    }
                }
                else
                {
                    styles [name] = ColorScheme.LoadFrom(stream);
                }
            } catch (Exception e) {
                throw new IOException("Error while loading style :" + name, e);
            } finally {
                stream.Close();
            }
        }
Exemplo n.º 2
0
        static void LoadStyle(string name)
        {
            if (!styleLookup.ContainsKey(name))
            {
                throw new System.ArgumentException("Style " + name + " not found", "name");
            }
            XmlReader reader = styleLookup [name].Open();

            try {
                styles [name] = ColorScheme.LoadFrom(reader);
            } catch (Exception e) {
                throw new IOException("Error while loading style :" + name, e);
            } finally {
                reader.Close();
            }
        }