Ejemplo n.º 1
0
 private void SkinLoader_Load(object sender, EventArgs e)
 {
     PreviewSkin   = API.CurrentSkin;
     PreviewImages = API.CurrentSkinImages;
     LoadPreview();
     pnlskinpacks.Hide();
     pgcontents.Show();
 }
Ejemplo n.º 2
0
 private void ExtractSkin(string file)
 {
     if (Directory.Exists(Paths.ToBeLoaded))
     {
         Directory.Delete(Paths.ToBeLoaded, true);
     }
     API.ExtractFile(file, Paths.ToBeLoaded, false);
     PreviewSkin = JsonConvert.DeserializeObject <Skinning.Skin>(File.ReadAllText(Paths.ToBeLoaded + "data.json"));
     LoadImages();
 }
Ejemplo n.º 3
0
        private void btnapplyskin_Click(object sender, EventArgs e)
        {
            if (LoadedSkinFile != "fail")
            {
                try
                {
                    if (Viruses.InfectedWith("skininceptor"))
                    {
                        var rnd = new Random();
                        switch (rnd.Next(0, 10))
                        {
                        case 1:
                        case 3:
                        case 5:
                        case 7:
                        case 9:
                            //Load another random skin.
                            List <string> skinfiles = new List <string>();
                            ScanForSkinFiles(Paths.SaveRoot, ref skinfiles);
                            string fname = skinfiles[rnd.Next(0, skinfiles.Count - 1)];
                            Skinning.Utilities.loadsknfile(fname);
                            Skinning.Utilities.loadskin();
                            API.CurrentSession.SetupDesktop();
                            API.UpdateWindows();
                            break;

                        default:
                            File.Delete(LoadedSkinFile);
                            //Corrupting binary is fun.
                            API.CreateInfoboxSession("Skin Loader - Error", "It appears that the provided skin file is either corrupted or not supported by this version of ShiftOS.", infobox.InfoboxMode.Info);
                            Skinning.Utilities.loadedSkin        = new Skinning.Skin();
                            Skinning.Utilities.loadedskin_images = new Skinning.Images();
                            API.UpdateWindows();
                            break;
                        }
                    }
                    else
                    {
                        Skinning.Utilities.loadsknfile(LoadedSkinFile);
                        Skinning.Utilities.loadskin();
                        API.CurrentSession.SetupDesktop();
                        API.UpdateWindows();
                        PreviewSkin   = API.CurrentSkin;
                        PreviewImages = API.CurrentSkinImages;
                        SetupDesktop();
                        setupborders();
                        setuptitlebar();
                        setskin();
                    }
                }
                catch (Exception ex)
                {
                    if (API.DeveloperMode == false)
                    {
                        API.CreateInfoboxSession("Skin Loader - Error", "It appears that the provided skin file is either corrupted or not supported by this version of ShiftOS.", infobox.InfoboxMode.Info);
                    }
                    else
                    {
                        API.CreateInfoboxSession("Skin Loader - Error", ex.Message, infobox.InfoboxMode.Info);
                    }
                }
            }
            else
            {
                API.CreateInfoboxSession("Skin Loader - Error", "You have not selected a skin file to load! Try pressing \"Load Skin\" and selecting a .skn file.", infobox.InfoboxMode.Info);
            }
        }