From 8768a855af9ccc482a9520ce708ef32e0e6e0e7d Mon Sep 17 00:00:00 2001 From: Normand Briere <nbriere@noware.ca> Date: Fri, 04 Oct 2019 20:06:36 -0400 Subject: [PATCH] Block multiple download. --- FileObject.java | 67 ++++++++++++++++++++++++++++++--- 1 files changed, 61 insertions(+), 6 deletions(-) diff --git a/FileObject.java b/FileObject.java index e41d012..e899a71 100644 --- a/FileObject.java +++ b/FileObject.java @@ -17,15 +17,50 @@ filecontent = null; } + boolean HasBigData() + { + return filecontent != null; + } + + void ExtractBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) + { + Object3D o; + + if (hashtable.containsKey(GetUUID())) + { + o = hashtable.get(GetUUID()); + + //Grafreed.Assert(this.filecontent == ((FileObject)o).filecontent); + } + else + { + o = new Object3D("copy of " + this.name); + + hashtable.put(GetUUID(), o); + } + + ExtractBigData(o); + } + + void RestoreBigData(java.util.Hashtable<java.util.UUID, Object3D> hashtable) + { + if (!hashtable.containsKey(GetUUID())) + return; + + Object3D o = hashtable.get(GetUUID()); + + RestoreBigData(o); + } + boolean IsStatic() { return false; // ???? false; } - void Reset() - { - // filecontent = null; - } +// void Reset() +// { +// // filecontent = null; +// } void ClearUI() { @@ -54,9 +89,12 @@ else { filecontent = ObjEditor.ReadGFD/*z*/(name); + if (filecontent != null) + { filecontent.parent = null; filecontent.fileparent = this; filecontent.RepairTexture(); + } // stripify on load instead? // OK... // filecontent.Stripify(); // fine. faster and read-only anyway @@ -78,6 +116,23 @@ this.objfile = objfile; } + void ExtractBigData(Object3D o) + { + super.ExtractBigData(o); + + o.savefilecontent = this.filecontent; + + // filecontent is transient + this.filecontent = null; + } + + void RestoreBigData(Object3D o) + { + super.RestoreBigData(o); + + this.filecontent = o.savefilecontent; + } + Object3D deepCopy() { FileObject e = new FileObject(name, objfile); @@ -85,9 +140,9 @@ return e; } - protected void deepCopySelf(Object3D other) + protected void deepCopyNode(Object3D other) { - super.deepCopySelf(other); + super.deepCopyNode(other); } // void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected) -- Gitblit v1.6.2