Exemplo n.º 1
0
        public override bool Write(GH_IWriter writer)
        {
            writer.SetString("Wave", Wave.ToString());
            writer.SetString("Profile", Profile.ToString());

            return(base.Write(writer));
        }
Exemplo n.º 2
0
 public override bool Write(GH_IWriter writer)
 {
     //writer.SetString( "selectedAccount", SNJ.JsonConvert.SerializeObject( Selected ) );
     writer.SetString("restapi", Selected.RestApi);
     writer.SetString("email", Selected.Email);
     return(base.Write(writer));
 }
Exemplo n.º 3
0
 public override bool Write(GH_IWriter writer)
 {
     writer.SetString("Coloring", Coloring.ToString());
     writer.SetString("Metric", Metric.ToString());
     writer.SetString("Feature", Feature.ToString());
     return(base.Write(writer));
 }
Exemplo n.º 4
0
 public override bool Write(GH_IWriter writer)
 {
     writer.SetString("Profile", Profile);
     writer.SetString("MinutesOrMeters", MinutesOrMeters);
     writer.SetString("Polygons", Polygons);
     return(base.Write(writer));
 }
Exemplo n.º 5
0
 public new bool Write(GH_IWriter writer)
 {
     writer.SetDrawingBitmap("Image", this.Value);
     writer.SetString("ReportPart", this.ReportPart);
     writer.SetString("RefTag", this._refTag);
     return(true);
 }
        /// <summary>
        /// Write all required data for deserialization to an IO archive.
        /// </summary>
        /// <param name="writer">Object to write with.</param>
        /// <returns>
        /// True on success, false on failure.
        /// </returns>
        public override bool Write(GH_IWriter writer)
        {
            //serialize the states

            GH_IWriter stateSetChunk = writer.CreateChunk("stateSetChunk");

            stateSetChunk.SetInt32("StateCount", savedStates.states.Count);
            int i = 0; //the state

            //for each state in saved states
            foreach (KeyValuePair <string, State> statePair in savedStates.states)
            {
                string     stateName  = statePair.Key;
                GH_IWriter StateChunk = stateSetChunk.CreateChunk("State", i);
                StateChunk.SetString("stateName", stateName);

                State state = statePair.Value;
                StateChunk.SetInt32("itemCount", state.stateDict.Count);
                int j = 0;
                //Custom serialization logic
                //for each element in the state
                foreach (KeyValuePair <UIElement_Goo, object> stateItem in state.stateDict)
                {
                    //get element and value
                    UIElement_Goo element = stateItem.Key;
                    object        value   = stateItem.Value;

                    GH_IWriter stateItemChunk = StateChunk.CreateChunk("stateItem", j);
                    //this info is used to retrieve the dynamic UI element on reserialization, by grabbing the component with matching instance guid
                    //and getting the output item at the matching index.
                    stateItemChunk.SetString("ElementID", element.instanceGuid.ToString());
                    stateItemChunk.SetInt32("ElementIndex", element.index);

                    string stringValue = value.ToString();
                    string typeString  = value.GetType().ToString();
                    //special case for lists of bool - all other element "states" are single items. This only applies to a checklist object.
                    if (value is List <bool> )
                    {
                        typeString  = "LIST OF BOOL";
                        stringValue = HUI_Util.stringFromBools((List <bool>)value);
                    }

                    if (value is List <string> )
                    {
                        typeString  = "LIST OF STRING";
                        stringValue = HUI_Util.stringFromStrings((List <string>)value);
                    }

                    //store the value and a hint as to its type
                    stateItemChunk.SetString("ElementValue", stringValue);
                    stateItemChunk.SetString("ElementValueType", typeString);

                    j++;     //counting up elements in state
                }


                i++; //counting up states
            }
            return(base.Write(writer));
        }
 public override bool Write(GH_IWriter writer)
 {
     writer.SetString("TileCacheMeta", TileCacheMeta);
     writer.SetString("SlippySourceList", SlippySourceList);
     writer.SetString("SlippySource", SlippySource);
     writer.SetString("SlippyURL", SlippyURL);
     return(base.Write(writer));
 }
