Exemplo n.º 1
0
        public BasicMediaFormatInfo(string filename)
        {
            string mediaInfo = Converter.GetMediaInfo(filename);

            Cll.JSON.Element info   = Cll.JSON.SyntacticAnalyzer.Read(mediaInfo);
            Cll.JSON.Object  format = (Cll.JSON.Object)info.Value.GetValue("format");

            FileName = ((Cll.JSON.String)format.GetValue("filename")).Value;
            Size     = Convert.ToInt64(((Cll.JSON.String)format.GetValue("size")).Value);
            Format   = ((Cll.JSON.String)format.GetValue("format_name")).Value;
            Duration = Convert.ToDouble(((Cll.JSON.String)format.GetValue("duration")).Value);
            Bitrate  = Convert.ToInt32(((Cll.JSON.String)format.GetValue("bit_rate")).Value);

            if (format.Contains("tags") && ((Cll.JSON.Object)format.GetValue("tags")).Contains("title"))
            {
                Title = ((Cll.JSON.String)format.GetValue("tags").GetValue("title")).Value;
            }
            else
            {
                Title = "";
            }

            int numStreams = Convert.ToInt32(((Cll.JSON.Number)info.Value.GetValue("format").GetValue("nb_streams")).Value);

            MediaInfo = new BasicMediaInfo[numStreams];

            for (int i = 0; i < MediaInfo.Length; i++)
            {
                Cll.JSON.Object streamInfo = (Cll.JSON.Object)info.Value.GetValue("streams").GetValue(i);
                string          codecType  = ((Cll.JSON.String)streamInfo.GetValue("codec_type")).Value;
                if (codecType == "video")
                {
                    MediaInfo[i] = new BasicVideoInfo(streamInfo);
                }
                else if (codecType == "audio")
                {
                    MediaInfo[i] = new BasicAudioInfo(streamInfo);
                }
                else if (codecType == "subtitle")
                {
                    MediaInfo[i] = new BasicSubtitleInfo(streamInfo);
                }
                else
                {
                    MediaInfo[i] = new BasicMediaInfo(streamInfo);
                }
            }
        }
Exemplo n.º 2
0
        private bool InjectGameLayout()
        {
            StreamReader sr = null;

            try
            {
                sr = File.OpenText(Path.Combine(BasePath, "content", "0010", "configuration_cafe.json"));
                Cll.JSON.SyntacticAnalyzer syn  = new Cll.JSON.SyntacticAnalyzer(sr);
                Cll.JSON.Element           json = syn.Run();
                sr.Close();

                Cll.JSON.Object config = (Cll.JSON.Object)json.Value.GetValue("configuration");

                if (DarkFilter)
                {
                    config.GetValue("Display").SetValue("Brightness", new Cll.JSON.Number(80));
                }
                else
                {
                    config.GetValue("Display").SetValue("Brightness", new Cll.JSON.Number(100));
                }

                string text = json.ToString("");
                File.WriteAllText(Path.Combine(BasePath, "content", "0010", "configuration_cafe.json"), text);

                return(true);
            }
            catch { }
            finally { if (sr != null)
                      {
                          sr.Close();
                      }
            }

            return(false);
        }
Exemplo n.º 3
0
        public Configuration(Cll.JSON.Element json)
        {
            Cll.JSON.Object config = (Cll.JSON.Object)json.Value.GetValue("configuration");
            Cll.JSON.Array  layout = (Cll.JSON.Array)config.GetValue("layouts").GetValue("layout");
            Cll.JSON.Array  groups = (Cll.JSON.Array)config.GetValue("layouts").GetValue("groups");

            Layouts          = new Layout[layout.Count];
            Groups           = new int[groups.Count];
            Bilinear         = Convert.ToInt32(((Cll.JSON.Number)config.GetValue("3DRendering").GetValue("Bilinear")).Value);
            RenderScale      = Convert.ToInt32(((Cll.JSON.Number)config.GetValue("3DRendering").GetValue("RenderScale")).Value);
            PixelArtUpscaler = Convert.ToInt32(((Cll.JSON.Number)config.GetValue("Display").GetValue("PixelArtUpscaler")).Value);
            Brightness       = Convert.ToInt32(((Cll.JSON.Number)config.GetValue("Display").GetValue("Brightness")).Value);

            if (config.Contains("arguments"))
            {
                FoldOnPause = ((Cll.JSON.Boolean)config.GetValue("arguments").GetValue("fold_on_pause")).Value;
                FoldOnResumeFadeFromBlackDuration = Convert.ToInt32(((Cll.JSON.Number)config.GetValue("arguments").GetValue("fold_on_resume_fade_from_black_duration")).Value);
                FoldOnPauseTimeout = Convert.ToInt32(((Cll.JSON.Number)config.GetValue("arguments").GetValue("fold_on_pause_timeout")).Value);
            }
            else
            {
                FoldOnPause = false;
                FoldOnResumeFadeFromBlackDuration = 1000;
                FoldOnPauseTimeout = 3000;
            }

            for (int i = 0; i < Layouts.Length; i++)
            {
                Layouts[i] = new Layout((Cll.JSON.Object)layout.GetValue(i));
            }

            for (int i = 0; i < Groups.Length; i++)
            {
                Groups[i] = Convert.ToInt32(((Cll.JSON.Number)groups.GetValue(i)).Value);
            }
        }