Ejemplo n.º 1
0
 public static void SaveFile(String p_FilePath, ByteBuffe p_Buffe)
 {
     if (!String.IsNullOrEmpty(p_FilePath) && p_Buffe.Count > 0)
     {
         IsolatedStorageManager.CreateImageFile(p_FilePath, p_Buffe.ToArrary());
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 载入xml 数据
        /// </summary>
        /// <param name="p_Xml">xml</param>
        /// <returns></returns>
        private static Dictionary <Language, LanguageInfo> GetInfoByFile(XDocument p_Xml)
        {
            Dictionary <Language, LanguageInfo> list = new Dictionary <Language, LanguageInfo>();
            List <XElement> elements = p_Xml.Root.Elements("Language").ToList();

            for (var i = 0; i < elements.Count; i++)
            {
                LanguageInfo model = new LanguageInfo();

                model.Name  = elements[i].Attribute("Name").Value;
                model.Text  = elements[i].Attribute("Text").Value;
                model.Voice = ByteBuffe.FromString(elements[i].Attribute("Voice").Value);

                if (model.IsVaild)
                {
                    if (String.Equals("Chinese", model.Name))
                    {
                        list.Add(Language.Chinese, model);
                    }
                    else if (String.Equals("English", model.Name))
                    {
                        list.Add(Language.Enlish, model);
                    }
                }
            }
            return(list);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Load Picture
        /// </summary>
        /// <param name="p_Xml">xml data</param>
        /// <returns></returns>
        private static ByteBuffe LoadPicture(XDocument p_Xml)
        {
            List <XElement> elements = p_Xml.Root.Elements("Picture").ToList();

            if (null != elements && elements.Count > 0)
            {
                return(ByteBuffe.FromString(elements[0].Attribute("Value").Value));
            }
            return(new ByteBuffe());
        }
Ejemplo n.º 4
0
        public static ByteBuffe GetPicture(String p_PictureName)
        {
            Picture pic = ml.Pictures.FirstOrDefault <Picture>(
                (obj) => {
                return(String.Equals(obj.Name, p_PictureName));
            });

            if (null != pic)
            {
                return(ByteBuffe.FromStream(pic.GetImage()));
            }
            return(new ByteBuffe());
        }