public Constraints(bool expand = false, bool fill = false, int padding = 0, PackType packType = PackType.Start)
 {
     mvarExpand   = expand;
     mvarFill     = fill;
     mvarPadding  = padding;
     mvarPackType = packType;
 }
Beispiel #2
0
        protected internal virtual object ReadValue(PackType type)
        {
            switch (type)
            {
            case PackType.Bytes:
                return(ReadBytes());

            case PackType.Null:
                return(ReadNull());

            case PackType.Boolean:
                return(ReadBoolean());

            case PackType.Integer:
                return(ReadLong());

            case PackType.Float:
                return(ReadDouble());

            case PackType.String:
                return(ReadString());

            case PackType.Map:
                return(ReadMap());

            case PackType.List:
                return(ReadList());

            case PackType.Struct:
                return(ReadStruct());
            }
            throw new ArgumentOutOfRangeException(nameof(type), type, $"Unknown value type: {type}");
        }
        public static Storable Create(StoredObjectType eType, PackType thePackType)
        {
            IntPtr   cPtr = otapiPINVOKE.Storable_Create((int)eType, (int)thePackType);
            Storable ret  = (cPtr == IntPtr.Zero) ? null : new Storable(cPtr, false);

            return(ret);
        }
Beispiel #4
0
    // =====================================================================================================
    public void BuyPack(PackType packType)
    {
        // check if can afford
        int cost = getCost(packType);

        if (DataManager.Instance.Saved.Credits < cost)
        {
            return;
        }

        // check free sockets
        List <Transform> freeSockets = getFreeSocketsForChipsPack();

        if (freeSockets == null)
        {
            return;
        }

        // pay
        DataManager.Instance.Saved.Credits -= cost;

        // add chips
        for (int i = 0; i < freeSockets.Count; ++i)
        {
            createRandomChip(freeSockets[i]);
        }

        // save to file
        DataManager.Instance.SaveDataToFile();
    }
Beispiel #5
0
        public PhaseManager(PackType t, params DownloadPack[] dls)
        {
            instance = this;
            _Type    = t;

            foreach (DownloadPack dl in dls)
            {
                Packs.Enqueue(dl);
            }

            NextDownload = (dl) =>
            {
                DownloadManager.StartDownload(frmMain.mainInstance, dl.col, _Type, dl.TotalBytes);
            };

            DownloadManager.DownloadCompleted += (comp) =>
            {
                if (comp)
                {
                    NextDownload?.Invoke(Dequeue());
                    Console.WriteLine("Download queue finished, starting a new phase!");
                }
                else
                {
                    Console.WriteLine("Finished a download, waiting to until the end.");
                }
            };
        }
Beispiel #6
0
        // Methods
        public bool ConvertToMod(out string complete)
        {
            bool worked = true;

            complete = "";

            try
            {
                using (FileStream fs = File.OpenWrite(_filePath))
                {
                    using (BinaryWriter writer = new BinaryWriter(fs))
                    {
                        writer.Seek(4, SeekOrigin.Begin);
                        writer.Write(3); // 03 = Movie
                    }
                }
            }
            catch (Exception e)
            {
                complete = e.Message;
                worked   = false;
            }

            _packType = PackType.Mod;
            return(worked);
        }
        // returns the list view group for the given pack type
        private ListViewGroup getListViewGroupByPackType(PackType packType)
        {
            if (!modListView.ShowGroups)
            {
                return(null);
            }

            switch (packType)
            {
            default:
            case PackType.Boot:
                return(null);

            case PackType.Release:
                return(modListView.Groups["releasePackGroup"]);

            case PackType.Patch:
                return(modListView.Groups["patchPackGroup"]);

            case PackType.Mod:
                return(modListView.Groups["modPackGroup"]);

            case PackType.Movie:
                return(modListView.Groups["moviePackGroup"]);
            }
        }
