コード例 #1
0
ファイル: Layout.cs プロジェクト: phacoxcll/VCNDSLayout
 public Cll.JSON.Value GetJSON()
 {
     Cll.JSON.Object jsonObj = new Cll.JSON.Object();
     jsonObj.AddMember("source", Source);
     jsonObj.AddMember("rotation", Rotation);
     jsonObj.AddMember("size", Size.Width.ToString() + " " + Size.Height.ToString());
     jsonObj.AddMember("target", Target);
     jsonObj.AddMember("position", Position.X.ToString() + " " + Position.Y.ToString());
     return(jsonObj);
 }
コード例 #2
0
ファイル: Layout.cs プロジェクト: phacoxcll/VCNDSLayout
 public Cll.JSON.Value GetJSON(int index)
 {
     Cll.JSON.Object jsonObj = new Cll.JSON.Object();
     jsonObj.AddMember("position", Position.X.ToString() + " " + Position.Y.ToString());
     jsonObj.AddMember("rotation", Rotation);
     jsonObj.AddMember("resource", "//content_dir/assets/textures/" + Target + index.ToString("00") + ".png");
     jsonObj.AddMember("target", Target);
     jsonObj.AddMember("size", Size.Width.ToString() + " " + Size.Height.ToString());
     return(jsonObj);
 }
コード例 #3
0
ファイル: Layout.cs プロジェクト: phacoxcll/VCNDSLayout
            public BackgroundStruct(Cll.JSON.Object background)
            {
                string[] size     = ((Cll.JSON.String)background.GetFirstValue("size")).Value.Split(new char[] { ' ' });
                string[] position = ((Cll.JSON.String)background.GetFirstValue("position")).Value.Split(new char[] { ' ' });

                Position = new Point(Convert.ToInt32(position[0]), Convert.ToInt32(position[1]));
                Rotation = Convert.ToInt32(((Cll.JSON.Number)background.GetFirstValue("rotation")).Value);
                Resource = ((Cll.JSON.String)background.GetFirstValue("resource")).Value;
                Target   = ((Cll.JSON.String)background.GetFirstValue("target")).Value;
                Size     = new Size(Convert.ToInt32(size[0]), Convert.ToInt32(size[1]));
            }
コード例 #4
0
ファイル: Layout.cs プロジェクト: phacoxcll/VCNDSLayout
            public ScreenStruct(Cll.JSON.Object screen)
            {
                string[] size     = ((Cll.JSON.String)screen.GetFirstValue("size")).Value.Split(new char[] { ' ' });
                string[] position = ((Cll.JSON.String)screen.GetFirstValue("position")).Value.Split(new char[] { ' ' });

                Source   = ((Cll.JSON.String)screen.GetFirstValue("source")).Value;
                Rotation = Convert.ToInt32(((Cll.JSON.Number)screen.GetFirstValue("rotation")).Value);
                Size     = new Size(Convert.ToInt32(size[0]), Convert.ToInt32(size[1]));
                Target   = ((Cll.JSON.String)screen.GetFirstValue("target")).Value;
                Position = new Point(Convert.ToInt32(position[0]), Convert.ToInt32(position[1]));
            }
コード例 #5
0
        public static Cll.JSON.Object InjectFolder(string inputPath, string outputPath)
        {
            string[] folders = Directory.GetDirectories(inputPath);
            string[] files   = Directory.GetFiles(inputPath);

            string validFolderName = ValidFilename(Path.GetFileName(inputPath));
            string output          = Path.Combine(outputPath, validFolderName);

            if (!Directory.Exists(output))
            {
                Directory.CreateDirectory(output);
            }

            NumericComparer numericComparer = new NumericComparer();

            Array.Sort(folders, numericComparer.Compare);
            Array.Sort(files, numericComparer.Compare);

            Cll.JSON.Object folderJSON = new Cll.JSON.Object();
            folderJSON.AddMember("name", ValidName(Path.GetFileName(inputPath)));
            folderJSON.AddMember("foldername", ValidName(validFolderName));

            Cll.JSON.Array foldersArray = new Cll.JSON.Array();
            foreach (string folder in folders)
            {
                foldersArray.AddValue(InjectFolder(folder, output));
            }

            Cll.JSON.Array filesArray = new Cll.JSON.Array();
            foreach (string file in files)
            {
                try
                {
                    Cll.JSON.Object fileJSON = InjectFile(file, output);
                    if (fileJSON.Count != 0)
                    {
                        filesArray.AddValue(fileJSON);
                    }
                }
                catch (Exception e)
                {
                    Cll.Log.WriteLine(e.ToString());
                }
            }

            folderJSON.AddMember("folders", foldersArray);
            folderJSON.AddMember("files", filesArray);

            return(folderJSON);
        }
