Skip to content

Commit

Permalink
Changed static members to instance members
Browse files Browse the repository at this point in the history
Changed static members of NCldrBinaryFileDataSource to instance members
  • Loading branch information
GuySmithFerrier committed Mar 28, 2013
1 parent 03966d9 commit 97516cd
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
10 changes: 5 additions & 5 deletions NCldr/NCldrBinaryFileDataSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ public class NCldrBinaryFileDataSource
/// <summary>
/// Gets or sets the path to the NCldr data file (includes the folder name only with no filename)
/// </summary>
public static string NCldrDataPath { get; set; }
public string NCldrDataPath { get; set; }

/// <summary>
/// Gets the data file name including the path
/// </summary>
public static string NCldrDataFilename
public string NCldrDataFilename
{
get
{
Expand All @@ -31,7 +31,7 @@ public static string NCldrDataFilename
/// Exists returns true if the NCldr data file exists
/// </summary>
/// <returns>True if the NCldr data file exists</returns>
public static bool Exists()
public bool Exists()
{
return File.Exists(NCldrDataFilename);
}
Expand All @@ -40,7 +40,7 @@ public static bool Exists()
/// Loads loads the raw data from the NCldr data file and returns an NCldrData object
/// </summary>
/// <returns>An INCldrData object from the NCldr data file</returns>
public static INCldrData Load()
public INCldrData Load()
{
if (!Exists())
{
Expand Down Expand Up @@ -71,7 +71,7 @@ public static INCldrData Load()
/// Save saves the NCldrData object to the NCldr data file
/// </summary>
/// <param name="ncldrData">The INCldrData object to save</param>
public static void Save(INCldrData ncldrData)
public void Save(INCldrData ncldrData)
{
FileStream fileStream = new FileStream(NCldrDataFilename, FileMode.Create);
BinaryFormatter formatter = new BinaryFormatter();
Expand Down
7 changes: 4 additions & 3 deletions NCldrBuilder/NCldrBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,14 @@ private static string GetDotNetCultureName(string cldrCultureName)

private static void Build(NCldrData ncldrData)
{
NCldrBinaryFileDataSource.NCldrDataPath = ncldrPath;
NCldrBinaryFileDataSource ncldrBinaryFileDataSource = new NCldrBinaryFileDataSource();
ncldrBinaryFileDataSource.NCldrDataPath = ncldrPath;

Progress("Writing data file", NCldrBinaryFileDataSource.NCldrDataFilename, ProgressEventType.Writing);
Progress("Writing data file", ncldrBinaryFileDataSource.NCldrDataFilename, ProgressEventType.Writing);

try
{
NCldrBinaryFileDataSource.Save(ncldrData);
ncldrBinaryFileDataSource.Save(ncldrData);
}
catch (SerializationException exception)
{
Expand Down
5 changes: 3 additions & 2 deletions NCldrBuilderGui/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,9 @@ private void btnBuild_Click(object sender, EventArgs e)
else
{
previousSection = null;
NCldrBinaryFileDataSource.NCldrDataPath = tbxCldrPath.Text;
if (!NCldrBinaryFileDataSource.Exists() || MessageBox.Show("The NCLDR data file exists - overwrite it ?", "NCLDR Builder", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
NCldrBinaryFileDataSource ncldrBinaryFileDataSource = new NCldrBinaryFileDataSource();
ncldrBinaryFileDataSource.NCldrDataPath = tbxCldrPath.Text;
if (!ncldrBinaryFileDataSource.Exists() || MessageBox.Show("The NCLDR data file exists - overwrite it ?", "NCLDR Builder", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
tbxProgress.Text = String.Empty;

Expand Down
5 changes: 3 additions & 2 deletions NCldrExplorer/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ private void btnLoadNCldrData_Click(object sender, EventArgs e)
lblLoading.Visible = true;
Application.DoEvents();

NCldrBinaryFileDataSource.NCldrDataPath = tbxNCldrDataPath.Text;
NCldr.NCldr.NCldrData = NCldrBinaryFileDataSource.Load();
NCldrBinaryFileDataSource ncldrBinaryFileDataSource = new NCldrBinaryFileDataSource();
ncldrBinaryFileDataSource.NCldrDataPath = tbxNCldrDataPath.Text;
NCldr.NCldr.NCldrData = ncldrBinaryFileDataSource.Load();
lblLoading.Visible = false;

foreach (string culture in NCldr.NCldr.CultureNames)
Expand Down

0 comments on commit 97516cd

Please sign in to comment.