Beispiel #1
0
        public override bool Read(GH_IReader reader)
        {
            var result = base.Read(reader);

            m_script = new CsxScript();

            m_script.OnError += OnError;

            var source = reader.GetString("source");

            if (File.Exists(source))
            {
                SourceUri = source;
                m_script.DefineSource(SourceUri);
            }

            m_script.OnUpdated += OnUpdated;

            m_inside  = new CsxInputsSide(this, m_script);
            m_outside = new CsxOutputsSide(this, m_script);

            if (reader.ChunkExists("m_inconnector"))
            {
                m_inside.Read(reader.FindChunk("m_inconnector"));
            }

            if (reader.ChunkExists("m_outconnector"))
            {
                m_outside.Read(reader.FindChunk("m_outconnector"));
            }

            return(result);
        }
Beispiel #2
0
        public override void AddedToDocument(GH_Document document)
        {
            // The script can be initialized via Read ()
            if (m_script == null)
            {
                m_script            = new CsxScript();
                m_inside            = new CsxInputsSide(this, m_script);
                m_outside           = new CsxOutputsSide(this, m_script);
                m_script.OnUpdated += OnUpdated;
                m_script.OnError   += OnError;
            }

            base.AddedToDocument(document);
        }