コード例 #6
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);
                }
            }
        }
コード例 #7
0
 public BasicVideoInfo(Cll.JSON.Object streamInfo)
     : base(streamInfo)
 {
     if (streamInfo.Contains("profile"))
     {
         Profile = ((Cll.JSON.String)streamInfo.GetValue("profile")).Value;
     }
     else
     {
         Profile = "none";
     }
     Level = ((Cll.JSON.Number)streamInfo.GetValue("level")).Value;
     if (Level > 10.0)
     {
         Level /= 10.0;
     }
     Width  = Convert.ToInt32(((Cll.JSON.Number)streamInfo.GetValue("width")).Value);
     Height = Convert.ToInt32(((Cll.JSON.Number)streamInfo.GetValue("height")).Value);
 }
コード例 #8
0
ファイル: Layout.cs プロジェクト: phacoxcll/VCNDSLayout
        public Cll.JSON.Value GetJSON(int index)
        {
            Cll.JSON.Object jsonObj          = new Cll.JSON.Object();
            Cll.JSON.Array  arrayScreens     = new Cll.JSON.Array();
            Cll.JSON.Array  arrayBackgrounds = new Cll.JSON.Array();

            if (ScreenUpperTV.Size.Width > 0 && ScreenUpperTV.Size.Height > 0)
            {
                arrayScreens.AddValue(ScreenUpperTV.GetJSON());
            }
            if (ScreenLowerTV.Size.Width > 0 && ScreenLowerTV.Size.Height > 0)
            {
                arrayScreens.AddValue(ScreenLowerTV.GetJSON());
            }
            if (ScreenUpperGamePad.Size.Width > 0 && ScreenUpperGamePad.Size.Height > 0)
            {
                arrayScreens.AddValue(ScreenUpperGamePad.GetJSON());
            }
            if (ScreenLowerGamePad.Size.Width > 0 && ScreenLowerGamePad.Size.Height > 0)
            {
                arrayScreens.AddValue(ScreenLowerGamePad.GetJSON());
            }

            if (arrayScreens.Count == 0)
            {
                throw new Exception("There must be at least one screen.");
            }

            arrayBackgrounds.AddValue(BackgroundTV.GetJSON(index));
            arrayBackgrounds.AddValue(BackgroundGamePad.GetJSON(index));

            jsonObj.AddMember("pad_rotation", PadRotation);
            jsonObj.AddMember("drc_rotation", DRCRotation);
            jsonObj.AddMember("screen", arrayScreens);
            jsonObj.AddMember("name_string_id", NameID);
            jsonObj.AddMember("background", arrayBackgrounds);
            jsonObj.AddMember("buttons_rotation", ButtonsRotation);
            jsonObj.AddMember("desc_string_id", DescriptionID);

            return(jsonObj);
        }
