当前位置: 首页>>代码示例>>C#>>正文


C# PyObject类代码示例

本文整理汇总了C#中PyObject的典型用法代码示例。如果您正苦于以下问题:C# PyObject类的具体用法?C# PyObject怎么用?C# PyObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PyObject类属于命名空间,在下文中一共展示了PyObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PyObjectEx

 public PyObjectEx(bool isType2, PyObject header)
     : base(PyObjectType.ObjectEx)
 {
     IsType2 = isType2;
     Header = header;
     Dictionary = new Dictionary<PyObject, PyObject>();
 }
开发者ID:stschake,项目名称:eveMarshal,代码行数:7,代码来源:PyObjectEx.cs

示例2: DirectOrder

        internal DirectOrder(DirectEve directEve, PyObject pyOrder)
            : base(directEve)
        {
            PyOrder = pyOrder;
            OrderId = -1;
            Price = (double) pyOrder.Attribute("price");
            VolumeRemaining = (int) pyOrder.Attribute("volRemaining");
            TypeId = (int) pyOrder.Attribute("typeID");
            if ((int) pyOrder.Attribute("range") == (int) DirectEve.Const.RangeSolarSystem)
                Range = DirectOrderRange.SolarSystem;
            else if ((int) pyOrder.Attribute("range") == (int) DirectEve.Const.RangeConstellation)
                Range = DirectOrderRange.Constellation;
            else if ((int) pyOrder.Attribute("range") == (int) DirectEve.Const.RangeRegion)
                Range = DirectOrderRange.Region;
            else if ((int) pyOrder.Attribute("range") == (int) DirectEve.Const.RangeStation)
                Range = DirectOrderRange.Station;
            else
                RangeAbsolute = (int) pyOrder.Attribute("range");

            OrderId = (long) pyOrder.Attribute("orderID");
            VolumeEntered = (int) pyOrder.Attribute("volEntered");
            MinimumVolume = (int) pyOrder.Attribute("minVolume");
            IsBid = (bool) pyOrder.Attribute("bid");
            IssuedOn = (DateTime) pyOrder.Attribute("issued");
            Duration = (int) pyOrder.Attribute("duration");
            StationId = (int) pyOrder.Attribute("stationID");
            RegionId = (int) pyOrder.Attribute("regionID");
            SolarSystemId = (int) pyOrder.Attribute("solarSystemID");
            Jumps = (int) pyOrder.Attribute("jumps");
        }
开发者ID:Blinker,项目名称:DirectEve,代码行数:30,代码来源:DirectOrder.cs

示例3: DirectSystemScanResult

        internal DirectSystemScanResult(DirectEve directEve, PyObject pyResult)
            : base(directEve)
        {
            PyResult = pyResult;
            Id = (string) pyResult.Attribute("id");
            ScanGroupName = (string) pyResult.Attribute("scanGroupName").ToUnicodeString();
            GroupName = (string) pyResult.Attribute("groupName").ToUnicodeString();
            TypeName = (string) pyResult.Attribute("typeName").ToUnicodeString();
            SignalStrength = (double) pyResult.Attribute("certainty");
            Deviation = (double) pyResult.Attribute("deviation");
            IsPointResult = (string) PyResult.Attribute("data").Attribute("__class__").Attribute("__name__") == "Vector3";
            IsSpereResult = (string) PyResult.Attribute("data").Attribute("__class__").Attribute("__name__") == "float";
            IsCircleResult = (!IsPointResult && !IsSpereResult);
            if (IsPointResult)
            {
                X = (double?) pyResult.Attribute("data").Attribute("x");
                Y = (double?) pyResult.Attribute("data").Attribute("y");
                Z = (double?) pyResult.Attribute("data").Attribute("z");
            }
            else if (IsCircleResult)
            {
                X = (double?) pyResult.Attribute("data").Attribute("point").Attribute("x");
                Y = (double?) pyResult.Attribute("data").Attribute("point").Attribute("y");
                Z = (double?) pyResult.Attribute("data").Attribute("point").Attribute("z");
            }

            // If SphereResult: X,Y,Z is probe location

            if (X.HasValue && Y.HasValue && Z.HasValue)
            {
                var myship = directEve.ActiveShip.Entity;
                Distance = Math.Sqrt((X.Value - myship.X)*(X.Value - myship.X) + (Y.Value - myship.Y)*(Y.Value - myship.Y) + (Z.Value - myship.Z)*(Z.Value - myship.Z));
            }
        }
开发者ID:Blinker,项目名称:DirectEve,代码行数:34,代码来源:DirectSystemScanResult.cs

