예제 #1
0
        /// <summary>
        /// Read the Manifest file and deserialize its content from JSON.
        /// </summary>
        public void Fetch()
        {
            var manifestText = File.ReadAllText(Path);

            m_RawContent = (Dictionary <string, object>)Json.Deserialize(manifestText);

            if (m_RawContent.TryGetValue(k_ScopedRegistriesKey, out var registriesBlob))
            {
                if (registriesBlob is List <object> registries)
                {
                    foreach (var registry in registries)
                    {
                        var registryDict  = (Dictionary <string, object>)registry;
                        var scopeRegistry = new ScopeRegistry(registryDict);
                        m_ScopeRegistries.Add(scopeRegistry.Url, scopeRegistry);
                    }
                }
            }

            if (m_RawContent.TryGetValue(k_DependenciesKey, out var dependenciesBlob))
            {
                if (dependenciesBlob is Dictionary <string, object> dependencies)
                {
                    foreach (var dependencyData in dependencies)
                    {
                        var dependency = new Dependency(dependencyData.Key, dependencyData.Value.ToString());
                        m_Dependencies.Add(dependency.Name, dependency);
                    }
                }
            }
        }
예제 #2
0
 /// <summary>
 /// Adds scope registry.
 /// </summary>
 /// <param name="registry">An entry to add.</param>
 public void AddScopeRegistry(ScopeRegistry registry)
 {
     if (!IsRegistryPresent(registry.Url))
     {
         m_ScopeRegistries.Add(registry.Url, registry);
     }
 }