Example #1
0
        /// <summary>
        /// Returns the speckle clients present in the current document.
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        public static SpeckleClientsWrapper ReadClients(Document doc)
        {
            var speckleClientsEntity = GetSpeckleEntity(doc);

            if (speckleClientsEntity == null || !speckleClientsEntity.IsValid())
            {
                return(null);
            }

            var mySpeckleClients = new SpeckleClientsWrapper();

            mySpeckleClients.SetClients(speckleClientsEntity.Get <IList <string> >("clients"));

            return(mySpeckleClients);
        }
Example #2
0
        /// <summary>
        /// Writes the clients to the current document.
        /// </summary>
        /// <param name="doc"></param>
        /// <param name="wrap"></param>
        public static void WriteClients(Document doc, SpeckleClientsWrapper wrap)
        {
            var ds = GetSettingsDataStorage(doc);

            if (ds == null)
            {
                ds = DataStorage.Create(doc);
            }

            Entity speckleClientsEntity = new Entity(SpeckleClientsSchema.GetSchema());

            speckleClientsEntity.Set("clients", wrap.GetStringList() as IList <string>);

            Entity idEntity = new Entity(DSUniqueSchemaClientsStorage.GetSchema());

            idEntity.Set("Id", ID);

            ds.SetEntity(idEntity);
            ds.SetEntity(speckleClientsEntity);
        }