Esempio n. 1
0
 /// <summary>
 /// Loads available skins into memory.
 /// </summary>
 /// <returns>Returns the number of loaded skins.</returns>
 public int LoadSkins()
 {
     int count = 0;
     SortedList skinlist = new SortedList();
     string defskinspath = Path.Combine(Program.StartupPath, "Skins");
     string userskinspath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"TibiaTek Plus\Skins");
     string[] defskins = Directory.GetDirectories(defskinspath);
     string[] userskins = new string[0];
     if (Directory.Exists(userskinspath))
         userskins = Directory.GetDirectories(userskinspath);
     foreach (string dir in defskins)
     {
         if (!skinlist.Contains(dir.Substring(defskinspath.Length + 1)))
             skinlist.Add(dir.Substring(defskinspath.Length + 1), Path.Combine(Program.StartupPath, @"Skins\" + dir.Substring(defskinspath.Length + 1)));
     }
     foreach (string dir in userskins)
     {
         if (!skinlist.Contains(dir.Substring(userskinspath.Length + 1)))
         skinlist.Add(dir.Substring(userskinspath.Length + 1), Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), @"TibiaTek Plus\Skins\" + dir.Substring(userskinspath.Length + 1)));
     }
     skins.Clear();
     foreach (DictionaryEntry skinentry in skinlist){
         try
         {
             Skin s = new Skin((string)skinentry.Key, (string)skinentry.Value);
             if (((string)skinentry.Key).Equals(Settings.Default.Skin))
             {
                 skin = s;
             }
             skins.Add(s);
             if (SkinLoaded != null)
                 SkinLoaded.Invoke(s);
             count++;
         } catch(Exception ex){
             MessageBox.Show(ex.Message, Language.Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     return count;
 }
Esempio n. 2
0
 static private void kernel_SkinLoaded(Skin skin)
 {
     if (splashScreenForm.Percent + skinstep <= 40)
     {
         splashScreenForm.Percent += skinstep;
     }
     else
     {
         splashScreenForm.Percent = 40;
     }
 }