Browse Source

Initial commit

master
Claire 1 year ago
parent
commit
9d6b2fb857
  1. 25
      LunaWin/LunaWin.sln
  2. 6
      LunaWin/LunaWin/App.config
  3. 24
      LunaWin/LunaWin/Globals.cs
  4. 204
      LunaWin/LunaWin/LunaCalc.cs
  5. 112
      LunaWin/LunaWin/LunaForm.Designer.cs
  6. 31
      LunaWin/LunaWin/LunaForm.cs
  7. 120
      LunaWin/LunaWin/LunaForm.resx
  8. 51
      LunaWin/LunaWin/LunaHidden.Designer.cs
  9. 56
      LunaWin/LunaWin/LunaHidden.cs
  10. 120
      LunaWin/LunaWin/LunaHidden.resx
  11. 56
      LunaWin/LunaWin/LunaIcon.cs
  12. 114
      LunaWin/LunaWin/LunaMenu.cs
  13. 159
      LunaWin/LunaWin/LunaWin.csproj
  14. 42
      LunaWin/LunaWin/Program.cs
  15. 36
      LunaWin/LunaWin/Properties/AssemblyInfo.cs
  16. 253
      LunaWin/LunaWin/Properties/Resources.Designer.cs
  17. 178
      LunaWin/LunaWin/Properties/Resources.resx
  18. 29
      LunaWin/LunaWin/Properties/Settings.Designer.cs
  19. 7
      LunaWin/LunaWin/Properties/Settings.settings
  20. BIN
      LunaWin/LunaWin/Resources/DefaultDark.ico
  21. BIN
      LunaWin/LunaWin/Resources/DefaultLight.ico
  22. BIN
      LunaWin/LunaWin/Resources/FirstqDark.ico
  23. BIN
      LunaWin/LunaWin/Resources/FirstqLight.ico
  24. BIN
      LunaWin/LunaWin/Resources/FullDark.ico
  25. BIN
      LunaWin/LunaWin/Resources/FullLight.ico
  26. BIN
      LunaWin/LunaWin/Resources/LastqDark.ico
  27. BIN
      LunaWin/LunaWin/Resources/LastqLight.ico
  28. BIN
      LunaWin/LunaWin/Resources/NewDark.ico
  29. BIN
      LunaWin/LunaWin/Resources/NewLight.ico
  30. BIN
      LunaWin/LunaWin/Resources/WancDark.ico
  31. BIN
      LunaWin/LunaWin/Resources/WancLight.ico
  32. BIN
      LunaWin/LunaWin/Resources/WangDark.ico
  33. BIN
      LunaWin/LunaWin/Resources/WangLight.ico
  34. BIN
      LunaWin/LunaWin/Resources/WaxcDark.ico
  35. BIN
      LunaWin/LunaWin/Resources/WaxcLight.ico
  36. BIN
      LunaWin/LunaWin/Resources/WaxgDark.ico
  37. BIN
      LunaWin/LunaWin/Resources/WaxgLight.ico
  38. BIN
      LunaWin/LunaWin/Resources/fullmoon.png
  39. BIN
      LunaWin/LunaWin/Resources/fullmoon200.png
  40. 19
      README.md

25
LunaWin/LunaWin.sln

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.33328.57
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LunaWin", "LunaWin\LunaWin.csproj", "{5D80F2E1-70A5-4D96-81B9-EC87739FD4D4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5D80F2E1-70A5-4D96-81B9-EC87739FD4D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5D80F2E1-70A5-4D96-81B9-EC87739FD4D4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5D80F2E1-70A5-4D96-81B9-EC87739FD4D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5D80F2E1-70A5-4D96-81B9-EC87739FD4D4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D85ED725-020C-4CE4-A9AF-FC5963DC41F3}
EndGlobalSection
EndGlobal

6
LunaWin/LunaWin/App.config

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

