Assign Mirror
March 10, 2014 at 2:10 AM
—
Admin
Assign Mirror is a small tool that is mirror the assign statement ( replace the left side with the right side and the right side with left side )
Usage : assume you are writing a code in your database application to read the values from your business object and puts the values in a controls on your form ( about 30 field ) and now you want to save the values form the form controls to your object so you can save it in the database again , the fast method will be by copying your previous code and change the left side of the assign operator with the right side .
but if you have a tool that make this for you, you are going to save time and type mistakes :)
The Code :
create as GUI like the bellow screen shoot

Then add the following code to the ( Mirror ) Button
bool mAddSemicolon = false;
foreach (string mStr in txtMirrorSource.Lines)
mTempStr = mStr.Substring(0, mStr.IndexOf("//")).Trim();
else if (mStr.Contains(";"))
mTempStr = mStr.Substring(0, mStr.IndexOf(";") + 1);
mAddSemicolon = mTempStr.EndsWith(";");
txtMirrorDist.AppendText(mTempStr.Split('=')[1].Replace(";", "").Trim());
txtMirrorDist.AppendText(" = ");
txtMirrorDist.AppendText(mTempStr.Split('=')[0].Trim());
if (mAddSemicolon) txtMirrorDist.AppendText(" ;");
txtMirrorDist.AppendText(Environment.NewLine);
de1d6d65-a8a1-4bb2-9e60-53dd2cddfc79|1|5.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
Posted in: .NET | IT
Tags: