Skip to content

Commit

Permalink
Fixed some logic errors with commas. Was producing an error if someon…
Browse files Browse the repository at this point in the history
…e did NOT choose smooth-lighting as their rendermode.

Fixed some code to use better logic.
  • Loading branch information
but2002 committed Mar 19, 2012
1 parent 86bd123 commit 8fabf47
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 43 deletions.
4 changes: 2 additions & 2 deletions Form1.Designer.cs → MainWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 16 additions & 35 deletions Form1.cs → MainWindow.cs
Expand Up @@ -12,15 +12,15 @@

namespace OverviewerGUI
{
public partial class Form1 : Form
public partial class MainWindow : Form
{
private string worldDir;
private string outDir;
private string configFile;
TextWriter _writer = null;
private String[] splashes = new String[8];

public Form1()
public MainWindow()
{
InitializeComponent();
splashes[0] = "Can't track the killers IP!";
Expand Down Expand Up @@ -158,40 +158,41 @@ private void ProcessExited(Object sender, EventArgs e)
private String getRenderModes()
{
//WALL OF IF STATEMENTS FTW
System.Text.StringBuilder rendermodes = new System.Text.StringBuilder();
List<string> rendermodes = new List<string>();
if (normalCheck.Checked == true)
{
rendermodes.Append("normal,");
rendermodes.Add("normal");
}
if (lightingCheck.Checked == true)
{
rendermodes.Append("lighting,");
rendermodes.Add("lighting");
}
if (smoothLighingCheck.Checked == true)
{
rendermodes.Append("smooth-lighting,");
rendermodes.Add("smooth-lighting");
}
if (caveCheck.Checked == true)
{
rendermodes.Append("cave,");
rendermodes.Add("cave");
}
if (nightCheck.Checked == true)
{
rendermodes.Append("night,");
rendermodes.Add("night");
}
if (smoothNightCheck.Checked == true)
{
rendermodes.Append("smooth-night");
rendermodes.Add("smooth-night");
}
if (rendermodes.Length == 0)


if (rendermodes.Count == 0)
{
Console.WriteLine("You need to specify a rendermode! Automatically rendering normal");
rendermodes.Append("normal");
rendermodes.Add("normal");
}
else
{
rendermodes.Remove(rendermodes.Length, 0);
Console.WriteLine("Ok, I'll be rendering " + rendermodes.ToString());
Console.WriteLine("Ok, I'll be rendering " + string.Join(",", rendermodes.ToArray()));
}
return rendermodes.ToString();
}
Expand Down Expand Up @@ -234,28 +235,8 @@ private void button3_Click(object sender, EventArgs e)
public String getSplash()
{
Random random = new Random();
int n = random.Next(0, 8);
switch (n)
{
case 0:
return splashes[0];
case 1:
return splashes[1];
case 2:
return splashes[2];
case 3:
return splashes[3];
case 4:
return splashes[4];
case 5:
return splashes[5];
case 6:
return splashes[6];
case 7:
return splashes[7];
default:
return "missingno";
}
int n = random.Next(0, splashes.Length);
return splashes[n];
}
}
}
File renamed without changes.
10 changes: 5 additions & 5 deletions OverviewerGUI.csproj
Expand Up @@ -53,16 +53,16 @@
</ItemGroup>
<ItemGroup>
<Compile Include="ConsoleRedirect.cs" />
<Compile Include="Form1.cs">
<Compile Include="MainWindow.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
<Compile Include="MainWindow.Designer.cs">
<DependentUpon>MainWindow.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
<EmbeddedResource Include="MainWindow.resx">
<DependentUpon>MainWindow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
Expand Down
20 changes: 20 additions & 0 deletions OverviewerGUI.sln
@@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C# Express 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OverviewerGUI", "OverviewerGUI.csproj", "{E0291443-66EF-4178-884F-0A601CF0A394}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E0291443-66EF-4178-884F-0A601CF0A394}.Debug|x86.ActiveCfg = Debug|x86
{E0291443-66EF-4178-884F-0A601CF0A394}.Debug|x86.Build.0 = Debug|x86
{E0291443-66EF-4178-884F-0A601CF0A394}.Release|x86.ActiveCfg = Release|x86
{E0291443-66EF-4178-884F-0A601CF0A394}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file added OverviewerGUI.suo
Binary file not shown.
2 changes: 1 addition & 1 deletion Program.cs
Expand Up @@ -15,7 +15,7 @@ static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
Application.Run(new MainWindow());
}
}
}

0 comments on commit 8fabf47

Please sign in to comment.