コード例 #9
0
        public Cll.JSON.Value GetJSON()
        {
            Cll.JSON.Object jsonObj           = new Cll.JSON.Object();
            Cll.JSON.Object jsonConfiguration = new Cll.JSON.Object();
            Cll.JSON.Object jsonLayouts       = new Cll.JSON.Object();
            Cll.JSON.Array  arrayLayout       = new Cll.JSON.Array();
            Cll.JSON.Array  arrayGroups       = new Cll.JSON.Array();
            Cll.JSON.Object json3DRendering   = new Cll.JSON.Object();
            Cll.JSON.Object jsonDisplay       = new Cll.JSON.Object();
            Cll.JSON.Object jsonArguments     = new Cll.JSON.Object();

            for (int i = 0; i < Layouts.Length; i++)
            {
                arrayLayout.AddValue(Layouts[i].GetJSON(i + 1));
            }

            for (int i = 0; i < Groups.Length; i++)
            {
                arrayGroups.AddValue(Groups[i]);
            }

            jsonLayouts.AddMember("layout", arrayLayout);
            jsonLayouts.AddMember("groups", arrayGroups);
            json3DRendering.AddMember("Bilinear", Bilinear);
            json3DRendering.AddMember("RenderScale", RenderScale);
            jsonDisplay.AddMember("PixelArtUpscaler", PixelArtUpscaler);
            jsonDisplay.AddMember("Brightness", Brightness);
            jsonArguments.AddMember("fold_on_pause", FoldOnPause);
            jsonArguments.AddMember("fold_on_resume_fade_from_black_duration", FoldOnResumeFadeFromBlackDuration);
            jsonArguments.AddMember("fold_on_pause_timeout", FoldOnPauseTimeout);

            jsonConfiguration.AddMember("layouts", jsonLayouts);
            jsonConfiguration.AddMember("3DRendering", json3DRendering);
            jsonConfiguration.AddMember("Display", jsonDisplay);
            jsonConfiguration.AddMember("arguments", jsonArguments);

            jsonObj.AddMember("configuration", jsonConfiguration);

            return(jsonObj);
        }
コード例 #10
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);
        }
コード例 #11
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);
            }
        }
