//[TestCase(GSATargetLayer.Analysis, "S5pNxjmUH.json")]
        public void ReceiverTestForDebug(GSATargetLayer layer, string fileName)
        {
            var json = Helper.ReadFile(fileName, TestDataDirectory);

            var mockGsaCom = SetupMockGsaCom();

            Initialiser.AppResources.Proxy.OpenFile("", false, mockGsaCom.Object);

            var receiverProcessor = new ReceiverProcessor(TestDataDirectory, Initialiser.AppResources);

            //Run conversion to GWA keywords
            receiverProcessor.JsonSpeckleStreamsToGwaRecords(new[] { fileName }, out var actualGwaRecords, layer);
            Assert.IsNotNull(actualGwaRecords);
            Assert.IsNotEmpty(actualGwaRecords);

            var keywords = Helper.GetTypeCastPriority(ioDirection.Receive, layer, false).Select(i => i.Key.GetGSAKeyword()).Distinct().ToList();

            //Log outcome to file

            foreach (var keyword in keywords)
            {
                var actualGwaRecordsForKeyword = new List <GwaRecord>();
                for (var i = 0; i < actualGwaRecords.Count(); i++)
                {
                    Initialiser.AppResources.Proxy.ParseGeneralGwa(actualGwaRecords[i].GwaCommand, out var recordKeyword, out var foundIndex, out var foundStreamId, out string foundApplicationId, out var gwaWithoutSet, out var gwaSetCommandType);
                    if (recordKeyword.Equals(keyword, StringComparison.InvariantCultureIgnoreCase))
                    {
                        actualGwaRecordsForKeyword.Add(actualGwaRecords[i]);
                    }
                }

                var actualUniqueApplicationIds = actualGwaRecordsForKeyword.Where(r => !string.IsNullOrEmpty(r.ApplicationId)).Select(r => r.ApplicationId).Distinct();
            }
        }
Example #2
0
        public void GsaInstanceToSpeckleObjects(GSATargetLayer layer, out List <SpeckleObject> speckleObjects, bool resultOnly)
        {
            var TypePrerequisites = Helper.GetTypeCastPriority(ioDirection.Send, layer, resultOnly);

            var gwaCacheRecords = new Dictionary <string, object>();

            speckleObjects = new List <SpeckleObject>();

            // Read objects
            var currentBatch   = new List <Type>();
            var traversedTypes = new List <Type>();

            do
            {
                currentBatch = TypePrerequisites.Where(i => i.Value.Count(x => !traversedTypes.Contains(x)) == 0).Select(i => i.Key).ToList();
                currentBatch.RemoveAll(i => traversedTypes.Contains(i));

                foreach (var t in currentBatch)
                {
                    var dummyObject = Activator.CreateInstance(t);
                    var result      = Converter.Serialise(dummyObject);

                    traversedTypes.Add(t);
                }
            } while (currentBatch.Count > 0);

            foreach (var t in Initialiser.GSASenderObjects.Keys)
            {
                foreach (var o in Initialiser.GSASenderObjects[t])
                {
                    speckleObjects.Add((SpeckleObject)(((IGSASpeckleContainer)o).Value));
                }
            }
        }
        protected List <SpeckleObject> ModelToSpeckleObjects(GSATargetLayer layer, bool resultsOnly, bool embedResults, string[] cases = null, string[] resultsToSend = null)
        {
            gsaCache.Clear();

            //Clear out all sender objects that might be there from the last test preparation
            Initialiser.GSASenderObjects.Clear();

            //Compile all GWA commands with application IDs
            var senderProcessor = new SenderProcessor(TestDataDirectory, gsaInterfacer, gsaCache, layer, embedResults, cases, resultsToSend);

            var keywords = senderProcessor.GetKeywords(layer);
            var data     = gsaInterfacer.GetGwaData(keywords, false);

            for (int i = 0; i < data.Count(); i++)
            {
                gsaCache.Upsert(
                    data[i].Keyword,
                    data[i].Index,
                    data[i].GwaWithoutSet,
                    //This needs to be revised as this logic is in the kit too
                    applicationId: (string.IsNullOrEmpty(data[i].ApplicationId)) ? ("gsa/" + data[i].Keyword + "_" + data[i].Index.ToString()) : data[i].ApplicationId,
                    gwaSetCommandType: data[i].GwaSetType,
                    streamId: data[i].StreamId
                    );
            }

            senderProcessor.GsaInstanceToSpeckleObjects(layer, out var speckleObjects, resultsOnly);

            return(speckleObjects);
        }
        //[TestCase(GSATargetLayer.Analysis, false, true, @"C:\Users\Nic.Burgers\OneDrive - Arup\Issues\Nguyen Le\2D result\shear wall system-seismic v10.1.gwb",
        //  "2D Element Projected Force", "A1 A2" )]
        public void TransmissionTestForDebug(GSATargetLayer layer, bool resultsOnly, bool embedResults, string gsaFileName,
                                             ResultType?overrideResultType = null, string loadCasesOverride = null)
        {
            Initialiser.AppResources.Proxy.OpenFile(gsaFileName.Contains("\\") ? gsaFileName : Path.Combine(TestDataDirectory, gsaFileName));

            var actualObjects = ModelToSpeckleObjects(layer, resultsOnly, embedResults,
                                                      (loadCasesOverride == null) ? loadCases : loadCasesOverride.ListSplit(" "),
                                                      (overrideResultType.HasValue) ? new List <ResultType> {
                overrideResultType.Value
            } : nodeResultTypes);

            Assert.IsNotNull(actualObjects);
            actualObjects = actualObjects.OrderBy(a => a.ApplicationId).ToList();

            var objectsByType = actualObjects.GroupBy(o => o.GetType());

            var actual = new Dictionary <SpeckleObject, string>();

            foreach (var actualObject in actualObjects)
            {
                var actualJson = JsonConvert.SerializeObject(actualObject, jsonSettings);

                actualJson = Regex.Replace(actualJson, jsonDecSearch, "$1");
                actualJson = Regex.Replace(actualJson, jsonHashSearch, jsonHashReplace);

                actual.Add(actualObject, actualJson);
            }

            var matched = new List <SpeckleObject>();

            Initialiser.AppResources.Proxy.Close();
        }
 public ReceiverProcessor(string directory, IGSAAppResources appResources, GSATargetLayer layer = GSATargetLayer.Design) : base(directory)
 {
     this.appResources = appResources;
     //GSAInterfacer = gsaInterfacer;
     //GSACache = gsaCache;
     this.appResources.Settings.TargetLayer = layer;
 }