24
LunaWin/LunaWin/Globals.cs

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LunaWin
{
public static class Globals
{
/// <summary>
/// about window
/// </summary>
public static LunaForm lunaForm;
/// <summary>
/// systray icon
/// </summary>
public static NotifyIcon lunaIcon = new NotifyIcon();
public static bool RunAtLogin;
}
}

204
LunaWin/LunaWin/LunaCalc.cs

@ -0,0 +1,204 @@
using System;
using System.Collections.Generic;
namespace LunaWin
{
class LunaCalc
{
/// <summary>
/// get array of lunar phases
/// </summary>
public static List<LunaPhase> Phases
{
get { return _phases; }
}
/// <summary>
/// array of lunar phases
/// </summary>
private static List<LunaPhase> _phases = new List<LunaPhase>
{
new LunaPhase() {
Id = "new",
Name = "New Moon",
Start = 0,
End = 1,
Icon = "🌑",
Utf = "1F311"
},
new LunaPhase() {
Id = "waxc",
Name = "Waxing Crescent",
Start = 1,
End = 6.38264692644,
Icon = "🌒",
Utf = "1F312"
},
new LunaPhase() {
Id = "firstq",
Name = "First Quarter",
Start = 6.38264692644,
End = 8.38264692644,
Icon = "🌓",
Utf = "1F313"
},
new LunaPhase() {
Id = "waxg",
Name = "Waxing Gibbous",
Start = 8.38264692644,
End = 13.76529385288,
Icon = "🌔",
Utf = "1F314"
},
new LunaPhase() {
Id = "full",
Name = "Full Moon",
Start = 13.76529385288,
End = 15.76529385288,
Icon = "🌕",
Utf = "1F315"
},
new LunaPhase() {
Id = "wang",
Name = "Waning Gibbous",
Start = 15.76529385288,
End = 21.14794077932,
Icon = "🌖",
Utf = "1F316"
},
new LunaPhase() {
Id = "lastq",
Name = "Last Quarter",
Start = 21.14794077932,
End = 23.14794077932,
Icon = "🌗",
Utf = "1F317"
},
new LunaPhase() {
Id = "wanc",
Name = "Waning Crescent",
Start = 23.14794077932,
End = 28.53058770576,
Icon = "🌘",
Utf = "1F318"
},
new LunaPhase() {
Id = "new2",
Name = "New Moon",
Start = 28.53058770576,
End = 29.53058770576,
Icon = "🌑",
Utf = "1F311"
},
new LunaPhase() {
Id = "default",
Name = "Failed to calculate.",
Icon = "🌙",
Utf = "1F319"
}
};
/// <summary>
/// get lunar constant (total days in a lunar phase)
/// </summary>
public static double LunarDays
{
get { return _lunarDays; }
}
/// <summary>
/// lunar constant (total days in a lunar phase)
/// </summary>
private static double _lunarDays = 29.53058770576;
/// <summary>
/// get total seconds in a lunar phase
/// </summary>
public static double LunarSecs
{
get { return _lunarSecs; }
}
/// <summary>
/// total seconds in a lunar phase
/// </summary>
private static double _lunarSecs = LunarDays * (24 * 60 * 60);
/// <summary>
/// get datetime of first full moon in 2000
/// </summary>
public static DateTime BaseDate
{
get { return _baseDate; }
}
/// <summary>
/// datetime of first full moon in 2000
/// </summary>
// private static DateTime _baseDate = DateTime.Parse("2000-01-6 18:14:00Z");
private static DateTime _baseDate = new DateTime(2000, 01, 6, 18, 14, 00, DateTimeKind.Utc);
public LunaPhase CurrentPhase(DateTime inputDate = default)
{
LunaPhase currPhase = new LunaPhase();
DateTime currDate = inputDate == default ? DateTime.UtcNow : inputDate.ToUniversalTime();
// get total seconds between current and base datetime
double totalSecs = (currDate - BaseDate).TotalSeconds;
// make sure TotalSecs is positive
totalSecs = totalSecs < 0 ? totalSecs * -1 : totalSecs;
// calculate total seconds into current lunar cycle
double CurrSecs = totalSecs % LunarSecs;
// current position in lunar cycle
double CurrFrac = CurrSecs / LunarSecs;
// days into current cycle
double CurrDays = CurrFrac * LunarDays;
// search phase array for CurrDays value to fall between start and finish doubles
currPhase = Phases.Find(p => CurrDays >= p.Start && CurrDays <= p.End);
return currPhase;
}
}
/// <summary>
/// creates a single lunar phase
/// </summary>
class LunaPhase
{
/// <summary>
/// lunar phase shortname
/// </summary>
public string Id;
/// <summary>
/// lunar phase friendly name
/// </summary>
public string Name;
/// <summary>
/// start of lunar phase
/// </summary>
public double Start;
/// <summary>
/// end of lunar phase
/// </summary>
public double End;
/// <summary>
/// emoji icon
/// </summary>
public string Icon;
/// <summary>
/// unicode value
/// </summary>
public string Utf;
}
}