コード例 #12
0
        public Cll.JSON.Value GetExtended()
        {
            Cll.JSON.Object jsonObj       = (Cll.JSON.Object)GetJSON();
            Cll.JSON.Object Strings       = new Cll.JSON.Object();
            Cll.JSON.Object Default       = new Cll.JSON.Object();
            Cll.JSON.Object Deutsch       = new Cll.JSON.Object();
            Cll.JSON.Object EnglishUSA    = new Cll.JSON.Object();
            Cll.JSON.Object EnglishEUR    = new Cll.JSON.Object();
            Cll.JSON.Object FrenchUSA     = new Cll.JSON.Object();
            Cll.JSON.Object FrenchEUR     = new Cll.JSON.Object();
            Cll.JSON.Object Italian       = new Cll.JSON.Object();
            Cll.JSON.Object Japanese      = new Cll.JSON.Object();
            Cll.JSON.Object Nederlands    = new Cll.JSON.Object();
            Cll.JSON.Object PortugueseUSA = new Cll.JSON.Object();
            Cll.JSON.Object PortugueseEUR = new Cll.JSON.Object();
            Cll.JSON.Object Russian       = new Cll.JSON.Object();
            Cll.JSON.Object SpanishUSA    = new Cll.JSON.Object();
            Cll.JSON.Object SpanishEUR    = new Cll.JSON.Object();

            foreach (Layout layout in Layouts)
            {
                Default.AddMember(layout.NameID, layout.Name.Default != null ? layout.Name.Default : "");
                Default.AddMember(layout.DescriptionID, layout.Description.Default != null ? layout.Description.Default : "");
                Deutsch.AddMember(layout.NameID, layout.Name.Deutsch != null ? layout.Name.Deutsch : "");
                Deutsch.AddMember(layout.DescriptionID, layout.Description.Deutsch != null ? layout.Description.Deutsch : "");
                EnglishUSA.AddMember(layout.NameID, layout.Name.EnglishUSA != null ? layout.Name.EnglishUSA : "");
                EnglishUSA.AddMember(layout.DescriptionID, layout.Description.EnglishUSA != null ? layout.Description.EnglishUSA : "");
                EnglishEUR.AddMember(layout.NameID, layout.Name.EnglishEUR != null ? layout.Name.EnglishEUR : "");
                EnglishEUR.AddMember(layout.DescriptionID, layout.Description.EnglishEUR != null ? layout.Description.EnglishEUR : "");
                FrenchUSA.AddMember(layout.NameID, layout.Name.FrenchUSA != null ? layout.Name.FrenchUSA : "");
                FrenchUSA.AddMember(layout.DescriptionID, layout.Description.FrenchUSA != null ? layout.Description.FrenchUSA : "");
                FrenchEUR.AddMember(layout.NameID, layout.Name.FrenchEUR != null ? layout.Name.FrenchEUR : "");
                FrenchEUR.AddMember(layout.DescriptionID, layout.Description.FrenchEUR != null ? layout.Description.FrenchEUR : "");
                Italian.AddMember(layout.NameID, layout.Name.Italian != null ? layout.Name.Italian : "");
                Italian.AddMember(layout.DescriptionID, layout.Description.Italian != null ? layout.Description.Italian : "");
                Japanese.AddMember(layout.NameID, layout.Name.Japanese != null ? layout.Name.Japanese : "");
                Japanese.AddMember(layout.DescriptionID, layout.Description.Japanese != null ? layout.Description.Japanese : "");
                Nederlands.AddMember(layout.NameID, layout.Name.Nederlands != null ? layout.Name.Nederlands : "");
                Nederlands.AddMember(layout.DescriptionID, layout.Description.Nederlands != null ? layout.Description.Nederlands : "");
                PortugueseUSA.AddMember(layout.NameID, layout.Name.PortugueseUSA != null ? layout.Name.PortugueseUSA : "");
                PortugueseUSA.AddMember(layout.DescriptionID, layout.Description.PortugueseUSA != null ? layout.Description.PortugueseUSA : "");
                PortugueseEUR.AddMember(layout.NameID, layout.Name.PortugueseEUR != null ? layout.Name.PortugueseEUR : "");
                PortugueseEUR.AddMember(layout.DescriptionID, layout.Description.PortugueseEUR != null ? layout.Description.PortugueseEUR : "");
                Russian.AddMember(layout.NameID, layout.Name.Russian != null ? layout.Name.Russian : "");
                Russian.AddMember(layout.DescriptionID, layout.Description.Russian != null ? layout.Description.Russian : "");
                SpanishUSA.AddMember(layout.NameID, layout.Name.SpanishUSA != null ? layout.Name.SpanishUSA : "");
                SpanishUSA.AddMember(layout.DescriptionID, layout.Description.SpanishUSA != null ? layout.Description.SpanishUSA : "");
                SpanishEUR.AddMember(layout.NameID, layout.Name.SpanishEUR != null ? layout.Name.SpanishEUR : "");
                SpanishEUR.AddMember(layout.DescriptionID, layout.Description.SpanishEUR != null ? layout.Description.SpanishEUR : "");
            }

            Strings.AddMember("Default", Default);
            Strings.AddMember("Deutsch", Deutsch);
            Strings.AddMember("EnglishUSA", EnglishUSA);
            Strings.AddMember("EnglishEUR", EnglishEUR);
            Strings.AddMember("FrenchUSA", FrenchUSA);
            Strings.AddMember("FrenchEUR", FrenchEUR);
            Strings.AddMember("Italian", Italian);
            Strings.AddMember("Japanese", Japanese);
            Strings.AddMember("Nederlands", Nederlands);
            Strings.AddMember("PortugueseUSA", PortugueseUSA);
            Strings.AddMember("PortugueseEUR", PortugueseEUR);
            Strings.AddMember("Russian", Russian);
            Strings.AddMember("SpanishUSA", SpanishUSA);
            Strings.AddMember("SpanishEUR", SpanishEUR);

            jsonObj.AddMember("strings", Strings);

            return(jsonObj);
        }
