Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions MorseCode_SoftWriters/MorseCode_SoftWriters.sln
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}") = "MorseCode_SoftWriters", "MorseCode_SoftWriters\MorseCode_SoftWriters.csproj", "{24E60371-C95B-4333-94AB-291D96D2B308}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{24E60371-C95B-4333-94AB-291D96D2B308}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{24E60371-C95B-4333-94AB-291D96D2B308}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24E60371-C95B-4333-94AB-291D96D2B308}.Release|Any CPU.ActiveCfg = Release|Any CPU
{24E60371-C95B-4333-94AB-291D96D2B308}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
6 changes: 6 additions & 0 deletions MorseCode_SoftWriters/MorseCode_SoftWriters/App.config
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>
85 changes: 85 additions & 0 deletions MorseCode_SoftWriters/MorseCode_SoftWriters/MorseCode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;

namespace MorseCode_SoftWriters
{
class MorseCode
{
private string[] readIn;
private string[] englishArray = new string[0];

// Dictionary that uses morse-code string as a key and an english character as the value
private static IDictionary<string, string> morseChart = new Dictionary<string, string>()
{
{".-", "a"},
{"-...", "b"},
{"-.-.", "c"},
{"-..", "d"},
{".", "e"},
{"..-.", "f"},
{"--.", "g"},
{"....", "h"},
{"..", "i"},
{".---", "j"},
{"-.-", "k"},
{".-..", "l"},
{"--", "m"},
{"-.", "n"},
{"---", "o"},
{".--.", "p"},
{"--.-", "q"},
{".-.", "r"},
{"...", "s"},
{"-", "t"},
{"..-", "u"},
{"...-", "v"},
{".--", "w"},
{"-..-", "x"},
{"-.--", "y"},
{"--..", "z"},
{"", " " },
{".----", "1" },
{"..---", "2" },
{"...--", "3" },
{"....-", "4" },
{".....", "5" },
{"-....", "6" },
{"--...", "7" },
{"---..", "8" },
{"----.", "9" },
{"-----", "0" }
};
public MorseCode(string path)
{
// sets readIn to an array of morse-code strings seperated by line from the file located in 'path'
readIn = System.IO.File.ReadAllLines(@path);


// sets englishArray to a new array with the same size as 'readIn'
englishArray = new string[readIn.Length];

for (int i = 0; i < readIn.Length; i++)
{
// in each line, split the variables at the "||" and save each new string into a temporary array
string[] temp = readIn[i].Split(new[] { "||" }, StringSplitOptions.None);

string s = "";

for (int j = 0; j < temp.Length; j++)
{
// adds the english equivalent to the string 's' using the dictionary 'morseChart'
s += morseChart[temp[j]];
}
if (s.Length != 0)
{
englishArray[i] = s;
}
}
}
public string[] ReturnEnglishArray()
{
//return englishArray
return englishArray;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?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>{24E60371-C95B-4333-94AB-291D96D2B308}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MorseCode_SoftWriters</RootNamespace>
<AssemblyName>MorseCode_SoftWriters</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</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.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MorseCode.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- 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>
30 changes: 30 additions & 0 deletions MorseCode_SoftWriters/MorseCode_SoftWriters/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using System;

namespace MorseCode_SoftWriters
{
class Program
{
static void Main(string[] args)
{
// path I used on my computer to test the input
string path = "C:\\Users\\Taylor\\Desktop\\input.txt";

// I'd expect some sort of check to be done in the system to make sure the file can actually be opened before passing in the path to the new class

// creates a new MorseCode object and passes in the path
MorseCode mc = new MorseCode(path);

// string array that stores the lines of english words
string[] sa = mc.ReturnEnglishArray();

foreach(string output in sa)
{
Console.WriteLine(output);
}

Console.Out.Write("Press any key to continue");
Console.ReadKey();

}
}
}
Original file line number Diff line number Diff line change
@@ -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("MorseCode_SoftWriters")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("MorseCode_SoftWriters")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2018")]
[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("24e60371-c95b-4333-94ab-291d96d2b308")]

// 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")]
Binary file not shown.
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>
Binary file not shown.
Binary file not shown.
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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
befecec0cffb1a0fb8c9f1a9f29ae01a4b950d67
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
\\PSBDFILESRVR.PSU-ERIE.BD.PSU.EDU\STUDENT\tzn5093\Private\Documents\Visual Studio 2015\Projects\MorseCode_SoftWriters\MorseCode_SoftWriters\bin\Debug\MorseCode_SoftWriters.exe.config
\\PSBDFILESRVR.PSU-ERIE.BD.PSU.EDU\STUDENT\tzn5093\Private\Documents\Visual Studio 2015\Projects\MorseCode_SoftWriters\MorseCode_SoftWriters\obj\Debug\MorseCode_SoftWriters.csprojResolveAssemblyReference.cache
\\PSBDFILESRVR.PSU-ERIE.BD.PSU.EDU\STUDENT\tzn5093\Private\Documents\Visual Studio 2015\Projects\MorseCode_SoftWriters\MorseCode_SoftWriters\bin\Debug\MorseCode_SoftWriters.exe
\\PSBDFILESRVR.PSU-ERIE.BD.PSU.EDU\STUDENT\tzn5093\Private\Documents\Visual Studio 2015\Projects\MorseCode_SoftWriters\MorseCode_SoftWriters\bin\Debug\MorseCode_SoftWriters.pdb
\\PSBDFILESRVR.PSU-ERIE.BD.PSU.EDU\STUDENT\tzn5093\Private\Documents\Visual Studio 2015\Projects\MorseCode_SoftWriters\MorseCode_SoftWriters\obj\Debug\MorseCode_SoftWriters.exe
\\PSBDFILESRVR.PSU-ERIE.BD.PSU.EDU\STUDENT\tzn5093\Private\Documents\Visual Studio 2015\Projects\MorseCode_SoftWriters\MorseCode_SoftWriters\obj\Debug\MorseCode_SoftWriters.pdb
P:\Private\Documents\Visual Studio 2015\Projects\MorseCode_SoftWriters\MorseCode_SoftWriters\bin\Debug\MorseCode_SoftWriters.exe.config
P:\Private\Documents\Visual Studio 2015\Projects\MorseCode_SoftWriters\MorseCode_SoftWriters\obj\Debug\MorseCode_SoftWriters.exe
P:\Private\Documents\Visual Studio 2015\Projects\MorseCode_SoftWriters\MorseCode_SoftWriters\obj\Debug\MorseCode_SoftWriters.pdb
P:\Private\Documents\Visual Studio 2015\Projects\MorseCode_SoftWriters\MorseCode_SoftWriters\bin\Debug\MorseCode_SoftWriters.exe
P:\Private\Documents\Visual Studio 2015\Projects\MorseCode_SoftWriters\MorseCode_SoftWriters\bin\Debug\MorseCode_SoftWriters.pdb
P:\Private\Documents\Visual Studio 2015\Projects\MorseCode_SoftWriters\MorseCode_SoftWriters\obj\Debug\MorseCode_SoftWriters.csprojResolveAssemblyReference.cache
C:\Users\Taylor\Downloads\MorseCode_SoftWriters\MorseCode_SoftWriters\bin\Debug\MorseCode_SoftWriters.exe.config
C:\Users\Taylor\Downloads\MorseCode_SoftWriters\MorseCode_SoftWriters\bin\Debug\MorseCode_SoftWriters.exe
C:\Users\Taylor\Downloads\MorseCode_SoftWriters\MorseCode_SoftWriters\bin\Debug\MorseCode_SoftWriters.pdb
C:\Users\Taylor\Downloads\MorseCode_SoftWriters\MorseCode_SoftWriters\obj\Debug\MorseCode_SoftWriters.csprojResolveAssemblyReference.cache
C:\Users\Taylor\Downloads\MorseCode_SoftWriters\MorseCode_SoftWriters\obj\Debug\MorseCode_SoftWriters.csproj.CoreCompileInputs.cache
C:\Users\Taylor\Downloads\MorseCode_SoftWriters\MorseCode_SoftWriters\obj\Debug\MorseCode_SoftWriters.exe
C:\Users\Taylor\Downloads\MorseCode_SoftWriters\MorseCode_SoftWriters\obj\Debug\MorseCode_SoftWriters.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.