112
LunaWin/LunaWin/LunaForm.Designer.cs diff.generated

@ -0,0 +1,112 @@

namespace LunaWin
{
partial class LunaForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.imgLogo = new System.Windows.Forms.PictureBox();
this.lblHeader = new System.Windows.Forms.Label();
this.lblText = new System.Windows.Forms.Label();
this.cmdHide = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.imgLogo)).BeginInit();
this.SuspendLayout();
//
// imgLogo
//
this.imgLogo.Image = global::LunaWin.Properties.Resources.fullmoon;
this.imgLogo.Location = new System.Drawing.Point(82, 12);
this.imgLogo.Name = "imgLogo";
this.imgLogo.Size = new System.Drawing.Size(175, 175);
this.imgLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.imgLogo.TabIndex = 0;
this.imgLogo.TabStop = false;
//
// lblHeader
//
this.lblHeader.AutoSize = true;
this.lblHeader.Font = new System.Drawing.Font("Segoe UI Semibold", 14F);
this.lblHeader.Location = new System.Drawing.Point(75, 190);
this.lblHeader.Name = "lblHeader";
this.lblHeader.Size = new System.Drawing.Size(188, 25);
this.lblHeader.TabIndex = 1;
this.lblHeader.Text = "About LunaWin Beta";
//
// lblText
//
this.lblText.AutoSize = true;
this.lblText.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.lblText.Location = new System.Drawing.Point(47, 224);
this.lblText.MaximumSize = new System.Drawing.Size(250, 0);
this.lblText.Name = "lblText";
this.lblText.Size = new System.Drawing.Size(247, 51);
this.lblText.TabIndex = 2;
this.lblText.Text = "LunaWin calculates the current moon phase based on your system time (UTC).";
//
// cmdHide
//
this.cmdHide.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.cmdHide.Location = new System.Drawing.Point(132, 303);
this.cmdHide.Name = "cmdHide";
this.cmdHide.Size = new System.Drawing.Size(75, 28);
this.cmdHide.TabIndex = 3;
this.cmdHide.Text = "Close";
this.cmdHide.UseVisualStyleBackColor = true;
this.cmdHide.Click += new System.EventHandler(this.cmdHide_Click);
//
// LunaForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(339, 363);
this.ControlBox = false;
this.Controls.Add(this.cmdHide);
this.Controls.Add(this.lblText);
this.Controls.Add(this.lblHeader);
this.Controls.Add(this.imgLogo);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "LunaForm";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "About LunaWin";
((System.ComponentModel.ISupportInitialize)(this.imgLogo)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox imgLogo;
private System.Windows.Forms.Label lblHeader;
private System.Windows.Forms.Label lblText;
private System.Windows.Forms.Button cmdHide;
}
}

31
LunaWin/LunaWin/LunaForm.cs

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LunaWin
{
public partial class LunaForm : Form
{
const int DWMWA_TRANSITIONS_FORCEDISABLED = 3;
[DllImport("dwmapi", PreserveSig = true)]
static extern int DwmSetWindowAttribute(IntPtr hWnd, int attr, ref int value, int attrLen);
public LunaForm()
{
InitializeComponent();
}
private void cmdHide_Click(object sender, EventArgs e)
{
Globals.lunaForm.Hide();
}
}
}

