Skip to content

Commit 9543c5a

Browse files
committed
Initial draft.
1 parent 4ccf491 commit 9543c5a

Some content is hidden

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

44 files changed

+4918
-3
lines changed

LICENSE renamed to LICENSE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
MIT License
21

3-
Copyright (c) 2019 Axel Kesseler
2+
# MIT License
3+
4+
Copyright (c) 2019 plexdata.de
45

56
Permission is hereby granted, free of charge, to any person obtaining a copy
67
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1+
12
# EnvironmentManager
2-
Managing tool for Windows environment variables.
3+
4+
Mainly, this program is designed to switch Windows environment variables using the tray icon
5+
menu. But the program also allows to manage (creating, modifying and deleting) all environment
6+
variables.
7+
8+
Another feature of this program is the possibility to relaunch the program with administrator
9+
privileges as well as to install or remove auto-launch behavior on user logon.

code/HISTORY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
**1.0.0.0**
3+
4+
- Initial draft.
5+
- Published on [https://github.com/akesseler/EnvironmentManager](https://github.com/akesseler/EnvironmentManager).

code/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
## Project Build
3+
4+
Best way to build the whole project is to use _Visual Studio 2017 Community_. Thereafter,
5+
download the complete sources, open the solution file ``EnvironmentManager.sln``, switch
6+
to release and rebuild all.

code/clean.cmd

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
@echo off
2+
3+
goto CHOICE_BINARIES
4+
5+
:CHOICE_BINARIES
6+
7+
choice /M "Do you really want to remove all \"bin\" and \"obj\" folders"
8+
9+
if %ERRORLEVEL% == 1 (
10+
goto CLEAN_BINARIES
11+
) else (
12+
goto CHOICE_PACKAGES
13+
)
14+
15+
:CLEAN_BINARIES
16+
17+
echo Clean up all "bin" and "obj" folders...
18+
19+
for /d /r %%x in (bin, obj) do rmdir "%%x" /s /q 2> nul
20+
21+
:CHOICE_PACKAGES
22+
23+
choice /M "Do you really want to remove all folders in \"packages\""
24+
25+
if %ERRORLEVEL% == 1 (
26+
goto CLEAN_PACKAGES
27+
) else (
28+
goto CHOICE_FINISHED
29+
)
30+
31+
:CLEAN_PACKAGES
32+
33+
echo Clean up all "packages"...
34+
35+
for /d /r %%x in (packages) do rmdir "%%x" /s /q 2> nul
36+
37+
:CHOICE_FINISHED
38+
39+
echo Done!
40+
41+
pause

code/src/EnvironmentManager.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 15
4+
VisualStudioVersion = 15.0.28307.645
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EnvironmentManager", "EnvironmentManager\EnvironmentManager.csproj", "{C1467758-5E28-4BA1-B416-D8E4685A5609}"
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+
{C1467758-5E28-4BA1-B416-D8E4685A5609}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{C1467758-5E28-4BA1-B416-D8E4685A5609}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{C1467758-5E28-4BA1-B416-D8E4685A5609}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{C1467758-5E28-4BA1-B416-D8E4685A5609}.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 = {E763ED87-E880-43D3-8A13-070E62875753}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2019 plexdata.de
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
using System;
26+
using System.Drawing;
27+
using System.Diagnostics;
28+
using System.Windows.Forms;
29+
using System.Windows.Forms.VisualStyles;
30+
31+
namespace Plexdata.EnvironmentManager.Controls
32+
{
33+
// Find a quite nice example of a splitter based on a TableLayoutPanel...
34+
// http://stackoverflow.com/questions/5033690/add-button-controls-to-splitcontainer-splitter/5046984#5046984
35+
36+
public class SplitContainerEx : SplitContainer
37+
{
38+
public SplitContainerEx()
39+
: base()
40+
{
41+
this.SetStyle(ControlStyles.DoubleBuffer, true);
42+
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
43+
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
44+
this.SetStyle(ControlStyles.UserPaint, true);
45+
this.SetStyle(ControlStyles.ResizeRedraw, true);
46+
47+
base.TabStop = false;
48+
}
49+
50+
protected override void OnKeyUp(KeyEventArgs args)
51+
{
52+
base.OnKeyUp(args);
53+
// Needed to disable painted focus rectangle...
54+
this.Refresh();
55+
}
56+
57+
protected override void OnPaint(PaintEventArgs args)
58+
{
59+
try
60+
{
61+
Size size = new Size(4, 40); // Gripper dimension...
62+
Rectangle rect = this.SplitterRectangle;
63+
VisualStyleRenderer renderer = null;
64+
65+
if (this.Orientation == Orientation.Vertical)
66+
{
67+
rect.Y = (rect.Bottom - (rect.Top + size.Height)) / 2;
68+
rect.Height = size.Height;
69+
rect.Width = size.Width;
70+
rect.X += Math.Max((this.SplitterWidth - rect.Width) / 2, 0) - 1;
71+
72+
if (VisualStyleRenderer.IsElementDefined(VisualStyleElement.Rebar.Gripper.Normal))
73+
{
74+
renderer = new VisualStyleRenderer(VisualStyleElement.Rebar.Gripper.Normal);
75+
}
76+
}
77+
else
78+
{
79+
rect.X = (rect.Right - (rect.Left + size.Height)) / 2;
80+
rect.Height = size.Width;
81+
rect.Width = size.Height;
82+
rect.Y += Math.Max((this.SplitterWidth - rect.Height) / 2, 0) - 1;
83+
84+
if (VisualStyleRenderer.IsElementDefined(VisualStyleElement.Rebar.GripperVertical.Normal))
85+
{
86+
renderer = new VisualStyleRenderer(VisualStyleElement.Rebar.GripperVertical.Normal);
87+
}
88+
}
89+
90+
if (renderer != null)
91+
{
92+
renderer.DrawBackground(args.Graphics, rect, args.ClipRectangle);
93+
}
94+
95+
if (base.Focused && base.TabStop)
96+
{
97+
ControlPaint.DrawFocusRectangle(args.Graphics,
98+
Rectangle.Inflate(this.SplitterRectangle, -1, -1),
99+
this.ForeColor, this.BackColor);
100+
}
101+
}
102+
catch (Exception exception)
103+
{
104+
Debug.WriteLine(exception);
105+
}
106+
}
107+
108+
protected override void OnDoubleClick(EventArgs args)
109+
{
110+
base.OnDoubleClick(args);
111+
if (this.Orientation == Orientation.Vertical)
112+
{
113+
this.SplitterDistance = this.ClientSize.Width / 2;
114+
}
115+
else
116+
{
117+
this.SplitterDistance = this.ClientSize.Height / 2;
118+
}
119+
this.Refresh();
120+
}
121+
}
122+
}
123+

0 commit comments

Comments
 (0)