Example #6
0
        public void TransmissionTestForDebug(GSATargetLayer layer, bool resultsOnly, bool embedResults, string gsaFileName)
        {
            gsaInterfacer.OpenFile(Helper.ResolveFullPath(gsaFileName, TestDataDirectory));

            var actualObjects = ModelToSpeckleObjects(layer, resultsOnly, embedResults, loadCases, resultTypes);

            Assert.IsNotNull(actualObjects);
            actualObjects = actualObjects.OrderBy(a => a.ApplicationId).ToList();

            var objectsByType = actualObjects.GroupBy(o => o.GetType());

            var actual = new Dictionary <SpeckleObject, string>();

            foreach (var actualObject in actualObjects)
            {
                var actualJson = JsonConvert.SerializeObject(actualObject, jsonSettings);

                actualJson = Regex.Replace(actualJson, jsonDecSearch, "$1");
                actualJson = Regex.Replace(actualJson, jsonHashSearch, jsonHashReplace);

                actual.Add(actualObject, actualJson);
            }

            var matched = new List <SpeckleObject>();

            gsaInterfacer.Close();
        }
Example #7
0
        protected List <SpeckleObject> ModelToSpeckleObjects(GSATargetLayer layer, bool resultsOnly, bool embedResults, string[] cases, string[] resultsToSend = null)
        {
            //((IGSACache) appResources.Cache).Clear();
            ((IGSACache)Initialiser.AppResources.Cache).Clear();

            //Clear out all sender objects that might be there from the last test preparation
            Initialiser.GsaKit.GSASenderObjects.Clear();

            //Compile all GWA commands with application IDs
            var senderProcessor = new SenderProcessor(TestDataDirectory, Initialiser.AppResources, layer, embedResults, cases, resultsToSend);

            var keywords = senderProcessor.GetKeywords(layer);
            var data     = Initialiser.AppResources.Proxy.GetGwaData(keywords, false);

            for (int i = 0; i < data.Count(); i++)
            {
                var applicationId = string.IsNullOrEmpty(data[i].ApplicationId) ? null : data[i].ApplicationId;
                Initialiser.AppResources.Cache.Upsert(
                    data[i].Keyword,
                    data[i].Index,
                    data[i].GwaWithoutSet,
                    applicationId: applicationId,
                    gwaSetCommandType: data[i].GwaSetType,
                    streamId: data[i].StreamId
                    );
            }

            senderProcessor.GsaInstanceToSpeckleObjects(layer, out var speckleObjects, resultsOnly);

            return(speckleObjects);
        }
Example #8
0
        public void TransmissionTest(string inputJsonFileName, GSATargetLayer layer, bool resultsOnly, bool embedResults, string gsaFileName)
        {
            gsaInterfacer.OpenFile(Helper.ResolveFullPath(gsaFileName, TestDataDirectory));

            //Deserialise into Speckle Objects so that these can be compared in any order

            var expectedFullJson = Helper.ReadFile(inputJsonFileName, TestDataDirectory);

            //This uses the installed SpeckleKits - when SpeckleStructural is built, the built files are copied into the
            // %LocalAppData%\SpeckleKits directory, so therefore this project doesn't need to reference the projects within in this solution
            var expectedObjects = JsonConvert.DeserializeObject <List <SpeckleObject> >(expectedFullJson, new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            });

            expectedObjects = expectedObjects.OrderBy(a => a.ApplicationId).ToList();

            var actualObjects = ModelToSpeckleObjects(layer, resultsOnly, embedResults, loadCases, resultTypes);

            Assert.IsNotNull(actualObjects);

            actualObjects = actualObjects.OrderBy(a => a.ApplicationId).ToList();

            //Assert.AreEqual(expectedObjects.Count(), actualObjects.Count());

            var expectedJsons = expectedObjects.Select(e => Regex.Replace(JsonConvert.SerializeObject(e, jsonSettings), jsonDecSearch, "$1")).ToList();

            expectedJsons = expectedJsons.Select(e => Regex.Replace(e, jsonHashSearch, jsonHashReplace)).ToList();

            var unmatching = new List <Tuple <string, string, List <string> > >();

            //Compare each object
            foreach (var actualObject in actualObjects)
            {
                var actualJson = JsonConvert.SerializeObject(actualObject, jsonSettings);

                actualJson = Regex.Replace(actualJson, jsonDecSearch, "$1");
                actualJson = Regex.Replace(actualJson, jsonHashSearch, jsonHashReplace);

                var matchingExpected = expectedJsons.FirstOrDefault(e => JsonCompareAreEqual(e, actualJson));

                if (matchingExpected == null)
                {
                    var nearestMatching = new List <string>();
                    if (!string.IsNullOrEmpty(actualObject.ApplicationId))
                    {
                        nearestMatching.AddRange(expectedJsons.Where(e => e.Contains(actualObject.ApplicationId)));
                    }

                    unmatching.Add(new Tuple <string, string, List <string> >(actualObject.ApplicationId, actualJson, nearestMatching));
                }
                else
                {
                    expectedJsons.Remove(matchingExpected);
                }
            }

            gsaInterfacer.Close();

            Assert.IsEmpty(unmatching, unmatching.Count().ToString() + " unmatched objects");
        }
Example #9
0
 public ReceiverProcessor(string directory, GSATargetLayer layer = GSATargetLayer.Design) : base(directory)
 {
     //this.appResources = appResources;
     //GSAInterfacer = gsaInterfacer;
     //GSACache = gsaCache;
     //((MockSettings)this.appResources.Settings).TargetLayer = layer;
 }
