示例#1
0
 /// <summary>
 /// Constructor. Reads a makefile from disk.
 /// </summary>
 /// <param name="Reader">The archive to read from</param>
 public TargetMakefile(BinaryArchiveReader Reader)
 {
     CreateTimeUtc                = new DateTime(Reader.ReadLong(), DateTimeKind.Utc);
     ToolchainInfo                = Reader.ReadString();
     ExternalMetadata             = Reader.ReadString();
     ReceiptFile                  = Reader.ReadFileReference();
     ProjectIntermediateDirectory = Reader.ReadDirectoryReference();
     TargetType              = (TargetType)Reader.ReadInt();
     bDeployAfterCompile     = Reader.ReadBool();
     bHasProjectScriptPlugin = Reader.ReadBool();
     AdditionalArguments     = Reader.ReadArray(() => Reader.ReadString());
     PreBuildScripts         = Reader.ReadArray(() => Reader.ReadFileReference());
     Actions = Reader.ReadList(() => new Action(Reader));
     EnvironmentVariables    = Reader.ReadList(() => Tuple.Create(Reader.ReadString(), Reader.ReadString()));
     OutputItems             = Reader.ReadList(() => Reader.ReadFileItem());
     ModuleNameToOutputItems = Reader.ReadDictionary(() => Reader.ReadString(), () => Reader.ReadArray(() => Reader.ReadFileItem()), StringComparer.OrdinalIgnoreCase);
     HotReloadModuleNames    = Reader.ReadHashSet(() => Reader.ReadString(), StringComparer.OrdinalIgnoreCase);
     DirectoryToSourceFiles  = Reader.ReadDictionary(() => Reader.ReadDirectoryItem(), () => Reader.ReadArray(() => Reader.ReadFileItem()));
     WorkingSet = Reader.ReadHashSet(() => Reader.ReadFileItem());
     CandidatesForWorkingSet = Reader.ReadHashSet(() => Reader.ReadFileItem());
     UObjectModules          = Reader.ReadList(() => new UHTModuleInfo(Reader));
     UObjectModuleHeaders    = Reader.ReadList(() => new UHTModuleHeaderInfo(Reader));
     PluginFiles             = Reader.ReadHashSet(() => Reader.ReadFileItem());
     AdditionalDependencies  = Reader.ReadHashSet(() => Reader.ReadFileItem());
 }
