示例#1
0
        public void Load(byte[] b)
        {
            Icons.Clear();

            // File-headers uitlezen
            if (conv_int(b, 0, 2) != 0)
            {
                throw new FileLoadException("Ongeldige header");
            }
            if (conv_int(b, 2, 2) != 1)
            {
                throw new FileLoadException("Dit is geen icon-bestand");
            }
            int count = conv_int(b, 4, 2);

            // Icon-headers uitlezen
            for (int i = 0; i < count; i++)
            {
                Subpictogram pic = new Subpictogram(b, i);
                Icons.Add(pic);
            }

            /*try
             * {
             * }
             * catch (Exception ex)
             * {
             * }*/
        }
    public bool Load()
    {
        {
            TIniFile IniFile = new TIniFile(IniFileName);
            FileName = IniFile.ReadString("General", "FileName", FileName);
            Glow     = IniFile.ReadBool("General", "Glow", Glow);
        };

        // - - -  - - -

        using (Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(TemplatesFileName))
            using (StreamReader reader = new StreamReader(stream))
            {
                TStrings text = new TStrings();
                text.Text = reader.ReadToEnd();
                text.SaveToFile("Templates.ini");

                TIniFile IniFile = new TIniFile("Templates.ini");
#if PCL
                await IniFile.LoadValues();
#else
                IniFile.LoadValues();
#endif

                TStrings Sections = IniFile.ReadSections();

                Icons.Clear();

                for (int s = 0; s < Sections.Count; s++)
                {
                    if (Sections[s].StartsWith("#"))
                    {
                        TStrings l = IniFile.ReadSectionValues(Sections[s]);

                        for (int i = 0; i < l.Count; i++)
                        {
                            var o = new Icon();
                            o.Section = Sections[s].Substring(1);
                            o.Name    = l.Names(i);

                            string st = l.ValueFromIndex(i);
                            o.Width  = int.Parse(st.Split(new char[] { 'x', 'X' })[0]);
                            o.Height = int.Parse(st.Split(new char[] { 'x', 'X', ',' })[1]);

                            if (st.Split(new char[] { 'x', 'X', ',' }).Length > 2)
                            {
                                o.Scale = int.Parse(st.Split(new char[] { 'x', 'X', ',' })[2]);
                            }
                            ;

                            Application.Current.Dispatcher.Invoke(new Action(() =>
                            {
                                Icons.Add(o);
                            }));
                        }
                        ;
                    }
                    ;
                }
                ;

                OnPropertyChanged("Icons");
            };

        return(true);
    }
示例#3
0
 public void ClearView()
 {
     Icons.Clear();
 }