Example #10
0
    //Note: this is called while the traversedSerialisedLock is in place
    private void SerialiseUpdateCacheForGSAType(GSATargetLayer layer, string keyword, Type t, object dummyObject)
    {
      var readPrereqs = GetPrereqs(t, FilteredReadTypePrereqs[layer]);

      //The way the readPrereqs are constructed (one linear list, not grouped by generations/batches), this cannot be parallelised
      for (int j = 0; j < readPrereqs.Count(); j++)
      {
        var prereqDummyObject = Activator.CreateInstance(readPrereqs[j]);
        var prereqKeyword = prereqDummyObject.GetAttribute("GSAKeyword").ToString();

        if (!traversedSerialisedTypes.Contains(readPrereqs[j]))
        {
          _ = Converter.Serialise(prereqDummyObject);
          var prereqSerialisedObjects = CollateSerialisedObjects(readPrereqs[j]);

          for (int k = 0; k < prereqSerialisedObjects.Count; k++)
          {
            //The GWA will contain stream ID, which needs to be stripped off for merging and sending purposes
            var applicationId = prereqSerialisedObjects[k].ApplicationId;
            //Only objects which have application IDs can be merged
            if (!string.IsNullOrEmpty(applicationId))
            {
              prereqSerialisedObjects[k].ApplicationId = applicationId;

              //The SpeckleTypeName of this cache entry is automatically created by the assignment of the object
              GSA.gsaCache.AssignSpeckleObject(prereqKeyword, applicationId, prereqSerialisedObjects[k]);
            }
          }
          traversedSerialisedTypes.Add(readPrereqs[j]);
        }
      }

      //This ensures the sender objects are filled within the assembly which contains the corresponding "ToSpeckle" method
      var result = Converter.Serialise(dummyObject);
      var serialisedObjects = CollateSerialisedObjects(t);

      //For these serialised objects, there should already be a match in the cache, as it was read during initialisation and updated
      //during previous reception Trigger calls

      for (int j = 0; j < serialisedObjects.Count; j++)
      {
        var applicationId = serialisedObjects[j].ApplicationId;

        //Only objects which have application IDs can be merged
        if (!string.IsNullOrEmpty(applicationId))
        {
          serialisedObjects[j].ApplicationId = applicationId;

          //The SpeckleTypeName of this cache entry is automatically created by the assignment of the object
          GSA.gsaCache.AssignSpeckleObject(keyword, serialisedObjects[j].ApplicationId, serialisedObjects[j]);
        }
      }

      traversedSerialisedTypes.Add(t);
    }
Example #11
0
        public List <string> GetKeywords(GSATargetLayer layer)
        {
            // Grab GSA interface and attribute type
            var attributeType = typeof(GSAObject);
            var interfaceType = typeof(IGSASpeckleContainer);

            // Grab all GSA related object
            var ass      = AppDomain.CurrentDomain.GetAssemblies().First(a => a.GetName().Name == "SpeckleStructuralGSA");
            var objTypes = ass.GetTypes().Where(t => interfaceType.IsAssignableFrom(t) && t != interfaceType && !t.IsAbstract).ToList();

            var TypePrerequisites = new Dictionary <Type, List <Type> >();

            var keywords = new List <string>();

            foreach (var t in objTypes)
            {
                if (t.GetAttribute("AnalysisLayer", attributeType) != null)
                {
                    if ((layer == GSATargetLayer.Analysis) && !(bool)t.GetAttribute("AnalysisLayer", attributeType))
                    {
                        continue;
                    }
                }

                if (t.GetAttribute("DesignLayer", attributeType) != null)
                {
                    if ((layer == GSATargetLayer.Design) && !(bool)t.GetAttribute("DesignLayer", attributeType))
                    {
                        continue;
                    }
                }

                var typeKeyword = t.GetGSAKeyword();
                if (!keywords.Contains(typeKeyword))
                {
                    keywords.Add(typeKeyword);
                }
                var subtypeKeywords = t.GetSubGSAKeyword();
                if (subtypeKeywords != null && subtypeKeywords.Count() > 0)
                {
                    for (var i = 0; i < subtypeKeywords.Count(); i++)
                    {
                        if (!keywords.Contains(subtypeKeywords[i]))
                        {
                            keywords.Add(subtypeKeywords[i]);
                        }
                    }
                }
            }

            return(keywords);
        }
Example #12
0
        protected bool ObjectTypeMatchesLayer(Type t, GSATargetLayer layer)
        {
            var analysisLayerAttribute = t.GetAttribute("AnalysisLayer");
            var designLayerAttribute   = t.GetAttribute("DesignLayer");

            //If an object type has a layer attribute exists and its boolean value doesn't match the settings target layer, then it doesn't match.  This could be reviewed and simplified.
            if ((analysisLayerAttribute != null && layer == GSATargetLayer.Analysis && !(bool)analysisLayerAttribute) ||
                (designLayerAttribute != null && layer == GSATargetLayer.Design && !(bool)designLayerAttribute))
            {
                return(false);
            }
            return(true);
        }
        private void ConvertSpeckleObjectsToGsaInterfacerCache(GSATargetLayer layer)
        {
            // Write objects
            var currentBatch      = new List <Type>();
            var traversedTypes    = new List <Type>();
            var TypePrerequisites = Helper.GetTypeCastPriority(ioDirection.Receive, layer, false);

            do
            {
                currentBatch = TypePrerequisites.Where(i => i.Value.Count(x => !traversedTypes.Contains(x)) == 0).Select(i => i.Key).ToList();
                currentBatch.RemoveAll(i => traversedTypes.Contains(i));

                foreach (var t in currentBatch)
                {
                    var dummyObject     = Activator.CreateInstance(t);
                    var keyword         = dummyObject.GetAttribute <GSAObject>("GSAKeyword").ToString();
                    var valueType       = t.GetProperty("Value").GetValue(dummyObject).GetType();
                    var speckleTypeName = valueType.GetType().Name;
                    var targetObjects   = receivedObjects.Where(o => o.Item2.GetType() == valueType).ToList();

                    for (var i = 0; i < targetObjects.Count(); i++)
                    {
                        var streamId = targetObjects[i].Item1;
                        var obj      = targetObjects[i].Item2;

                        //DESERIALISE
                        var deserialiseReturn = ((string)Converter.Deserialise(obj));
                        var gwaCommands       = deserialiseReturn.Split(new[] { '\n' }).Where(c => c.Length > 0).ToList();

                        for (var j = 0; j < gwaCommands.Count(); j++)
                        {
                            appResources.Proxy.ParseGeneralGwa(gwaCommands[j], out keyword, out int?foundIndex, out var foundStreamId, out var foundApplicationId,
                                                               out var gwaWithoutSet, out var gwaSetCommandType);

                            //Only cache the object against, the top-level GWA command, not the sub-commands
                            ((IGSACache)appResources.Cache).Upsert(keyword, foundIndex.Value, gwaWithoutSet, applicationId: foundApplicationId,
                                                                   so: (foundApplicationId == obj.ApplicationId) ? obj : null, gwaSetCommandType: gwaSetCommandType.Value);
                        }
                    }

                    traversedTypes.Add(t);
                }
            } while (currentBatch.Count > 0);

            var toBeAddedGwa = ((IGSACache)appResources.Cache).GetNewGwaSetCommands();

            for (int i = 0; i < toBeAddedGwa.Count(); i++)
            {
                appResources.Proxy.SetGwa(toBeAddedGwa[i]);
            }
        }
