Skip to content
This repository was archived by the owner on May 8, 2025. It is now read-only.

Commit 5c42de1

Browse files
committed
pushing visual studio application source to github
1 parent d96c7df commit 5c42de1

File tree

1,132 files changed

+1662174
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,132 files changed

+1662174
-0
lines changed

ProfileSwitcher.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.3.32929.385
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProfileSwitcher", "ProfileSwitcher\ProfileSwitcher.csproj", "{0D7304C7-D732-47C1-895E-6CEF7410B0F9}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{0D7304C7-D732-47C1-895E-6CEF7410B0F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{0D7304C7-D732-47C1-895E-6CEF7410B0F9}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{0D7304C7-D732-47C1-895E-6CEF7410B0F9}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{0D7304C7-D732-47C1-895E-6CEF7410B0F9}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {1B9F6C09-BB5D-41AD-A5E1-99EBE47241A1}
24+
EndGlobalSection
25+
EndGlobal

ProfileSwitcher/App.config

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
5+
</startup>
6+
<PropertyGroup>
7+
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
8+
<PublishSingleFile>true</PublishSingleFile>
9+
</PropertyGroup>
10+
</configuration>

ProfileSwitcher/Form1.Designer.cs

Lines changed: 101 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ProfileSwitcher/Form1.cs

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Drawing;
4+
using System.Runtime.InteropServices;
5+
using System.Windows.Forms;
6+
7+
using ProfileSwitcher.Utilities;
8+
9+
namespace ProfileSwitcher
10+
{
11+
public partial class Form1 : Form
12+
{
13+
public Form1()
14+
{
15+
InitializeComponent();
16+
Button1_Click(null, null);
17+
}
18+
19+
private void Button1_Click(object sender, EventArgs e)
20+
{
21+
Panel.Controls.Clear();
22+
23+
List<Button> Buttons = new List<Button>();
24+
foreach (string ProfileID in Functions.OperaGX.GetProfiles(false, true))
25+
{
26+
Image ProfileIconData;
27+
ProfileIconData = Functions.OperaGX.GetProfileIcon(ProfileID);
28+
Bitmap ProfileIcon = new Bitmap(ProfileIconData, new Size(16, 16));
29+
string ProfileName = Functions.OperaGX.GetProfileName(ProfileID);
30+
31+
Button Button = new Button
32+
{
33+
Size = new Size((ProfileName.Length * 10) + ProfileIcon.Width * 2, 30),
34+
Image = ProfileIcon,
35+
ImageAlign = ContentAlignment.MiddleLeft,
36+
FlatStyle = FlatStyle.Flat,
37+
ForeColor = Color.White,
38+
BackColor = Color.FromArgb(29, 29, 29),
39+
Tag = ProfileID, // use for later
40+
Font = new Font("Segoe UI", 11.25F), // segoe ui comes with every windows 7+ i think so im gonna use that just incase (correct me if im wrong)
41+
Text = ProfileName,
42+
TextAlign = ContentAlignment.MiddleRight
43+
};
44+
45+
if (Functions.OperaGX.GetCurrentStatus().Equals(ProfileID))
46+
{
47+
Button.FlatAppearance.BorderSize = 1;
48+
Button.FlatAppearance.BorderColor = Color.White;
49+
}
50+
else
51+
{
52+
Button.FlatAppearance.BorderSize = 0;
53+
}
54+
55+
Button.Click += delegate
56+
{
57+
Functions.OperaGX.SetDefaultProfile(ProfileID);
58+
foreach (Button Button2 in Buttons)
59+
{
60+
if (Functions.OperaGX.GetCurrentStatus().Equals(Button2.Tag)) // here is the "use for later"
61+
{
62+
Button2.FlatAppearance.BorderSize = 1;
63+
Button2.FlatAppearance.BorderColor = Color.White;
64+
}
65+
else
66+
{
67+
Button2.FlatAppearance.BorderSize = 0;
68+
}
69+
}
70+
};
71+
72+
Buttons.Add(Button); // add em to an array so we can loop through em later
73+
}
74+
75+
76+
foreach (Button Button in Buttons)
77+
{
78+
Panel.Controls.Add(Button); // this is the later
79+
/*
80+
* as you can tell i suck at writing docs or anything like that
81+
* i don't really know, this is just a program that i wrote
82+
*/
83+
}
84+
}
85+
private void Button1_Click_1(object sender, EventArgs e)
86+
{
87+
Application.Exit();
88+
}
89+
90+
// the code below has probably been pasted millions of times
91+
public const int WM_NCLBUTTONDOWN = 0xA1;
92+
public const int HT_CAPTION = 0x2;
93+
94+
[DllImport("user32.dll")]
95+
public static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
96+
[DllImport("user32.dll")]
97+
public static extern bool ReleaseCapture();
98+
99+
private void Panel1_MouseMove(object sender, MouseEventArgs e)
100+
{
101+
if (e.Button == MouseButtons.Left)
102+
{
103+
ReleaseCapture();
104+
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
105+
}
106+
}
107+
}
108+
}

0 commit comments

Comments
 (0)