示例4: NotifyClients

 public static void NotifyClients(PyObject notify)
 {
     foreach (Client client in clients)
     {
         client.Send(notify);
     }
 }
开发者ID:Reve,项目名称:EVESharp,代码行数:7,代码来源:ClientManager.cs

示例5: DirectFleetMember

        internal DirectFleetMember(DirectEve directEve, PyObject memberObject)
            : base(directEve)
        {
            CharacterId = (int) memberObject.Attribute("charID");
            SquadID = (long) memberObject.Attribute("squadID");
            WingID = (long) memberObject.Attribute("wingID");
            Skills = new List<int>
            {
                (int) memberObject.Attribute("skills").ToList()[0],
                (int) memberObject.Attribute("skills").ToList()[1],
                (int) memberObject.Attribute("skills").ToList()[2]
            };

            if ((int) memberObject.Attribute("job") == (int) directEve.Const.FleetJobCreator)
                Job = JobRole.Boss;
            else
                Job = JobRole.RegularMember;

            if ((int) memberObject.Attribute("role") == (int) directEve.Const.FleetRoleLeader)
                Role = FleetRole.FleetCommander;
            else if ((int) memberObject.Attribute("role") == (int) directEve.Const.FleetRoleWingCmdr)
                Role = FleetRole.WingCommander;
            else if ((int) memberObject.Attribute("role") == (int) directEve.Const.FleetRoleSquadCmdr)
                Role = FleetRole.SquadCommander;
            else if ((int) memberObject.Attribute("role") == (int) directEve.Const.FleetRoleMember)
                Role = FleetRole.Member;

            ShipTypeID = (int?) memberObject.Attribute("shipTypeID");
            SolarSystemID = (int) memberObject.Attribute("solarSystemID");
        }
开发者ID:Blinker,项目名称:DirectEve,代码行数:30,代码来源:DirectFleetMember.cs

示例6: DirectReprocessingQuoteRecoverable

 internal DirectReprocessingQuoteRecoverable(DirectEve directEve, PyObject recoverable) : base(directEve)
 {
     TypeId = (int) recoverable.Item(0);
     YouReceive = (long) recoverable.Item(1);
     WeTake = (long) recoverable.Item(2);
     Unrecoverable = (long) recoverable.Item(3);
 }
开发者ID:1100617,项目名称:DirectEve,代码行数:7,代码来源:DirectReprocessingQuoteRecoverable.cs

示例7: DirectMarketActionWindow

        internal DirectMarketActionWindow(DirectEve directEve, PyObject pyWindow)
            : base(directEve, pyWindow)
        {
            IsReady = (bool) pyWindow.Attribute("ready");
            IsBuyAction = Name == "marketbuyaction";
            IsSellAction = Name == "marketsellaction";

            Item = new DirectItem(directEve);
            Item.PyItem = pyWindow.Attribute("sr").Attribute("sellItem");

            var order = pyWindow.Attribute("sr").Attribute("currentOrder");
            Price = (double?) order.Attribute("price");
            RemainingVolume = (double?) order.Attribute("volRemaining");
            Range = (int?) order.Attribute("range");
            OrderId = (long?) order.Attribute("orderID");
            EnteredVolume = (int?) order.Attribute("volEntered");
            MinimumVolume = (int?) order.Attribute("minVolume");
            IsBid = (bool?) order.Attribute("bid");
            Issued = (DateTime?) order.Attribute("issued");
            Duration = (int?) order.Attribute("duration");
            StationId = (long?) order.Attribute("stationID");
            RegionId = (long?) order.Attribute("regionID");
            SolarSystemId = (long?) order.Attribute("solarSystemID");
            Jumps = (int?) order.Attribute("jumps");
        }
开发者ID:Blinker,项目名称:DirectEve,代码行数:25,代码来源:DirectMarketActionWindow.cs

示例8: Register__Py_NoneStruct

 Register__Py_NoneStruct(IntPtr address)
 {
     PyObject none = new PyObject();
     none.ob_refcnt = 1;
     none.ob_type = this.PyNone_Type;
     Marshal.StructureToPtr(none, address, false);
     // no need to Associate: None/null is special-cased
 }
开发者ID:netcharm,项目名称:ironclad,代码行数:8,代码来源:PythonMapper_register.cs

示例9: Register__Py_NotImplementedStruct

 Register__Py_NotImplementedStruct(IntPtr address)
 {
     PyObject notimpl = new PyObject();
     notimpl.ob_refcnt = 1;
     notimpl.ob_type = this.PyNotImplemented_Type;
     Marshal.StructureToPtr(notimpl, address, false);
     this.map.Associate(address, PythonOps.NotImplemented);
 }
