From 9d2969e151e99b503dfdde9701858c428bd31727 Mon Sep 17 00:00:00 2001 From: Andrew Payne Date: Wed, 30 Oct 2024 15:01:48 -0400 Subject: [PATCH] minor bug fixes --- CHANGELOG.HOPS.md | 6 ++-- src/compute.geometry/GrasshopperDefinition.cs | 4 +-- src/compute.geometry/ResthopperEndpoints.cs | 32 ------------------- 3 files changed, 4 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.HOPS.md b/CHANGELOG.HOPS.md index 0f1749e6..b8dd6ee7 100644 --- a/CHANGELOG.HOPS.md +++ b/CHANGELOG.HOPS.md @@ -4,13 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.16.14] - 2024-10-11 +## [0.16.14] - 2024-10-30 ### Fixed -- Definitions which had nested Hops components in them which pointed to a URL were not deserializing the definition at the URL destination correctly. This was fixed. - -- Fixed a bug where the open file icon shown in the Set Definition dialog was blurry. +- Minor bug fixes. Fixed a bug where the open file icon shown in the Set Definition dialog was blurry. ## [0.16.13] - 2024-08-29 diff --git a/src/compute.geometry/GrasshopperDefinition.cs b/src/compute.geometry/GrasshopperDefinition.cs index 42a05e0b..13cef243 100644 --- a/src/compute.geometry/GrasshopperDefinition.cs +++ b/src/compute.geometry/GrasshopperDefinition.cs @@ -67,8 +67,8 @@ private static void Fsw_Changed(object sender, FileSystemEventArgs e) _watchedFileRuntimeSerialNumber++; } - static void LogDebug(string message) { Log.Debug(message); } - static void LogError(string message) { Log.Error(message); } + public static void LogDebug(string message) { Log.Debug(message); } + public static void LogError(string message) { Log.Error(message); } public static GrasshopperDefinition FromUrl(string url, bool cache) { diff --git a/src/compute.geometry/ResthopperEndpoints.cs b/src/compute.geometry/ResthopperEndpoints.cs index c34f1120..e5f9fedd 100644 --- a/src/compute.geometry/ResthopperEndpoints.cs +++ b/src/compute.geometry/ResthopperEndpoints.cs @@ -27,38 +27,6 @@ public void AddRoutes(IEndpointRouteBuilder app) app.MapGet("/io", GetIoNames); } - public static GH_Archive ArchiveFromUrl(string url) - { - if (string.IsNullOrWhiteSpace(url)) - return null; - - byte[] byteArray = null; - HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); - request.AutomaticDecompression = DecompressionMethods.GZip; - using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) - using (var stream = response.GetResponseStream()) - using (var memStream = new MemoryStream()) - { - stream.CopyTo(memStream); - byteArray = memStream.ToArray(); - } - - try - { - var byteArchive = new GH_Archive(); - if (byteArchive.Deserialize_Binary(byteArray)) - return byteArchive; - } - catch (Exception) { } - - var grasshopperXml = StripBom(System.Text.Encoding.UTF8.GetString(byteArray)); - var xmlArchive = new GH_Archive(); - if (xmlArchive.Deserialize_Xml(grasshopperXml)) - return xmlArchive; - - return null; - } - static void SetDefaultTolerances(double absoluteTolerance, double angleToleranceDegrees) { if (absoluteTolerance <= 0 || angleToleranceDegrees <= 0)