Hello there, I created a program that is designed to add a bit of ease when it comes to change logs. Since I really didn't want anything over complicated that could've been a paid for app I decided to make my own. The only thing I have no idea to do is Serializing to save the current state of my custom class that has 6 lists that are for each type of change(Added, Removed, etc.) and one string used for keeping track of that version.
If a new version is created then the previous one(the whole class) gets added to a list of versions to add under the current version.
I intend to use the menuStrip control for handling the Opening/Saving of these different changes.
I'm just unsure how to handle serializing to make all the information available for storage.
I've read a few articles already about Serialization but I still remain quite confused and frustrated. All I know is you add "[Serializable]" to the beginning of the class and after that I get lost as I'm not sure how to handle the lists.
The two events that would trigger the "save" and "load" methods are click events that happen from the menuStrip.
On the main Form it just checks if the version has changed and if true adds the old version to a list which is another part I'm unsure of how to add to the "save" file.
private void btnChange_Click(object sender, EventArgs e)
{
if(currentVersion is Old)
{
listOldVersion.Add(currentVersion);
}
currentVersion = new ChangeHandle(new version number);
}
ChangeHandle Class
[Serializable]
public class ChangeHandle
{
#region Fields
private string sVersion;
private List<string> listAdded;
private List<string> listRemoved;
private List<string> listBug;
private List<string> listFixed;
private List<string> listChanged;
private List<string> listOther;
#endregion
#region Properties
public string Version { get { return sVersion; } }
#endregion
#region Constructor
public ChangeHandle(string Version)
{
sVersion = Version;
listAdded = new List<string>();
listRemoved = new List<string>();
listBug = new List<string>();
listFixed = new List<string>();
listChanged = new List<string>();
listOther = new List<string>();
}
#endregion
#region Public Methods
public void Added(string Change)
{
listAdded.Add(Change);
}
public void Removed(string Change)
{
listRemoved.Add(Change);
}
public void Bug(string Change)
{
listBug.Add(Change);
}
public void Fixed(string Change)
{
listFixed.Add(Change);
}
public void Changed(string Change)
{
listChanged.Add(Change);
}
public void Other(string Change)
{
listOther.Add(Change);
}
public StringBuilder Compile()
{
StringBuilder sbFinal = new StringBuilder();
sbFinal.AppendLine();
sbFinal.AppendLine(string.Format("Version: {0}",sVersion));
foreach (string s in listAdded)
{
sbFinal.AppendLine(string.Format(" [Added] - {0}", s));
}
foreach (string s in listRemoved)
{
sbFinal.AppendLine(string.Format(" [Removed] - {0}",s));
}
foreach (string s in listBug)
{
sbFinal.AppendLine(string.Format(" [Bug] - {0}", s));
}
foreach (string s in listFixed)
{
sbFinal.AppendLine(string.Format(" [Fixed] - {0}", s));
}
foreach (string s in listChanged)
{
sbFinal.AppendLine(string.Format(" [Changed] - {0}", s));
}
foreach (string s in listOther)
{
sbFinal.AppendLine(string.Format(" [Other] - {0}", s));
}
return sbFinal;
}
#endregion
}
Any other information needed just let me know and I'll post back asap.
Thank you in advance!
<ArrayOfChangeHandle xmlns="http://schemas.datacontract.org/2004/07/DevLog" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><ChangeHandle/><ChangeHandle/></ArrayOfChangeHandle>