コード例 #13
0
        private static Cll.JSON.Object InjectFile(string inputFile, string outputPath)
        {
            string extension = Path.GetExtension(inputFile);

            Cll.JSON.Object fileJSON = new Cll.JSON.Object();

            if (extension == ".3gp" ||
                extension == ".avi" ||
                extension == ".flv" ||
                extension == ".m4v" ||
                extension == ".mkv" ||
                extension == ".mov" ||
                extension == ".mp4" ||
                extension == ".mpeg" ||
                extension == ".mpg" ||
                extension == ".ogv" ||
                extension == ".rm" ||
                extension == ".webm" ||
                extension == ".aac" ||
                extension == ".mp3" ||
                extension == ".m4a" ||
                extension == ".oga" ||
                extension == ".ogg" ||
                extension == ".wav" ||
                extension == ".wma")
            {
                Converter.EncoderResult result = Converter.Encoder(inputFile, outputPath);
                for (int i = 0; i < result.Name.Length; i++)
                {
                    fileJSON.AddMember("name", ValidName(result.Name[i]));
                    fileJSON.AddMember("filename", ValidName(ValidFilename(result.Name[i])));
                    fileJSON.AddMember("ext", result.Extension);
                    if (result.Extension == ".mp4")
                    {
                        fileJSON.AddMember("width", result.VideoInfo.Width);
                        fileJSON.AddMember("height", result.VideoInfo.Height);
                    }
                    else
                    {
                        fileJSON.AddMember("width", 0);
                        fileJSON.AddMember("height", 0);
                    }
                }
                Cll.Log.WriteLine("\"" + inputFile + "\" OK!");
            }
            else if (extension == ".jpg" ||
                     extension == ".png" ||
                     extension == ".bmp" ||
                     extension == ".gif")
            {
                string validFileName = ValidFilename(Path.GetFileNameWithoutExtension(inputFile));
                File.Copy(inputFile, Path.Combine(outputPath, validFileName + extension));
                fileJSON.AddMember("name", ValidName(Path.GetFileNameWithoutExtension(inputFile)));
                fileJSON.AddMember("filename", ValidName(validFileName));
                fileJSON.AddMember("ext", extension);
                Bitmap img = new Bitmap(inputFile);
                fileJSON.AddMember("width", img.Width);
                fileJSON.AddMember("height", img.Height);
                img.Dispose();
                Cll.Log.WriteLine("\"" + inputFile + "\" OK!");
            }
            else
            {
                Cll.Log.WriteLine("\"" + inputFile + "\" file is not supported.");
            }

            return(fileJSON);
        }