Beispiel #8
0
        public static Storage CreateStorageContext(StorageType eStoreType, PackType ePackType)
        {
            global::System.IntPtr cPtr = otapiPINVOKE.CreateStorageContext__SWIG_0((int)eStoreType, (int)ePackType);
            Storage ret = (cPtr == global::System.IntPtr.Zero) ? null : new Storage(cPtr, true);

            return(ret);
        }
Beispiel #9
0
        public SWIGTYPE_p_OTPacker GetPacker(PackType ePackType)
        {
            IntPtr cPtr             = otapiPINVOKE.Storage_GetPacker__SWIG_0(swigCPtr, (int)ePackType);
            SWIGTYPE_p_OTPacker ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_OTPacker(cPtr, false);

            return(ret);
        }
Beispiel #10
0
        // Token: 0x060011BE RID: 4542 RVA: 0x0001D2E0 File Offset: 0x0001B4E0
        public static Coroutine BuyPack(int itemId, string authToken, PackType packType, UberStrikeCurrencyType currencyType, UberstrikeItemType itemType, BuyingLocationType marketLocation, BuyingRecommendationType recommendationType, Action <int> callback, Action <Exception> handler)
        {
            Coroutine result;

            using (MemoryStream memoryStream = new MemoryStream())
            {
                Int32Proxy.Serialize(memoryStream, itemId);
                StringProxy.Serialize(memoryStream, authToken);
                EnumProxy <PackType> .Serialize(memoryStream, packType);

                EnumProxy <UberStrikeCurrencyType> .Serialize(memoryStream, currencyType);

                EnumProxy <UberstrikeItemType> .Serialize(memoryStream, itemType);

                EnumProxy <BuyingLocationType> .Serialize(memoryStream, marketLocation);

                EnumProxy <BuyingRecommendationType> .Serialize(memoryStream, recommendationType);

                result = MonoInstance.Mono.StartCoroutine(SoapClient.MakeRequest("IShopWebServiceContract", "ShopWebService", "BuyPack", memoryStream.ToArray(), delegate(byte[] data)
                {
                    if (callback != null)
                    {
                        callback(Int32Proxy.Deserialize(new MemoryStream(data)));
                    }
                }, handler));
            }
            return(result);
        }
Beispiel #11
0
        public static Storage Create(StorageType eStorageType, PackType ePackType)
        {
            IntPtr  cPtr = otapiPINVOKE.Storage_Create((int)eStorageType, (int)ePackType);
            Storage ret  = (cPtr == IntPtr.Zero) ? null : new Storage(cPtr, false);

            return(ret);
        }
Beispiel #12
0
 public Message(string user, DateTime time, PackType type, string body = "")
 {
     Body = body;
     User = user;
     Time = time;
     PacketType = type;
 }
Beispiel #13
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="port">端口</param>
        /// <param name="remote">远程ip地址</param>
        /// <param name="subThread">是否运行子线程派发消息</param>
        /// <param name="type">封包类型</param>
        /// <param name="es">封包缓存大小</param>
        public UdpSocket(int port, IPEndPoint remote, bool subThread = true, PackType type = PackType.Total, int es = 262144)
        {
            endPoint = remote;
            //Links = new Linker[thread * 1024];
            IPEndPoint ip = new IPEndPoint(IPAddress.Any, port);

            soc = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); //new UdpClient(_port);//new IPEndPoint(IPAddress.Parse(ip),
            soc.Bind(ip);
            soc.ReceiveTimeout = 1000;

            if (type != PackType.None)
            {
                Packaging     = true;
                envelope      = new TcpEnvelope(es);
                envelope.type = type;
            }
            running = true;
            auto    = subThread;
            if (thread == null)
            {
                thread = new Thread(Run);
                thread.Start();
            }
            queue = new QueueBuffer <SocData>();
        }
