Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Merge changes. #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
9 changes: 9 additions & 0 deletions Aura Debugger/Aura Debugger/Aura Debugger.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Cosmos.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
Expand All @@ -45,16 +48,19 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ConfigManager.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="NetworkManager.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
Expand All @@ -78,5 +84,8 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Cosmos.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
81 changes: 81 additions & 0 deletions Aura Debugger/Aura Debugger/ConfigManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;

namespace Aura_Debugger
{
public static class ConfigManager
{
public static string FileName = "cnd_config.ini";

public static bool WordWrap = true;
public static bool AutoScroll = true;

public static void SaveConfig()
{
WordWrap = Program.MainForm.GetWordWrap();
AutoScroll = Program.MainForm.GetAutoScroll();

string config = "word_wrap," + WordWrap.ToString() + "\n";
config += "auto_scroll," + AutoScroll.ToString() + "\n";
config += "win_pos," + Program.MainForm.Location.X.ToString() + "," + Program.MainForm.Location.Y.ToString() + "\n";
config += "win_size," + Program.MainForm.Size.Width.ToString() + "," + Program.MainForm.Size.Height.ToString() + "\n";
File.WriteAllText(FileName, config);
}

public static void LoadConfig()
{
if (!File.Exists(FileName))
{
NetworkManager.WriteInfo("Generating new configuration file");
SaveConfig();
}

string[] config = File.ReadAllLines(FileName);

for (int i = 0; i < config.Length; i++)
{
string[] parts = config[i].Split(',');
if (parts.Length == 0) { continue; }

if (parts[0] == "word_wrap")
{
if (parts.Length < 2) { NetworkManager.WriteError("Error parsing word wrap property in configuration file"); return; }
WordWrap = bool.Parse(parts[1]);
Program.MainForm.SetWordWrap(WordWrap);
}

if (parts[0] == "auto_scroll")
{
if (parts.Length < 2) { NetworkManager.WriteError("Error parsing auto scroll property in configuration file"); return; }
AutoScroll = bool.Parse(parts[1]);
Program.MainForm.SetAutoScroll(AutoScroll);
}

if (parts[0] == "win_pos")
{
if (parts.Length < 3) { NetworkManager.WriteError("Error parsing window position property in configuration file"); return; }
int x = 0, y = 0;
if (!int.TryParse(parts[1], out x)) { NetworkManager.WriteError("Error parsing window X position value in configuration file"); return; }
if (!int.TryParse(parts[2], out y)) { NetworkManager.WriteError("Error parsing window Y position value in configuration file"); return; }
Program.MainForm.SetDesktopLocation(x, y);
}

if (parts[0] == "win_size")
{
if (parts.Length < 3) { NetworkManager.WriteError("Error parsing window size property in configuration file"); return; }
int x = 0, y = 0;
if (!int.TryParse(parts[1], out x)) { NetworkManager.WriteError("Error parsing window width value in configuration file"); return; }
if (!int.TryParse(parts[2], out y)) { NetworkManager.WriteError("Error parsing window height value in configuration file"); return; }
Program.MainForm.Size = new Size(x, y);
}
}

NetworkManager.WriteInfo("Loaded configuration file");
}
}
}
Binary file added Aura Debugger/Aura Debugger/Cosmos.ico
Binary file not shown.
Loading