Skip to content

Commit

Permalink
Fix file loading
Browse files Browse the repository at this point in the history
Related to Issue #3
This needs to have the directory "Resources" and the files espout.txt
and engout.txt in them.
  • Loading branch information
AConsolePeasant authored and AConsolePeasant committed Aug 31, 2016
1 parent 002d855 commit bf81059
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 6 additions & 2 deletions EO-Flashcards/EO-Flashcards/EO-Flashcards.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,12 @@
<None Include="Resources\espdic.txt" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\engout.txt" />
<EmbeddedResource Include="Resources\espout.txt" />
<EmbeddedResource Include="Resources\engout.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="Resources\espout.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.5.2">
Expand Down
8 changes: 3 additions & 5 deletions EO-Flashcards/EO-Flashcards/frmArcade.vb
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
' https://github.com/AConsolePeasant/EO-Flashcards

Public Class frmArcade
' Loading each file into their own arrays
'Dim english As String() = My.Resources.engout 'This causes errors because My.Resource.engout is compiled into the executable, and doesn't allow being imported back into a string.
Dim english As String() = System.IO.File.ReadAllLines("C:\Users\ACP\Documents\GitHub\EO-Flashcards\EO-Flashcards\EO-Flashcards\Resources\engout.txt")
Dim esperanto As String() = System.IO.File.ReadAllLines("C:\Users\ACP\Documents\GitHub\EO-Flashcards\EO-Flashcards\EO-Flashcards\Resources\espout.txt")
' I know this doesn't work on more than one computer, but If I use My.Resources It would error out.
Dim english As String() = System.IO.File.ReadAllLines(My.Application.Info.DirectoryPath + "\Resources\engout.txt")
Dim esperanto As String() = System.IO.File.ReadAllLines(My.Application.Info.DirectoryPath + "\Resources\espout.txt")
'Read all lines in the relative directory.
Dim score As Integer = 0
Public Sub frmArcade_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Randomize()
Expand Down

0 comments on commit bf81059

Please sign in to comment.