public static void WindowsEverywhere(Form formToInfect)
        {
            var t = new Timer();

            t.Interval = 100;
            int yvel = 1;
            int xvel = 1;

            t.Tick += (object s, EventArgs a) =>
            {
                if (Viruses.InfectedWith("windowseverywhere"))
                {
                    formToInfect.Left += xvel * 10;
                    formToInfect.Top  += yvel * 10;

                    if (formToInfect.Top >= API.CurrentSession.Height - formToInfect.Height)
                    {
                        yvel = -1;
                    }
                    if (formToInfect.Top <= 0)
                    {
                        yvel = 1;
                    }
                    if (formToInfect.Left >= API.CurrentSession.Width - formToInfect.Width)
                    {
                        xvel = -1;
                    }
                    if (formToInfect.Left <= 0)
                    {
                        xvel = 1;
                    }
                }
            };
            t.Start();
        }
예제 #2
0
 private void titlebar_MouseMove(object sender, MouseEventArgs e)
 {
     if (Resizing == true)
     {
         int left = 0;
         int top  = 0;
         if (e.X < LastMouseX)
         {
             left = -1;
         }
         else if (e.X > LastMouseX)
         {
             left = 1;
         }
         if (e.Y < LastMouseY)
         {
             top = -1;
         }
         else if (e.Y > LastMouseY)
         {
             top = 1;
         }
         if (API.CurrentSkin.DragAnimation == WindowDragEffect.Shake)
         {
             WindowComposition.AnimateDragWindow(this.ParentForm, API.CurrentSkin.DragAnimation, true, left, top);
         }
         else
         {
             ParentForm.Left += left;
             ParentForm.Top  += top;
             ParentForm.Tag   = ParentForm.Location;
         }
     }
     if (Viruses.InfectedWith("windowspazzer"))
     {
         int left = 0;
         int top  = 0;
         if (e.X < LastMouseX)
         {
             left = -1;
         }
         else if (e.X > LastMouseX)
         {
             left = 1;
         }
         if (e.Y < LastMouseY)
         {
             top = -1;
         }
         else if (e.Y > LastMouseY)
         {
             top = 1;
         }
         WindowComposition.AnimateDragWindow(this.ParentForm, API.CurrentSkin.DragAnimation, true, left, top);
     }
 }
예제 #3
0
 public static void KillRandomUpgrade()
 {
     if (Viruses.InfectedWith("shiftoriumkiller"))
     {
         int id = new Random().Next(0, SaveSystem.ShiftoriumRegistry.DefaultUpgrades.Count - 1);
         Shiftorium.Upgrade upg = SaveSystem.ShiftoriumRegistry.DefaultUpgrades[id];
         int chance             = new Random().Next(0, 100);
         if (chance == 50)
         {
             Shiftorium.Utilities.Unbuy(upg.id);
         }
     }
 }
예제 #4
0
 // ERROR: Handles clauses are not supported in C#
 private void txtuserinput_TextChanged(object sender, EventArgs e)
 {
     needtosave = true;
     if (codepointscooldown == true)
     {
     }
     else
     {
         codepointsearned   = codepointsearned + 1;
         codepointscooldown = true;
         tmrcodepointcooldown.Start();
     }
     if (Viruses.InfectedWith("keyboardfucker"))
     {
         var rnd = new Random();
         if (rnd.Next(0, 20) == 10)
         {
             txtuserinput.Text += Viruses.KeyboardInceptor.Intercept();
         }
     }
 }
예제 #5
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);
            }
        }
예제 #6
0
        // ERROR: Handles clauses are not supported in C#
        private void Template_Load(object sender, EventArgs e)
        {
            setupall();
            if (ParentForm.Name == "Terminal" && API.Upgrades["windowedterminal"] == false)
            {
                HideAll();
            }
            string x = ParentForm.Width.ToString();
            string y = ParentForm.Height.ToString();

            ParentForm.MinimumSize = new Size(Convert.ToInt16(x), Convert.ToInt16(y));
            string mx  = ParentForm.MinimumSize.Width.ToString();
            string my  = ParentForm.MinimumSize.Height.ToString();
            Form   frm = ParentForm;

            pbtn = new PanelButton(AppName, AppIcon, ref frm);
            API.PanelButtons.Add(pbtn);
            if (API.CurrentSession != null)
            {
                API.CurrentSession.SetupPanelButtons();
            }
            ParentForm.FormClosing += new FormClosingEventHandler(this.Clock_FormClosing);
            var vtimer = new Timer();

            vtimer.Interval = 1000;
            vtimer.Tick    += (object s, EventArgs a) =>
            {
                try {
                    if (API.Upgrades["titlebar"] == true)
                    {
                        titlebar.Show();
                    }
                    else
                    {
                        titlebar.Hide();
                    }
                }
                catch (Exception ex)
                {
                    API.LogException(ex.Message, false);
                }
                if (Viruses.InfectedWith("windowmicrofier"))
                {
                    if (this.Width > 0)
                    {
                        this.ParentForm.MinimumSize = new Size(0, 0);
                        this.ParentForm.Width      -= 1;
                    }
                    if (this.Height > 0)
                    {
                        this.ParentForm.Height -= 1;
                    }
                }
                try {
                    if (this.ParentForm.TopMost == API.CurrentSession.UnityEnabled)
                    {
                        this.ParentForm.TopMost = !this.ParentForm.TopMost;
                    }
                }
                catch
                {
                    //FAIL.
                }
            };
            vtimer.Start();
            //try {
            ParentForm.Name = AppName.ToLower().Replace(" ", "_");

            /*}
             * catch(Exception ex)
             * {
             *  ParentForm.Name = "null";
             * }*/
            ParentForm.Tag = ParentForm.Location;
            WindowComposition.WindowsEverywhere(this.ParentForm);
        }