Beispiel #14
0
 public Message(string user, DateTime time, PackType type, string body = "")
 {
     Body       = body;
     User       = user;
     Time       = time;
     PacketType = type;
 }
 public TcpServer(string ip, int port, PackType type = PackType.All, int thread = 8)
 {
     tCount   = thread;
     packType = type;
     if (tCount > 0)
     {
         linkBuff = new LinkThread <T> [tCount];
         for (int i = 0; i < tCount; i++)
         {
             linkBuff[i] = new LinkThread <T>(SingleCount);
         }
     }
     else
     {
         tCount      = 1;
         linkBuff    = new LinkThread <T> [1];
         linkBuff[0] = new LinkThread <T>(SingleCount);
     }
     soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
     soc.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
     //端点
     endPoint = new IPEndPoint(IPAddress.Parse(ip), port);
     //绑定
     try
     {
         soc.Bind(endPoint);
     }
     catch (Exception ex)
     {
         UnityEngine.Debug.Log(ex.StackTrace);
     }
     soc.Listen(0);
     Instance = this;
 }
Beispiel #16
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void shouldPackUnpackHeaderWithCorrectBufferSize(PackType type) throws Throwable
        private void ShouldPackUnpackHeaderWithCorrectBufferSize(PackType type)
        {
            Machine machine = new Machine();

            PackStream.Packer packer = machine.Packer();

            MachineClient client = new MachineClient(8);

            PackStream.Unpacker unpacker = client.Unpacker();

            for (int size = 0; size <= 65536; size++)
            {
                machine.Reset();
                switch (type)
                {
                case Org.Neo4j.Bolt.v1.packstream.PackType.Map:
                    packer.PackMapHeader(size);
                    break;

                case Org.Neo4j.Bolt.v1.packstream.PackType.List:
                    packer.PackListHeader(size);
                    break;

                case Org.Neo4j.Bolt.v1.packstream.PackType.String:
                    packer.PackStringHeader(size);
                    break;

                default:
                    throw new System.ArgumentException("Unsupported type: " + type + ".");
                }
                packer.Flush();

                int     bufferSize = ComputeOutputBufferSize(size, true);
                sbyte[] output     = machine.Output();
                assertThat(output.Length, equalTo(bufferSize));

                client.Reset(output);
                int value = 0;
                switch (type)
                {
                case Org.Neo4j.Bolt.v1.packstream.PackType.Map:
                    value = ( int )unpacker.UnpackMapHeader();
                    break;

                case Org.Neo4j.Bolt.v1.packstream.PackType.List:
                    value = ( int )unpacker.UnpackListHeader();
                    break;

                case Org.Neo4j.Bolt.v1.packstream.PackType.String:
                    value = unpacker.UnpackStringHeader();
                    break;

                default:
                    throw new System.ArgumentException("Unsupported type: " + type + ".");
                }

                assertThat(value, equalTo(size));
            }
        }
