/// <summary>导出目标文件</summary> /// <param name="axf"></param> /// <param name="target"></param> /// <returns></returns> protected override Boolean Dump(String axf, String target) { var cmd = ""; if (target.EndsWithIgnoreCase(".bin")) { cmd = "--bin -o \"{0}\" \"{1}\"".F(target, axf); } else if (target.EndsWithIgnoreCase(".hex")) { cmd = "--i32 -o \"{0}\" \"{1}\"".F(target, axf); } else { return(false); } var rs = ObjCopy.Run(cmd, 3000, WriteLog); return(rs != 0); }
private static void CopyComponentValues(GameObject src, GameObject dst, ObjCopy.IsAssignable assignable, bool addIfMissing) { if (src.name != dst.name) { Debug.LogWarning(string.Format("Name is different. {0} <-> {1}", src.name, dst.name)); } ObjCopy copy = new ObjCopy(true, assignable); copy.ExcludeType("UnityEngine.Component", "UnityEngine.Object"); copy.ExcludeField("UnityEngine.Transform", "hasChanged"); foreach (Component s in src.GetComponents <Component>()) { Component d = dst.GetComponent(s.GetType()); if (addIfMissing && d == null) { d = dst.AddComponent(s.GetType()); } if (d != null) { List <MemberInfo> changed = copy.SetValue(s, d); EditorUtil.SetDirty(d); StringBuilder str = new StringBuilder(); foreach (MemberInfo m in changed) { str.Append(dst.name).Append(".").Append(m.Name).Append("\n"); } if (str.Length > 0) { Debug.LogWarning(str.ToString()); } } else { Debug.LogWarning(string.Format("Source has {0} but Missing in Dest", s.GetType().FullName)); } } EditorUtil.SetDirty(dst); }
/// <summary>导出目标文件</summary> /// <param name="axf"></param> /// <param name="target"></param> /// <returns></returns> protected override Boolean Dump(String axf, String target) { XTrace.WriteLine("生成:{0}", target); Console.WriteLine(""); var cmd = ""; if (target.EndsWithIgnoreCase(".bin")) { cmd = "--bin \"{0}\" \"{1}\"".F(axf, target); } else if (target.EndsWithIgnoreCase(".hex")) { cmd = "--ihex \"{0}\" \"{1}\"".F(axf, target); } else { return(false); } var rs = ObjCopy.Run(cmd, 3000, WriteLog); return(rs != 0); }