コード例 #14
0
        protected void InjectMultimedia(string outputPath)
        {
            XmlWriterSettings xmlSettings = new XmlWriterSettings
            {
                Encoding        = new UTF8Encoding(false),
                Indent          = true,
                IndentChars     = "  ",
                NewLineChars    = "\n",
                NewLineHandling = NewLineHandling.Replace
            };

            XmlDocument xmlConfig = new XmlDocument();

            xmlConfig.Load(Path.Combine(outputPath, "config.xml"));

            XmlNodeList nodes   = xmlConfig.LastChild.ChildNodes;
            XmlNodeList options = null;

            for (int i = 0; i < nodes.Count; i++)
            {
                if (nodes.Item(i).Name == "nwf:options")
                {
                    options = nodes.Item(i).ChildNodes;
                    break;
                }
            }

            XmlNode supportedWiiRemotes = null;
            XmlNode touchScrollingTV    = null;
            XmlNode touchScrollingGP    = null;

            if (options != null)
            {
                for (int i = 0; i < options.Count; i++)
                {
                    if (options.Item(i).Name == "nwf:supportedWiiRemotes")
                    {
                        supportedWiiRemotes = options.Item(i);
                        break;
                    }
                }

                if (supportedWiiRemotes != null)
                {
                    supportedWiiRemotes.InnerText = "1";
                }

                for (int i = 0; i < options.Count; i++)
                {
                    if (options.Item(i).Name == "nwf:touchScrolling" &&
                        options.Item(i).Attributes.GetNamedItem("nwf:display").Value == "tv")
                    {
                        touchScrollingTV = options.Item(i);
                        break;
                    }
                }

                if (touchScrollingTV != null)
                {
                    touchScrollingTV.ChildNodes.Item(1).Attributes.GetNamedItem("value").Value = "true";
                }

                for (int i = 0; i < options.Count; i++)
                {
                    if (options.Item(i).Name == "nwf:touchScrolling" &&
                        options.Item(i).Attributes.GetNamedItem("nwf:display").Value == "gp")
                    {
                        touchScrollingGP = options.Item(i);
                        break;
                    }
                }

                if (touchScrollingGP != null)
                {
                    touchScrollingGP.ChildNodes.Item(1).Attributes.GetNamedItem("value").Value = "true";
                }
            }

            XmlNode widget_content            = xmlConfig.LastChild.LastChild;
            XmlAttributeCollection attributes = widget_content.Attributes;
            XmlNode src = attributes.GetNamedItem("src");

            src.InnerText = "/index.html";
            XmlWriter config = XmlWriter.Create(Path.Combine(outputPath, "config.xml"), xmlSettings);

            xmlConfig.Save(config);
            config.Close();

            Cll.JSON.Object json = InjectFolder(MultimediaPath, outputPath);

            Resources.folder.Save(Path.Combine(outputPath, "folder.png"), ImageFormat.Png);
            Resources.audio.Save(Path.Combine(outputPath, "audio.png"), ImageFormat.Png);
            Resources.image.Save(Path.Combine(outputPath, "image.png"), ImageFormat.Png);
            Resources.video.Save(Path.Combine(outputPath, "video.png"), ImageFormat.Png);
            Resources.random_audio.Save(Path.Combine(outputPath, "random_audio.png"), ImageFormat.Png);
            Resources.random_audio_blue.Save(Path.Combine(outputPath, "random_audio_blue.png"), ImageFormat.Png);
            Resources.back.Save(Path.Combine(outputPath, "back.png"), ImageFormat.Png);
            Resources.border.Save(Path.Combine(outputPath, "border.png"), ImageFormat.Png);
            Resources.next_audio.Save(Path.Combine(outputPath, "next_audio.png"), ImageFormat.Png);
            Resources.pause_audio.Save(Path.Combine(outputPath, "pause_audio.png"), ImageFormat.Png);
            Resources.play_audio.Save(Path.Combine(outputPath, "play_audio.png"), ImageFormat.Png);

            StreamWriter sw = File.CreateText(Path.Combine(outputPath, "index.html"));

            sw.Write(Resources.index);
            sw.Close();
            sw = File.CreateText(Path.Combine(outputPath, "wumplayer_style_1920.css"));
            sw.Write(Resources.wumplayer_style_1920);
            sw.Close();
            sw = File.CreateText(Path.Combine(outputPath, "wumplayer_style_1280.css"));
            sw.Write(Resources.wumplayer_style_1280);
            sw.Close();
            sw = File.CreateText(Path.Combine(outputPath, "wumplayer_style_854.css"));
            sw.Write(Resources.wumplayer_style_854);
            sw.Close();
            sw = File.CreateText(Path.Combine(outputPath, "wumplayer_style_640.css"));
            sw.Write(Resources.wumplayer_style_640);
            sw.Close();
            sw = File.CreateText(Path.Combine(outputPath, "wumplayer.js"));
            sw.Write(Resources.wumplayer);
            sw.Close();
            sw = File.CreateText(Path.Combine(outputPath, "wumplayer_fs.js"));
            sw.Write("var fs = '");
            sw.Write(json.ToString());
            sw.Write("';");
            sw.Close();
        }
