Skip to content

Commit 5bc37da

Browse files
committed
Initial Commit!
1 parent 566352c commit 5bc37da

Some content is hidden

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

64 files changed

+9261
-0
lines changed

.vs/ScreenSaver/v14/.suo

44 KB
Binary file not shown.

Readme.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
![screencast](surfacebook.png)
2+
3+
## Aerial - Apple TV Aerial Views Screen Saver for Windows 7, 8, 10+
4+
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.
5+
6+
Aerial is based on the Mac Screen saver by John Coates/Aerial
7+
8+
#### Coded with Love by Dmitry Sadakov
9+
10+
## Download
11+
Download from [Github](https://github.com/cdima/Aerial/releases/download/v0.1/Aerial.scr.zip)
12+
13+
**Option A:** Right click Aerial.scr and choose Install, windows will install it for you.
14+
15+
**Option B:** Unzip the Aerial.scr and double-click to launch.
16+
17+
## Features
18+
* **Auto Load Latest Aerials:** Aerials are loaded directly from Apple, so you're never out of date.
19+
* **Play Different Aerial On Each Display:** If you've got multiple monitors, this setting loads a different aerial for each of your displays.
20+
21+
## Compatibility
22+
Aerial is written in C# for [.Net Framework v4.6](https://www.microsoft.com/en-us/download/details.aspx?id=48130).
23+
24+
## Community
25+
- **Find a bug?** [Open an issue](https://github.com/cdima/Aerial/issues/new). Try to be as specific as possible.
26+
- **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.
27+
28+
## Contribute
29+
I appreciate all pull requests. Caching hasn't been added yet.
30+
31+
## Changelog
32+
33+
- October 27th, 2015 - 1.0: First release.
34+
35+
## License
36+
[MIT License](https://raw.githubusercontent.com/JohnCoates/Aerial/master/LICENSE)

ScreenSaver.sln

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 14
4+
VisualStudioVersion = 14.0.23107.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScreenSaver", "ScreenSaver\ScreenSaver.csproj", "{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
All|Any CPU = All|Any CPU
11+
All|x86 = All|x86
12+
Debug|Any CPU = Debug|Any CPU
13+
Debug|x86 = Debug|x86
14+
Release|Any CPU = Release|Any CPU
15+
Release|x86 = Release|x86
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.All|Any CPU.ActiveCfg = All|Any CPU
19+
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.All|Any CPU.Build.0 = All|Any CPU
20+
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.All|x86.ActiveCfg = All|x86
21+
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.All|x86.Build.0 = All|x86
22+
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Debug|x86.ActiveCfg = Debug|x86
25+
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Debug|x86.Build.0 = Debug|x86
26+
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Release|Any CPU.ActiveCfg = Release|Any CPU
27+
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Release|Any CPU.Build.0 = Release|Any CPU
28+
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Release|x86.ActiveCfg = Release|x86
29+
{C79DC106-23F3-4FA7-BA69-6B8684C4AD9F}.Release|x86.Build.0 = Release|x86
30+
EndGlobalSection
31+
GlobalSection(SolutionProperties) = preSolution
32+
HideSolutionNode = FALSE
33+
EndGlobalSection
34+
EndGlobal

ScreenSaver.suo

25 KB
Binary file not shown.

ScreenSaver/AerialEntities.cs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Net;
5+
using System.Text;
6+
using System.Web.Script.Serialization;
7+
8+
namespace ScreenSaver
9+
{
10+
// Parses http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/entries.json
11+
public class AerialContext
12+
{
13+
static List<Asset> cachedPlaylist;
14+
15+
public List<Asset> GetMovies()
16+
{
17+
var settings = new RegSettings();
18+
19+
var aerialUrl = "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/entries.json";
20+
WebClient webClient = new WebClient();
21+
string ee = webClient.DownloadString(aerialUrl);
22+
23+
var urls = new JavaScriptSerializer().Deserialize<IdAsset[]>(ee);
24+
25+
var time = (DateTime.Now.Hour < 6 || DateTime.Now.Hour > 19) ? "night" : "day";
26+
var ran = new Random();
27+
var links = urls.SelectMany(s => s.assets)
28+
.OrderBy(t => ran.Next())
29+
.OrderByDescending(t => settings.UseTimeOfDay && t.timeOfDay == time)
30+
.ToList();
31+
32+
if (settings.DifferentMoviesOnDual)
33+
return links;
34+
if (cachedPlaylist == null)
35+
cachedPlaylist = links;
36+
37+
return cachedPlaylist;
38+
}
39+
}
40+
41+
public class IdAsset
42+
{
43+
public string id;
44+
public Asset[] assets;
45+
}
46+
47+
public class Asset
48+
{
49+
public string url;//" : "http://a1.phobos.apple.com/us/r1000/000/Features/atv/AutumnResources/videos/b1-1.mov",
50+
public string accessibilityLabel;//" : "Hawaii",
51+
public string type;//" : "video",
52+
public string id;// : "b1-1",
53+
public string timeOfDay;//" : "day"
54+
}
55+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
using System;
2+
using System.Windows.Forms;
3+
4+
namespace ScreenSaver
5+
{
6+
7+
class IgnoreMouseClickMessageFilter : IMessageFilter
8+
{
9+
private Control parent { get; set; }
10+
private Control target { get; set; }
11+
12+
public IgnoreMouseClickMessageFilter(Control parent, Control target)
13+
{
14+
this.parent = parent;
15+
this.target = target;
16+
}
17+
18+
public bool PreFilterMessage(ref Message messageBeforeFiltering)
19+
{
20+
const Boolean FilterTheMessageOut = true;
21+
const Boolean LetTheMessageThrough = false;
22+
23+
if (IsNull(parent)) return LetTheMessageThrough;
24+
if (IsNull(target)) return LetTheMessageThrough;
25+
if (WasNotClickedOnTarget(parent, target)) return LetTheMessageThrough;
26+
if (MessageContainsAnyMousebutton(messageBeforeFiltering)) return FilterTheMessageOut;
27+
return LetTheMessageThrough;
28+
}
29+
30+
private bool MessageContainsAnyMousebutton(Message message)
31+
{
32+
if (message.Msg == 0x202) return true; /* WM_LBUTTONUP*/
33+
if (message.Msg == 0x203) return true; /* WM_LBUTTONDBLCLK*/
34+
if (message.Msg == 0x204) return true; /* WM_RBUTTONDOWN */
35+
if (message.Msg == 0x205) return true; /* WM_RBUTTONUP */
36+
return false;
37+
}
38+
39+
private bool WasNotClickedOnTarget(Control parent, Control target)
40+
{
41+
Control clickedOn = parent.GetChildAtPoint(Cursor.Position);
42+
if (IsNull(clickedOn)) return true;
43+
if (AreEqual(clickedOn, target)) return false;
44+
return true;
45+
}
46+
47+
private bool AreEqual(Control controlA, Control controlB)
48+
{
49+
if (controlA == controlB) return true;
50+
return false;
51+
}
52+
53+
private bool IsNull(Control control)
54+
{
55+
if (control == null) return true;
56+
return false;
57+
}
58+
}
59+
}

ScreenSaver/Program.cs

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
using System;
2+
using System.Windows.Forms;
3+
4+
namespace ScreenSaver
5+
{
6+
static class Program
7+
{
8+
[STAThread]
9+
static void Main(string[] args)
10+
{
11+
Application.EnableVisualStyles();
12+
Application.SetCompatibleTextRenderingDefault(false);
13+
14+
if (args.Length > 0)
15+
{
16+
string firstArgument = args[0].ToLower().Trim();
17+
string secondArgument = null;
18+
19+
// Handle cases where arguments are separated by colon.
20+
// Examples: /c:1234567 or /P:1234567
21+
if (firstArgument.Length > 2)
22+
{
23+
secondArgument = firstArgument.Substring(3).Trim();
24+
firstArgument = firstArgument.Substring(0, 2);
25+
}
26+
else if (args.Length > 1)
27+
secondArgument = args[1];
28+
29+
if (firstArgument == "/c") // Configuration mode
30+
{
31+
Application.Run(new SettingsForm());
32+
}
33+
else if (firstArgument == "/p") // Preview mode
34+
{
35+
if (secondArgument == null)
36+
{
37+
MessageBox.Show("Sorry, but the expected window handle was not provided.",
38+
"ScreenSaver", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
39+
return;
40+
}
41+
42+
IntPtr previewWndHandle = new IntPtr(long.Parse(secondArgument));
43+
Application.Run(new ScreenSaverForm(previewWndHandle));
44+
}
45+
else if (firstArgument == "/s") // Full-screen mode
46+
{
47+
ShowScreenSaver();
48+
Application.Run();
49+
}
50+
else // Undefined argument
51+
{
52+
MessageBox.Show("Sorry, but the command line argument \"" + firstArgument +
53+
"\" is not valid.", "ScreenSaver",
54+
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
55+
}
56+
}
57+
else // No arguments - treat like /c
58+
{
59+
Application.Run(new SettingsForm());
60+
}
61+
}
62+
63+
/// <summary>
64+
/// Display the form on each of the computer's monitors.
65+
/// </summary>
66+
static void ShowScreenSaver()
67+
{
68+
foreach (Screen screen in Screen.AllScreens)
69+
{
70+
ScreenSaverForm screensaver = new ScreenSaverForm(screen.Bounds);
71+
screensaver.Show();
72+
}
73+
}
74+
75+
}
76+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("ScreenSaver")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("ScreenSaver")]
13+
[assembly: AssemblyCopyright("Copyright © 2010")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("b05a44d5-ef0f-4004-9ab2-894af28dc7d6")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

ScreenSaver/Properties/Resources.Designer.cs

Lines changed: 63 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)