Skip to content

Commit

Permalink
Initial Commit!
Browse files Browse the repository at this point in the history
  • Loading branch information
cDima committed Oct 27, 2015
1 parent 566352c commit 5bc37da
Show file tree
Hide file tree
Showing 64 changed files with 9,261 additions and 0 deletions.
Binary file added .vs/ScreenSaver/v14/.suo
Binary file not shown.
36 changes: 36 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
![screencast](surfacebook.png)

## Aerial - Apple TV Aerial Views Screen Saver for Windows 7, 8, 10+
Aerial is a Windows screen saver based on the new Apple TV screen saver that displays the aerial movies Apple shot over New York, San Francisco, Hawaii, China, etc.

Aerial is based on the Mac Screen saver by John Coates/Aerial

#### Coded with Love by Dmitry Sadakov

## Download
Download from [Github](https://github.com/cdima/Aerial/releases/download/v0.1/Aerial.scr.zip)

**Option A:** Right click Aerial.scr and choose Install, windows will install it for you.

**Option B:** Unzip the Aerial.scr and double-click to launch.

## Features
* **Auto Load Latest Aerials:** Aerials are loaded directly from Apple, so you're never out of date.
* **Play Different Aerial On Each Display:** If you've got multiple monitors, this setting loads a different aerial for each of your displays.

## Compatibility
Aerial is written in C# for [.Net Framework v4.6](https://www.microsoft.com/en-us/download/details.aspx?id=48130).

## Community
- **Find a bug?** [Open an issue](https://github.com/cdima/Aerial/issues/new). Try to be as specific as possible.
- **Have a feature request** [Open an issue](https://github.com/cdima/Aerial/issues/new). Tell me why this feature would be useful, and why you and others would want it.

## Contribute
I appreciate all pull requests. Caching hasn't been added yet.

## Changelog

- October 27th, 2015 - 1.0: First release.

## License
[MIT License](https://raw.githubusercontent.com/JohnCoates/Aerial/master/LICENSE)
34 changes: 34 additions & 0 deletions ScreenSaver.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScreenSaver", "ScreenSaver\ScreenSaver.csproj", "{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
All|Any CPU = All|Any CPU
All|x86 = All|x86
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.All|Any CPU.ActiveCfg = All|Any CPU
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.All|Any CPU.Build.0 = All|Any CPU
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.All|x86.ActiveCfg = All|x86
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.All|x86.Build.0 = All|x86
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Debug|x86.ActiveCfg = Debug|x86
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Debug|x86.Build.0 = Debug|x86
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Release|Any CPU.Build.0 = Release|Any CPU
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Release|x86.ActiveCfg = Release|x86
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file added ScreenSaver.suo
Binary file not shown.
55 changes: 55 additions & 0 deletions ScreenSaver/AerialEntities.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Web.Script.Serialization;

namespace ScreenSaver
{
// Parses http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/entries.json
public class AerialContext
{
static List<Asset> cachedPlaylist;

public List<Asset> GetMovies()
{
var settings = new RegSettings();

var aerialUrl = "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/entries.json";
WebClient webClient = new WebClient();
string ee = webClient.DownloadString(aerialUrl);

var urls = new JavaScriptSerializer().Deserialize<IdAsset[]>(ee);

var time = (DateTime.Now.Hour < 6 || DateTime.Now.Hour > 19) ? "night" : "day";
var ran = new Random();
var links = urls.SelectMany(s => s.assets)
.OrderBy(t => ran.Next())
.OrderByDescending(t => settings.UseTimeOfDay && t.timeOfDay == time)
.ToList();

if (settings.DifferentMoviesOnDual)
return links;
if (cachedPlaylist == null)
cachedPlaylist = links;

return cachedPlaylist;
}
}

public class IdAsset
{
public string id;
public Asset[] assets;
}

public class Asset
{
public string url;//" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b1-1.mov",
public string accessibilityLabel;//" : "Hawaii",
public string type;//" : "video",
public string id;// : "b1-1",
public string timeOfDay;//" : "day"
}
}
59 changes: 59 additions & 0 deletions ScreenSaver/IgnoreMouseClickMessageFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System;
using System.Windows.Forms;

namespace ScreenSaver
{

class IgnoreMouseClickMessageFilter : IMessageFilter
{
private Control parent { get; set; }
private Control target { get; set; }

public IgnoreMouseClickMessageFilter(Control parent, Control target)
{
this.parent = parent;
this.target = target;
}

public bool PreFilterMessage(ref Message messageBeforeFiltering)
{
const Boolean FilterTheMessageOut = true;
const Boolean LetTheMessageThrough = false;

if (IsNull(parent)) return LetTheMessageThrough;
if (IsNull(target)) return LetTheMessageThrough;
if (WasNotClickedOnTarget(parent, target)) return LetTheMessageThrough;
if (MessageContainsAnyMousebutton(messageBeforeFiltering)) return FilterTheMessageOut;
return LetTheMessageThrough;
}

private bool MessageContainsAnyMousebutton(Message message)
{
if (message.Msg == 0x202) return true; /* WM_LBUTTONUP*/
if (message.Msg == 0x203) return true; /* WM_LBUTTONDBLCLK*/
if (message.Msg == 0x204) return true; /* WM_RBUTTONDOWN */
if (message.Msg == 0x205) return true; /* WM_RBUTTONUP */
return false;
}

private bool WasNotClickedOnTarget(Control parent, Control target)
{
Control clickedOn = parent.GetChildAtPoint(Cursor.Position);
if (IsNull(clickedOn)) return true;
if (AreEqual(clickedOn, target)) return false;
return true;
}

private bool AreEqual(Control controlA, Control controlB)
{
if (controlA == controlB) return true;
return false;
}

private bool IsNull(Control control)
{
if (control == null) return true;
return false;
}
}
}
76 changes: 76 additions & 0 deletions ScreenSaver/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
using System;
using System.Windows.Forms;

namespace ScreenSaver
{
static class Program
{
[STAThread]
static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

if (args.Length > 0)
{
string firstArgument = args[0].ToLower().Trim();
string secondArgument = null;

// Handle cases where arguments are separated by colon.
// Examples: /c:1234567 or /P:1234567
if (firstArgument.Length > 2)
{
secondArgument = firstArgument.Substring(3).Trim();
firstArgument = firstArgument.Substring(0, 2);
}
else if (args.Length > 1)
secondArgument = args[1];

if (firstArgument == "/c") // Configuration mode
{
Application.Run(new SettingsForm());
}
else if (firstArgument == "/p") // Preview mode
{
if (secondArgument == null)
{
MessageBox.Show("Sorry, but the expected window handle was not provided.",
"ScreenSaver", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}

IntPtr previewWndHandle = new IntPtr(long.Parse(secondArgument));
Application.Run(new ScreenSaverForm(previewWndHandle));
}
else if (firstArgument == "/s") // Full-screen mode
{
ShowScreenSaver();
Application.Run();
}
else // Undefined argument
{
MessageBox.Show("Sorry, but the command line argument \"" + firstArgument +
"\" is not valid.", "ScreenSaver",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}
}
else // No arguments - treat like /c
{
Application.Run(new SettingsForm());
}
}

/// <summary>
/// Display the form on each of the computer's monitors.
/// </summary>
static void ShowScreenSaver()
{
foreach (Screen screen in Screen.AllScreens)
{
ScreenSaverForm screensaver = new ScreenSaverForm(screen.Bounds);
screensaver.Show();
}
}

}
}
36 changes: 36 additions & 0 deletions ScreenSaver/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -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("ScreenSaver")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ScreenSaver")]
[assembly: AssemblyCopyright("Copyright © 2010")]
[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("b05a44d5-ef0f-4004-9ab2-894af28dc7d6")]

// 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")]
63 changes: 63 additions & 0 deletions ScreenSaver/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5bc37da

Please sign in to comment.