Example #14
0
        public SenderProcessor(string directory, IGSAAppResources appResources, GSATargetLayer layer, bool embedResults, string[] cases = null, string[] resultsToSend = null) : base(directory)
        {
            this.appResources = appResources;
            this.appResources.Settings.TargetLayer = layer;

            this.appResources.Settings.EmbedResults = embedResults;
            if (cases != null)
            {
                this.appResources.Settings.ResultCases = cases.ToList();
            }
            if (resultsToSend != null)
            {
                processResultLabels(resultsToSend);
            }
        }
Example #15
0
        //[TestCase(GSATargetLayer.Analysis, "S5pNxjmUH.json")]
        public void ReceiveFullMesh(GSATargetLayer layer, string fileName)
        {
            var json = Helper.ReadFile(fileName, TestDataDirectory);

            var mockGsaCom = SetupMockGsaCom();

            Initialiser.AppResources.Proxy.OpenFile("", false, mockGsaCom.Object);

            var receiverProcessor = new ReceiverProcessor(TestDataDirectory);

            var rxObjs       = ExtractObjects(fileName, TestDataDirectory);
            var rx2DElements = rxObjs.Select(t => t.Item2).Where(o => o is Structural2DElement).Cast <Structural2DElement>().ToList();

            Assert.IsTrue(rx2DElements.All(o => o.Faces != null && o.Faces.Count() > 0 && o.Vertices != null && o.Vertices.Count() > 0));
        }
        public void ReceiverTestLoadRelated(GSATargetLayer layer, string fileName,
                                            int expectedNum0DLoads, int expectedNum2DBeamLoads, int expectedNum2dFaceLoads, int expectedNumLoadTasks, int expectedLoadCombos)
        {
            var json = Helper.ReadFile(fileName, TestDataDirectory);

            var mockGsaCom = SetupMockGsaCom();

            Initialiser.AppResources.Proxy.OpenFile("", false, mockGsaCom.Object);


            var receiverProcessor = new ReceiverProcessor(TestDataDirectory);

            //Run conversion to GWA keywords
            Assert.IsTrue(receiverProcessor.JsonSpeckleStreamsToGwaRecords(new[] { fileName }, out var actualGwaRecords, layer));
            Assert.IsNotNull(actualGwaRecords);
            Assert.IsNotEmpty(actualGwaRecords);

            var TypePrerequisites = Initialiser.GsaKit.RxTypeDependencies;
            var keywords          = TypePrerequisites.Select(i => i.Key.GetGSAKeyword()).Distinct().ToList();

            //Log outcome to file

            var actualGwaRecordsForKeyword = new Dictionary <string, List <string> >();

            for (var i = 0; i < actualGwaRecords.Count(); i++)
            {
                GSAProxy.ParseGeneralGwa(actualGwaRecords[i].GwaCommand, out var recordKeyword, out var foundIndex, out var foundStreamId, out string foundApplicationId, out var gwaWithoutSet, out var gwaSetCommandType);
                if (!actualGwaRecordsForKeyword.ContainsKey(recordKeyword))
                {
                    actualGwaRecordsForKeyword.Add(recordKeyword, new List <string>());
                }
                actualGwaRecordsForKeyword[recordKeyword].Add(actualGwaRecords[i].GwaCommand);
            }

            Assert.AreEqual(expectedNum0DLoads, actualGwaRecords.Where(r => r.GwaCommand.Contains("LOAD_NODE")).Count());
            Assert.AreEqual(expectedNum2DBeamLoads, actualGwaRecords.Where(r => r.GwaCommand.Contains("LOAD_BEAM_UDL")).Count());
            Assert.AreEqual(expectedNum2dFaceLoads, actualGwaRecords.Where(r => r.GwaCommand.Contains("LOAD_2D_FACE")).Count());
            Assert.AreEqual(expectedNumLoadTasks, actualGwaRecords.Where(r => r.GwaCommand.Contains("TASK")).Count());
            Assert.AreEqual(expectedLoadCombos, actualGwaRecords.Where(r => r.GwaCommand.Contains("COMBINATION")).Count());

            /*
             * Assert.AreEqual(expectedNum2DBeamLoads, actualGwaRecordsForKeyword["LOAD_BEAM_UDL.2"].Distinct().Count());
             * Assert.AreEqual(expectedNum2dFaceLoads, actualGwaRecordsForKeyword["LOAD_2D_FACE.2"].Distinct().Count());
             * Assert.AreEqual(expectedNumLoadTasks, actualGwaRecordsForKeyword["TASK.1"].Distinct().Count());
             * Assert.AreEqual(expectedLoadCombos, actualGwaRecordsForKeyword["COMBINATION.1"].Distinct().Count());
             */
        }
Example #17
0
        public bool SetUpTransmissionTestData(string outputJsonFileName, GSATargetLayer layer,
                                              bool resultsOnly, bool embedResults, string[] cases = null, string[] resultsToSend = null)
        {
            var speckleObjects = ModelToSpeckleObjects(layer, resultsOnly, embedResults, cases, resultsToSend);

            if (speckleObjects == null)
            {
                return(false);
            }

            //Create JSON file containing serialised SpeckleObjects
            var jsonToWrite = JsonConvert.SerializeObject(speckleObjects, Formatting.Indented);

            Helper.WriteFile(jsonToWrite, outputJsonFileName, TestDataDirectory);

            return(true);
        }
Example #18
0
        public bool SetUpTransmissionTestData(string outputJsonFileName, GSATargetLayer layer,
                                              bool resultsOnly, bool embedResults, List <ResultType> resultTypes = null, string[] cases = null)
        {
            var speckleObjects = ModelToSpeckleObjects(layer, resultsOnly, embedResults, cases, resultTypes);

            if (speckleObjects == null)
            {
                return(false);
            }

            //Create JSON file containing serialised SpeckleObjects
            speckleObjects.Sort((a, b) => CompareForOutputFileOrdering(a, b));
            var jsonToWrite = JsonConvert.SerializeObject(speckleObjects, Formatting.Indented);

            Test.Helper.WriteFile(jsonToWrite, outputJsonFileName, TestDataDirectory);

            return(true);
        }