示例#2
0
        /// <summary>
        /// Called whenever a Rhino document is being loaded and plug-in user data was
        /// encountered written by a plug-in with this plug-in's GUID.
        /// </summary>
        protected override void ReadDocument(RhinoDoc doc, BinaryArchiveReader archive, FileReadOptions options)
        {
            archive.Read3dmChunkVersion(out var major, out var minor);
            if (MAJOR == major && MINOR == minor)
            {
                // Always read user data even though you might not use it.

                var string_table = new SampleCsStringDocumentData();
                string_table.ReadDocument(archive);

                var simple_table = new SampleCsSimpleDocumentDataTable();
                simple_table.ReadDocument(archive);

                var dictionary = archive.ReadDictionary();

                if (!options.ImportMode && !options.ImportReferenceMode)
                {
                    if (string_table.Count > 0)
                    {
                        StringDocumentDataTable.AddRange(string_table.ToArray());
                    }

                    if (simple_table.Count > 0)
                    {
                        SimpleDocumentDataTable.AddRange(simple_table.ToArray());
                    }

                    if (null != dictionary && dictionary.Count > 0)
                    {
                        Dictionary = dictionary;
                    }
                }
            }
        }
        public override bool IsCurrentModelStateInAnySnapshot(RhinoDoc doc, RhinoObject doc_object, BinaryArchiveReader archive, SimpleArrayBinaryArchiveReader archive_array, TextLog text_log = null)
        {
            var userdata = archive.ReadDictionary();

            string name = "";

            if (!userdata.TryGetString("ObjName", out name))
            {
                return(false);
            }

            for (int i = 0; i < archive_array.Count; i++)
            {
                var ba = archive_array.Get(i);
                var ud = ba.ReadDictionary();

                string s = "";

                if (ud.TryGetString("ObjName", out s))
                {
                    if (0 == s.CompareTo(name))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
        //=========================== Select and highlight =================================

        //public bool SelectRoom() => SelectByIDs(new Guid[] { this.RoomID });

        //public bool SelectApertures() => SelectByIDs(this.ApertureIDs);

        //public bool SelectShades() => SelectByIDs(this.ShadeIDs);

        //public bool SelectEntireEntity()
        //{
        //    return this.SelectRoom() &&
        //        this.SelectApertures() &&
        //        this.SelectShades();
        //}

        //private bool SelectByIDs(IEnumerable<Guid> guids)
        //{
        //    var ids = guids;
        //    var rc = true;
        //    foreach (var item in ids)
        //    {
        //        //TODO: may need to check if object is visible or locked. deleted
        //        var obj = RhinoDoc.ActiveDoc.Objects.FindId(item);
        //        if (obj == null)
        //            continue;

        //        //Object might have been deleted
        //        if (this.RoomID == item)
        //        {

        //        }
        //        else if (!this.ApertureIDs.Any(_ => _ == item))
        //        {
        //            this.ApertureIDs.Remove(item);
        //        }

        //        if (obj.IsSelected(checkSubObjects: false) == 2)
        //        {
        //            //the entire object (including subobjects) is already selected
        //            //Do nothing
        //        }
        //        else
        //        {
        //            rc = rc && RhinoDoc.ActiveDoc.Objects.Select(item, true, true);
        //        }


        //    }
        //    return rc;
        //}

        //========================= Read/Write ===================================

        //public bool ShouldWrite => this.IsValid;


        public bool ReadArchive(BinaryArchiveReader archive)
        {
            archive.Read3dmChunkVersion(out var major, out var minor);
            if (major == 1 && minor == 0)
            {
                //HBObject, orphaned objects
                var dic = archive.ReadDictionary();
                Deserialize(dic);
            }
            return(!archive.ReadErrorOccured);
        }
 protected override void ReadDocument(RhinoDoc doc, BinaryArchiveReader archive, FileReadOptions options)
 {
     RigidBodyManager.World = new World(new CollisionSystemSAP());
     Rhino.Collections.ArchivableDictionary dict = archive.ReadDictionary();
     RigidBodyManager.GuidList           = (List <Guid>)RigidBodyManager.ByteArrayToObject(dict["guidList"] as byte[]);
     RigidBodyManager.RigidBodies        = (List <RigidBody>)RigidBodyManager.ByteArrayToObject(dict["rigidBodies"] as byte[]);
     RigidBodyManager.GeometryList       = (List <Brep>)RigidBodyManager.ByteArrayToObject(dict["geometryList"] as byte[]);
     TimePanel.Instance.MaxFrameBoxValue = (int)dict["MaxFrameBoxValue"];
     //Reset
     TimePanel.Instance.ResetNotSavable();
     WorldCount = (int)dict["worldCount"];
 }
        public override bool RestoreObject(RhinoDoc doc, RhinoObject doc_object, ref Transform transform, BinaryArchiveReader archive)
        {
            Rhino.Collections.ArchivableDictionary userdata = archive.ReadDictionary();

            string name = "";

            if (userdata.TryGetString("ObjName", out name))
            {
                doc_object.Attributes.Name = name;
                doc_object.CommitChanges();
            }
            return(!archive.ReadErrorOccured);
        }
示例#7
0
        protected override bool Read(BinaryArchiveReader archive)
        {
            // read archivable dict from archive
            var dict = archive.ReadDictionary();

            // test keys
            if (dict.ContainsKey("Width") && dict.ContainsKey("Height"))
            {
                // set properties from dict
                Plane  = dict.GetPlane("Plane");
                Width  = dict.GetDouble("Width");
                Height = dict.GetDouble("Height");
            }

            return(!archive.ReadErrorOccured);
        }
        /// <inheritdoc />
        /// <summary>
        /// Called whenever a Rhino document is being loaded and plug-in user data was
        /// encountered written by a plug-in with this plug-in's GUID.
        /// </summary>
        protected override void ReadDocument(RhinoDoc doc, BinaryArchiveReader archive, FileReadOptions options)
        {
            archive.Read3dmChunkVersion(out var major, out var minor);
            if (MAJOR == major && MINOR == minor)
            {
                var dictionary = archive.ReadDictionary();
                if (null != dictionary && !options.ImportMode && !options.ImportReferenceMode)
                {
                    m_dictionary = dictionary.Clone();

                    // Note, if we read our user data from a document, then
                    // assume that we can to track commands...
                    CommandTrackingEnabled = true;
                }
            }
        }
示例#9
0
        /// <summary>
        /// Attempts to load this action history from disk
        /// </summary>
        void Load()
        {
            try
            {
                using (BinaryArchiveReader Reader = new BinaryArchiveReader(Location))
                {
                    int Version = Reader.ReadInt();
                    if (Version != CurrentVersion)
                    {
                        Log.TraceLog("Unable to read action history from {0}; version {1} vs current {2}", Location, Version, CurrentVersion);
                        return;
                    }

                    OutputItemToCommandLineHash = Reader.ReadDictionary(() => Reader.ReadFileItem(), () => Reader.ReadFixedSizeByteArray(HashLength));
                }
            }
            catch (Exception Ex)
            {
                Log.TraceWarning("Unable to read {0}. See log for additional information.", Location);
                Log.TraceLog("{0}", ExceptionUtils.FormatExceptionDetails(Ex));
            }
        }
示例#10
0
        protected override void ReadDocument(RhinoDoc doc, BinaryArchiveReader archive, FileReadOptions options)
        {
            Beams.Clear();
            CurrentBeam = null;

            if (unitfactors.ContainsKey(RhinoDoc.ActiveDoc.ModelUnitSystem))
            {
                Unitfactor = unitfactors[RhinoDoc.ActiveDoc.ModelUnitSystem];
            }
            else
            {
                MessageBox.Show("Cross section design tool does not support the chosen" +
                                "unit system. Unit system will be changed to millimeters.");
                RhinoDoc.ActiveDoc.ModelUnitSystem = UnitSystem.Millimeters;
                Unitfactor = unitfactors[RhinoDoc.ActiveDoc.ModelUnitSystem];
            }



            try
            {
                ArchivableDictionary dict = archive.ReadDictionary();

                int i     = 1;
                int count = 0;
                if (dict["BeamCount"] != null)
                {
                    count = (int)dict["BeamCount"];
                }

                dict.Set("CountUserData", CountableUserData.getCounter());
                while (i < count + 1)
                {
                    Beam   bTemp;
                    string beamName = (string)dict["BeamName" + i];

                    if ((string)dict["BeamType" + i] == "Column")
                    {
                        bTemp = new Column(beamName, dict.GetDouble("Gammas" + i),
                                           dict.GetDouble("Gammac" + i),
                                           dict.GetDouble("Gammar" + i),
                                           dict.GetDouble("Acc" + i))
                        {
                            Length = (double)dict["ColLength" + i],
                            Ky     = (double)dict["ky" + i],
                            Kz     = (double)dict["kz" + i],
                        };
                        ((Column)bTemp).ColumnCalcSettings.ColumnCalMethod[ColumnCalculationMethod.NominalCurvature1] =
                            dict.GetBool("ColumnCalculationSettings1" + i);
                        ((Column)bTemp).ColumnCalcSettings.ColumnCalMethod[ColumnCalculationMethod.NominalCurvature2] =
                            dict.GetBool("ColumnCalculationSettings2" + i);
                        ((Column)bTemp).ColumnCalcSettings.ColumnCalMethod[ColumnCalculationMethod.NominalStiffness1] =
                            dict.GetBool("ColumnCalculationSettings3" + i);
                        ((Column)bTemp).ColumnCalcSettings.ColumnCalMethod[ColumnCalculationMethod.NominalStiffness2] =
                            dict.GetBool("ColumnCalculationSettings4" + i);
                    }
                    else
                    {
                        bTemp = new Beam(beamName, dict.GetDouble("Gammas" + i),
                                         dict.GetDouble("Gammac" + i),
                                         dict.GetDouble("Gammar" + i),
                                         dict.GetDouble("Acc" + i))
                        {
                        };
                    }

                    bTemp.ClimateCond = new ClimateCondition(
                        (int)dict["Rh" + i],
                        (int)dict["T0" + i],
                        (int)dict["T" + i],
                        bTemp);

                    string       crossSecName = (string)dict["CrossSecName" + i];
                    CrossSection cTemp;
                    if ((string)dict["CrossSectionType" + i] == "Basic")
                    {
                        cTemp =
                            new CrossSection(crossSecName, bTemp)
                        {
                        };
                    }

                    else if (dict.GetString("CrossSectionType" + i) == "Rect")
                    {
                        cTemp =
                            new RectangleCrossSection(crossSecName, bTemp)
                        {
                            NoReinfH       = (int)dict["NoReinfH" + i],
                            NoReinfW       = (int)dict["NoReinfW" + i],
                            ConcreteCover  = (int)dict["ConcreteCover" + i],
                            ConcreteWidth  = dict.GetInteger("ConcreteWidth" + i),
                            ConcreteHeight = dict.GetInteger("ConcreteHeight" + i),
                            HasSteelShell  = dict.GetBool("HasSteelShell" + i),
                            SteelThickness = dict.GetDouble("SteelThickness" + i),
                            MainD          = dict.GetInteger("MainDiameter" + i),
                            StirrupD       = dict.GetInteger("StirrupDiameter" + i),
                            SteelMaterial  = new SteelMaterial(dict.GetString("SteelMaterialName" + i) ?? "S355", SteelType.StructuralSteel, bTemp),
                            ReinfMaterial  = new SteelMaterial(dict.GetString("ReinforcementMaterialName" + i ?? "B500B"), SteelType.Reinforcement, bTemp),
                            Rotation       = dict.GetInteger("Rotation" + i),
                        };
                    }
                    else
                    {
                        cTemp =
                            new CircleCrossSection(crossSecName, bTemp)
                        {
                            NoReinf          = (int)dict["NoReinf"],
                            ConcreteCover    = (int)dict["ConcreteCover" + i],
                            ConcreteDiameter = dict.GetInteger("ConcreteDiameter" + i),
                            HasSteelShell    = dict.GetBool("HasSteelShell" + i),
                            SteelThickness   = dict.GetDouble("SteelThickness" + i),
                            MainD            = dict.GetInteger("MainDiameter" + i),
                            StirrupD         = dict.GetInteger("StirrupDiameter" + i),
                            SteelMaterial    = new SteelMaterial(dict.GetString("SteelMaterialName" + i) ?? "S355", SteelType.StructuralSteel, bTemp),
                            ReinfMaterial    = new SteelMaterial(dict.GetString("ReinforcementMaterialName" + i) ?? "B500B", SteelType.Reinforcement, bTemp),
                        };
                    }


                    //Sets a link between reinforcements and the beam
                    List <int> reinforcements = ((int[])dict["reinf" + i]).ToList();

                    List <Reinforcement> temp = GetReinforcements(reinforcements);
                    temp.ForEach(o => o.Material.Bm = bTemp);



                    //Sets a link between geometry larges and the beam
                    List <int> geometryLarges = ((int[])dict["geomLarges" + i]).ToList();

                    List <GeometryLarge> gls = GetGeometryLarges(geometryLarges);
                    gls.ForEach(o => o.Material.Bm = bTemp);


                    cTemp.ConcreteMaterial = new ConcreteMaterial((string)dict["ConcreteStrenghtClass" + i], bTemp);
                    bTemp.CrossSec         = cTemp;
                    geometryLarges.ForEach(id => cTemp.GeometryLargeIds.Add(id));
                    reinforcements.ForEach(id => cTemp.ReinforementIds.Add(id));
                    bTemp.Id = dict.GetInteger("BeamId" + i);
                    Beams.Add(bTemp);



                    //Set loadCases
                    int lc_n = dict.GetInteger("NumberOfLoadCases" + i);
                    int k    = 1;
                    while (k <= lc_n)
                    {
                        string name           = dict.GetString("LoadCaseName" + i + "s" + k);
                        int    limitStatenumb = dict.GetInteger("LimitState" + i + "s" + k);

                        LimitState ls;
                        switch (limitStatenumb)
                        {
                        case 0:
                            ls = LimitState.Ultimate; break;

                        case 1:
                            ls = LimitState.Service_CH; break;

                        case 2:
                            ls = LimitState.Service_FR; break;

                        case 3:
                            ls = LimitState.Service_QP; break;

                        default:
                            ls = LimitState.Ultimate; break;
                        }
                        ;

                        if (dict.GetString("LoadCaseType" + i + "s" + k) == "ColLoadCase")
                        {
                            ColLoadCase clc = new ColLoadCase(
                                dict.GetDouble("N_Ed" + i + "s" + k),
                                dict.GetDouble("M_EzTop" + i + "s" + k),
                                dict.GetDouble("M_EzBottom" + i + "s" + k),
                                dict.GetDouble("M_EyTop" + i + "s" + k),
                                dict.GetDouble("M_EyBottom" + i + "s" + k),
                                (Column)bTemp,
                                dict.GetDouble("Ratio" + i + "s" + k),
                                name,
                                dict.GetDouble("CCurve" + i + "s" + k),
                                ls);
                        }
                        else if (dict.GetString("LoadCaseType" + i + "s" + k) == "SimpleLoadCase")
                        {
                            SimpleLoadCase slc = new SimpleLoadCase(
                                dict.GetDouble("N_Ed" + i + "s" + k),
                                dict.GetDouble("M_Edz" + i + "s" + k),
                                dict.GetDouble("M_Edy" + i + "s" + k),
                                bTemp,
                                name,
                                ls);
                            bTemp.LoadCases.Add(slc);
                        }
                        k++;
                    }


                    i++;
                }
                Countable.SetCounter(i - 2);
                if (Beams.Count != 0)
                {
                    int currentID = (int)dict["currentBeamId"];
                    if (currentID != -1)
                    {
                        CurrentBeam = Beams.FirstOrDefault(beam => beam.Id == currentID);
                    }
                }

                CountableUserData.setCounter((int)dict["CountableUserData"]);

                if (MainForm != null)
                {
                    MainForm.ChangeToStartView();
                }

                //If there is previous display results, clear them
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                base.ReadDocument(doc, archive, options);
            }
        }
示例#11
0
 /// <summary>
 /// Construct an object from an archive on disk
 /// </summary>
 /// <param name="Reader">Archive to read from</param>
 public ConfigValueTracker(BinaryArchiveReader Reader)
 {
     Dependencies = Reader.ReadDictionary(() => new ConfigDependencyKey(Reader), () => (IReadOnlyList <string>)Reader.ReadList(() => Reader.ReadString()));
 }