Prepare to release.
This commit is contained in:
153
aclock#/Program.cs
Normal file
153
aclock#/Program.cs
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
//
|
||||||
|
// Author:
|
||||||
|
// Natalia Portillo claunia@claunia.com
|
||||||
|
//
|
||||||
|
// Copyright (c) 2016, © Claunia.com
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in
|
||||||
|
// the documentation and/or other materials provided with the distribution.
|
||||||
|
// * Neither the name of the [ORGANIZATION] nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace aclock_sharp
|
||||||
|
{
|
||||||
|
class MainClass
|
||||||
|
{
|
||||||
|
const int FontWH_Ratio = 2;
|
||||||
|
|
||||||
|
static void DrawCircle(int handMax, int sYcen, int sXcen)
|
||||||
|
{
|
||||||
|
int x, y, r;
|
||||||
|
char c;
|
||||||
|
|
||||||
|
for(r = 0; r < 60; r++)
|
||||||
|
{
|
||||||
|
x = (int)(Math.Cos(r * Math.PI / 180 * 6) * handMax * FontWH_Ratio + sXcen);
|
||||||
|
y = (int)(Math.Sin(r * Math.PI / 180 * 6) * handMax + sYcen);
|
||||||
|
switch(r)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
case 5:
|
||||||
|
case 10:
|
||||||
|
case 15:
|
||||||
|
case 20:
|
||||||
|
case 25:
|
||||||
|
case 30:
|
||||||
|
case 35:
|
||||||
|
case 40:
|
||||||
|
case 45:
|
||||||
|
case 50:
|
||||||
|
case 55:
|
||||||
|
c = 'o';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
c = '.';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Console.SetCursorPosition(x, y);
|
||||||
|
Console.Write(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void DrawHand(int minute, int hlength, char c, int sXcen, int sYcen)
|
||||||
|
{
|
||||||
|
int x, y, n;
|
||||||
|
double r = (minute - 15) * (Math.PI / 180) * 6;
|
||||||
|
|
||||||
|
for(n = 1; n < hlength; n++)
|
||||||
|
{
|
||||||
|
x = (int)(Math.Cos(r) * n * FontWH_Ratio + sXcen);
|
||||||
|
y = (int)(Math.Sin(r) * n + sYcen);
|
||||||
|
Console.SetCursorPosition(x, y);
|
||||||
|
Console.Write(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PrintCopyr()
|
||||||
|
{
|
||||||
|
Console.Clear();
|
||||||
|
Console.WriteLine("Copyright (c) 1994-2013 Antoni Sawicki <as@tenoware.com>");
|
||||||
|
Console.WriteLine("Copyright (c) 2016 Natalia Portillo <claunia@claunia.com>");
|
||||||
|
Console.WriteLine("Version 2.4 (.net); Canary Islands, December 2016");
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool KeepRunning = true;
|
||||||
|
|
||||||
|
public static void Main()
|
||||||
|
{
|
||||||
|
PrintCopyr();
|
||||||
|
Thread.Sleep(2000);
|
||||||
|
|
||||||
|
int sXmax, sYmax, smax, handMax, sXcen, sYcen;
|
||||||
|
DateTime ltime;
|
||||||
|
|
||||||
|
sXmax = sYmax = handMax = sXcen = sYcen = 0;
|
||||||
|
|
||||||
|
Console.Clear();
|
||||||
|
Console.CursorVisible = false;
|
||||||
|
Console.Title = ".:ACLOCK:.";
|
||||||
|
|
||||||
|
Console.CancelKeyPress += (sender, e) =>
|
||||||
|
{
|
||||||
|
e.Cancel = false;
|
||||||
|
KeepRunning = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
if(!KeepRunning)
|
||||||
|
break;
|
||||||
|
|
||||||
|
ltime = DateTime.Now;
|
||||||
|
sXmax = Console.WindowWidth;
|
||||||
|
sYmax = Console.WindowHeight;
|
||||||
|
|
||||||
|
if(sXmax / FontWH_Ratio <= sYmax)
|
||||||
|
smax = sXmax / FontWH_Ratio;
|
||||||
|
else
|
||||||
|
smax = sYmax;
|
||||||
|
|
||||||
|
handMax = (smax / 2) - 1;
|
||||||
|
|
||||||
|
sXcen = sXmax / 2;
|
||||||
|
sYcen = sYmax / 2;
|
||||||
|
|
||||||
|
Console.Clear();
|
||||||
|
DrawCircle(handMax, sYcen, sXcen);
|
||||||
|
|
||||||
|
DrawHand((ltime.Hour * 5) + (ltime.Minute / 10), 2 * handMax / 3, 'h', sXcen, sYcen);
|
||||||
|
DrawHand(ltime.Minute, handMax - 2, 'm', sXcen, sYcen);
|
||||||
|
DrawHand(ltime.Second, handMax - 1, '.', sXcen, sYcen);
|
||||||
|
Console.SetCursorPosition(sXcen - 5, sYcen - (3 * handMax / 5));
|
||||||
|
Console.Write(".:ACLOCK:.");
|
||||||
|
Console.SetCursorPosition(sXcen - 5, sYcen + (3 * handMax / 5));
|
||||||
|
Console.Write("{0:D2}:{1:D2}:{2:D2}", ltime.Hour, ltime.Minute, ltime.Second);
|
||||||
|
|
||||||
|
Thread.Sleep(1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintCopyr();
|
||||||
|
Console.CursorVisible = true;
|
||||||
|
Console.Title = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
53
aclock#/Properties/AssemblyInfo.cs
Normal file
53
aclock#/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
//
|
||||||
|
// Author:
|
||||||
|
// Natalia Portillo claunia@claunia.com
|
||||||
|
//
|
||||||
|
// Copyright (c) 2016, © Claunia.com
|
||||||
|
//
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in
|
||||||
|
// the documentation and/or other materials provided with the distribution.
|
||||||
|
// * Neither the name of the [ORGANIZATION] nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||||
|
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||||
|
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||||
|
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
|
||||||
|
// Information about this assembly is defined by the following attributes.
|
||||||
|
// Change them to the values specific to your project.
|
||||||
|
|
||||||
|
[assembly: AssemblyTitle ("aclock#")]
|
||||||
|
[assembly: AssemblyDescription ("")]
|
||||||
|
[assembly: AssemblyConfiguration ("")]
|
||||||
|
[assembly: AssemblyCompany ("Claunia.com")]
|
||||||
|
[assembly: AssemblyProduct ("")]
|
||||||
|
[assembly: AssemblyCopyright ("© Claunia.com")]
|
||||||
|
[assembly: AssemblyTrademark ("")]
|
||||||
|
[assembly: AssemblyCulture ("")]
|
||||||
|
|
||||||
|
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||||
|
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||||
|
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||||
|
|
||||||
|
[assembly: AssemblyVersion ("1.0.*")]
|
||||||
|
|
||||||
|
// The following attributes are used to specify the signing key for the assembly,
|
||||||
|
// if desired. See the Mono documentation for more information about signing.
|
||||||
|
|
||||||
|
//[assembly: AssemblyDelaySign(false)]
|
||||||
|
//[assembly: AssemblyKeyFile("")]
|
||||||
41
aclock#/aclock#.csproj
Normal file
41
aclock#/aclock#.csproj
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
|
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||||
|
<ProjectGuid>{175CBC6F-94CB-4C02-B112-8BAB721A774F}</ProjectGuid>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<RootNamespace>aclock#</RootNamespace>
|
||||||
|
<AssemblyName>aclock#</AssemblyName>
|
||||||
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
|
<ReleaseVersion>2.4</ReleaseVersion>
|
||||||
|
<Description>Aclock is an analog clock program for text mode console displays, terminals, or terminal emulators. This program is obviously absolutely useless, except for turning your old, expensive mainframe or supercomputer into a wall clock.</Description>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>bin\Debug</OutputPath>
|
||||||
|
<DefineConstants>DEBUG;</DefineConstants>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<ExternalConsole>true</ExternalConsole>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>bin\Release</OutputPath>
|
||||||
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<ExternalConsole>true</ExternalConsole>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="System" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Program.cs" />
|
||||||
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
|
</Project>
|
||||||
Reference in New Issue
Block a user