Example #19
0
        public void Test1(string filePath, GSATargetLayer layer)
        {
            var args = new List <string> {
                "sender", "--server", url, "--email", email, "--token", token, "--file", filePath, "--layer", layer.ToString().ToLower(),
                "--result", "1D Element Force", "--resultCases", "C3"
            };

            var app = new App();

            app.RunCLI(args.ToArray());

            /*
             * var app = new App();
             * app.InitializeComponent();
             * app.Run();
             */
            //Process.Start(@"C:\Nicolaas\Repo\speckleGSA-github\SpeckleGSAUI\bin\Debug\SpeckleGSAUI.exe", string.Join(" ", args));
        }
 public ReceiverProcessor(string directory, GSAProxy gsaInterfacer, GSACache gsaCache, GSATargetLayer layer = GSATargetLayer.Design) : base(directory)
 {
     GSAInterfacer = gsaInterfacer;
     GSACache      = gsaCache;
     Initialiser.Settings.TargetLayer = layer;
 }
Example #21
0
        protected List <SpeckleObject> ModelToSpeckleObjects(GSATargetLayer layer, bool resultsOnly, bool embedResults, string[] cases,
                                                             List <ResultType> resultTypes)
        {
            bool sendResults = false;

            if (layer == GSATargetLayer.Analysis && cases != null && cases.Length > 0 && resultTypes != null && resultTypes.Count > 0)
            {
                Initialiser.AppResources.Settings.ResultTypes = resultTypes;
                Initialiser.AppResources.Settings.ResultCases = cases.ToList();
                sendResults = true;

                /*
                 * ((nodeResultsToSend != null && nodeResultsToSend.Length > 0) || (elem1dResultsToSend != null && elem1dResultsToSend.Length > 0)
                 || (elem2dResultsToSend != null && elem2dResultsToSend.Length > 0) || (miscResultsToSend != null && miscResultsToSend.Length > 0)))
                 ||{
                 ||sendResults = true;
                 ||Initialiser.AppResources.Settings.ResultCases = cases.ToList();
                 ||allResults = new List<string>();
                 ||if (nodeResultsToSend != null)
                 ||{
                 || //Initialiser.AppResources.Settings.NodalResults = nodeResultsToSend.ToDictionary(nrts => nrts, nrts => (IGSAResultParams)null);
                 ||}
                 ||if (elem1dResultsToSend != null)
                 ||{
                 || //Initialiser.AppResources.Settings.Element1DResults = elem1dResultsToSend.ToDictionary(nrts => nrts, nrts => (IGSAResultParams)null);
                 ||}
                 ||if (elem2dResultsToSend != null)
                 ||{
                 || //Initialiser.AppResources.Settings.Element2DResults = elem2dResultsToSend.ToDictionary(nrts => nrts, nrts => (IGSAResultParams)null);
                 ||}
                 ||if (miscResultsToSend != null)
                 ||{
                 || //Initialiser.AppResources.Settings.MiscResults = miscResultsToSend.ToDictionary(nrts => nrts, nrts => (IGSAResultParams)null);
                 ||}
                 */

                if (resultsOnly)
                {
                    Initialiser.AppResources.Settings.StreamSendConfig = StreamContentConfig.TabularResultsOnly;
                }
                else if (embedResults)
                {
                    Initialiser.AppResources.Settings.StreamSendConfig = StreamContentConfig.ModelWithEmbeddedResults;
                }
                else
                {
                    Initialiser.AppResources.Settings.StreamSendConfig = StreamContentConfig.ModelWithTabularResults;
                }
            }
            else
            {
                Initialiser.AppResources.Settings.StreamSendConfig = StreamContentConfig.ModelOnly;
            }
            Initialiser.AppResources.Settings.TargetLayer = layer;

            ((IGSACache)Initialiser.AppResources.Cache).Clear();

            ((GSAProxy)Initialiser.AppResources.Proxy).SetUnits("m");

            if (sendResults)
            {
                //Initialiser.AppResources.Proxy.LoadResults(allResults, cases.ToList());
                Initialiser.AppResources.Proxy.PrepareResults(resultTypes, Initialiser.AppResources.Settings.Result1DNumPosition + 2);
            }

            //Clear out all sender objects that might be there from the last test preparation
            Initialiser.GsaKit.GSASenderObjects.Clear();

            //Compile all GWA commands with application IDs
            var senderProcessor = new SenderProcessor(TestDataDirectory);

            var keywords = Initialiser.GsaKit.Keywords;
            var data     = Initialiser.AppResources.Proxy.GetGwaData(keywords, false);

            for (int i = 0; i < data.Count(); i++)
            {
                var applicationId = string.IsNullOrEmpty(data[i].ApplicationId) ? null : data[i].ApplicationId;
                Initialiser.AppResources.Cache.Upsert(
                    data[i].Keyword,
                    data[i].Index,
                    data[i].GwaWithoutSet,
                    applicationId: applicationId,
                    gwaSetCommandType: data[i].GwaSetType,
                    streamId: data[i].StreamId
                    );
            }

            senderProcessor.GsaInstanceToSpeckleObjects(out var speckleObjects);

            return(speckleObjects);
        }