コード例 #15
0
 public BasicMediaInfo(Cll.JSON.Object streamInfo)
 {
     if (streamInfo.Contains("codec_name"))
     {
         CodecName = ((Cll.JSON.String)streamInfo.GetValue("codec_name")).Value;
     }
     else
     {
         CodecName = "";
     }
     if (streamInfo.Contains("codec_type"))
     {
         CodecType = ((Cll.JSON.String)streamInfo.GetValue("codec_type")).Value;
     }
     else
     {
         CodecType = "";
     }
     if (streamInfo.Contains("bit_rate"))
     {
         Bitrate = Convert.ToInt32(((Cll.JSON.String)streamInfo.GetValue("bit_rate")).Value);
     }
     else
     {
         Bitrate = 0;
     }
     if (streamInfo.Contains("r_frame_rate"))
     {
         string   frameRate = ((Cll.JSON.String)streamInfo.GetValue("r_frame_rate")).Value;
         string[] a         = frameRate.Split(new char[] { '/' });
         if (a[1] != "0")
         {
             FrameRate = Convert.ToDouble(a[0]) / Convert.ToDouble(a[1]);
         }
         else
         {
             FrameRate = Double.NaN;
         }
     }
     else
     {
         FrameRate = Double.NaN;
     }
     if (streamInfo.Contains("duration"))
     {
         Duration = Convert.ToDouble(((Cll.JSON.String)streamInfo.GetValue("duration")).Value);
     }
     else
     {
         Duration = 0;
     }
     if (streamInfo.Contains("tags") && ((Cll.JSON.Object)streamInfo.GetValue("tags")).Contains("title"))
     {
         Title = ((Cll.JSON.String)streamInfo.GetValue("tags").GetValue("title")).Value;
     }
     else
     {
         Title = "";
     }
     if (streamInfo.Contains("tags") && ((Cll.JSON.Object)streamInfo.GetValue("tags")).Contains("language"))
     {
         Language = ((Cll.JSON.String)streamInfo.GetValue("tags").GetValue("language")).Value;
     }
     else
     {
         Language = "";
     }
 }
コード例 #16
0
 public BasicAudioInfo(Cll.JSON.Object streamInfo)
     : base(streamInfo)
 {
     Channels   = Convert.ToInt32(((Cll.JSON.Number)streamInfo.GetValue("channels")).Value);
     SampleRate = Convert.ToInt32(((Cll.JSON.String)streamInfo.GetValue("sample_rate")).Value);
 }
コード例 #17
0
 public BasicSubtitleInfo(Cll.JSON.Object streamInfo)
     : base(streamInfo)
 {
 }
