Skip to content

Commit

Permalink
Merge pull request #29 from caidevOficial/npd_CSharp_SB
Browse files Browse the repository at this point in the history
Advance to version v2.6.1.5
  • Loading branch information
[FacuFalcone] authored Sep 20, 2021
2 parents e5c7319 + 54f50da commit c1884bf
Show file tree
Hide file tree
Showing 43 changed files with 317 additions and 57 deletions.
Binary file removed Media/sample_1.png
Binary file not shown.
Binary file removed Media/sample_1_1.png
Binary file not shown.
Binary file added Media/sample_1_2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 43 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@


<table>
<th>App UI</th><th>Exception Form</th><th>Loading Screen</th><th>Success Screen</th>
<th>App GUI</th><th>Exception Form</th><th>Loading Screen</th><th>Success Screen</th>
<tr>
<td>
<img src="Media/sample_1_1.png"/>
<img src="Media/sample_1_2.png"/>
</td>
<td>
<img src="Media/sample_2_1.png"/>
Expand Down Expand Up @@ -69,9 +69,44 @@ This project is under license \[MIT License\] - read the file [LICENSE.md](LICEN
---

## Where to find me: 🌎
|<img class="circular" alt="Facu" src="https://avatars1.githubusercontent.com/u/12877139?s=400&u=d369ee24466653d9bbeeb9654930e3ff1c67b76a&v=4" width="80px" height="80px" />||
|------------|------------|
|🤴 Facu Falcone|Junior Developer|
|<img alt="GitHub" src="https://img.shields.io/badge/GitHub-%2312100E.svg?&style=for-the-badge&logo=Github&logoColor=white" width="95px" height="30px" />|<center><a href="https://github.com/caidevOficial/">Github</a></center>|
|<img alt="LinkedIn" src="https://img.shields.io/badge/linkedin-%230077B5.svg?&style=for-the-badge&logo=linkedin&logoColor=white" width="95px" height="30px" />|<a href="https://www.linkedin.com/in/facundo-falcone/">LinkedIn</a>|
|<img alt='Invitame un café en cafecito.app' srcset='https://cdn.cafecito.app/imgs/buttons/button_5.png 1x, https://cdn.cafecito.app/imgs/buttons/button_5_2x.png 2x, https://cdn.cafecito.app/imgs/buttons/button_5_3.75x.png 3.75x' src='https://cdn.cafecito.app/imgs/buttons/button_5.png' width="95px" height="30px" />|<a href="https://cafecito.app/caidevoficial/">CafecitoApp</a>|

<table>
<theader>
<tr align='center'>
<td>
<img class="circular" alt="Facu" src="https://avatars1.githubusercontent.com/u/12877139?s=400&u=d369ee24466653d9bbeeb9654930e3ff1c67b76a&v=4" width="80px" height="80px" />
</td>
</tr>
<th><center>🤴 Facu Falcone - Junior Developer</center></th>
</theader>
<tbody>
<tr align='center'>
<td>
<a href="https://github.com/caidevOficial/">
<img alt="GitHub" src="https://img.shields.io/badge/GitHub-%2312100E.svg?&style=for-the-badge&logo=Github&logoColor=white" width="125px" height="30px" />
</a>
</td>
</tr>
<tr align='center'>
<td>
<a href="https://www.linkedin.com/in/facundo-falcone/">
<img alt="LinkedIn" src="https://img.shields.io/badge/linkedin-%230077B5.svg?&style=for-the-badge&logo=linkedin&logoColor=white" width="125px" height="30px" />
</a>
</td>
</tr>
<tr align='center'>
<td>
<a href="https://cafecito.app/caidevoficial/">
<img alt='Invitame un café en cafecito.app' srcset='https://cdn.cafecito.app/imgs/buttons/button_5.png 1x, https://cdn.cafecito.app/imgs/buttons/button_5_2x.png 2x, https://cdn.cafecito.app/imgs/buttons/button_5_3.75x.png 3.75x' src='https://cdn.cafecito.app/imgs/buttons/button_5.png' width="125px" height="30px" />
</a>
</td>
</tr>
<tr align='center'>
<td>
<a href='https://ko-fi.com/P5P74JBOH' target='_blank'>
<img width="125px" height="30px" style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi1.png?v=2' border='0' alt='Buy Me a Coffee at ko-fi.com' />
</a>
</td>
</tr>
</tbody>
</table>
Binary file modified StructureBuilder/.vs/StructureBuilder/v16/.suo
Binary file not shown.
39 changes: 0 additions & 39 deletions StructureBuilder/Entities/SB.Models.Classes/MyPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ public sealed class MyPlayer {

public event SoundPlayerHandler ESoundPlayer;
private readonly WindowsMediaPlayer player;
private bool isPlaying;
private bool isLooping;
private const string FORMAT = ".mp3";

#endregion
Expand Down Expand Up @@ -67,30 +65,6 @@ public string SoundLocation {
}
}

/// <summary>
/// Gets/Sets: the boolean state of it's playing or not.
/// </summary>
public bool IsPlaying {
get => this.isPlaying;
set {
if (value.GetType() == typeof(bool)) {
this.isPlaying = value;
}
}
}

/// <summary>
/// Gets/Sets: the boolean state of it's Looping or not.
/// </summary>
public bool IsLooping {
get => this.isLooping;
set {
if (value.GetType() == typeof(bool)) {
this.isLooping = value;
}
}
}

#endregion

#region Methods
Expand All @@ -101,25 +75,12 @@ public bool IsLooping {
public void Play(string soundName) {
this.SoundLocation = $"{Environment.CurrentDirectory}\\Sounds\\{soundName}{FORMAT}";
try {
this.IsLooping = false;
this.player.controls.play();
this.IsPlaying = true;
} catch (Exception e) {
throw new NoSoundFoundException($"The '{soundName}{FORMAT}' is missing in the Sound's Directory.", e);
}
}

/// <summary>
/// If the SoundPlayer instance isPlaying, stops it.
/// </summary>
public void Stop() {
if (this.IsPlaying) {
this.IsPlaying = false;
this.IsLooping = false;
this.player.controls.stop();
}
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,13 @@ public void CreateShowEntity(Structure myStructure, StringBuilder streamText) {
if (aParam.TypeParameter.Equals("char")) {
streamText.Append($"%s");
//CASE INT
} else if (aParam.TypeParameter.Equals("int")) {
} else if (aParam.TypeParameter.Equals("int") || aParam.TypeParameter.Equals("short")) {
streamText.Append($"%d");
//CASE SHORT SHORT INT
} else if (aParam.TypeParameter.Equals("float")) {
streamText.Append($"%f");
} else if (aParam.TypeParameter.Equals("long int")) {
streamText.Append($"%ld");
}

if (myStructure.ListParamaters.IndexOf(aParam) != (myStructure.ListParamaters.Count - 1)) {
Expand Down
Binary file not shown.
Binary file not shown.
Binary file added StructureBuilder/Entities/bin/Debug/Entities.pdb
Binary file not shown.
Binary file not shown.
Binary file added StructureBuilder/Entities/obj/Debug/Entities.pdb
Binary file not shown.
Binary file not shown.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ab7992d465dd792c15d1cbb86db084d2d9bcc108
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
F:\Datos\Git_UTN\GitHub\CSharp_StructureBuilder\StructureBuilder\Entities\bin\Debug\Entities.dll
F:\Datos\Git_UTN\GitHub\CSharp_StructureBuilder\StructureBuilder\Entities\bin\Debug\Entities.pdb
F:\Datos\Git_UTN\GitHub\CSharp_StructureBuilder\StructureBuilder\Entities\bin\Debug\AxInterop.WMPLib.dll
F:\Datos\Git_UTN\GitHub\CSharp_StructureBuilder\StructureBuilder\Entities\obj\Debug\SB.Models.csproj.AssemblyReference.cache
F:\Datos\Git_UTN\GitHub\CSharp_StructureBuilder\StructureBuilder\Entities\obj\Debug\SB.Models.csproj.CoreCompileInputs.cache
F:\Datos\Git_UTN\GitHub\CSharp_StructureBuilder\StructureBuilder\Entities\obj\Debug\SB.Models.csproj.CopyComplete
F:\Datos\Git_UTN\GitHub\CSharp_StructureBuilder\StructureBuilder\Entities\obj\Debug\Entities.dll
F:\Datos\Git_UTN\GitHub\CSharp_StructureBuilder\StructureBuilder\Entities\obj\Debug\Entities.pdb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using Entities;
using FileBuilders;
Expand Down Expand Up @@ -53,6 +54,8 @@ public partial class StructureBuilder : Form {

#region Attributes

private List<TextBox> textBoxes;
private List<TextBox> textChars;
private readonly List<Thread> threads;
private readonly MyPlayer myDelPlayer;
private Parameter myParameter;
Expand All @@ -62,7 +65,7 @@ public partial class StructureBuilder : Form {
private readonly short fullPackSize = 8; // Basic functions struct newEmpty + new + show + showall
private readonly short packsDone = 0;
private bool locked = false;
private readonly string appVersion = "Version [2.6.1.0]";
private readonly string appVersion = "Version [2.6.1.5]";

#endregion

Expand All @@ -74,6 +77,8 @@ public partial class StructureBuilder : Form {
public StructureBuilder() {

InitializeComponent();
this.textBoxes = new List<TextBox>();
this.textChars = new List<TextBox>();
this.threads = new List<Thread>();
this.myDelPlayer = new MyPlayer();
this.myDelPlayer.ESoundPlayer += this.MyPlayerMainMusic;
Expand All @@ -95,13 +100,13 @@ public StructureBuilder() {
private void StructureBuilder_Load(object sender, EventArgs e) {
this.Hide();
try {

this.FormInitialState();
this.lblNewVersion.Text = this.appVersion;
FrmWelcome welcome = new FrmWelcome();
if (welcome.ShowDialog() == DialogResult.OK) {
this.PlayMusic(this.loginSound);
}
this.FormInitialState();
this.lblNewVersion.Text = this.appVersion;

} catch (NoSoundFoundException ns) {
frmException fe = new frmException(ns) {
Location = this.Location
Expand Down Expand Up @@ -136,9 +141,9 @@ private void FormInitialState() {
/// Plays a sound in another thread.
/// </summary>
/// <param name="musicName">Name of the sound.</param>
private void PlayMusic(string musicName) {
private void PlayMusic(object musicName) {
Thread playerThread = new Thread(new ParameterizedThreadStart(this.MyPlayerMainMusic));
playerThread.Start(musicName);
playerThread.Start((object)musicName);
this.threads.Add(playerThread);
}

Expand All @@ -148,8 +153,11 @@ private void PlayMusic(string musicName) {
/// <param name="soundName">Name of the sound to play.</param>
private void MyPlayerMainMusic(object soundName) {
if (this.InvokeRequired) {
SoundPlayerHandler sp = new SoundPlayerHandler(this.MyPlayerMainMusic);
this.BeginInvoke(sp, new object[] { (string)soundName });
this.BeginInvoke(
(MethodInvoker)delegate {
MyPlayer player = new MyPlayer();
player.Play((string)soundName);
});
} else {
MyPlayer player = new MyPlayer();
player.Play((string)soundName);
Expand Down Expand Up @@ -325,8 +333,16 @@ private bool CreateStructure() {
// Set parameter
this.myParameter = CreateParameter(myStructure, this.myParameter, this.txtFirstParamName.Text.RemoveSpaces(), this.cmbFirstParamType.SelectedItem.ToString(), this.txtFirstParamLength.Text.RemoveSpaces());
// add to list
if (!(myStructure + this.myParameter))
if (!(myStructure + this.myParameter)) {
MessageBox.Show($"An Error has occurred adding the 1st parameter: {this.myParameter.NameParameter}!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} else {
if (this.cmbFirstParamType.SelectedItem.ToString().Equals("char")) {
this.textChars.Add(this.txtFirstParamLength);
}
this.textBoxes.Add(this.txtFirstParamName);
this.textBoxes.Add(this.txtStructureName);
}


return true;
}
Expand Down Expand Up @@ -368,6 +384,11 @@ private void CreateParameterFromForm(string paramNumber, Structure aStructure, C
aParameter = CreateParameter(aStructure, aParameter, txtName.Text, cmbType.SelectedItem.ToString(), txtLength.Text);
if (!(aStructure + aParameter)) {
MessageBox.Show($"An Error has occurred adding the {paramNumber} parameter: {aParameter.NameParameter}!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} else {
this.textBoxes.Add(txtName);
if (cmbType.SelectedItem.ToString().Equals("char")) {
this.textChars.Add(txtLength);
}
}
} else {
throw new EmptyFieldException("You have at least one field Empty.");
Expand Down Expand Up @@ -403,6 +424,7 @@ private void btnCreate_Click(object sender, EventArgs e) {
};
fs.ShowDialog();
this.LockForm(this.locked);
this.ClearTextBoxes();
myStructure.ListParamaters.Clear();
}
} catch (Exception ex) {
Expand Down Expand Up @@ -536,6 +558,35 @@ private void btnLock_Click(object sender, EventArgs e) {

#endregion

#region Clear

/// <summary>
/// Clear all the unlocked textBox and set its length to 1.
/// </summary>
private void ClearTextBoxes() {
try {
if (this.textBoxes.Count > 0) {
foreach (TextBox item in this.textBoxes) {
item.Text = "";
}
this.textBoxes.Clear();
}
if (this.textChars.Count > 0) {
foreach (TextBox item in this.textChars) {
item.Text = "1";
}
this.textChars.Clear();
}
} catch (Exception e) {
frmException fe = new frmException(e) {
Location = this.Location
};
fe.ShowDialog();
}
}

#endregion

#region CloseEvent

/// <summary>
Expand Down
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit c1884bf

Please sign in to comment.