/// <summary>
        /// When overriden in derived class, initializes the accessor and returns whether any content is available.
        /// </summary>
        /// <returns>true if the accessor contains any files; false otherwise.</returns>
        protected override bool Initialize()
        {
            if (Metadata == null)
            {
                return(false);
            }

            Json.File[] files = Metadata.Files;
            if (files == null || files.Length < 1)
            {
                return(false);
            }

            _filesByPath      = new Dictionary <string, int>(StringComparer.OrdinalIgnoreCase);
            _filesByReference = new Dictionary <string, int>();

            for (int i = 0; i < files.Length; i++)
            {
                Json.File file = files[i];

                _filesByPath[file.Name]         = i;
                _filesByReference[file.DataRef] = i;
            }

            return(true);
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="File"/> class with an existing <see cref="Json.File"/> storage.
 /// </summary>
 /// <param name="file">A <see cref="Json.File"/> to use as a storage for the entry.</param>
 public File(Json.File file)
 {
     JsonFile = file;
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="File" /> class.
 /// </summary>
 public File()
 {
     JsonFile = new Json.File();
 }