コード例 #18
0
ファイル: Layout.cs プロジェクト: phacoxcll/VCNDSLayout
        public Layout(Cll.JSON.Object layout)
        {
            Cll.JSON.Array screen     = (Cll.JSON.Array)layout.GetValue("screen");
            Cll.JSON.Array background = (Cll.JSON.Array)layout.GetValue("background");

            if (screen.Count < 1 || screen.Count > 4)
            {
                throw new Exception("Screens count must be greater than 0 and less than 5.");
            }

            if (background.Count != 2)
            {
                throw new Exception("Backgrounds count must be equal to 2.");
            }

            ScreenStruct[]     screens     = new ScreenStruct[screen.Count];
            BackgroundStruct[] backgrounds = new BackgroundStruct[background.Count];

            for (int i = 0; i < screens.Length; i++)
            {
                screens[i] = new ScreenStruct((Cll.JSON.Object)screen.GetValue(i));
            }

            if (screens[0].Source == "upper" && screens[0].Target == "tv")
            {
                ScreenUpperTV = screens[0];
            }
            else if (screens.Length > 1 && screens[1].Source == "upper" && screens[1].Target == "tv")
            {
                ScreenUpperTV = screens[1];
            }
            else if (screens.Length > 2 && screens[2].Source == "upper" && screens[2].Target == "tv")
            {
                ScreenUpperTV = screens[2];
            }
            else if (screens.Length > 3 && screens[3].Source == "upper" && screens[3].Target == "tv")
            {
                ScreenUpperTV = screens[3];
            }
            else
            {
                ScreenUpperTV = new ScreenStruct("upper", "tv", 0, 0, 0, 0);
            }

            if (screens[0].Source == "lower" && screens[0].Target == "tv")
            {
                ScreenLowerTV = screens[0];
            }
            else if (screens.Length > 1 && screens[1].Source == "lower" && screens[1].Target == "tv")
            {
                ScreenLowerTV = screens[1];
            }
            else if (screens.Length > 2 && screens[2].Source == "lower" && screens[2].Target == "tv")
            {
                ScreenLowerTV = screens[2];
            }
            else if (screens.Length > 3 && screens[3].Source == "lower" && screens[3].Target == "tv")
            {
                ScreenLowerTV = screens[3];
            }
            else
            {
                ScreenLowerTV = new ScreenStruct("lower", "tv", 0, 0, 0, 0);
            }

            if (screens[0].Source == "upper" && screens[0].Target == "drc")
            {
                ScreenUpperGamePad = screens[0];
            }
            else if (screens.Length > 1 && screens[1].Source == "upper" && screens[1].Target == "drc")
            {
                ScreenUpperGamePad = screens[1];
            }
            else if (screens.Length > 2 && screens[2].Source == "upper" && screens[2].Target == "drc")
            {
                ScreenUpperGamePad = screens[2];
            }
            else if (screens.Length > 3 && screens[3].Source == "upper" && screens[3].Target == "drc")
            {
                ScreenUpperGamePad = screens[3];
            }
            else
            {
                ScreenUpperGamePad = new ScreenStruct("upper", "drc", 0, 0, 0, 0);
            }

            if (screens[0].Source == "lower" && screens[0].Target == "drc")
            {
                ScreenLowerGamePad = screens[0];
            }
            else if (screens.Length > 1 && screens[1].Source == "lower" && screens[1].Target == "drc")
            {
                ScreenLowerGamePad = screens[1];
            }
            else if (screens.Length > 2 && screens[2].Source == "lower" && screens[2].Target == "drc")
            {
                ScreenLowerGamePad = screens[2];
            }
            else if (screens.Length > 3 && screens[3].Source == "lower" && screens[3].Target == "drc")
            {
                ScreenLowerGamePad = screens[3];
            }
            else
            {
                ScreenLowerGamePad = new ScreenStruct("lower", "drc", 0, 0, 0, 0);
            }

            backgrounds[0] = new BackgroundStruct((Cll.JSON.Object)background.GetValue(0));
            backgrounds[1] = new BackgroundStruct((Cll.JSON.Object)background.GetValue(1));

            if (backgrounds[0].Target == "tv")
            {
                BackgroundTV = backgrounds[0];
            }
            else if (backgrounds[1].Target == "tv")
            {
                BackgroundTV = backgrounds[1];
            }
            else
            {
                BackgroundTV = new BackgroundStruct("tv");
            }

            if (backgrounds[0].Target == "drc")
            {
                BackgroundGamePad = backgrounds[0];
            }
            else if (backgrounds[1].Target == "drc")
            {
                BackgroundGamePad = backgrounds[1];
            }
            else
            {
                BackgroundGamePad = new BackgroundStruct("drc");
            }

            if (layout.Contains("pad_rotation"))
            {
                PadRotation = Convert.ToInt32(((Cll.JSON.Number)layout.GetValue("pad_rotation")).Value);
            }
            else
            {
                PadRotation = 0;
            }
            if (layout.Contains("drc_rotation"))
            {
                DRCRotation = Convert.ToInt32(((Cll.JSON.Number)layout.GetValue("drc_rotation")).Value);
            }
            else
            {
                DRCRotation = 0;
            }
            if (layout.Contains("buttons_rotation"))
            {
                ButtonsRotation = Convert.ToInt32(((Cll.JSON.Number)layout.GetValue("buttons_rotation")).Value);
            }
            else
            {
                ButtonsRotation = 0;
            }

            if (layout.Contains("name_string_id"))
            {
                NameID = ((Cll.JSON.String)layout.GetValue("name_string_id")).Value;
            }
            else
            {
                NameID = "";
            }
            if (layout.Contains("desc_string_id"))
            {
                DescriptionID = ((Cll.JSON.String)layout.GetValue("desc_string_id")).Value;
            }
            else
            {
                DescriptionID = "";
            }

            Name        = StringLanguages.Empty;
            Description = StringLanguages.Empty;
        }