From 404414abea025b170a730be4b59f4dd9c9b5e540 Mon Sep 17 00:00:00 2001 From: scoliono <2191476+scoliono@users.noreply.github.com> Date: Fri, 5 Feb 2021 18:27:48 -0800 Subject: [PATCH] Initial commit --- .gitignore | 362 ++++++++++++++++++ FemboyWatchdog.sln | 20 + FemboyWatchdog/FemboyWatchdog.csproj | 109 ++++++ FemboyWatchdog/Program.cs | 20 + FemboyWatchdog/Properties/AssemblyInfo.cs | 36 ++ .../Properties/Resources.Designer.cs | 63 +++ FemboyWatchdog/Properties/Resources.resx | 117 ++++++ .../Properties/Settings.Designer.cs | 26 ++ FemboyWatchdog/Properties/Settings.settings | 7 + FemboyWatchdog/Toolbar.Designer.cs | 95 +++++ FemboyWatchdog/Toolbar.cs | 151 ++++++++ FemboyWatchdog/Toolbar.resx | 120 ++++++ FemboyWatchdog/app.config | 3 + FemboyWatchdog/packages.config | 9 + README.md | 17 + 15 files changed, 1155 insertions(+) create mode 100644 .gitignore create mode 100644 FemboyWatchdog.sln create mode 100644 FemboyWatchdog/FemboyWatchdog.csproj create mode 100644 FemboyWatchdog/Program.cs create mode 100644 FemboyWatchdog/Properties/AssemblyInfo.cs create mode 100644 FemboyWatchdog/Properties/Resources.Designer.cs create mode 100644 FemboyWatchdog/Properties/Resources.resx create mode 100644 FemboyWatchdog/Properties/Settings.Designer.cs create mode 100644 FemboyWatchdog/Properties/Settings.settings create mode 100644 FemboyWatchdog/Toolbar.Designer.cs create mode 100644 FemboyWatchdog/Toolbar.cs create mode 100644 FemboyWatchdog/Toolbar.resx create mode 100644 FemboyWatchdog/app.config create mode 100644 FemboyWatchdog/packages.config create mode 100644 README.md diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ee5385 --- /dev/null +++ b/.gitignore @@ -0,0 +1,362 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.rsuser +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Mono auto generated files +mono_crash.* + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +[Ww][Ii][Nn]32/ +[Aa][Rr][Mm]/ +[Aa][Rr][Mm]64/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ +[Ll]ogs/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUnit +*.VisualState.xml +TestResult.xml +nunit-*.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ + +# ASP.NET Scaffolding +ScaffoldingReadMe.txt + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_h.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*_wpftmp.csproj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Coverlet is a free, cross platform Code Coverage Tool +coverage*.json +coverage*.xml +coverage*.info + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# NuGet Symbol Packages +*.snupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx +*.appxbundle +*.appxupload + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!?*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser +*- [Bb]ackup.rdl +*- [Bb]ackup ([0-9]).rdl +*- [Bb]ackup ([0-9][0-9]).rdl + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# CodeRush personal settings +.cr/personal + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ + +# Local History for Visual Studio +.localhistory/ + +# BeatPulse healthcheck temp database +healthchecksdb + +# Backup folder for Package Reference Convert tool in Visual Studio 2017 +MigrationBackup/ + +# Ionide (cross platform F# VS Code tools) working folder +.ionide/ + +# Fody - auto-generated XML schema +FodyWeavers.xsd diff --git a/FemboyWatchdog.sln b/FemboyWatchdog.sln new file mode 100644 index 0000000..bef91fd --- /dev/null +++ b/FemboyWatchdog.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FemboyWatchdog", "FemboyWatchdog\FemboyWatchdog.csproj", "{8ABBD681-A6EA-4399-9C35-708CBCB15455}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x86 = Debug|x86 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8ABBD681-A6EA-4399-9C35-708CBCB15455}.Debug|x86.ActiveCfg = Debug|x86 + {8ABBD681-A6EA-4399-9C35-708CBCB15455}.Debug|x86.Build.0 = Debug|x86 + {8ABBD681-A6EA-4399-9C35-708CBCB15455}.Release|x86.ActiveCfg = Release|x86 + {8ABBD681-A6EA-4399-9C35-708CBCB15455}.Release|x86.Build.0 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/FemboyWatchdog/FemboyWatchdog.csproj b/FemboyWatchdog/FemboyWatchdog.csproj new file mode 100644 index 0000000..7ce4a6b --- /dev/null +++ b/FemboyWatchdog/FemboyWatchdog.csproj @@ -0,0 +1,109 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {8ABBD681-A6EA-4399-9C35-708CBCB15455} + WinExe + Properties + FemboyWatchdog + FemboyWatchdog + v3.0 + + + 512 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\AForge.2.2.5\lib\AForge.dll + True + + + ..\packages\AForge.Controls.2.2.5\lib\AForge.Controls.dll + True + + + ..\packages\AForge.Imaging.2.2.5\lib\AForge.Imaging.dll + True + + + ..\packages\AForge.Math.2.2.5\lib\AForge.Math.dll + True + + + ..\packages\AForge.Video.2.2.5\lib\AForge.Video.dll + True + + + ..\packages\AForge.Video.DirectShow.2.2.5\lib\AForge.Video.DirectShow.dll + True + + + + + + + + + + + Form + + + Toolbar.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + Toolbar.cs + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + \ No newline at end of file diff --git a/FemboyWatchdog/Program.cs b/FemboyWatchdog/Program.cs new file mode 100644 index 0000000..77bba6b --- /dev/null +++ b/FemboyWatchdog/Program.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace FemboyWatchdog +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Toolbar()); + } + } +} diff --git a/FemboyWatchdog/Properties/AssemblyInfo.cs b/FemboyWatchdog/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6e1079f --- /dev/null +++ b/FemboyWatchdog/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("FemboyWatchdog")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("FemboyWatchdog")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[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("47a3491c-e08c-4e1d-8003-f9788ed7c287")] + +// 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")] diff --git a/FemboyWatchdog/Properties/Resources.Designer.cs b/FemboyWatchdog/Properties/Resources.Designer.cs new file mode 100644 index 0000000..6ed1919 --- /dev/null +++ b/FemboyWatchdog/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1008 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace FemboyWatchdog.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // 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", "4.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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [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("FemboyWatchdog.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/FemboyWatchdog/Properties/Resources.resx b/FemboyWatchdog/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/FemboyWatchdog/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/FemboyWatchdog/Properties/Settings.Designer.cs b/FemboyWatchdog/Properties/Settings.Designer.cs new file mode 100644 index 0000000..f356135 --- /dev/null +++ b/FemboyWatchdog/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1008 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace FemboyWatchdog.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.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; + } + } + } +} diff --git a/FemboyWatchdog/Properties/Settings.settings b/FemboyWatchdog/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/FemboyWatchdog/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/FemboyWatchdog/Toolbar.Designer.cs b/FemboyWatchdog/Toolbar.Designer.cs new file mode 100644 index 0000000..00f99e2 --- /dev/null +++ b/FemboyWatchdog/Toolbar.Designer.cs @@ -0,0 +1,95 @@ +using AForge.Controls; + +namespace FemboyWatchdog +{ + partial class Toolbar + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.vsp = new AForge.Controls.VideoSourcePlayer(); + this.label2 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.BackColor = System.Drawing.Color.Red; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(183, 13); + this.label1.TabIndex = 0; + this.label1.Text = "YOU ARE BEING MONITORED"; + // + // vsp + // + this.vsp.Location = new System.Drawing.Point(217, 9); + this.vsp.Name = "vsp"; + this.vsp.Size = new System.Drawing.Size(256, 144); + this.vsp.TabIndex = 1; + this.vsp.VideoSource = null; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.BackColor = System.Drawing.Color.Yellow; + this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label2.Location = new System.Drawing.Point(12, 76); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(187, 13); + this.label2.TabIndex = 2; + this.label2.Text = "\"SMILE!\" YOU\'RE ON CAMERA"; + this.label2.Visible = false; + // + // Toolbar + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(488, 164); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.vsp); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "Toolbar"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; + this.Text = "Toolbar"; + this.TopMost = true; + this.TransparencyKey = System.Drawing.SystemColors.Control; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private AForge.Controls.VideoSourcePlayer vsp; + private System.Windows.Forms.Label label2; + } +} \ No newline at end of file diff --git a/FemboyWatchdog/Toolbar.cs b/FemboyWatchdog/Toolbar.cs new file mode 100644 index 0000000..d3cf5ed --- /dev/null +++ b/FemboyWatchdog/Toolbar.cs @@ -0,0 +1,151 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Speech.Synthesis; +using System.Text; +using System.Windows.Forms; +using AForge.Video; +using AForge.Video.DirectShow; +using System.Drawing.Imaging; +using System.IO; + +namespace FemboyWatchdog +{ + public partial class Toolbar : Form + { + private FilterInfoCollection videoDevices; + private VideoCaptureDevice videoDevice; + private VideoCapabilities[] videoCapabilities; + + private Timer labelBlinkTimer; + private Timer ttsTimer; + + private SpeechSynthesizer ss; + + private SolidBrush brush = new SolidBrush(Color.Red); + private Font font = new Font(FontFamily.GenericSansSerif, 24); + + + public Toolbar() + { + InitializeComponent(); + + ss = new SpeechSynthesizer(); + + ttsTimer = new Timer(); + ttsTimer.Interval = 15000; + labelBlinkTimer = new Timer(); + labelBlinkTimer.Interval = 1000; + + // hook events + vsp.NewFrame += new AForge.Controls.VideoSourcePlayer.NewFrameHandler(vsp_NewFrame); + ttsTimer.Tick += new EventHandler(ttsTimer_Tick); + labelBlinkTimer.Tick += new EventHandler(labelBlinkTimer_Tick); + + OpenCamera(); + } + + private void OpenCamera() + { + try + { + videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); + if (videoDevices.Count != 0) + { + videoDevice = new VideoCaptureDevice(videoDevices[0].MonikerString); + } + else + { + MessageBox.Show("Camera device not found! Get a webcam!", "Error initializing camera", MessageBoxButtons.OK, MessageBoxIcon.Error); + Environment.Exit(-2); + return; + } + videoCapabilities = videoDevice.VideoCapabilities; + if (videoCapabilities.Length == 0) + { + MessageBox.Show("Camera does not support video capture! Get a better webcam!", "Error initializing camera", MessageBoxButtons.OK, MessageBoxIcon.Error); + Environment.Exit(-3); + return; + } + + // adjust VSP's resolution so as to not stretch the picture + double aspectRatio = 1.0 * videoCapabilities[0].FrameSize.Width / videoCapabilities[0].FrameSize.Height; + vsp.Size = new System.Drawing.Size(Convert.ToInt32(aspectRatio * 144), 144); + + OpenVideoSource(videoDevice); + } + catch (Exception err) + { + MessageBox.Show(err.ToString(), "Error initializing camera", MessageBoxButtons.OK, MessageBoxIcon.Error); + Environment.Exit(-1); + } + } + + void labelBlinkTimer_Tick(object sender, EventArgs e) + { + this.label2.Visible = !this.label2.Visible; + } + + void ttsTimer_Tick(object sender, EventArgs e) + { + ss.SpeakAsync("You are being monitored"); + } + + public void OpenVideoSource(IVideoSource source) + { + try + { + // set busy cursor + this.Cursor = Cursors.WaitCursor; + // stop current video source + CloseCurrentVideoSource(); + // start new video source + vsp.VideoSource = source; + vsp.Start(); + this.Cursor = Cursors.Default; + ttsTimer.Start(); + labelBlinkTimer.Start(); + } + catch { } + } + + public void CloseCurrentVideoSource() + { + try + { + if (vsp.VideoSource != null) + { + vsp.SignalToStop(); + // wait ~ 3 seconds + for (int i = 0; i < 30; i++) + { + if (!vsp.IsRunning) + break; + System.Threading.Thread.Sleep(100); + } + if (vsp.IsRunning) + { + vsp.Stop(); + } + vsp.VideoSource = null; + labelBlinkTimer.Stop(); + } + } + catch { } + } + + private void vsp_NewFrame(object sender, ref Bitmap image) + { + try + { + DateTime now = DateTime.Now; + Graphics g = Graphics.FromImage(image); + // paint current time + g.DrawString(now.ToString(), font, brush, new Point(5, 5)); + } + catch + { } + } + } +} diff --git a/FemboyWatchdog/Toolbar.resx b/FemboyWatchdog/Toolbar.resx new file mode 100644 index 0000000..7080a7d --- /dev/null +++ b/FemboyWatchdog/Toolbar.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/FemboyWatchdog/app.config b/FemboyWatchdog/app.config new file mode 100644 index 0000000..e59af44 --- /dev/null +++ b/FemboyWatchdog/app.config @@ -0,0 +1,3 @@ + + + diff --git a/FemboyWatchdog/packages.config b/FemboyWatchdog/packages.config new file mode 100644 index 0000000..31125fb --- /dev/null +++ b/FemboyWatchdog/packages.config @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..6f9c138 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# FemboyWatchdog + +The ultimate corporate surveillance mechanism! + +## User Requirements + +- .NET Framework 3.0 + +- Windows XP and up + +- A webcam + +## Developer Requirements + +- AForge.NET + +- Visual C# 2010