Browse Source

commit: import project

HOME 4 years ago
parent
commit
7483e240b6
4 changed files with 160 additions and 0 deletions
  1. 62 0
      LoopPlayAudio.csproj
  2. 25 0
      LoopPlayAudio.sln
  3. 69 0
      Program.cs
  4. 4 0
      packages.config

+ 62 - 0
LoopPlayAudio.csproj

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{D696866D-0DCD-493E-AB0E-FA473120151A}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>LoopPlayAudio</RootNamespace>
+    <AssemblyName>LoopPlayAudio</AssemblyName>
+    <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <TargetFrameworkProfile />
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Windows.Forms" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="Program.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <Folder Include="Properties\" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <PropertyGroup>
+    <PostBuildEvent>if $(ConfigurationName) == Release if not exist $(TargetDir)Packed md $(TargetDir)Packed
+if $(ConfigurationName) == Release $(SolutionDir)packages\ILRepack.2.0.10\tools\ILRepack /ndebug /out:$(TargetDir)Packed\$(TargetFileName) $(TargetPath)</PostBuildEvent>
+  </PropertyGroup>
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>

+ 25 - 0
LoopPlayAudio.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 16
+VisualStudioVersion = 16.0.29728.190
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LoopPlayAudio", "LoopPlayAudio.csproj", "{D696866D-0DCD-493E-AB0E-FA473120151A}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{D696866D-0DCD-493E-AB0E-FA473120151A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D696866D-0DCD-493E-AB0E-FA473120151A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D696866D-0DCD-493E-AB0E-FA473120151A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D696866D-0DCD-493E-AB0E-FA473120151A}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {7B0FA954-0BCB-42FE-9BB6-8C18E2CA059C}
+	EndGlobalSection
+EndGlobal

+ 69 - 0
Program.cs

@@ -0,0 +1,69 @@
+//Target:Winform
+
+using System;
+using System.Drawing;
+using System.Media;
+using System.Reflection;
+using System.Windows.Forms;
+
+[assembly: AssemblyTitle("LoopPlayAudio")]
+[assembly: AssemblyProduct("LoopPlayAudio")]
+
+namespace LoopPlayAudio
+{
+    internal static class Program
+    {
+        [STAThread]
+        private static void Main(string[] args)
+        {
+            Application.EnableVisualStyles();
+            Application.SetCompatibleTextRenderingDefault(false);
+
+            var player = new SoundPlayer();
+
+            var mainForm = new Form();
+            var label = new Label();
+            var statusBar = new StatusStrip();
+            var statusLabel = new ToolStripStatusLabel();
+
+            mainForm.Controls.Add(label);
+            mainForm.Controls.Add(statusBar);
+            statusBar.Items.Add(statusLabel);
+
+            mainForm.ClientSize = new Size(640, mainForm.Font.Height + statusBar.Height);
+            mainForm.MaximizeBox = false;
+            mainForm.FormBorderStyle = FormBorderStyle.Sizable;
+            mainForm.SizeGripStyle = SizeGripStyle.Show;
+            mainForm.Text = Application.ProductName;
+            label.Dock = DockStyle.Fill;
+            label.Text = "Drop a file in to me to play looping...";
+            statusLabel.Text = "Ready";
+
+            Action<string> loopPlay = delegate (string file)
+            {
+                player.Stop();
+
+                try
+                {
+                    player.SoundLocation = file;
+                    player.PlayLooping();
+                    label.Text = file;
+                    statusLabel.Text = "Playing";
+                }
+                catch (Exception ex)
+                {
+                    label.Text = "ERROR:" + ex.Message + Environment.NewLine + ex;
+                    statusLabel.Text = "Stopped";
+                }
+            };
+
+            mainForm.AllowDrop = true;
+            mainForm.DragEnter += delegate (object sender, DragEventArgs eventArgs) { eventArgs.Effect = DragDropEffects.Link; };
+            mainForm.DragDrop += delegate (object sender, DragEventArgs eventArgs) { loopPlay(((string[])eventArgs.Data.GetData(DataFormats.FileDrop))[0]); };
+
+            if (args.Length == 1) loopPlay(args[0]);
+
+            Application.Run(mainForm);
+        }
+    }
+}

+ 4 - 0
packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="ILRepack" version="2.0.10" targetFramework="net20" />
+</packages>