public string GetFullName(FullNameFlags flags) { StringBuilder builder = new StringBuilder(); builder.Append(this.name); if (!string.IsNullOrEmpty(this.version)) { builder.Append(string.Format(CultureInfo.InvariantCulture, ", Version={0}", new object[] { this.version })); } if (!string.IsNullOrEmpty(this.culture)) { builder.Append(string.Format(CultureInfo.InvariantCulture, ", Culture={0}", new object[] { this.culture })); } if (!string.IsNullOrEmpty(this.publicKeyToken)) { builder.Append(string.Format(CultureInfo.InvariantCulture, ", PublicKeyToken={0}", new object[] { this.publicKeyToken })); } if (!string.IsNullOrEmpty(this.processorArchitecture) && ((flags & FullNameFlags.ProcessorArchitecture) != FullNameFlags.Default)) { builder.Append(string.Format(CultureInfo.InvariantCulture, ", ProcessorArchitecture={0}", new object[] { this.processorArchitecture })); } if (!string.IsNullOrEmpty(this.type) && ((flags & FullNameFlags.Type) != FullNameFlags.Default)) { builder.Append(string.Format(CultureInfo.InvariantCulture, ", Type={0}", new object[] { this.type })); } return(builder.ToString()); }
/// <summary> /// Returns the full name of the assembly. /// </summary> /// <param name="flags">Specifies which attributes to be included in the full name.</param> /// <returns>A string representation of the full name.</returns> public string GetFullName(FullNameFlags flags) { StringBuilder sb = new StringBuilder(); sb.Append(_name); if (!String.IsNullOrEmpty(_version)) { sb.Append(String.Format(CultureInfo.InvariantCulture, ", Version={0}", _version)); } if (!String.IsNullOrEmpty(_culture)) { sb.Append(String.Format(CultureInfo.InvariantCulture, ", Culture={0}", _culture)); } if (!String.IsNullOrEmpty(_publicKeyToken)) { sb.Append(String.Format(CultureInfo.InvariantCulture, ", PublicKeyToken={0}", _publicKeyToken)); } if (!String.IsNullOrEmpty(_processorArchitecture) && (flags & FullNameFlags.ProcessorArchitecture) != 0) { sb.Append(String.Format(CultureInfo.InvariantCulture, ", ProcessorArchitecture={0}", _processorArchitecture)); } if (!String.IsNullOrEmpty(_type) && (flags & FullNameFlags.Type) != 0) { sb.Append(String.Format(CultureInfo.InvariantCulture, ", Type={0}", _type)); } return(sb.ToString()); }
private static void BuildScenePath(Transform t, StringBuilder builder, FullNameFlags flags) { if (t.parent != null) { BuildScenePath(t.parent, builder, flags); if (FlagSet(flags, FullNameFlags.SiblingIndex)) { builder.AppendFormat("[{0}]", t.parent.GetSiblingIndex()); } builder.Append("/"); } builder.Append(t.name); }
/// <summary> /// Returns the full name of the assembly. /// </summary> /// <param name="flags">Specifies which attributes to be included in the full name.</param> /// <returns>A string representation of the full name.</returns> public string GetFullName(FullNameFlags flags) { StringBuilder sb = new StringBuilder(); sb.Append(_name); if (!String.IsNullOrEmpty(_version)) sb.Append(String.Format(CultureInfo.InvariantCulture, ", Version={0}", _version)); if (!String.IsNullOrEmpty(_culture)) sb.Append(String.Format(CultureInfo.InvariantCulture, ", Culture={0}", _culture)); if (!String.IsNullOrEmpty(_publicKeyToken)) sb.Append(String.Format(CultureInfo.InvariantCulture, ", PublicKeyToken={0}", _publicKeyToken)); if (!String.IsNullOrEmpty(_processorArchitecture) && (flags & FullNameFlags.ProcessorArchitecture) != 0) sb.Append(String.Format(CultureInfo.InvariantCulture, ", ProcessorArchitecture={0}", _processorArchitecture)); if (!String.IsNullOrEmpty(_type) && (flags & FullNameFlags.Type) != 0) sb.Append(String.Format(CultureInfo.InvariantCulture, ", Type={0}", _type)); return sb.ToString(); }
public string GetFullName(FullNameFlags flags) { throw new NotImplementedException(); }
public string GetFullName (FullNameFlags flags) { throw new NotImplementedException (); }
public string GetFullName(FullNameFlags flags) { }
public string GetFullName(FullNameFlags flags) { StringBuilder builder = new StringBuilder(); builder.Append(this.name); if (!string.IsNullOrEmpty(this.version)) { builder.Append(string.Format(CultureInfo.InvariantCulture, ", Version={0}", new object[] { this.version })); } if (!string.IsNullOrEmpty(this.culture)) { builder.Append(string.Format(CultureInfo.InvariantCulture, ", Culture={0}", new object[] { this.culture })); } if (!string.IsNullOrEmpty(this.publicKeyToken)) { builder.Append(string.Format(CultureInfo.InvariantCulture, ", PublicKeyToken={0}", new object[] { this.publicKeyToken })); } if (!string.IsNullOrEmpty(this.processorArchitecture) && ((flags & FullNameFlags.ProcessorArchitecture) != FullNameFlags.Default)) { builder.Append(string.Format(CultureInfo.InvariantCulture, ", ProcessorArchitecture={0}", new object[] { this.processorArchitecture })); } if (!string.IsNullOrEmpty(this.type) && ((flags & FullNameFlags.Type) != FullNameFlags.Default)) { builder.Append(string.Format(CultureInfo.InvariantCulture, ", Type={0}", new object[] { this.type })); } return builder.ToString(); }
public string GetFullName(FullNameFlags flags) {}
private static bool FlagSet(FullNameFlags flags, FullNameFlags mask) { return((flags & mask) != 0); }
public static string FullName(this Object o, FullNameFlags flags = FullNameFlags.Default, int maxLength = 0) { if (o == null) { return("null"); } bool contentBeforeType = false; bool contentBeforeName = false; StringBuilder builder = new StringBuilder(); #if UNITY_EDITOR if (FlagSet(flags, FullNameFlags.AssetPath)) { string assetPath = AssetDatabase.GetAssetPath(o); if (!string.IsNullOrEmpty(assetPath)) { builder.Append(assetPath); contentBeforeType = true; contentBeforeName = true; } else { builder.Append(SceneManager.GetActiveScene()); contentBeforeType = true; contentBeforeName = true; } } #endif Transform t = GetTransform(o); if (FlagSet(flags, FullNameFlags.Name)) { if (contentBeforeName) { builder.Append(" "); } if (FlagSet(flags, FullNameFlags.FullScenePath)) { if (t != null) { BuildScenePath(t, builder, flags); contentBeforeType = true; } else { builder.Append(o.name); contentBeforeType = true; } } else { builder.Append(o.name); contentBeforeType = true; } } if (FlagSet(flags, FullNameFlags.SiblingIndex) && t) { builder.AppendFormat("[{0}]", t.GetSiblingIndex()); } if (FlagSet(flags, FullNameFlags.TypeName)) { if (contentBeforeType) { builder.Append(":"); } Type type = o.GetType(); if (FlagSet(flags, FullNameFlags.FullTypeName)) { builder.Append(type.FullName); } else { builder.Append(type.Name); } } string fullName = builder.ToString(); if ((maxLength > 0) && (fullName.Length > maxLength)) { const string kInsert = "..."; int prefixLength = (maxLength - kInsert.Length) / 3; int suffixLength = maxLength - (kInsert.Length + prefixLength); string prefix = fullName.Substring(0, prefixLength); string suffix = fullName.Substring(fullName.Length - suffixLength, suffixLength); return(prefix + kInsert + suffix); } else { return(fullName); } }