Exemplo n.º 8
0
        private static void WriteGH_ISerializable(GH_IWriter writer, GH_ISerializable data)
        {
            writer.SetString("TypeString", data.GetType().FullName);
            writer.SetString("AssemblyString", data.GetType().Assembly.FullName);
            var objectWriter = writer.CreateChunk("Data");

            data.Write(objectWriter);
        }
        public override bool Write(GH_IWriter writer)
        {
            writer.SetBoolean("UseDefaultCache", UseDefaultCache);
            writer.SetString("KitName", Kit.Name);
            var owSer = string.Join("\n", OutputWrappers.Select(ow => $"{ow.ServerUrl}\t{ow.StreamId}\t{ow.CommitId}"));

            writer.SetString("OutputWrappers", owSer);
            return(base.Write(writer));
        }
Exemplo n.º 10
0
        public override bool Write(GH_IWriter writer)
        {
            writer.SetString("Environment", EnvironmentFile);
            writer.SetString("Projection", Projection.ToString());
            writer.SetString("Interpolation", Interpolation.ToString());
            writer.SetString("ColorSpace", ColorSpace.ToString());

            return(base.Write(writer));
        }
Exemplo n.º 11
0
        public override bool Write(GH_IWriter writer)
        {
            writer.SetString("Image", ImageFile);
            writer.SetString("ImTexInterpolation", Interpolation.ToString());
            writer.SetString("ImTexColorSpace", ColorSpace.ToString());
            writer.SetString("ImTexTextureExtension", TextureExtension.ToString());
            writer.SetString("ImTexProjection", Projection.ToString());

            return(base.Write(writer));
        }
Exemplo n.º 12
0
        public override bool Write(GH_IWriter writer)
        {
            if (SelectedConstructor != null)
            {
                writer.SetString("SelectedConstructorName", CSOUtils.MethodFullName(SelectedConstructor));
                writer.SetString("SelectedTypeName", SelectedConstructor.DeclaringType.FullName);
            }

            writer.SetString("seed", Seed);
            return(base.Write(writer));
        }
        public override bool Write(GH_IWriter writer)
        {
            if (selectedMethod == null)
            {
                return(false);
            }

            writer.SetString("ccmethod", selectedMethod.methodId);
            writer.SetString("www", selectedMethod.url);
            return(base.Write(writer));
        }
Exemplo n.º 14
0
 bool GH_ISerializable.Write(GH_IWriter writer)
 {
     writer.SetString("Text", Text);
     writer.SetString("Font", Font);
     writer.SetDrawingColor("Colour", Colour);
     writer.SetPoint3D("Location", new GH_Point3D(Location.X, Location.Y, Location.Z));
     writer.SetDouble("Horizontal", HorizontalAlignment);
     writer.SetDouble("Vertical", VerticalAlignment);
     writer.SetDouble("Rotation", Rotation);
     return(true);
 }
Exemplo n.º 15
0
 public override bool WriteFull(GH_IWriter writer)
 {
     writer.CreateChunk("key");
     writer.CreateChunk("proj");
     writer.CreateChunk("filterbyname");
     writer.CreateChunk("filteroldone");
     writer.SetString("key", myControlPanel.key);
     writer.SetString("proj", myControlPanel.project);
     writer.SetBoolean("filterbyname", myControlPanel._filterbyname);
     writer.SetBoolean("filteroldone", myControlPanel._filteroldone);
     return(base.Write(writer));
 }
Exemplo n.º 16
0
        public override bool Write(GH_IWriter writer)
        {
            var selectedAccountId = SelectedItems[0].Expression.Trim(new char[] { '"' });
            var selectedAccount   = AccountManager.GetAccounts().FirstOrDefault(a => a.id == selectedAccountId);

            if (selectedAccount != null)
            {
                writer.SetString("selectedId", selectedAccountId);
                writer.SetString("selectedServer", selectedAccount.serverInfo.url);
            }

            return(base.Write(writer));
        }
