Skip to content

Commit

Permalink
Merge pull request #51 from gdevic/dev
Browse files Browse the repository at this point in the history
code cleanup
  • Loading branch information
mcrossley authored Feb 27, 2020
2 parents b50a161 + 41be83b commit 55c3439
Show file tree
Hide file tree
Showing 28 changed files with 50 additions and 313 deletions.
48 changes: 23 additions & 25 deletions CumulusMX/Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,29 @@ public static class Api
public static string Utf16ToUtf8(string utf16String)
{
/**************************************************************
* Every .NET string will store text with the UTF16 encoding, *
* known as Encoding.Unicode. Other encodings may exist as *
* Byte-Array or incorrectly stored with the UTF16 encoding. *
* *
* UTF8 = 1 bytes per char *
* ["100" for the ansi 'd'] *
* ["206" and "186" for the russian 'κ'] *
* *
* UTF16 = 2 bytes per char *
* ["100, 0" for the ansi 'd'] *
* ["186, 3" for the russian 'κ'] *
* *
* UTF8 inside UTF16 *
* ["100, 0" for the ansi 'd'] *
* ["206, 0" and "186, 0" for the russian 'κ'] *
* *
* We can use the convert encoding function to convert an *
* UTF16 Byte-Array to an UTF8 Byte-Array. When we use UTF8 *
* encoding to string method now, we will get a UTF16 string. *
* *
* So we imitate UTF16 by filling the second byte of a char *
* with a 0 byte (binary 0) while creating the string. *
**************************************************************/
* Every .NET string will store text with the UTF16 encoding, *
* known as Encoding.Unicode. Other encodings may exist as *
* Byte-Array or incorrectly stored with the UTF16 encoding. *
* *
* UTF8 = 1 bytes per char *
* ["100" for the ansi 'd'] *
* ["206" and "186" for the russian 'κ'] *
* *
* UTF16 = 2 bytes per char *
* ["100, 0" for the ansi 'd'] *
* ["186, 3" for the russian 'κ'] *
* *
* UTF8 inside UTF16 *
* ["100, 0" for the ansi 'd'] *
* ["206, 0" and "186, 0" for the russian 'κ'] *
* *
* We can use the convert encoding function to convert an *
* UTF16 Byte-Array to an UTF8 Byte-Array. When we use UTF8 *
* encoding to string method now, we will get a UTF16 string. *
* *
* So we imitate UTF16 by filling the second byte of a char *
* with a 0 byte (binary 0) while creating the string. *
**************************************************************/

// Storage for the UTF8 string
string utf8String = String.Empty;
Expand Down Expand Up @@ -165,7 +165,6 @@ public bool EditData()
{
return HandleError(ex, 404);
}

}

private bool HandleError(Exception ex, int statusCode)
Expand Down Expand Up @@ -232,7 +231,6 @@ public bool EditData()
{
return HandleError(ex, 404);
}

}

private bool HandleError(Exception ex, int statusCode)
Expand Down
2 changes: 0 additions & 2 deletions CumulusMX/AstroLib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,6 @@ public static double PutIn360Deg(double pfDeg)
public static int cEndNautTwilight = 3;
public static int cEndAstroTwilight = 4;


/*
private static double mjd(int year, int month, int day)
{
Expand Down Expand Up @@ -1286,7 +1285,6 @@ public static double CalcMoonBrightLimb(double fSunRA, double fSunDecl, double f
}
*/


public static double CalcMoonAge(DateTime dDate, int iZone)
{
double fJD, fIP, fAge;
Expand Down
14 changes: 3 additions & 11 deletions CumulusMX/AstroLib2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static double BrasSolar(double el, double r, double nfac)
// el solar elevation deg from horizon
// r distance from earth to sun in AU
// nfac atmospheric turbidity parameter (2=clear, 4-5=smoggy)

double sinal = Math.Sin(degToRad(el)); // Sine of the solar elevation angle

if (sinal < 0)
Expand All @@ -33,7 +33,7 @@ public static double BrasSolar(double el, double r, double nfac)

}
}

public static double RyanStolzSolar(double el, double erv, double atc, double z)
{
// el solar elevation deg from horizon
Expand Down Expand Up @@ -230,7 +230,6 @@ public static void CalculateSunPosition(
solarelevation = 90.0 - solarzen;
}


private static double degToRad(double angle)
{
return Math.PI*angle/180.0;
Expand Down Expand Up @@ -766,7 +765,6 @@ public static double solarelevation(
//return azimuth;
}


public static double PutIn360Deg(double pfDeg)
{
while (pfDeg >= 360)
Expand All @@ -782,7 +780,6 @@ public static double PutIn360Deg(double pfDeg)

// ###############################################################


public static int cSunrise = 1;
public static int cBeginCivilTwilight = -2;
public static int cBeginNautTwilight = -3;
Expand All @@ -792,7 +789,6 @@ public static double PutIn360Deg(double pfDeg)
public static int cEndNautTwilight = 3;
public static int cEndAstroTwilight = 4;


private static double mjd(int year, int month, int day)
{
//
Expand All @@ -813,7 +809,6 @@ private static double mjd(int year, int month, int day)
return a + b + (int)Math.Floor(30.6001 * (month + 1)) + day;
}


private static double frac(double x)
{
//
Expand Down Expand Up @@ -857,7 +852,6 @@ private static string hrsmin(double t)
//return "0000";
}


private static double lmst(double mjd, double glong)
{
//
Expand Down Expand Up @@ -913,7 +907,6 @@ private static void minisun(double t, ref double ra, ref double dec)
}
}


private static void quad(double ym, double yz, double yp, ref int nz, ref double z1, ref double z2, ref double xe, ref double ye)
{
//
Expand Down Expand Up @@ -1523,7 +1516,6 @@ public static void CalcMoonPhase(DateTime dDate, DateTime dEpoch, double fMEpoch
fMD = fL2 - fSLambda;
fMPhase = 0.5 * (1.0 - Trig.Cos(fMD));


}

public static void CalcMoonDistance(DateTime dDate, DateTime dEpoch, double fMEpochLong, double fMPeriLong, double fMAscNode, double fMIncl, double fMEcc, double fSEpochEclLong, double fSPeriEclLong, double fSEcc, double fMSMA, ref double fMDistance)
Expand Down Expand Up @@ -1662,4 +1654,4 @@ private static double Normalize(double fN)
return fN;
}
}
}
}
Loading

0 comments on commit 55c3439

Please sign in to comment.