Beispiel #17
0
 public RoomPacker(int x, int y, int maxWidth, int maxHeight, PackType type = PackType.LEFT_ALIGN)
 {
     maxPackWidth  = maxWidth;
     maxPackHeight = maxHeight;
     packType      = type;
     packedNodes   = new List <BinNode>();
     _root         = CreateNode(null, new Rect(x, y, maxPackWidth, maxPackHeight));
 }
        public ActionResult DeleteConfirmed(int id)
        {
            PackType packType = db.PackTypes.Find(id);

            db.PackTypes.Remove(packType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #19
0
 // Constructor
 public Pack(string filePath, PackType packType, bool isVanilla, List <string> fileList)
 {
     _filePath  = filePath;
     _packType  = packType;
     _isVanilla = isVanilla;
     _fileList  = fileList;
     _conflicts = new List <Conflict>();
 }
Beispiel #20
0
 /// <summary>
 /// Stores a new packet routine
 /// </summary>
 /// <param name="type">Packet Type</param>
 /// <param name="callback">Method to be called when the packet arrives</param>
 public static void StorePacketRoutine(PackType type, HandlePacket callback)
 {
     if (!PackRoutines.ContainsKey(type))
     {
         PackRoutines.Add(type, new List <HandlePacket>());
     }
     PackRoutines[type].Add(callback);
 }
Beispiel #21
0
 public Item(int id, Duel_Series pack, int price, PackType type)
 {
     Id       = id;
     Series   = pack;
     Price    = price;
     Type     = type;
     CodeName = new Localized_Text();
     Name     = new Localized_Text();
     UnkStr   = new Localized_Text();
 }
Beispiel #22
0
	public void SwitchPack(){
		switch (curPackType) {
		case PackType.MedPack:
			curPackType = PackType.StimPack;
			break;
		case PackType.StimPack:
			curPackType = PackType.MedPack;
			break;
		}
	}
 public ActionResult Edit([Bind(Include = "ID,name")] PackType packType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(packType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(packType));
 }
Beispiel #24
0
        /// <summary>
        /// 验证登入
        /// </summary>
        /// <param name="data"></param>
        /// <param name="e"></param>
        static void LogOnPack(byte[] data, SocketAsyncEventArgs e)
        {
            ReadBytesV2 read = new ReadBytesV2(data, Deflate.Decompress);

            int lengt;
            int cmd;

            if (read.ReadInt32(out lengt) && lengt == read.Length && read.ReadInt32(out cmd))
            {
                PackType cmdtype = (PackType)cmd;

                switch (cmdtype)
                {
                case PackType.LogOn:
                {
                    LogOn logOn;
                    if (read.ReadObject <LogOn>(out logOn))
                    {
                        if (logOn.UserName.Equals(UserName, StringComparison.Ordinal) && logOn.PassWord.Equals(PassWord, StringComparison.Ordinal))
                        {
                            LogOnRes res = new LogOnRes()
                            {
                                IsOk = true,
                                Msg  = "登入成功"
                            };

                            UserManager userinfo = new UserManager()
                            {
                                Asyn   = e,
                                Stream = e.UserToken as ZYNetBufferReadStreamV2
                            };

                            e.UserToken = userinfo;


                            server.SendData(e.AcceptSocket, BufferFormatV2.FormatFCA(res, Deflate.Compress));
                        }
                        else
                        {
                            LogOnRes res = new LogOnRes()
                            {
                                IsOk = false,
                                Msg  = "用户名或密码错误"
                            };



                            server.SendData(e.AcceptSocket, BufferFormatV2.FormatFCA(res, Deflate.Compress));
                        }
                    }
                }
                break;
                }
            }
        }
Beispiel #25
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="bs">缓冲区大小</param>
 /// <param name="type">封包类型</param>
 /// <param name="es">封包缓冲区大小</param>
 public TcpSocket(int bs = 262144, PackType type = PackType.Part, int es = 262144)
 {
     buffer = new byte[bs];
     if (type != PackType.None)
     {
         Packaging     = true;
         envelope      = new TcpEnvelope(es);
         envelope.type = type;
     }
     queue = new Queue <SocData>();
 }
Beispiel #26
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private void unpackHeaderSizeGreaterThanIntMaxValue(PackType type) throws Throwable
        private void UnpackHeaderSizeGreaterThanIntMaxValue(PackType type)
        {
            sbyte marker32;

            switch (type)
            {
            case Org.Neo4j.Bolt.v1.packstream.PackType.Map:
                marker32 = PackStream.Map_32;
                break;

            case Org.Neo4j.Bolt.v1.packstream.PackType.List:
                marker32 = PackStream.List_32;
                break;

            case Org.Neo4j.Bolt.v1.packstream.PackType.String:
                marker32 = PackStream.String_32;
                break;

            case Org.Neo4j.Bolt.v1.packstream.PackType.Bytes:
                marker32 = PackStream.Bytes_32;
                break;

            default:
                throw new System.ArgumentException("Unsupported type: " + type + ".");
            }

            sbyte[]       input  = new sbyte[] { marker32, unchecked (( sbyte )0xff), unchecked (( sbyte )0xff), unchecked (( sbyte )0xff), unchecked (( sbyte )0xff) };
            MachineClient client = new MachineClient(8);

            client.Reset(input);
            PackStream.Unpacker unpacker = client.Unpacker();

            switch (type)
            {
            case Org.Neo4j.Bolt.v1.packstream.PackType.Map:
                unpacker.UnpackMapHeader();
                break;

            case Org.Neo4j.Bolt.v1.packstream.PackType.List:
                unpacker.UnpackListHeader();
                break;

            case Org.Neo4j.Bolt.v1.packstream.PackType.String:
                unpacker.UnpackStringHeader();
                break;

            case Org.Neo4j.Bolt.v1.packstream.PackType.Bytes:
                unpacker.UnpackBytesHeader();
                break;

            default:
                throw new System.ArgumentException("Unsupported type: " + type + ".");
            }
        }
        public ActionResult Create([Bind(Include = "ID,name")] PackType packType)
        {
            if (ModelState.IsValid)
            {
                db.PackTypes.Add(packType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(packType));
        }
Beispiel #28
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public org.neo4j.values.AnyValue unpack() throws java.io.IOException
            public override AnyValue Unpack()
            {
                PackType valType = PeekNextType();

                switch (valType)
                {
                case PackType.BYTES:
                    return(byteArray(UnpackBytes()));

                case PackType.STRING:
                    return(Values.utf8Value(UnpackUTF8()));

                case PackType.INTEGER:
                    return(Values.longValue(UnpackLong()));

                case PackType.FLOAT:
                    return(Values.doubleValue(UnpackDouble()));

                case PackType.BOOLEAN:
                    return(Values.booleanValue(UnpackBoolean()));

                case PackType.NULL:
                    // still need to move past the null value
                    UnpackNull();
                    return(Values.NO_VALUE);

                case PackType.LIST:
                {
                    return(UnpackList());
                }

                case PackType.MAP:
                {
                    return(UnpackMap());
                }

                case PackType.STRUCT:
                {
                    long size      = UnpackStructHeader();
                    char signature = UnpackStructSignature();
                    return(UnpackStruct(signature, size));
                }

                case PackType.END_OF_STREAM:
                {
                    UnpackEndOfStream();
                    return(null);
                }

                default:
                    throw new BoltIOException(Org.Neo4j.Kernel.Api.Exceptions.Status_Request.InvalidFormat, "Unknown value type: " + valType);
                }
            }
Beispiel #29
0
        //

        public GameSession(ConsoleStream IOStream, PackType packType, params Player [] player)
        {
            consoleStream = IOStream; // init io stream
            this.dealer   = new Dealer(packType);

            this.players.Add(dealer);
            this.players.AddRange(player);

            // add services
            dealerService = new DealerService(dealer, player);
            //
        }
Beispiel #30
0
        public static IDictionary <int, string> GetCardDict(PackType packType)
        {
            if (packType == PackType.big)
            {
                return(cardDictionary52);
            }
            if (packType == PackType.small)
            {
                return(cardDictionary36);
            }

            return(null);
        }
Beispiel #31
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private int unpackUINT32(PackType type) throws java.io.IOException
            internal virtual int UnpackUINT32(PackType type)
            {
                long longSize = UnpackUINT32();

                if (longSize <= int.MaxValue)
                {
                    return(( int )longSize);
                }
                else
                {
                    throw new Overflow(string.Format("{0}_32 too long for Java", type));
                }
            }
Beispiel #32
0
        public static IEnumerable <int> GetCardDeck(PackType packType)
        {
            if (packType == PackType.big)
            {
                return(cardDeck52);
            }
            if (packType == PackType.small)
            {
                return(cardDeck36);
            }

            return(null);
        }
Beispiel #33
0
 public PackageCreatez(MainForm xParent, PackType xThisType)
 {
     this.MdiParent = xParent;
     xparent = xParent;
     InitializeComponent();
     List<PackageType> y = new List<PackageType>();
     if (xThisType == PackType.STFS)
     {
         xsession = new CreateSTFS();
         PackageType[] x = (PackageType[])Enum.GetValues(typeof(PackageType));
         y.AddRange(x);
         y.RemoveAll(new Predicate<PackageType>(ptcheck));
         node1.DataKey = (ushort)0xFFFF;
         node1.NodeClick += new EventHandler(xReturn_NodeClick);
         comboBoxEx1.SelectedIndex = 0;
         comboBoxEx4.DataSource = Enum.GetValues(typeof(SphereColor));
         comboBoxEx4.SelectedIndex = 0;
         comboBoxEx5.DataSource = Enum.GetValues(typeof(DashStyle));
         comboBoxEx5.SelectedIndex = 0;
         numericUpDown4.Value = xsession.ThemeSettings.AvatarLightingAmbient;
         numericUpDown7.Value = xsession.ThemeSettings.AvatarLightingDirectional3;
         numericUpDown8.Value = xsession.ThemeSettings.AvatarLightingDirectional0;
         numericUpDown9.Value = xsession.ThemeSettings.AvatarLightingDirectional1;
         numericUpDown10.Value = xsession.ThemeSettings.AvatarLightingDirectional2;
         advTree1.SelectedIndex = 0;
         tabItem7.Visible = false;
     }
     else
     {
         y.Add(PackageType.OriginalXboxGame);
         y.Add(PackageType.HDDInstalledGame);
         y.Add(PackageType.GamesOnDemand);
         y.Add(PackageType.SocialTitle);
         tabItem6.Visible = false;
         xhead = new HeaderData();
         tabItem5.Visible = false;
         tabItem4.Visible = false;
         comboBoxEx1.Visible = false;
     }
     xtype = xThisType;
     comboBoxEx2.DataSource = y.ToArray();
     comboBoxEx2.SelectedIndex = 0;
     comboBoxEx3.DataSource = Enum.GetValues(typeof(Languages));
     comboBoxEx3.SelectedIndex = 0;
     SetText();
 }
 public static Storable Create(StoredObjectType eType, PackType thePackType)
 {
     IntPtr cPtr = otapiPINVOKE.Storable_Create((int)eType, (int)thePackType);
     Storable ret = (cPtr == IntPtr.Zero) ? null : new Storable(cPtr, false);
     return ret;
 }
Beispiel #35
0
 private void comboBoxEx1_SelectedIndexChanged(object sender, EventArgs e)
 {
     SelectedType = (PackType)comboBoxEx1.SelectedItem;
 }
Beispiel #36
0
 public static Storage CreateStorageContext(StorageType eStoreType, PackType ePackType)
 {
     IntPtr cPtr = otapiPINVOKE.CreateStorageContext__SWIG_0((int)eStoreType, (int)ePackType);
     Storage ret = (cPtr == IntPtr.Zero) ? null : new Storage(cPtr, true);
     return ret;
 }
Beispiel #37
0
 public static bool InitDefaultStorage(StorageType eStoreType, PackType ePackType)
 {
     bool ret = otapiPINVOKE.InitDefaultStorage__SWIG_6((int)eStoreType, (int)ePackType);
     return ret;
 }
Beispiel #38
0
 public static bool InitDefaultStorage(StorageType eStoreType, PackType ePackType, string oneStr)
 {
     bool ret = otapiPINVOKE.InitDefaultStorage__SWIG_5((int)eStoreType, (int)ePackType, oneStr);
     if (otapiPINVOKE.SWIGPendingException.Pending) throw otapiPINVOKE.SWIGPendingException.Retrieve();
     return ret;
 }
Beispiel #39
0
 public static Storage Create(StorageType eStorageType, PackType ePackType)
 {
     IntPtr cPtr = otapiPINVOKE.Storage_Create((int)eStorageType, (int)ePackType);
     Storage ret = (cPtr == IntPtr.Zero) ? null : new Storage(cPtr, false);
     return ret;
 }
Beispiel #40
0
 public SWIGTYPE_p_OTPacker GetPacker(PackType ePackType)
 {
     IntPtr cPtr = otapiPINVOKE.Storage_GetPacker__SWIG_0(swigCPtr, (int)ePackType);
     SWIGTYPE_p_OTPacker ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_OTPacker(cPtr, false);
     return ret;
 }
 public Constraints(bool expand = false, bool fill = false, int padding = 0, PackType packType = PackType.Start)
 {
     mvarExpand = expand;
     mvarFill = fill;
     mvarPadding = padding;
     mvarPackType = packType;
 }