Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScData"/> class with the specified <see cref="ScFile"/>
        /// which contains the <see cref="ScData"/>.
        /// </summary>
        /// <param name="scFile"><see cref="ScFile"/> which contains the <see cref="ScData"/>.</param>
        /// <exception cref="ArgumentNullException"/>
        public ScData(ScFile scFile)
        {
            if (scFile == null)
            {
                throw new ArgumentNullException(nameof(scFile));
            }

            _scFile = scFile;
        }
Exemple #2
0
        /// <summary>
        /// Loads the .sc(<see cref="ScFile"/>) file at the specified path.
        /// </summary>
        /// <param name="path">Path pointing to the .sc file.</param>
        /// <returns>An instance of the <see cref="ScFile"/> representing the specified .sc file.</returns>
        /// <exception cref="ArgumentNullException"/>
        /// <exception cref="FileNotFoundException"/>
        public static ScFile Load(string path, ScFormatVersion version)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }
            if (!File.Exists(path))
            {
                throw new FileNotFoundException();
            }

            var scFile = new ScFile(version);
            var loader = ScLoader.GetLoader(version);

            using (var fileStream = File.OpenRead(path))
                loader.Load(ref scFile, fileStream);

            return(scFile);
        }
Exemple #3
0
 public abstract void Load(ref ScFile file, Stream stream);
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScData"/> class with the specified <see cref="ScFile"/>
 /// which contains the <see cref="ScData"/>.
 /// </summary>
 /// <param name="scFile"><see cref="ScFile"/> which contains the <see cref="ScData"/>.</param>
 /// <exception cref="ArgumentNullException"/>
 public ScData(ScFile scFile)
 {
     _scFile = scFile ?? throw new ArgumentNullException(nameof(scFile));
 }