120
LunaWin/LunaWin/LunaForm.resx

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

51
LunaWin/LunaWin/LunaHidden.Designer.cs diff.generated

@ -0,0 +1,51 @@

namespace LunaWin
{
partial class LunaHidden
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// LunaHidden
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(120, 83);
this.ControlBox = false;
this.Name = "LunaHidden";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "LunaHidden";
this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
this.ResumeLayout(false);
}
#endregion
}
}

56
LunaWin/LunaWin/LunaHidden.cs

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LunaWin
{
public partial class LunaHidden : Form
{
private const int WM_WININICHANGE = 0x001A;
public LunaHidden()
{
InitializeComponent();
}
protected override void WndProc(ref Message m)
{
// Listen for operating system messages.
switch (m.Msg)
{
// The WM_ACTIVATEAPP message occurs when the application
// becomes the active application or becomes inactive.
case WM_WININICHANGE:
// create string
string str;
// read string from memory pointer
unsafe
{
str = new string((char*)m.LParam);
}
// if string is "ImmersiveColorSet,"
// regenerate icon
if (str == "ImmersiveColorSet")
{
using (LunaIcon li = new LunaIcon())
{
li.Display();
}
}
break;
}
// pass message through
base.WndProc(ref m);
}
}
}

120
LunaWin/LunaWin/LunaHidden.resx

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

56
LunaWin/LunaWin/LunaIcon.cs

@ -0,0 +1,56 @@
using System;
using System.Drawing;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using LunaWin.Properties;
namespace LunaWin
{
class LunaIcon : IDisposable
{
[DllImport("UXTheme.dll", EntryPoint = "#138")]
public static extern bool IsDarkMode();
// Instantiate the icon object
public LunaIcon()
{
//Globals.lunaIcon = new NotifyIcon();
}
// Display the icon in the systray
// Invoke at application launch
// Probably re-invoke when icon should be updated
public void Display()
{
// TextInfo object for accessing ToTitleCase
TextInfo txtInf = new CultureInfo("en-US", false).TextInfo;
// get the current lunar phase
LunaCalc lunaCalc = new LunaCalc();
LunaPhase currentPhase = lunaCalc.CurrentPhase();
// set icon resource name
string IconName = txtInf.ToTitleCase(currentPhase.Id);
IconName += IsDarkMode() ? "Dark" : "Light" ;
// set the icon resource
Globals.lunaIcon.Icon = Resources.ResourceManager.GetObject(IconName) as Icon;
// set the tooltip
Globals.lunaIcon.Text = currentPhase.Name;
// set the context menu
Globals.lunaIcon.ContextMenuStrip = new LunaMenu().CreateMenu();
// set icon visibility
Globals.lunaIcon.Visible = true;
}
// Dispose of object instance on exit
public void Dispose()
{
Globals.lunaIcon.Dispose();
}
}
}

114
LunaWin/LunaWin/LunaMenu.cs