Example #22
0
        private void ReceiverGsaValidation(string subdir, string[] jsonFiles, GSATargetLayer layer)
        {
            // Takes a saved Speckle stream with structural objects
            // converts to GWA and sends to GSA
            // then reads the data back out of GSA
            // and compares the two sets of GWA
            // if successful then there will be the same number
            // of each of the keywords in as out

            SpeckleInitializer.Initialize();
            Initialiser.AppResources = new MockGSAApp(proxy: new GSAProxy());
            Initialiser.GsaKit.Clear();
            Initialiser.AppResources.Settings.TargetLayer = layer;
            Initialiser.AppResources.Proxy.NewFile(true);

            var dir = TestDataDirectory;

            if (subdir != String.Empty)
            {
                dir = Path.Combine(TestDataDirectory, subdir);
                dir = dir + @"\"; // TestDataDirectory setup unconvetionally with trailing seperator - follow suit
            }

            var receiverProcessor = new ReceiverProcessor(dir, Initialiser.AppResources);

            // Run conversion to GWA keywords
            // Note that it can be one model split over several json files
            receiverProcessor.JsonSpeckleStreamsToGwaRecords(jsonFiles, out var gwaRecordsFromFile, layer);

            //Run conversion to GWA keywords
            Assert.IsNotNull(gwaRecordsFromFile);
            Assert.IsNotEmpty(gwaRecordsFromFile);

            var designTypeHierarchy   = Helper.GetTypeCastPriority(ioDirection.Receive, GSATargetLayer.Design, false);
            var analysisTypeHierarchy = Helper.GetTypeCastPriority(ioDirection.Receive, GSATargetLayer.Analysis, false);
            var keywords = designTypeHierarchy.Select(i => i.Key.GetGSAKeyword()).ToList();

            keywords.AddRange(designTypeHierarchy.SelectMany(i => i.Key.GetSubGSAKeyword()));
            keywords.AddRange(analysisTypeHierarchy.Select(i => i.Key.GetGSAKeyword()));
            keywords.AddRange(analysisTypeHierarchy.SelectMany(i => i.Key.GetSubGSAKeyword()));
            keywords = keywords.Where(k => k.Length > 0).Select(k => Helper.RemoveVersionFromKeyword(k)).Distinct().ToList();

            Initialiser.AppResources.Proxy.Sync();                                        // send GWA to GSA

            var retrievedGwa = Initialiser.AppResources.Proxy.GetGwaData(keywords, true); // read GWA from GSA

            var retrievedDict = new Dictionary <string, List <string> >();

            foreach (var gwa in retrievedGwa)
            {
                Initialiser.AppResources.Proxy.ParseGeneralGwa(gwa.GwaWithoutSet, out string keyword, out _, out _, out _, out _, out _);
                if (!retrievedDict.ContainsKey(keyword))
                {
                    retrievedDict.Add(keyword, new List <string>());
                }
                retrievedDict[keyword].Add(gwa.GwaWithoutSet);
            }

            var fromFileDict = new Dictionary <string, List <string> >();

            foreach (var r in gwaRecordsFromFile)
            {
                Initialiser.AppResources.Proxy.ParseGeneralGwa(r.GwaCommand, out string keyword, out _, out _, out _, out string gwaWithoutSet, out _);
                if (!fromFileDict.ContainsKey(keyword))
                {
                    fromFileDict.Add(keyword, new List <string>());
                }
                fromFileDict[keyword].Add(gwaWithoutSet);
            }

            Initialiser.AppResources.Proxy.Close();

            var unmatching = new Dictionary <string, UnmatchedData>();

            foreach (var keyword in fromFileDict.Keys)
            {
                if (!retrievedDict.ContainsKey(keyword))
                {
                    unmatching[keyword]          = new UnmatchedData();
                    unmatching[keyword].FromFile = fromFileDict[keyword];
                }
                else if (retrievedDict[keyword].Count != fromFileDict[keyword].Count)
                {
                    unmatching[keyword]           = new UnmatchedData();
                    unmatching[keyword].Retrieved = (retrievedDict.ContainsKey(keyword)) ? retrievedDict[keyword] : null;
                    unmatching[keyword].FromFile  = fromFileDict[keyword];
                }
            }

            Assert.AreEqual(0, unmatching.Count());

            // GSA sometimes forgets the SID - should check that this has passed through correctly here
        }
Example #23
0
        private void RunReceiverTest(string[] savedJsonFileNames, string expectedGwaPerIdsFile, GSATargetLayer layer)
        {
            var expectedJson       = Helper.ReadFile(expectedGwaPerIdsFile, TestDataDirectory);
            var expectedGwaRecords = Helper.DeserialiseJson <List <GwaRecord> >(expectedJson);

            var mockGsaCom = SetupMockGsaCom();

            gsaInterfacer.OpenFile("", false, mockGsaCom.Object);

            var receiverProcessor = new ReceiverProcessor(TestDataDirectory, gsaInterfacer, gsaCache);

            //Run conversion to GWA keywords
            receiverProcessor.JsonSpeckleStreamsToGwaRecords(savedJsonFileNames, out var actualGwaRecords);
            Assert.IsNotNull(actualGwaRecords);
            Assert.IsNotEmpty(actualGwaRecords);

            var keywords = Helper.GetTypeCastPriority(ioDirection.Receive, GSATargetLayer.Design, false).Select(i => i.Key.GetGSAKeyword()).Distinct().ToList();

            //Log outcome to file

            foreach (var keyword in keywords)
            {
                var expectedGwaRecordsForKeyword = new List <GwaRecord>();
                for (var i = 0; i < expectedGwaRecords.Count(); i++)
                {
                    Initialiser.Interface.ParseGeneralGwa(expectedGwaRecords[i].GwaCommand, out var recordKeyword, out var foundIndex, out var foundStreamId, out string foundApplicationId, out var gwaWithoutSet, out var gwaSetCommandType);
                    if (recordKeyword.Equals(keyword, StringComparison.InvariantCultureIgnoreCase))
                    {
                        expectedGwaRecordsForKeyword.Add(expectedGwaRecords[i]);
                    }
                }

                var actualGwaRecordsForKeyword = new List <GwaRecord>();
                for (var i = 0; i < actualGwaRecords.Count(); i++)
                {
                    Initialiser.Interface.ParseGeneralGwa(actualGwaRecords[i].GwaCommand, out var recordKeyword, out var foundIndex, out var foundStreamId, out string foundApplicationId, out var gwaWithoutSet, out var gwaSetCommandType);
                    if (recordKeyword.Equals(keyword, StringComparison.InvariantCultureIgnoreCase))
                    {
                        actualGwaRecordsForKeyword.Add(actualGwaRecords[i]);
                    }
                }

                if (expectedGwaRecordsForKeyword.Count() == 0)
                {
                    continue;
                }

                Assert.GreaterOrEqual(actualGwaRecordsForKeyword.Count(), expectedGwaRecordsForKeyword.Count(), "Number of GWA records don't match");

                var actualUniqueApplicationIds   = actualGwaRecordsForKeyword.Where(r => !string.IsNullOrEmpty(r.ApplicationId)).Select(r => r.ApplicationId).Distinct();
                var expectedUniqueApplicationIds = expectedGwaRecordsForKeyword.Where(r => !string.IsNullOrEmpty(r.ApplicationId)).Select(r => r.ApplicationId).Distinct();
                Assert.AreEqual(expectedUniqueApplicationIds.Count(), actualUniqueApplicationIds.Count());

                //Check for any actual records missing from expected
                Assert.IsTrue(actualUniqueApplicationIds.All(a => expectedUniqueApplicationIds.Contains(a)));

                //Check any expected records missing in actual
                Assert.IsTrue(expectedUniqueApplicationIds.All(a => actualUniqueApplicationIds.Contains(a)));

                //Check each actual record has match in expected
                foreach (var actualGwaRecord in actualGwaRecordsForKeyword)
                {
                    Assert.GreaterOrEqual(1,
                                          expectedGwaRecordsForKeyword.Count(er => er.ApplicationId == actualGwaRecord.ApplicationId && er.GwaCommand.Equals(actualGwaRecord.GwaCommand, StringComparison.InvariantCultureIgnoreCase)),
                                          "Expected record not found in actual records");
                }
            }
        }