开发者ID:netcharm,项目名称:ironclad,代码行数:8,代码来源:PythonMapper_register.cs

示例10: DirectBookmarkFolder

 internal DirectBookmarkFolder(DirectEve directEve, PyObject pyFolder)
     : base(directEve)
 {
     Id = (long) pyFolder.Attribute("folderID");
     Name = (string) pyFolder.Attribute("folderName");
     OwnerId = (long) pyFolder.Attribute("ownerID");
     CreatorId = (long?) pyFolder.Attribute("creatorID");
 }
开发者ID:Blinker,项目名称:DirectEve,代码行数:8,代码来源:DirectBookmarkFolder.cs

示例11: DirectConstellation

 internal DirectConstellation(DirectEve directEve, PyObject pyo)
     : base(directEve)
 {
     Id = (long) pyo.Attribute("constellationID");
     Name = (string) DirectEve.PySharp.Import("__builtin__").Attribute("cfg").Attribute("evelocations").Call("Get", Id).Attribute("name");
     RegionId = (long) pyo.Attribute("regionID");
     FactionId = (long?) pyo.Attribute("factionID");
 }
开发者ID:Blinker,项目名称:DirectEve,代码行数:8,代码来源:DirectConstellation.cs

示例12: Register__Py_EllipsisObject

 Register__Py_EllipsisObject(IntPtr address)
 {
     PyObject ellipsis = new PyObject();
     ellipsis.ob_refcnt = 1;
     ellipsis.ob_type = this.PyEllipsis_Type;
     Marshal.StructureToPtr(ellipsis, address, false);
     this.map.Associate(address, Builtin.Ellipsis);
 }
开发者ID:netcharm,项目名称:ironclad,代码行数:8,代码来源:PythonMapper_register.cs

示例13: Evaluate

        private PyObject Evaluate(PySharp.PySharp pySharp, PyObject pyObject)
        {
            // TODO: Better part splitting (e.g. bla('bla', const.bla)
            var parts = _evaluate.Split('.');
            if (parts.Length == 0)
            {
                // TODO: List imports
                return null;
            }

            if (pyObject == null)
                pyObject = pySharp.Import(parts[0]);

            for (var i = 1; i < parts.Length; i++)
            {
                if (parts[i].Contains("("))
                {
                    // TODO: Call
                }
                else if (parts[i].Contains("["))
                {
                    var attr = parts[i].Substring(0, parts[i].IndexOf('['));

                    var key = parts[i].Substring(parts[i].IndexOf('[') + 1, parts[i].IndexOf(']') - parts[i].IndexOf('[') - 1);
                    if (key.StartsWith("'") || key.StartsWith("\""))
                        key = key.Substring(1, key.Length - 2);

                    if (!string.IsNullOrEmpty(attr))
                        pyObject = pyObject.Attribute(attr);

                    if (pyObject.GetPyType() == PyType.DictType ||
                        pyObject.GetPyType() == PyType.DerivedDictType ||
                        pyObject.GetPyType() == PyType.DictProxyType ||
                        pyObject.GetPyType() == PyType.DerivedDictProxyType)
                    {
                        var dict = pyObject.ToDictionary();

                        pyObject = PySharp.PySharp.PyZero;
                        foreach (var dictItem in dict)
                        {
                            if (GetPyValue(dictItem.Key) == key)
                                pyObject = dictItem.Value;
                        }
                    }
                    else
                    {
                        int index;
                        pyObject = int.TryParse(key, out index) ? pyObject.Item(index) : PySharp.PySharp.PyZero;
                    }
                }
                else
                {
                    pyObject = pyObject.Attribute(parts[i]);
                }
            }

            return pyObject;
        }
开发者ID:Blinker,项目名称:DirectEve,代码行数:58,代码来源:frmMain.cs

示例14: Initialize

 protected void Initialize()
 {
     if (!Initialized)
     {
         Module = new PyObject(Python.InitModule(Name, Methods.ToArray()), ReferenceType.Borrowed);
         Module.IncRef();
         Initialized = true;
     }
 }
开发者ID:Reve,项目名称:beliEVE,代码行数:9,代码来源:NativeModule.cs

示例15: Decode

        /* This should never be used in the node, just the Cache Tool */
        public bool Decode(PyObject from)
        {
            PyTuple data = (from as PyObjectData).Arguments as PyTuple;

            // Just decode the cache info for now..
            cache = data.Items[4] as PyBuffer;

            return true;
        }
开发者ID:Reve,项目名称:EVESharp,代码行数:10,代码来源:PyCachedObject.cs


注:本文中的PyObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。