Esempio n. 1
0
        public bool SetClippedContent(List <Node> nodes, bool isCutting)
        {
            ClearClippedContent();

            // 确保节点列表有效
            if (nodes.Count == 0)
            {
                return(false);
            }

            // 确保节点列表有共同的父节点
            Node parent = nodes[0].Parent;

            foreach (Node n in nodes)
            {
                if (parent != n.Parent)
                {
                    Logging.Instance.Message("待操作的节点没有一个公共的父节点。");
                    return(false);
                }
            }

            foreach (Node n in nodes)
            {
                string str = NodeJsonUtil.NodeToString(n);
                if (str.Length == 0)
                {
                    Logging.Instance.Message("SetClippedContent() 时发现无效节点,操作失败。");
                    return(false);
                }
                m_clippedContent.Add(str);
                m_clippedNodes.Add(n);
            }

            ResetOffset();
            m_isCutting = isCutting;
            SceneEdEventNotifier.Instance.Emit_RefreshScene(RefreshSceneOpt.Refresh_All);
            return(true);
        }
Esempio n. 2
0
        public bool SaveTo(Node node, string targetLocation)
        {
            string text = NodeJsonUtil.NodeToString(node);

            if (text.Length == 0)
            {
                return(false);
            }

            try
            {
                using (StreamWriter file = File.CreateText(targetLocation))
                {
                    file.Write(text);
                }
            }
            catch (System.Exception ex)
            {
                Logging.Instance.LogExceptionDetail(ex);
                return(false);
            }

            return(true);
        }
 public void ChangeCommitted()
 {
     m_changedContent = NodeJsonUtil.NodeToString(m_targetNode);
 }
 public Action_PropertyChange(Node targetNode)
 {
     m_targetNode     = targetNode;
     m_initialContent = NodeJsonUtil.NodeToString(m_targetNode);
 }