Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit following application rebuild
- Loading branch information
Skyline969
committed
Sep 18, 2018
0 parents
commit 9a2019f
Showing
100 changed files
with
258,187 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.25420.1 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FilterBro", "FilterBro\FilterBro.csproj", "{A641EEDD-6B25-4C77-B8C9-AF94D47DFF27}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{A641EEDD-6B25-4C77-B8C9-AF94D47DFF27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{A641EEDD-6B25-4C77-B8C9-AF94D47DFF27}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{A641EEDD-6B25-4C77-B8C9-AF94D47DFF27}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{A641EEDD-6B25-4C77-B8C9-AF94D47DFF27}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> | ||
</startup> | ||
</configuration> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,229 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Data; | ||
using System.Drawing; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
using System.Windows.Media; | ||
using WMPLib; | ||
|
||
namespace FilterBro | ||
{ | ||
public partial class frmCustomSounds : Form | ||
{ | ||
// Reference to the parent form | ||
private frmFilterBro frmParent; | ||
// Stores a mapping of built in sound : sound to replace it with | ||
private Dictionary<string, string> dictReplaceActions; | ||
// Stores a mapping of combo box value : sound file | ||
private Dictionary<string, string> dictDefaultSounds; | ||
// Stores a mapping of combo box value : text used in filter | ||
private Dictionary<string, string> dictDefaultText; | ||
// A list of the default sounds | ||
private List<string> lstDefaultSounds; | ||
// A list of the custom sounds available | ||
private List<string> lstCustomSounds; | ||
// Supported file extensions for sounds | ||
public static string strSupportedExtensions = "*.mp3,*.wav"; | ||
// URL to stream built-in sounds from | ||
private static string strStreamURL = ""; | ||
|
||
public frmCustomSounds(frmFilterBro owner) | ||
{ | ||
InitializeComponent(); | ||
|
||
this.frmParent = owner; | ||
dictReplaceActions = new Dictionary<string, string>(); | ||
dictDefaultSounds = new Dictionary<string, string>(); | ||
dictDefaultText = new Dictionary<string, string>(); | ||
lstDefaultSounds = new List<string>(); | ||
lstCustomSounds = new List<string>(); | ||
|
||
lblEditingFor.Text = "Editing custom sounds for " + frmParent.GetSelectedFilter(); | ||
} | ||
|
||
/* | ||
* Takes in a list of filter files to open up and replace sound files in. | ||
*/ | ||
private void ReplaceFilterSounds(List<string> filters) | ||
{ | ||
// Go through each passed in filter | ||
foreach (string filter in filters) | ||
{ | ||
// Load the entire filter | ||
string strFilterContents = File.ReadAllText(filter); | ||
// Go through the replace action dictionary and find and replace all instances of each default | ||
// sound with the corresponding custom sound | ||
foreach(KeyValuePair<string, string> action in dictReplaceActions) | ||
strFilterContents = strFilterContents.Replace(dictDefaultText[action.Key], "CustomAlertSound \"" + action.Value + "\" "); | ||
|
||
// Save the updated file | ||
//File.WriteAllText(Path.Combine(frmFilterBro.strPathOfExilePath, Path.GetFileNameWithoutExtension(filter) + "-custom.filter"), strFilterContents); | ||
File.WriteAllText(filter, strFilterContents); | ||
} | ||
|
||
MessageBox.Show("Filters updated successully!"); | ||
} | ||
|
||
private void frmCustomSounds2_Load(object sender, EventArgs e) | ||
{ | ||
// Add the default sounds. In future updates, if GGG adds more sounds | ||
// all we need to do is get the files, rename them like the others, | ||
// and increment this number. | ||
for (int i=1; i <= 16; i++) | ||
{ | ||
string strDisplay = "Alert Sound " + i; | ||
lstDefaultSounds.Add(strDisplay); | ||
dictDefaultSounds.Add(strDisplay, "AlertSound" + i + ".mp3"); | ||
dictDefaultText.Add(strDisplay, "PlayAlertSound " + i + " "); | ||
} | ||
|
||
// For every audio file in the PoE directory, add it to the list. Add any other popular | ||
// file extensions here. | ||
foreach (string sound in Directory.GetFiles(frmFilterBro.strPathOfExilePath, "*.*") | ||
.Where(s => strSupportedExtensions.Contains(Path.GetExtension(s).ToLower()))) | ||
{ | ||
lstCustomSounds.Add(Path.GetFileName(sound)); | ||
} | ||
|
||
// Populate our combo boxes | ||
cboReplace.DataSource = lstDefaultSounds; | ||
cboWith.DataSource = lstCustomSounds; | ||
|
||
// Get the DataGridView ready to accept data. | ||
dgvActions.Columns.Add("Replace", "Replace"); | ||
dgvActions.Columns.Add("With", "With"); | ||
} | ||
|
||
/* | ||
* Updates the DataGridView with the replace action dictionary's contents. | ||
* This happens whenever the dictionary is updated. | ||
*/ | ||
private void UpdateDataGrid() | ||
{ | ||
dgvActions.Rows.Clear(); | ||
foreach(KeyValuePair<string, string> action in dictReplaceActions) | ||
dgvActions.Rows.Add(action.Key, action.Value); | ||
} | ||
|
||
/* | ||
* Connects to a web server to stream the built-in sound file. This is to work | ||
* in accordance to GGG's wishes that the built-in sound files do not get distributed | ||
* with a third party application. | ||
*/ | ||
private void btnPreviewReplace_Click(object sender, EventArgs e) | ||
{ | ||
if (strStreamURL != "") | ||
{ | ||
// Play the built-in sound file relative to the location of FilterBro.exe | ||
WindowsMediaPlayer snd = new WindowsMediaPlayer(); | ||
snd.PlayStateChange += new WMPLib._WMPOCXEvents_PlayStateChangeEventHandler(WebSoundStatusChangeHandler); | ||
snd.MediaError += new WMPLib._WMPOCXEvents_MediaErrorEventHandler(WebSoundErrorHandler); | ||
snd.URL = strStreamURL + dictDefaultSounds[cboReplace.SelectedItem.ToString()]; | ||
snd.controls.play(); | ||
} | ||
} | ||
|
||
/* | ||
* Handles the preview button when streaming a sound file. Prevents the user from | ||
* mashing the preview button if the sound doesn't play instantly to avoid tons | ||
* of requests to the web server. | ||
*/ | ||
private void WebSoundStatusChangeHandler(int state) | ||
{ | ||
if ((WMPLib.WMPPlayState)state == WMPLib.WMPPlayState.wmppsStopped) | ||
{ | ||
btnPreviewReplace.Enabled = true; | ||
cboReplace.Enabled = true; | ||
} | ||
else | ||
{ | ||
btnPreviewReplace.Enabled = false; | ||
cboReplace.Enabled = false; | ||
} | ||
} | ||
|
||
/* | ||
* Handles any errors encountered while streaming an audio file. | ||
*/ | ||
private void WebSoundErrorHandler(object wmpObj) | ||
{ | ||
MessageBox.Show("Could not play " + dictDefaultSounds[cboReplace.SelectedItem.ToString()]); | ||
btnPreviewReplace.Enabled = true; | ||
cboReplace.Enabled = true; | ||
} | ||
|
||
private void btnWithPreview_Click(object sender, EventArgs e) | ||
{ | ||
// Play the custom sound file located in the Path of Exile install folder | ||
MediaPlayer snd = new MediaPlayer(); | ||
snd.Open(new System.Uri(Path.Combine(frmFilterBro.strPathOfExilePath, cboWith.SelectedValue.ToString()))); | ||
snd.Play(); | ||
} | ||
|
||
/* | ||
* Add a new replace action given the values of the two combo boxes. | ||
* If there is already an action to replace the selected default sound, | ||
* it will be updated with the newly selected sound. | ||
*/ | ||
private void btnAdd_Click(object sender, EventArgs e) | ||
{ | ||
if (dictReplaceActions.ContainsKey(cboReplace.SelectedItem.ToString())) | ||
dictReplaceActions[cboReplace.SelectedItem.ToString()] = cboWith.SelectedItem.ToString(); | ||
else | ||
dictReplaceActions.Add(cboReplace.SelectedItem.ToString(), cboWith.SelectedItem.ToString()); | ||
UpdateDataGrid(); | ||
} | ||
|
||
/* | ||
* Remove the selected action from the action dictionary based on the selected row | ||
* in the data grid. | ||
*/ | ||
private void btnRemove_Click(object sender, EventArgs e) | ||
{ | ||
try | ||
{ | ||
dictReplaceActions.Remove(dgvActions.SelectedRows[0].Cells[0].Value.ToString()); | ||
UpdateDataGrid(); | ||
} | ||
catch (ArgumentOutOfRangeException) { } | ||
} | ||
|
||
/* | ||
* Get a list of the installed filter files pertaining to the currently selected filter | ||
* and begin replacing sounds based on the action dictionary. Notify the user if the filter | ||
* is not currently installed. | ||
*/ | ||
private void btnApply_Click(object sender, EventArgs e) | ||
{ | ||
List<string> lstSelectedFilterFiles = frmParent.GetSelectedFilterFiles(); | ||
if (!lstSelectedFilterFiles.Any()) | ||
MessageBox.Show("The currently selected loot filter is not installed."); | ||
else | ||
ReplaceFilterSounds(lstSelectedFilterFiles); | ||
this.Close(); | ||
} | ||
|
||
private void btnCancel_Click(object sender, EventArgs e) | ||
{ | ||
this.Close(); | ||
} | ||
|
||
/* | ||
* Before the form closes, if there are pending actions make sure the user wants to close | ||
* the window without applying the changes. | ||
*/ | ||
private void frmCustomSounds_FormClosing(object sender, FormClosingEventArgs e) | ||
{ | ||
if (dictReplaceActions.Count > 0) | ||
{ | ||
if (MessageBox.Show("Close the editor without applying the selected custom sounds?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.No) | ||
e.Cancel = true; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<?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> | ||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> | ||
<value>True</value> | ||
</metadata> | ||
</root> |
Oops, something went wrong.