Пример #1
0
 /// <summary>
 /// Overloaded constructor
 /// </summary>
 /// <param name="strPortName">Name of new serial port</param>
 /// <param name="ucaKey">Byte array of new ECU key</param>
 /// <param name="ConnectionType">Type of connection</param>
 public Protocol15(string strPortName, byte[] ucaKey, Comm.PortType ConnectionType)
     : base(strPortName, ucaKey, ConnectionType)
 {
     ProtocolVersion = 15;
     mRtcData        = new VolatileData();
     mEmpData        = new EmpiricalDataBlock();
 }
Пример #2
0
        bool Kernel.IGH_ElementIdParam.NeedsToBeExpired
        (
            DB.Document doc,
            ICollection <DB.ElementId> added,
            ICollection <DB.ElementId> deleted,
            ICollection <DB.ElementId> modified
        )
        {
            if (DataType == GH_ParamData.remote)
            {
                return(false);
            }

            foreach (var data in VolatileData.AllData(true).OfType <Types.IGH_ElementId>())
            {
                if (!data.IsElementLoaded)
                {
                    continue;
                }

                if (modified.Contains(data.Id))
                {
                    return(true);
                }

                if (deleted.Contains(data.Id))
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #3
0
    public override bool ShouldChangeHangar(out string string_1)
    {
        string_1 = null;
        AccountSettings account = base.C.Account;

        if (account != null && account.Spinner_UsePhoenix)
        {
            AccountSettings account2 = base.C.Account;
            if (((account2 != null) ? account2.HangarDefault : null) != null && base.Started.Cooldown(30000))
            {
                GClass893.< > c__DisplayClass8_0 CS$ < > 8__locals1 = new GClass893.< > c__DisplayClass8_0();
                GClass919 gclass = base.Context.method_62 <GClass919>();
                GClass893.< > c__DisplayClass8_0 CS$ < > 8__locals2 = CS$ < > 8__locals1;
                AccountSettings account3 = base.C.Account;
                List <string>   list;
                if (account3 == null)
                {
                    list = null;
                }
                else
                {
                    VolatileData @volatile = account3.Volatile;
                    list = ((@volatile != null) ? @volatile.Hangars : null);
                }
                CS$ < > 8__locals2.list_0 = list;
                string_1 = ((CS$ < > 8__locals1.list_0 == null) ? null : GClass893.list_0.FirstOrDefault(new Func <string, bool>(CS$ < > 8__locals1.method_0)));
                return(string_1 != null && gclass.method_15() > 0);
            }
        }
        return(false);
    }
Пример #4
0
        bool IGH_ElementIdParam.NeedsToBeExpired(Document doc, ICollection <ElementId> added, ICollection <ElementId> deleted, ICollection <ElementId> modified)
        {
            // If anything of that type is added we need to update ListItems
            if (added.Where(id => PassesFilter(doc, id)).Any())
            {
                return(true);
            }

            // If selected items are modified we need to expire dependant components
            foreach (var data in VolatileData.AllData(true).OfType <Types.IGH_ElementId>())
            {
                if (!data.IsElementLoaded)
                {
                    continue;
                }

                if (modified.Contains(data.Id))
                {
                    return(true);
                }
            }

            // If an item in ListItems is deleted we need to update ListItems
            foreach (var item in ListItems.Select(x => x.Value).OfType <Grasshopper.Kernel.Types.GH_Integer>())
            {
                var id = new ElementId(item.Value);

                if (deleted.Contains(id))
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #5
0
        public override void PostProcessData()
        {
            base.PostProcessData();

            if (SourceCount == 0)
            {
                RefreshList(NickName);
            }
            else
            {
                RefreshList(VolatileData.AllData(true));
            }

            // Show elements sorted
            ListItems.Sort((x, y) => string.CompareOrdinal(x.Name, y.Name));

            //base.CollectVolatileData_Custom();
            m_data.Clear();

            var path = new GH_Path(0);

            if (SelectedItems.Count == 0)
            {
                m_data.AppendRange(new IGH_Goo[0], path);
            }
            else
            {
                foreach (var item in SelectedItems)
                {
                    m_data.Append(item.Value, path);
                }
            }
        }
Пример #6
0
 public void BakeGeometry(RhinoDoc doc, ObjectAttributes att, List <Guid> obj_ids)
 {
     foreach (IGH_BakeAwareData data in VolatileData.AllData(true))
     {
         data.BakeGeometry(doc, att, out Guid id);
         obj_ids.Add(id);
     }
 }
Пример #7
0
        public override void ClearData()
        {
            Logger.Info("ClearData Called");

            VolatileData.AllData(true).Select(obj => obj as T).Where(obj => obj.IsValid && obj.NXObject.HasUserAttribute("GH_Baked_Object", NXObject.AttributeType.Boolean, -1) && !obj.NXObject.GetBooleanUserAttribute("GH_Baked_Object", -1)).ToList().ForEach(obj => (obj as T).Delete());

            base.ClearData();
        }
Пример #8
0
 public void DrawViewportWires(IGH_PreviewArgs args)
 {
     foreach (var path in VolatileData.Paths)
     {
         var branch = VolatileData.get_Branch(path) as IList <SurfaceGhData>;
         foreach (var item in branch)
         {
             var converted = item.Value.ToRhino();
             args.Display.DrawBrepWires(converted.ToBrep(), Attributes.Selected ? args.WireColour_Selected : args.WireColour);
         }
     }
 }
Пример #9
0
 public void DrawViewportMeshes(IGH_PreviewArgs args)
 {
     clippingBox = new BoundingBox();
     foreach (var path in VolatileData.Paths)
     {
         var branch = VolatileData.get_Branch(path) as IList <MeshGhData>;
         foreach (var item in branch)
         {
             var converted = item.Value.ToRhino();
             args.Display.DrawMeshShaded(converted, Attributes.Selected ? args.ShadeMaterial_Selected : args.ShadeMaterial);
             clippingBox.Union(converted.GetBoundingBox(false));
         }
     }
 }
Пример #10
0
        protected void SelectionPreparation()
        {
            if (VolatileData.DataCount != 0)
            {
                var validDatas = VolatileData.AllData(true).Where(obj => obj.IsValid).ToArray();

                foreach (INXDisplayableObject data in validDatas)
                {
                    if (data.Highlight)
                    {
                        data.Highlight = false;
                    }
                }
            }
        }
Пример #11
0
        public override void ProcessData()
        {
            int dataCount          = VolatileDataCount;
            int nonComparableCount = 0;
            var goosSet            = new HashSet <IGH_Goo>(VolatileData.AllData(true).
                                                           Where(x =>
            {
                if (GooComparer.IsComparable(x))
                {
                    return(true);
                }

                nonComparableCount++;
                return(false);
            })
                                                           , new GooComparer());

            if (nonComparableCount > 0)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, $"{nonComparableCount} null or non comparable elements filtered.");
            }

            var duplicatedCount = dataCount - nonComparableCount - goosSet.Count;

            if (duplicatedCount > 0)
            {
                AddRuntimeMessage(GH_RuntimeMessageLevel.Remark, $"{duplicatedCount} duplicated elements filtered.");
            }

            if (DataType == GH_ParamData.local)
            {
                ListItems = goosSet.Select(goo => new ListItem(goo, true)).
                            Where(x => string.IsNullOrEmpty(NickName) || x.Name.IsSymbolNameLike(NickName)).
                            ToList();
            }
            else if (DataType == GH_ParamData.remote)
            {
                var selectSet = new HashSet <IGH_Goo>(PersistentData.Where(x => GooComparer.IsComparable(x)), new GooComparer());
                ListItems = goosSet.Select(goo => new ListItem(goo, selectSet.Contains(goo))).
                            Where(x => string.IsNullOrEmpty(NickName) || x.Name.IsSymbolNameLike(NickName)).
                            ToList();
            }
            else
            {
                ListItems.Clear();
            }
        }
Пример #12
0
 public bool NeedsToBeExpired(ICollection <Handle> modified,
                              ICollection <Handle> erased,
                              ICollection <Handle> added,
                              ICollection <string> finishedCmds)
 {
     foreach (var data in VolatileData.AllData(true).OfType <Types.IGH_BcGeometricGoo>())
     {
         if (modified.Contains(data.PersistentRef) || erased.Contains(data.PersistentRef))
         {
             return(true);
         }
     }
     if (added.Count != 0)
     {
         return(PersistentData.AllData(true).OfType <Types.IGH_BcGeometricGoo>().Any(data => added.Contains(data.PersistentRef)));
     }
     return(false);
 }
Пример #13
0
 public void DrawViewportWires(IGH_PreviewArgs args)
 {
     foreach (var path in VolatileData.Paths)
     {
         var branch = VolatileData.get_Branch(path) as IList <MeshGhData>;
         foreach (var item in branch)
         {
             var mesh = item.Value;
             foreach (var edge in mesh.Edges)
             {
                 var vertices = edge.AdjacentVertices();
                 var line     = new Line(vertices[0].ToRhino(), vertices[1].ToRhino());
                 args.Display.DrawLine(line, Attributes.Selected ? args.WireColour_Selected: args.WireColour);
                 clippingBox.Union(line.BoundingBox);
             }
         }
     }
 }
Пример #14
0
    public override void Execute()
    {
        GClass28.GClass48 hangarList = base.Context.Game.Web.Equipment.GetHangarList();
        GClass49.GClass76 hangar     = base.Context.Game.Web.Equipment.GetHangar();
        IDopeService      service    = base.Context.MainController.Parent.Service;
        List <string>     list       = hangarList.data.ret.hangars.Select(new Func <GClass28.GClass32, string>(GClass920.< > c.< > c_0.method_0)).ToList <string>();

        if (list != null && list.Any <string>() && hangar != null)
        {
            VolatileData volatileData = new VolatileData();
            volatileData.LastUpdated = DateTimeOffset.Now;
            volatileData.Hangars     = list;
            VolatileData      volatileData2 = volatileData;
            GClass28.GClass32 gclass        = hangarList.data.ret.hangars.FirstOrDefault(new Func <GClass28.GClass32, bool>(GClass920.< > c.< > c_0.method_1));
            string            activeHangar;
            if (gclass == null)
            {
                activeHangar = null;
            }
            else
            {
                GClass28.GClass31 gclass31_ = gclass.GClass31_0;
                if (gclass31_ == null)
                {
                    activeHangar = null;
                }
                else
                {
                    GClass28.GClass30 gclass30_ = gclass31_.GClass30_0;
                    activeHangar = ((gclass30_ != null) ? gclass30_.String_0 : null);
                }
            }
            volatileData2.ActiveHangar = activeHangar;
            volatileData.Fill();
            base.Context.Account.Volatile = volatileData;
            if (this.method_2().Cooldown(120000))
            {
                service.UpdateVolatile(base.Context.Account.BotId, volatileData);
                this.method_3(DateTimeOffset.Now);
            }
        }
    }
Пример #15
0
        protected override void OnVolatileDataCollected()
        {
            int config = 0;

            if (VolatileDataCount > 0)
            {
                var values = VolatileData.get_Branch(0);

                foreach (var value in values)
                {
                    if (value is GH_Integer)
                    {
                        config += (value as GH_Integer).Value;
                    }
                }
            }

            VolatileData.Clear();
            AddVolatileData(new GH_Path(0), 0, new GH_Integer(config));
        }
 protected override void CollectVolatileData_Custom()
 {
     VolatileData.Clear();
     AddVolatileData(new Grasshopper.Kernel.Data.GH_Path(0), 0, new GH_Integer(Value));
 }
Пример #17
0
        private void Menu_ForceUpdate(object sender, EventArgs e)
        {
            VolatileData.AllData(true).Select(obj => obj as NX_Body).Where(obj => obj.IsValid).ToList().ForEach(obj => System.IO.File.Delete(obj.InterFile));

            ExpireSolution(true);
        }
Пример #18
0
        /// <summary>
        /// 连接的 Source 断开
        /// </summary>
        /// <param name="source"></param>
        public override void RemoveSource(IGH_Param source)
        {
            VolatileData.AllData(true).Where(obj => obj.IsValid).ToList().ForEach(obj => (obj as T).Delete());

            base.RemoveSource(source);
        }