Exemple #1
0
        static void Main()
        {
            var disk    = new FileSystem();
            var baseDir = ConfigUtil.FindBasePath(disk);

            if (baseDir == null)
            {
                throw new InvalidOperationException("No base directory could be found.");
            }

            var dir = Path.Combine(baseDir, RelativePath);

            var files = Directory.EnumerateFiles(dir, "*.bin");

            foreach (var file in files)
            {
                using var stream = File.OpenRead(file);
                using var br     = new BinaryReader(stream);
                using var s      = new AlbionReader(br);
                var flic   = new FlicFile(s);
                var buffer = new byte[flic.Width * flic.Height];

                AviFile.Write(
                    Path.ChangeExtension(file, "avi"),
                    flic.Speed,
                    flic.Width,
                    flic.Height,
                    flic.Play(() => buffer).AllFrames32());
                // break;
            }
        }
Exemple #2
0
    public FlicPlayer(FlicFile flic, FlicFile.GetPixelDataFunc getPixelData)
    {
        if (flic == null)
        {
            throw new ArgumentNullException(nameof(flic));
        }
        _getPixelData = getPixelData ?? throw new ArgumentNullException(nameof(getPixelData));

        var pixelData = _getPixelData();

        if (pixelData.Length != flic.Width * flic.Height)
        {
            throw new ArgumentOutOfRangeException(
                      "FlicFile.Player: Expected a pixel buffer " +
                      $"of size {flic.Width * flic.Height} ({flic.Width}x{flic.Height})," +
                      $" but was given a buffer of size {pixelData.Length}");
        }

        _flic   = flic;
        _frames = flic.Chunks.OfType <FlicFrame>().ToArray();
        ApplyFrame(_frames[0]);
    }