Example #24
0
 public void ReceiverTestDesignLayer(GSATargetLayer layer)
 {
     RunReceiverTest(savedJsonFileNames, expectedGwaPerIdsFileName, layer);
 }
 public void ReceiverTestBlankRefsDesignLayer(GSATargetLayer layer)
 {
     RunReceiverTest(savedBlankRefsJsonFileNames, expectedBlankRefsGwaPerIdsFileName, "Blank", layer);
 }
Example #26
0
        //made public so that the sender tests can use it to know which keywords to use to hydrate the cache
        public static Dictionary <Type, List <Type> > GetTypeCastPriority(ioDirection ioDirection, GSATargetLayer layer, bool resultsOnly)
        {
            // Grab GSA interface and attribute type
            var attributeType = typeof(GSAObject);
            var interfaceType = typeof(IGSASpeckleContainer);

            var ioAttribute = (ioDirection == ioDirection.Receive) ? "WritePrerequisite" : "ReadPrerequisite";

            // Grab all GSA related object
            var ass      = AppDomain.CurrentDomain.GetAssemblies().First(a => a.GetName().Name == "SpeckleStructuralGSA");
            var objTypes = ass.GetTypes().Where(t => interfaceType.IsAssignableFrom(t) && t != interfaceType).ToList();

            var TypePrerequisites = new Dictionary <Type, List <Type> >();

            foreach (var t in objTypes)
            {
                if (t.GetAttribute("AnalysisLayer", attributeType) != null)
                {
                    if ((layer == GSATargetLayer.Analysis) && !(bool)t.GetAttribute("AnalysisLayer", attributeType))
                    {
                        continue;
                    }
                }

                if (t.GetAttribute("DesignLayer", attributeType) != null)
                {
                    if ((layer == GSATargetLayer.Design) && !(bool)t.GetAttribute("DesignLayer", attributeType))
                    {
                        continue;
                    }
                }

                if (ioDirection == ioDirection.Send)
                {
                    if (t.GetAttribute("Stream", attributeType) != null)
                    {
                        if (resultsOnly && t.GetAttribute("Stream", attributeType) as string != "results")
                        {
                            continue;
                        }
                    }
                }

                var prereq = new List <Type>();
                if (t.GetAttribute(ioAttribute, attributeType) != null)
                {
                    prereq = ((Type[])t.GetAttribute(ioAttribute, attributeType)).ToList();
                }

                TypePrerequisites[t] = prereq;
            }

            // Remove wrong layer objects from prerequisites
            foreach (var t in objTypes)
            {
                if (t.GetAttribute("AnalysisLayer", attributeType) != null)
                {
                    if ((layer == GSATargetLayer.Analysis) && !(bool)t.GetAttribute("AnalysisLayer", attributeType))
                    {
                        foreach (var kvp in TypePrerequisites)
                        {
                            kvp.Value.Remove(t);
                        }
                    }
                }

                if (t.GetAttribute("DesignLayer", attributeType) != null)
                {
                    if ((layer == GSATargetLayer.Design) && !(bool)t.GetAttribute("DesignLayer", attributeType))
                    {
                        foreach (var kvp in TypePrerequisites)
                        {
                            kvp.Value.Remove(t);
                        }
                    }
                }

                if (ioDirection == ioDirection.Send)
                {
                    if (t.GetAttribute("Stream", attributeType) != null)
                    {
                        if (resultsOnly && t.GetAttribute("Stream", attributeType) as string != "results")
                        {
                            foreach (var kvp in TypePrerequisites)
                            {
                                kvp.Value.Remove(t);
                            }
                        }
                    }
                }
            }

            return(TypePrerequisites);
            // Generate which GSA object to cast for each type
            //TypeCastPriority = TypePrerequisites.ToList();
            //TypeCastPriority.Sort((x, y) => x.Value.Count().CompareTo(y.Value.Count()));
        }
        private bool PrepareReceptionTestData(string[] savedJsonFileNames, string outputGWAFileName, GSATargetLayer layer, string subdir)
        {
            var mockGsaCom = SetupMockGsaCom();

            Initialiser.AppResources.Proxy.OpenFile("", false, mockGsaCom.Object);

            var receiverProcessor = new ReceiverProcessor(Path.Combine(TestDataDirectory, subdir), Initialiser.AppResources, layer);

            //Run conversion to GWA keywords
            receiverProcessor.JsonSpeckleStreamsToGwaRecords(savedJsonFileNames, out var gwaRecords, layer);

            //Create JSON file containing pairs of ApplicationId and GWA commands
            var jsonToWrite = JsonConvert.SerializeObject(gwaRecords, Formatting.Indented, jsonSettings);

            //Save JSON file
            Test.Helper.WriteFile(jsonToWrite, outputGWAFileName, Path.Combine(TestDataDirectory, subdir));

            return(true);
        }
