public static SpeckleObject ToSpeckle(this GSAMaterialConcrete dummyObject)
        {
            var newLines      = ToSpeckleBase <GSAMaterialConcrete>();
            var typeName      = dummyObject.GetType().Name;
            var materialsLock = new object();
            var materials     = new SortedDictionary <int, GSAMaterialConcrete>();

            Parallel.ForEach(newLines.Keys, k =>
            {
                var pPieces = newLines[k].ListSplit(Initialiser.AppResources.Proxy.GwaDelimiter);
                var gsaId   = pPieces[1];
                try
                {
                    var mat = new GSAMaterialConcrete()
                    {
                        GWACommand = newLines[k]
                    };
                    mat.ParseGWACommand();
                    lock (materialsLock)
                    {
                        materials.Add(k, mat);
                    }
                }
                catch (Exception ex)
                {
                    Initialiser.AppResources.Messenger.CacheMessage(MessageIntent.Display, MessageLevel.Error, typeName, gsaId);
                    Initialiser.AppResources.Messenger.CacheMessage(MessageIntent.TechnicalLog, MessageLevel.Error, ex, typeName, gsaId);
                }
            });

            Initialiser.GsaKit.GSASenderObjects.AddRange(materials.Values.ToList());

            return((materials.Keys.Count > 0) ? new SpeckleObject() : new SpeckleNull());
        }
        public static SpeckleObject ToSpeckle(this GSAMaterialConcrete dummyObject)
        {
            var newLines = ToSpeckleBase <GSAMaterialConcrete>();

            var materialsLock = new object();
            var materials     = new List <GSAMaterialConcrete>();

            Parallel.ForEach(newLines.Values, p =>
            {
                try
                {
                    var mat = new GSAMaterialConcrete()
                    {
                        GWACommand = p
                    };
                    mat.ParseGWACommand();
                    lock (materialsLock)
                    {
                        materials.Add(mat);
                    }
                }
                catch { }
            });

            Initialiser.GSASenderObjects.AddRange(materials);

            return((materials.Count() > 0) ? new SpeckleObject() : new SpeckleNull());
        }
Esempio n. 3
0
        public static SpeckleObject ToSpeckle(this GSAMaterialConcrete dummyObject)
        {
            var newLines = ToSpeckleBase <GSAMaterialConcrete>();

            var materials = new List <GSAMaterialConcrete>();

            foreach (var p in newLines.Values)
            {
                try
                {
                    var mat = new GSAMaterialConcrete()
                    {
                        GWACommand = p
                    };
                    mat.ParseGWACommand();
                    materials.Add(mat);
                }
                catch { }
            }

            Initialiser.GSASenderObjects[typeof(GSAMaterialConcrete)].AddRange(materials);

            return((materials.Count() > 0) ? new SpeckleObject() : new SpeckleNull());
        }