// 这个方法仅在 Document.BeanDefine 改名的时候调用。所以不能再去更新: 修改BeanDefine.Name。 internal void RenameWhenRootBeanDefineNameChange(string nameOnlyWithoutExtension) { if (this.Name.Equals(nameOnlyWithoutExtension)) { return; } var oldAbsoluteName = this.AbsoluteName; Parent.RemoveFile(this.Name); this.Name = nameOnlyWithoutExtension; Parent.AddFile(this); this.AbsoluteName = System.IO.Path.Combine(Parent.AbsoluteName, this.Name + ".xml"); var home = FormMain.Instance.ConfigEditor.GetHome(); this.RelateName = this.AbsoluteName.Substring(home.Length); if (this.RelateName.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString())) { this.RelateName = this.RelateName.Substring(1); } Document?.UpdateRelateName(); System.IO.File.Move(oldAbsoluteName, this.AbsoluteName); }