@ -0,0 +1,114 @@
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LunaWin
{
class LunaMenu
{
/// <summary>
/// creates the context menu
/// </summary>
/// <returns></returns>
public ContextMenuStrip CreateMenu()
{
// create menu and add default items
ContextMenuStrip lunaMenu = new ContextMenuStrip();
ToolStripMenuItem itm;
ToolStripSeparator sep;
// startup setting
itm = new ToolStripMenuItem();
itm.Name = "itmStartup";
itm.Text = "Run at login";
itm.Checked = Globals.RunAtLogin;
itm.Click += new EventHandler(SetStartup);
lunaMenu.Items.Add(itm);
// about
itm = new ToolStripMenuItem();
itm.Text = "About LunaWin";
itm.Click += new EventHandler(ShowAbout);
lunaMenu.Items.Add(itm);
// separator
sep = new ToolStripSeparator();
lunaMenu.Items.Add(sep);
// exit
itm = new ToolStripMenuItem();
itm.Text = "Exit";
itm.Click += new EventHandler(ExitApp);
lunaMenu.Items.Add(itm);
return lunaMenu;
}
/// <summary>
/// sets the user's startup preference
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void SetStartup(object sender, EventArgs e)
{
RegistryKey startKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
if (Globals.RunAtLogin)
{
// remove from startup
startKey.DeleteValue("LunaWin", false);
Globals.RunAtLogin = false;
} else
{
// add to startup
startKey.SetValue("LunaWin", Application.ExecutablePath);
Globals.RunAtLogin = true;
}
// set the context menu item's checked state
((ToolStripMenuItem)Globals.lunaIcon.ContextMenuStrip.Items["itmStartup"]).Checked = Globals.RunAtLogin;
}
public void GetStartup()
{
RegistryKey startKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
object startVal = startKey.GetValue("LunaWin");
if(startVal != null)
{
Globals.RunAtLogin = true;
} else
{
Globals.RunAtLogin = false;
}
}
/// <summary>
/// displays the about window
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ShowAbout(object sender, EventArgs e)
{
// show the about window
Globals.lunaForm.Show();
// bring about window to front
Globals.lunaForm.BringToFront();
}
/// <summary>
/// exits the application
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ExitApp(object sender, EventArgs e)
{
Application.Exit();
}
}
}

159
LunaWin/LunaWin/LunaWin.csproj

@ -0,0 +1,159 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5D80F2E1-70A5-4D96-81B9-EC87739FD4D4}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>LunaWin</RootNamespace>
<AssemblyName>LunaWin</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Globals.cs" />
<Compile Include="LunaCalc.cs" />
<Compile Include="LunaForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LunaForm.Designer.cs">
<DependentUpon>LunaForm.cs</DependentUpon>
</Compile>
<Compile Include="LunaHidden.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LunaHidden.Designer.cs">
<DependentUpon>LunaHidden.cs</DependentUpon>
</Compile>
<Compile Include="LunaIcon.cs" />
<Compile Include="LunaMenu.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="LunaForm.resx">
<DependentUpon>LunaForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LunaHidden.resx">
<DependentUpon>LunaHidden.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\DefaultLight.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\WaxcDark.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\DefaultDark.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\FirstqDark.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\FirstqLight.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\FullDark.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\FullLight.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\LastqDark.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\LastqLight.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\NewDark.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\NewLight.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\WancDark.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\WancLight.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\WangDark.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\WangLight.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\WaxcLight.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\WaxgDark.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\WaxgLight.ico" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\fullmoon.png" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\fullmoon200.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

42
LunaWin/LunaWin/Program.cs

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace LunaWin
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
// set up the hidden form for handling window messaging events
LunaHidden lunaHidden = new LunaHidden();
lunaHidden.Show();
// set up the about window
Globals.lunaForm = new LunaForm();
// get current startup preference
LunaMenu lm = new LunaMenu();
lm.GetStartup();
// invoke the icon display method
using (LunaIcon lunaIcon = new LunaIcon())
{
lunaIcon.Display();
Application.Run();
//Application.Run();
}
}
}
}

36
LunaWin/LunaWin/Properties/AssemblyInfo.cs

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("LunaWin")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LunaWin")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5d80f2e1-70a5-4d96-81b9-ec87739fd4d4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

253
LunaWin/LunaWin/Properties/Resources.Designer.cs diff.generated

