Initial Commit
This commit is contained in:
commit
ea14b22d13
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
.vs/
|
||||||
|
obj/
|
||||||
|
dist/
|
||||||
|
*.user
|
164
FishNotify.cs
Normal file
164
FishNotify.cs
Normal file
@ -0,0 +1,164 @@
|
|||||||
|
using Dalamud.Data;
|
||||||
|
using Dalamud.Game.Network;
|
||||||
|
using Dalamud.Interface.Colors;
|
||||||
|
using Dalamud.IoC;
|
||||||
|
using Dalamud.Logging;
|
||||||
|
using Dalamud.Plugin;
|
||||||
|
using ImGuiNET;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace FishNotify
|
||||||
|
{
|
||||||
|
public sealed class FishNotifyPlugin : IDalamudPlugin
|
||||||
|
{
|
||||||
|
public string Name => "FishNotify";
|
||||||
|
|
||||||
|
[PluginService]
|
||||||
|
[RequiredVersion("1.0")]
|
||||||
|
private DalamudPluginInterface PluginInterface { get; set; }
|
||||||
|
|
||||||
|
[PluginService]
|
||||||
|
private GameNetwork Network { get; set; }
|
||||||
|
private bool settingsVisible;
|
||||||
|
private int expectedOpCode = -1;
|
||||||
|
|
||||||
|
public FishNotifyPlugin()
|
||||||
|
{
|
||||||
|
Network!.NetworkMessage += OnNetworkMessage;
|
||||||
|
PluginInterface!.UiBuilder.Draw += OnDrawUI;
|
||||||
|
PluginInterface!.UiBuilder.OpenConfigUi += OnOpenConfigUi;
|
||||||
|
|
||||||
|
var client = new HttpClient();
|
||||||
|
client.GetStringAsync("https://raw.githubusercontent.com/karashiiro/FFXIVOpcodes/master/opcodes.min.json")
|
||||||
|
.ContinueWith(ExtractOpCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Network.NetworkMessage -= OnNetworkMessage;
|
||||||
|
PluginInterface!.UiBuilder.Draw -= OnDrawUI;
|
||||||
|
PluginInterface.UiBuilder.OpenConfigUi -= OnOpenConfigUi;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ExtractOpCode(Task<string> task)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var regions = JsonConvert.DeserializeObject<List<OpcodeRegion>>(task.Result);
|
||||||
|
if (regions == null)
|
||||||
|
{
|
||||||
|
PluginLog.Warning("No regions found in opcode list");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var region = regions.Find(r => r.Region == "Global");
|
||||||
|
if (region == null || region.Lists == null)
|
||||||
|
{
|
||||||
|
PluginLog.Warning("No global region found in opcode list");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!region.Lists.TryGetValue("ServerZoneIpcType", out List<OpcodeList> serverZoneIpcTypes))
|
||||||
|
{
|
||||||
|
PluginLog.Warning("No ServerZoneIpcType in opcode list");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var eventPlay = serverZoneIpcTypes.Find(opcode => opcode.Name == "EventPlay");
|
||||||
|
if (eventPlay == null)
|
||||||
|
{
|
||||||
|
PluginLog.Warning("No EventPlay opcode in ServerZoneIpcType");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
expectedOpCode = eventPlay.Opcode;
|
||||||
|
PluginLog.Debug($"Found EventPlay opcode {expectedOpCode:X4}");
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
PluginLog.Error(e, "Could not download/extract opcodes: {}", e.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnNetworkMessage(IntPtr dataPtr, ushort opCode, uint sourceActorId, uint targetActorId, NetworkMessageDirection direction)
|
||||||
|
{
|
||||||
|
if (direction != NetworkMessageDirection.ZoneDown || opCode != expectedOpCode)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var data = new byte[32];
|
||||||
|
Marshal.Copy(dataPtr, data, 0, data.Length);
|
||||||
|
|
||||||
|
int eventId = BitConverter.ToInt32(data, 8);
|
||||||
|
short scene = BitConverter.ToInt16(data, 12);
|
||||||
|
int param5 = BitConverter.ToInt32(data, 28);
|
||||||
|
|
||||||
|
// Fishing event?
|
||||||
|
if (eventId != 0x00150001)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Fish hooked?
|
||||||
|
if (scene != 5)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch (param5)
|
||||||
|
{
|
||||||
|
|
||||||
|
case 0x124:
|
||||||
|
// light tug (!)
|
||||||
|
Sounds.PlaySound(Resources.Info);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x125:
|
||||||
|
// medium tug (!!)
|
||||||
|
Sounds.PlaySound(Resources.Alert);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 0x126:
|
||||||
|
// heavy tug (!!!)
|
||||||
|
Sounds.PlaySound(Resources.Alarm);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Sounds.Stop();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDrawUI()
|
||||||
|
{
|
||||||
|
if (!settingsVisible)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (ImGui.Begin("FishNotify", ref this.settingsVisible, ImGuiWindowFlags.AlwaysAutoResize))
|
||||||
|
{
|
||||||
|
if (expectedOpCode > -1)
|
||||||
|
ImGui.TextColored(ImGuiColors.HealerGreen, $"Status: OK, opcode = {expectedOpCode:X}");
|
||||||
|
else
|
||||||
|
ImGui.TextColored(ImGuiColors.DalamudRed, "Status: No opcode :(");
|
||||||
|
}
|
||||||
|
ImGui.End();
|
||||||
|
}
|
||||||
|
private void OnOpenConfigUi()
|
||||||
|
{
|
||||||
|
settingsVisible = !settingsVisible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OpcodeRegion
|
||||||
|
{
|
||||||
|
public string Version { get; set; }
|
||||||
|
public string Region { get; set; }
|
||||||
|
public Dictionary<string, List<OpcodeList>> Lists { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class OpcodeList
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
public ushort Opcode { get; set; }
|
||||||
|
}
|
||||||
|
}
|
87
FishNotify.csproj
Normal file
87
FishNotify.csproj
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
<PropertyGroup>
|
||||||
|
<Authors></Authors>
|
||||||
|
<Company></Company>
|
||||||
|
<Version>1.0.0.0</Version>
|
||||||
|
<Description>Plays a sound effect when a fish bites</Description>
|
||||||
|
<Copyright></Copyright>
|
||||||
|
<PackageProjectUrl>https://github.com/carvelli/Fish-Notify</PackageProjectUrl>
|
||||||
|
<Configurations>Release</Configurations>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net5.0-windows</TargetFramework>
|
||||||
|
<Platforms>x64</Platforms>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<LangVersion>latest</LangVersion>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
|
||||||
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
|
<OutputPath>dist</OutputPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="FishNotify.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<DebugType>none</DebugType>
|
||||||
|
<DebugSymbols>false</DebugSymbols>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="DalamudPackager" Version="2.1.2" />
|
||||||
|
<PackageReference Include="System.Windows.Extensions" Version="5.0.0" />
|
||||||
|
<Reference Include="FFXIVClientStructs">
|
||||||
|
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Newtonsoft.Json">
|
||||||
|
<HintPath>$(DalamudLibPath)Newtonsoft.Json.dll</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Dalamud">
|
||||||
|
<HintPath>$(DalamudLibPath)Dalamud.dll</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="ImGui.NET">
|
||||||
|
<HintPath>$(DalamudLibPath)ImGui.NET.dll</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="ImGuiScene">
|
||||||
|
<HintPath>$(DalamudLibPath)ImGuiScene.dll</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Lumina">
|
||||||
|
<HintPath>$(DalamudLibPath)Lumina.dll</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Lumina.Excel">
|
||||||
|
<HintPath>$(DalamudLibPath)Lumina.Excel.dll</HintPath>
|
||||||
|
<Private>false</Private>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Resources.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
12
FishNotify.json
Normal file
12
FishNotify.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"Author": "Liza Carvelli",
|
||||||
|
"Name": "Fish Notify",
|
||||||
|
"Punchline": "Plays a sound when a fish is caught",
|
||||||
|
"Description": "Plays a sound when a fish is caught, depending on tug-strength",
|
||||||
|
"InternalName": "FishNotify",
|
||||||
|
"DalamudApiLevel": 4,
|
||||||
|
"Tags": [
|
||||||
|
"fishing"
|
||||||
|
],
|
||||||
|
"RepoUrl": "https://github.com/carvelli/Fish-Notify"
|
||||||
|
}
|
22
FishNotify.sln
Normal file
22
FishNotify.sln
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.29709.97
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{DFE2B530-7D7B-41FD-B03C-8E11371610E3}") = "FishNotify", "FishNotify.csproj", "{3F91A6A9-5F97-4F6D-864C-DA066F94121A}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Release|x64 = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{3F91A6A9-5F97-4F6D-864C-DA066F94121A}.Release|x64.ActiveCfg = Release|x64
|
||||||
|
{3F91A6A9-5F97-4F6D-864C-DA066F94121A}.Release|x64.Build.0 = Release|x64
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {8BCE7152-3829-4975-A314-A29987BE3DE9}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
90
Resources.Designer.cs
generated
Normal file
90
Resources.Designer.cs
generated
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Dieser Code wurde von einem Tool generiert.
|
||||||
|
// Laufzeitversion:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
|
||||||
|
// der Code erneut generiert wird.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace FishNotify {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw.
|
||||||
|
/// </summary>
|
||||||
|
// Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert
|
||||||
|
// -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert.
|
||||||
|
// Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen
|
||||||
|
// mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.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() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird.
|
||||||
|
/// </summary>
|
||||||
|
[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("FishNotify.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle
|
||||||
|
/// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sucht eine lokalisierte Ressource vom Typ System.IO.UnmanagedMemoryStream ähnlich wie System.IO.MemoryStream.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.IO.UnmanagedMemoryStream Alarm {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetStream("Alarm", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sucht eine lokalisierte Ressource vom Typ System.IO.UnmanagedMemoryStream ähnlich wie System.IO.MemoryStream.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.IO.UnmanagedMemoryStream Alert {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetStream("Alert", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sucht eine lokalisierte Ressource vom Typ System.IO.UnmanagedMemoryStream ähnlich wie System.IO.MemoryStream.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.IO.UnmanagedMemoryStream Info {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetStream("Info", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
130
Resources.resx
Normal file
130
Resources.resx
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||||
|
<data name="Alarm" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>Sounds\Alarm.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name="Alert" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>Sounds\Alert.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name="Info" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>Sounds\Info.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
30
Sounds.cs
Normal file
30
Sounds.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using System.IO;
|
||||||
|
using System.Media;
|
||||||
|
|
||||||
|
namespace FishNotify
|
||||||
|
{
|
||||||
|
public class Sounds
|
||||||
|
{
|
||||||
|
private static readonly SoundPlayer player = new SoundPlayer();
|
||||||
|
|
||||||
|
public static void PlaySound(Stream input)
|
||||||
|
{
|
||||||
|
lock (player)
|
||||||
|
{
|
||||||
|
Stop();
|
||||||
|
|
||||||
|
player.Stream = input;
|
||||||
|
player.Play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Stop()
|
||||||
|
{
|
||||||
|
lock (player)
|
||||||
|
{
|
||||||
|
player.Stop();
|
||||||
|
player.Stream = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
BIN
Sounds/Alarm.wav
Normal file
BIN
Sounds/Alarm.wav
Normal file
Binary file not shown.
BIN
Sounds/Alert.wav
Normal file
BIN
Sounds/Alert.wav
Normal file
Binary file not shown.
BIN
Sounds/Info.wav
Normal file
BIN
Sounds/Info.wav
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user