Example #28
0
    private SpeckleObject ProcessObject(SpeckleObject targetObject, string speckleTypeName, string keyword, Type t, object dummyObject, string streamId, GSATargetLayer layer)
    {
      var existingList = GSA.gsaCache.GetSpeckleObjects(speckleTypeName, targetObject.ApplicationId, streamId: streamId);

      if (existingList == null || existingList.Count() == 0)
      {
        //The serialisation for this object didn't work (a notable example is ASSEMBLY when type is ELEMENT when Design layer is targeted)
        //so mark it as previous as there is clearly an update from the stream.  For these cases, merging isn't possible.
        GSA.gsaCache.MarkAsPrevious(keyword, targetObject.ApplicationId);
      }
      else
      {
        var existing = existingList.First();  //There should just be one instance of each Application ID per type

        try
        {
          targetObject = GSA.Merger.Merge(targetObject, existing);
        }
        catch
        {
          //Add for summary messaging at the end of processing
          GSA.appUi.Message("Unable to merge " + t.Name + " with existing objects", targetObject.ApplicationId);
        }
      }

      List<string> gwaCommands = new List<string>();
      List<string> linesToAdd = null;

      HelperFunctions.tryCatchWithEvents(() =>
        {
          var deserialiseReturn = Converter.Deserialise(targetObject);
          if (deserialiseReturn.GetType() != typeof(string))
          {
            throw new Exception("Converting to native didn't produce a string output");
          }
          linesToAdd = ((string)deserialiseReturn).Split(new[] { '\n' }).Where(c => c.Length > 0).ToList();
        }, "", "Unable to convert object to GWA");

      if (linesToAdd != null)
      {
        gwaCommands.AddRange(linesToAdd);

        //TO DO - parallelise
        for (int j = 0; j < gwaCommands.Count(); j++)
        {
          //At this point the SID will be filled with the application ID
          GSA.gsaProxy.ParseGeneralGwa(gwaCommands[j], out keyword, out int? foundIndex, out string foundStreamId, out string foundApplicationId, out string gwaWithoutSet, out GwaSetCommandType? gwaSetCommandType);

          var originalSid = GSA.gsaProxy.FormatSidTags(foundStreamId, foundApplicationId);
          var newSid = GSA.gsaProxy.FormatSidTags(streamId, foundApplicationId);

          //If the SID tag has been set then update it with the stream
          if (string.IsNullOrEmpty(originalSid))
          {
            gwaCommands[j] = gwaCommands[j].Replace(keyword, keyword + ":" + newSid);
            gwaWithoutSet = gwaWithoutSet.Replace(keyword, keyword + ":" + newSid);
          }
          else
          {
            gwaCommands[j] = gwaCommands[j].Replace(originalSid, newSid);
            gwaWithoutSet = gwaWithoutSet.Replace(originalSid, newSid);
          }

          //Only cache the object against, the top-level GWA command, not the sub-commands - this is what the SID value comparision is there for
          GSA.gsaCache.Upsert(keyword,
            foundIndex.Value,
            gwaWithoutSet,
            foundApplicationId,
            so: (foundApplicationId != null 
              && targetObject.ApplicationId != null 
              && targetObject.ApplicationId.EqualsWithoutSpaces(foundApplicationId)) 
                ? targetObject 
                : null,
            gwaSetCommandType: gwaSetCommandType.HasValue ? gwaSetCommandType.Value : GwaSetCommandType.Set,
            streamId: streamId);
        }
      }
      return targetObject;
    }
Example #29
0
    private Task ProcessObjectsForLayer(GSATargetLayer layer)
    {
      // Write objects
      var currentBatch = new List<Type>();

      do
      {
        ExecuteWithLock(ref traversedDeserialisedLock, () =>
        {
          currentBatch = FilteredWriteTypePrereqs[layer].Where(i => i.Value.Count(x => !traversedDeserialisedTypes.Contains(x)) == 0).Select(i => i.Key).ToList();
          currentBatch.RemoveAll(i => traversedDeserialisedTypes.Contains(i));
        });

        //Trigger the discovery and assignment of ToNative() methods within the SpeckleCore Converter static object
        //in preparation for their parallel use below.  The methods are stored in a Dictionary object, which is thread-safe
        //for reading. Because the calls to Deserialise below (of dummy objects) will alter the Dictionary object, it must be
        //done in serial on the one thread
        foreach (var t in currentBatch)
        {
          if (!dummyObjectDict.ContainsKey(t))
          {
            var dummyObject = Activator.CreateInstance(t);
            dummyObjectDict[t] = dummyObject;
          }
          var valueType = t.GetProperty("Value").GetValue(dummyObjectDict[t]).GetType();
          if (!Converter.toNativeMethods.ContainsKey(valueType.ToString()))
          {
            try
            {
              Converter.Deserialise((SpeckleObject)((IGSASpeckleContainer)dummyObjectDict[t]).Value);
            }
            catch { }
          }
        }

        Debug.WriteLine("Ran through all types in batch to populate SpeckleCore's ToNative list");

#if DEBUG
        foreach (var t in currentBatch)
#else
        Parallel.ForEach(currentBatch, t =>
#endif
        {
          Status.ChangeStatus("Writing " + t.Name);

          Debug.WriteLine("Processing " + t.Name + " on thread " + Thread.CurrentThread.ManagedThreadId);

          var dummyObject = dummyObjectDict[t];
          var keyword = dummyObject.GetAttribute("GSAKeyword").ToString();

          var valueType = t.GetProperty("Value").GetValue(dummyObject).GetType();
          var targetObjects = ExecuteWithLock(ref currentObjectsLock, () => currentObjects.Where(o => o.Item2.GetType() == valueType).ToList());

          var speckleTypeName = ((SpeckleObject)((IGSASpeckleContainer)dummyObject).Value).Type;

          //First serialise all relevant objects into sending dictionary so that merging can happen
          var typeAppIds = targetObjects.Where(o => o.Item2.ApplicationId != null).Select(o => o.Item2.ApplicationId).ToList();
          if (typeAppIds.Any(i => GSA.gsaCache.ApplicationIdExists(keyword, i)))
          {
            //Serialise all objects of this type and update traversedSerialised list
            ExecuteWithLock(ref traversedSerialisedLock, () =>
            {
              if (!traversedSerialisedTypes.Contains(t))
              {
                SerialiseUpdateCacheForGSAType(layer, keyword, t, dummyObject);
              }
            });
          }

#if DEBUG
          foreach (var tuple in targetObjects)
#else
            Parallel.ForEach(targetObjects, tuple =>
#endif
          {
            dummyObject = Activator.CreateInstance(t);
            var streamId = tuple.Item1;
            var obj = tuple.Item2;

            var applicationId = obj.ApplicationId;

            if (string.IsNullOrEmpty(applicationId))
            {
              if (string.IsNullOrEmpty(obj.Name))
              {
                GSA.appUi.Message(speckleTypeName + " with no name nor ApplicationId (identified by hashes)", obj.Hash);
              }
              else
              {
                GSA.appUi.Message(speckleTypeName + " with name but no ApplicationId (identified by name)", obj.Name);
              }
            }
            //Check if this application appears in the cache at all
            else
            {
              HelperFunctions.tryCatchWithEvents(() => ProcessObject(obj, speckleTypeName, keyword, t, dummyObject, streamId, layer),
                "", "Processing error for " + speckleTypeName + " with ApplicationId = " + applicationId);

              ExecuteWithLock(ref currentObjectsLock, () => currentObjects.Remove(tuple));
            }
          }
#if !DEBUG
          );
#endif
          ExecuteWithLock(ref traversedDeserialisedLock, () => traversedDeserialisedTypes.Add(t));
        }
#if !DEBUG
        );
#endif

      } while (currentBatch.Count > 0);

      return Task.CompletedTask;
    }
Example #30
0
 public TabBase(GSATargetLayer defaultLayer)
 {
     TargetLayer = defaultLayer;
 }