@ -0,0 +1,253 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace LunaWin.Properties {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("LunaWin.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon DefaultDark {
get {
object obj = ResourceManager.GetObject("DefaultDark", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon DefaultLight {
get {
object obj = ResourceManager.GetObject("DefaultLight", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon FirstqDark {
get {
object obj = ResourceManager.GetObject("FirstqDark", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon FirstqLight {
get {
object obj = ResourceManager.GetObject("FirstqLight", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon FullDark {
get {
object obj = ResourceManager.GetObject("FullDark", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon FullLight {
get {
object obj = ResourceManager.GetObject("FullLight", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap fullmoon {
get {
object obj = ResourceManager.GetObject("fullmoon", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon LastqDark {
get {
object obj = ResourceManager.GetObject("LastqDark", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon LastqLight {
get {
object obj = ResourceManager.GetObject("LastqLight", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon NewDark {
get {
object obj = ResourceManager.GetObject("NewDark", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon NewLight {
get {
object obj = ResourceManager.GetObject("NewLight", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon WancDark {
get {
object obj = ResourceManager.GetObject("WancDark", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon WancLight {
get {
object obj = ResourceManager.GetObject("WancLight", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon WangDark {
get {
object obj = ResourceManager.GetObject("WangDark", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon WangLight {
get {
object obj = ResourceManager.GetObject("WangLight", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon WaxcDark {
get {
object obj = ResourceManager.GetObject("WaxcDark", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon WaxcLight {
get {
object obj = ResourceManager.GetObject("WaxcLight", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon WaxgDark {
get {
object obj = ResourceManager.GetObject("WaxgDark", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon WaxgLight {
get {
object obj = ResourceManager.GetObject("WaxgLight", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
}
}

178
LunaWin/LunaWin/Properties/Resources.resx

@ -0,0 +1,178 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="DefaultDark" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\DefaultDark.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DefaultLight" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\DefaultLight.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="FirstqDark" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\FirstqDark.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="FirstqLight" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\FirstqLight.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="FullDark" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\FullDark.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="FullLight" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\FullLight.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="fullmoon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\fullmoon200.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="LastqDark" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\LastqDark.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="LastqLight" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\LastqLight.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NewDark" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NewDark.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NewLight" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\NewLight.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="WancDark" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WancDark.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="WancLight" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WancLight.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="WangDark" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WangDark.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="WangLight" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WangLight.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="WaxcDark" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WaxcDark.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="WaxcLight" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WaxcLight.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="WaxgDark" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WaxgDark.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="WaxgLight" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\WaxgLight.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

29
LunaWin/LunaWin/Properties/Settings.Designer.cs diff.generated

@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace LunaWin.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

7
LunaWin/LunaWin/Properties/Settings.settings

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

BIN
LunaWin/LunaWin/Resources/DefaultDark.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/DefaultLight.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/FirstqDark.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/FirstqLight.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/FullDark.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/FullLight.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/LastqDark.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/LastqLight.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/NewDark.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/NewLight.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/WancDark.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/WancLight.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/WangDark.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/WangLight.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/WaxcDark.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/WaxcLight.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/WaxgDark.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/WaxgLight.ico

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
LunaWin/LunaWin/Resources/fullmoon.png

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 9.2 MiB

BIN
LunaWin/LunaWin/Resources/fullmoon200.png

diff.bin_not_shown

After

Width:  |  Height:  |  Size: 49 KiB

19
README.md

@ -1,2 +1,19 @@
# VisualStudioProjects
# LunaWin
LunaWin is a small systray utility displaying the current moon phase. It's written in .NET C# using WinForms.
The actual lunar phase calculation credit goes to [this blog post](https://minkukel.com/en/various/calculating-moon-phase/) *([archive](https://archive.ph/hjXlv))*, which details the rationale behind the calculations and presents a PHP implementation.
This project demonstrates a number of concepts, some more advanced than others.
**Introductory**
* Programmatically creating and updating a system tray icon
* Programmatically creating and updating the icon's context menu
* Setting a program to run at user login (startup)
**Advanced**
* Using [`DllImport`](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.dllimportattribute?view=net-8.0) to access the current Windows 10+ theme (light or dark) natively
* Overloading [`WndProc`](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.control.wndproc?view=windowsdesktop-8.0) to handle system-wide messaging, to detect Windows 10+ theme changes
* Accessing memory directly through pointers and [`unsafe`](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/unsafe) code handling
Loading…
Cancel
Save