Skip to content

Commit

Permalink
revert partial and add comments (#14377)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjkkirschner authored Sep 6, 2023
1 parent 39c6cc9 commit 01c2525
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
5 changes: 1 addition & 4 deletions src/DynamoCoreWpf/ViewModels/Preview/WatchViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ private static string GetStringFromObject(object obj)
return ObjectToLabelString(obj);
case TypeCode.Double:
return ((double)obj).ToString(numberFormat, CultureInfo.InvariantCulture);
//!!!!carefully consider the consequences of this change before uncommenting.
//TODO: uncomment this once https://jira.autodesk.com/browse/DYN-5101 is complete
//return ((double)obj).ToString(ProtoCore.Mirror.MirrorData.PrecisionFormat, CultureInfo.InvariantCulture);
case TypeCode.Int32:
Expand All @@ -271,10 +272,6 @@ private static string GetStringFromObject(object obj)
case TypeCode.Object:
return ObjectToLabelString(obj);
default:
if (double.TryParse(obj.ToString(), out double d))
{
return Convert.ToDouble(obj).ToString(ProtoCore.Mirror.MirrorData.PrecisionFormat, CultureInfo.InvariantCulture);
}
return (string)obj;
};
}
Expand Down
11 changes: 4 additions & 7 deletions src/Engine/ProtoCore/Reflection/MirrorData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,19 @@ public string StringData
{
return "null";
}
else if (Data is bool)
if (Data is bool)
{
return Data.ToString().ToLower();
}
else if (Data is IFormattable)
if (Data is IFormattable)
{
// Object.ToString() by default will use the current
// culture to do formatting. For example, Double.ToString()
// https://msdn.microsoft.com/en-us/library/3hfd35ad(v=vs.110).aspx
// We should always use invariant culture format for formattable
// object.

//!!!!carefully consider the consequences of this change before uncommenting.
//TODO: uncomment this once https://jira.autodesk.com/browse/DYN-5101 is complete
//if (Data is double)
//{
Expand All @@ -246,12 +247,8 @@ public string StringData
return (Data as IFormattable).ToString(null, CultureInfo.InvariantCulture);
//}
}
else

{
if (double.TryParse(Data.ToString(), out double d))
{
return Convert.ToDouble(Data).ToString(PrecisionFormat, CultureInfo.InvariantCulture);
}
return Data.ToString();
}
}
Expand Down

0 comments on commit 01c2525

Please sign in to comment.