コード例 #1
0
    public void GlobalSetupNative()
    {
        var palContents = File.ReadAllText(_paletteFileName);

        _pal = PaletteJsonSerializer.ReadPalette(palContents, new ColorFactory());

        _codec = new Snes3bppCodec(8, 8);
        Setup(_nativeFileName, "native");
    }
コード例 #2
0
    /// <summary>
    /// Read a palette from a JSON file
    /// </summary>
    /// <param name="paletteFileName">Path to the JSON palette file</param>
    public Palette ReadJsonPalette(string paletteFileName)
    {
        if (!File.Exists(paletteFileName))
        {
            throw new FileNotFoundException($"{nameof(ReadJsonPalette)}: Could not locate file {paletteFileName}");
        }

        string json = File.ReadAllText(paletteFileName);
        var    pal  = PaletteJsonSerializer.ReadPalette(json, ColorFactory);

        return(pal);
    }
コード例 #3
0
    public void GlobalSetupGeneric()
    {
        var palContents = File.ReadAllText(_paletteFileName);

        _pal = PaletteJsonSerializer.ReadPalette(palContents, new ColorFactory());

        //var codecFileName = Path.Combine(Directory.GetCurrentDirectory(), "Resources", _genericCodecFileName);
        var serializer = new XmlGraphicsFormatReader(_codecSchemaFileName);
        var format     = serializer.LoadFromFile(_genericCodecFileName);

        _codec = new IndexedFlowGraphicsCodec((FlowGraphicsFormat)format.AsSuccess.Result);

        Setup(_genericFileName, "generic");
    }