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); }
public bool Read(GH_IReader reader) { if (reader.ChunkExists("params")) { GH_IReader val = reader.FindChunk("params"); if (val.ChunkExists("input") && inputs != null) { GH_IReader val2 = val.FindChunk("input"); int num = -1; if (val2.TryGetInt32("count", ref num) && inputs.Count == num) { for (int i = 0; i < num; i++) { if (val2.ChunkExists("p", i)) { inputs[i].Parameter.Read(val2.FindChunk("p", i)); } else if (val2.ChunkExists("param", i)) { inputs[i].Parameter.Read(val2.FindChunk("param", i)); } } } } if (val.ChunkExists("output") && outputs != null) { GH_IReader val3 = val.FindChunk("output"); int num2 = -1; if (val3.TryGetInt32("count", ref num2) && outputs.Count == num2) { for (int j = 0; j < num2; j++) { if (val3.ChunkExists("p", j)) { outputs[j].Parameter.Read(val3.FindChunk("p", j)); } else if (val3.ChunkExists("param", j)) { outputs[j].Parameter.Read(val3.FindChunk("param", j)); } } } } } try { GH_IReader val4 = reader.FindChunk("context"); if (val4 != null) { cxt.Collection.Read(val4); } } catch (Exception ex) { RhinoApp.WriteLine("Component error:" + ex.Message + "\n" + ex.StackTrace); } return(true); }
public override bool Read(GH_IReader reader) { bool flag = true; SetReadState(); flag &= base.Read(reader); string text = null; if (reader.ChunkExists("ActiveUnit")) { text = reader.FindChunk("ActiveUnit").GetString("unitname"); } if (reader.ChunkExists("EvalUnits")) { GH_IReader val = reader.FindChunk("EvalUnits"); int num = -1; if (val.TryGetInt32("count", ref num)) { for (int i = 0; i < num; i++) { if (val.ChunkExists("unit", i)) { GH_IReader val2 = val.FindChunk("unit", i); string @string = val2.GetString("name"); if (text != null) { @string.Equals(text); } evalUnits.GetUnit(@string)?.Read(val2); } } } } if (text != null) { GetUnit(text); SwitchUnit(GetUnit(text), recompute: false, recordEvent: false); } for (int j = 0; j < EvalUnits.Count; j++) { if (!EvalUnits[j].Active) { EvalUnits[j].NewParameterIds(); } } OnComponentLoaded(); return(flag); }