Exemplo n.º 17
0
        public override bool Write(GH_IWriter writer)
        {
            bool rc = base.Write(writer);

            if (rc)
            {
                writer.SetVersion("GLShader", 0, 1, 0);
                rc = _model.Write(writer);
                writer.SetString("ResourceName", _resourceName);
                writer.SetString("Defines", _defines);
            }
            return(rc);
        }
        public override bool Write(GH_IWriter writer)
        {
            writer.SetBoolean("AutoReceive", AutoReceive);
            writer.SetString("CurrentComponentState", CurrentComponentState);

            var streamUrl = StreamWrapper != null?StreamWrapper.ToString() : "";

            writer.SetString("StreamWrapper", streamUrl);
            writer.SetString("LastInfoMessage", LastInfoMessage);
            writer.SetString("LastCommitDate", LastCommitDate);
            writer.SetString("ReceivedCommitId", ReceivedCommitId);
            writer.SetBoolean("ReceiveOnOpen", ReceiveOnOpen);
            return(base.Write(writer));
        }
        public override bool Write(GH_IWriter writer)
        {
            if (SelectedConstructor != null)
              {
            var methodFullName = CSOUtils.MethodFullName(SelectedConstructor);
            var declaringTypeFullName = SelectedConstructor.DeclaringType.FullName;
            writer.SetString("SelectedConstructorName", methodFullName);
            writer.SetString("SelectedTypeName", declaringTypeFullName);
            writer.SetBoolean("UseSchemaTag", UseSchemaTag);
            writer.SetBoolean("UserSetSchemaTag", UserSetSchemaTag);
              }

              writer.SetString("seed", Seed);
              return base.Write(writer);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Serialises the current state of the component, making sure we save:
        /// - the current type.
        /// </summary>
        /// <param name="writer"></param>
        /// <returns></returns>
        public override bool Write(GH_IWriter writer)
        {
            if (SelectedType != null)
            {
                writer.SetBoolean("init", true);
                writer.SetString("type", SelectedType.Name);
                writer.SetString("assembly", SelectedType.AssemblyQualifiedName);
            }
            else
            {
                writer.SetBoolean("init", false);
            }

            return(base.Write(writer));
        }
        public override bool Write(GH_IWriter writer)
        {
            writer.SetBoolean("AutoReceive", AutoReceive);
            //writer.SetString("CurrentComponentState", CurrentComponentState);
            writer.SetString("LastInfoMessage", LastInfoMessage);
            //writer.SetString("LastCommitDate", LastCommitDate);
            writer.SetString("ReceivedObjectId", ReceivedObjectId);
            writer.SetString("ReceivedCommitId", ReceivedCommitId);
            writer.SetString("KitName", Kit.Name);
            var streamUrl = StreamWrapper != null?StreamWrapper.ToString() : "";

            writer.SetString("StreamWrapper", streamUrl);
            //writer.SetBoolean(nameof(ConvertToNative), ConvertToNative);
            return(base.Write(writer));
        }
Exemplo n.º 22
0
 public bool Write(GH_IWriter writer)
 {
     writer.SetString("tName", Name);
     writer.SetString("tDescription", Description);
     writer.SetString("tOwner", Owner);
     writer.SetString("tLink", Link);
     writer.SetBoolean("tHasDate", HasDate);
     writer.SetDrawingColor("tColor", Color);
     if (HasDate)
     {
         writer.SetDate("tDate", Date);
     }
     writer.SetInt32("tStatus", (int)Status);
     writer.SetEnumerable("tTags", _tags, WriteString);
     return(true);
 }
Exemplo n.º 23
0
        public bool Write(GH_IWriter writer)
        {
            writer.SetString("name", Name);
            GH_IWriter val  = writer.CreateChunk("params");
            GH_IWriter val2 = val.CreateChunk("input");

            val2.SetInt32("index", 0);
            val2.SetInt32("count", Inputs.Count);
            for (int i = 0; i < inputs.Count; i++)
            {
                if (inputs[i].Parameter.Attributes != null)
                {
                    GH_IWriter val3 = val2.CreateChunk("p", i);
                    inputs[i].Parameter.Write(val3);
                }
            }
            GH_IWriter val4 = val.CreateChunk("output");

            val4.SetInt32("index", 0);
            val4.SetInt32("count", Outputs.Count);
            for (int j = 0; j < outputs.Count; j++)
            {
                if (outputs[j].Parameter.Attributes != null)
                {
                    GH_IWriter val5 = val4.CreateChunk("p", j);
                    outputs[j].Parameter.Write(val5);
                }
            }
            GH_IWriter writer2 = writer.CreateChunk("context");

            return(cxt.Collection.Write(writer2));
        }
Exemplo n.º 24
0
        public override bool Write(GH_IWriter writer)
        {
            writer.SetInt32("ListMode", (int)this.ListMode);
            writer.SetInt32("ListCount", this.m_userItems.Count);
            int arg_36_0 = 0;
            int num      = this.m_userItems.Count - 1;

            for (int i = arg_36_0; i <= num; i++)
            {
                GH_IWriter chunk = writer.CreateChunk("ListItem", i);
                chunk.SetString("Name", this.m_userItems[i].Name);
                chunk.SetString("Expression", this.m_userItems[i].Expression);
                chunk.SetBoolean("Selected", this.m_userItems[i].Selected);
            }
            return(base.Write(writer));
        }
Exemplo n.º 25
0
        /// <summary>
        /// Serialises the current state of the component, making sure we save:
        /// - the optional property dictionary
        /// - the current type.
        /// </summary>
        /// <param name="writer"></param>
        /// <returns></returns>
        public override bool Write(GH_IWriter writer)
        {
            if (InputType != null)
            {
                writer.SetBoolean("init", true);
                writer.SetString("type", InputType.Name);
                writer.SetString("assembly", InputType.AssemblyQualifiedName);
                writer.SetByteArray("optionalmask", SpeckleCore.Converter.getBytes(OptionalPropsMask));
            }
            else
            {
                writer.SetBoolean("init", false);
            }

            return(base.Write(writer));
        }
Exemplo n.º 26
0
        public override bool Write(GH_IWriter writer)
        {
            writer.SetInt32("ListMode", (int)ListMode);
            writer.SetInt32("ListCount", m_userItems.Count);
            int num1 = 0;
            int num2 = m_userItems.Count - 1;

            for (int chunk_index = num1; chunk_index <= num2; ++chunk_index)
            {
                GH_IWriter chunk = writer.CreateChunk("ListItem", chunk_index);
                chunk.SetString("Name", m_userItems[chunk_index].Name);
                chunk.SetString("Expression", m_userItems[chunk_index].Expression);
                chunk.SetBoolean("Selected", m_userItems[chunk_index].Selected);
            }
            return(base.Write(writer));
        }
Exemplo n.º 27
0
        /***************************************************/

        public override bool Write(GH_IWriter writer)
        {
            if (Value != null)
            {
                writer.SetString("Json", Value.ToJson());
            }
            return(true);
        }
Exemplo n.º 28
0
 public override bool Write(GH_IWriter writer)
 {
     if (Receiver != null)
     {
         writer.SetString("serialisedReceiver", Receiver.ToString());
     }
     return(base.Write(writer));
 }
Exemplo n.º 29
0
 public override bool Write(GH_IWriter writer)
 {
     try
     {
         Value.GH_Write(writer);
         return(true);
     }
     catch (Exception e)
     {
         writer.SetString("Oh Dear", "An Exception Occured");
         writer.SetString("Exception Message", e.Message);
         writer.SetString("Stack Trace", e.StackTrace);
         writer.SetString("Exception Type", e.GetType().FullName);
         writer.SetString("TargetSite", e.TargetSite.ToString());
         return(true);
     }
 }
Exemplo n.º 30
0
        public override bool Write(GH_IWriter writer)
        {
            if (mySender != null)
            {
                writer.SetString("specklesender", mySender.ToString());
            }

            return(base.Write(writer));
        }
Exemplo n.º 31
0
        public override bool Write(GH_IWriter writer)
        {
            if (m_settings != null && m_settings.Length > 0)
                    {
                        writer.SetInt32("StringCount", m_settings.Length);
                        for (int i = 0; i < m_settings.Length; i++)
                        {
                            writer.SetString("String", i, m_settings[i]);
                        }
                    }

                    return base.Write(writer);
        }