Ejemplo n.º 1
0
 public ResultStatus ValidateQtyCombine(
     Combine combine,
     Combine_Request request,
     out Combine_Result result)
 {
     return(this.ValidateQtyCombine(combine, (Combine_Parameters)null, request, out result));
 }
Ejemplo n.º 2
0
        void ProcessCommandBuy(ref State state, Player player, Turn.Command command, bool reflected)
        {
            Unit temp = null;
            int  type = command.arguments[0];
            int  line = command.arguments[1];

            if (line < 0 || line >= Const.NumberOfLines)
            {
                command.comment = "Неверно указана горизонталь";
                return;
            }
            int bas         = reflected ? Const.NumberOfColumns + 1 : 0;
            int destination = reflected ? (Const.NumberOfColumns + 1 - command.arguments[2]) : command.arguments[2];

            if (destination < 1 || destination > Const.NumberOfColumns)
            {
                command.comment = "Неверно указано место назначения";
                return;
            }
            OwnerType owner = player.Owner;

            switch (type)
            {
            case (int)UnitTypes.Armored:
                temp = new Armored(owner, line, bas, destination);
                break;

            case (int)UnitTypes.Cannon:
                temp = new Cannon(owner, line, bas, destination);
                break;

            case (int)UnitTypes.Combine:
                temp = new Combine(owner, line, bas, destination);
                break;

            case (int)UnitTypes.Mine:
                temp = new Mine(owner, line, bas, destination);
                break;

            case (int)UnitTypes.Tank:
                temp = new Tank(owner, line, bas, destination);
                break;

            default:
                command.comment = "Неверный тип юнита";
                return;
            }
            if (player.Money < temp.Cost)
            {
                command.comment = "Недостаточно денег";
                return;
            }
            if (player.Units[line] != null)
            {
                command.comment = "Горизонталь занята";
                return;
            }
            player.Money -= temp.Cost;
            state.AddUnit(bas, line, player, temp);
        }
Ejemplo n.º 3
0
 public ResultStatus Combine_QuantityExecute(
     Combine combine,
     Combine_Request request,
     out Combine_Result result)
 {
     return(this.Combine_QuantityExecute(combine, (Combine_Parameters)null, request, out result));
 }
Ejemplo n.º 4
0
        /// <summary>
        /// handles the event when the user clicks "Combine" button
        /// validates the list and starts the combine function
        /// </summary>
        /// <param name="sender">the button</param>
        /// <param name="e">event arguments</param>
        private void btnCombine_Click(object sender, EventArgs e)
        {
            sfDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            sfDialog.Title            = "Select where you want the output file and the name of the new file...";
            sfDialog.Filter           = "PDF Files|*.pdf";
            var result = sfDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                List <PdfFileList.FileListRow> rows = new List <PdfFileList.FileListRow>();
                foreach (PdfFileList.FileListRow row in this.fileList.FileList.Rows)
                {
                    rows.Add(row);
                }
                try
                {
                    Combine.Start(rows, sfDialog.FileName);
                    MessageBox.Show(this, "Success");
                    this.fileList = new PdfFileList();
                    this.lbFileList.Items.Clear();
                }
                catch (Exception x)
                {
                    MessageBox.Show(this, x.Message, "Something went wrong...");
                }
            }
        }
Ejemplo n.º 5
0
 public ResultStatus ProcessComputation(
     Combine combine,
     Combine_Request request,
     out Combine_Result result)
 {
     return(this.ProcessComputation(combine, (Combine_Parameters)null, request, out result));
 }
Ejemplo n.º 6
0
 public ResultStatus ResolveParametricData(
     Combine combine,
     Combine_Request request,
     out Combine_Result result)
 {
     return(this.ResolveParametricData(combine, (Combine_Parameters)null, request, out result));
 }
Ejemplo n.º 7
0
 public ResultStatus GetWIPMsgs(
     Combine combine,
     Combine_Request request,
     out Combine_Result result)
 {
     return(this.GetWIPMsgs(combine, (Combine_Parameters)null, request, out result));
 }
Ejemplo n.º 8
0
 public ResultStatus LoadESigDetails(
     Combine combine,
     Combine_Request request,
     out Combine_Result result)
 {
     return(this.LoadESigDetails(combine, (Combine_LoadESigDetails_Parameters)null, request, out result));
 }
Ejemplo n.º 9
0
        Unit CreateUnit(int type)
        {
            Unit temp = null;

            switch (type)
            {
            case (int)UnitTypes.Armored:
                temp = new Armored(OwnerType.Player1, 0, 0, 0);
                break;

            case (int)UnitTypes.Cannon:
                temp = new Cannon(OwnerType.Player1, 0, 0, 0);
                break;

            case (int)UnitTypes.Combine:
                temp = new Combine(OwnerType.Player1, 0, 0, 0);
                break;

            case (int)UnitTypes.Mine:
                temp = new Mine(OwnerType.Player1, 0, 0, 0);
                break;

            case (int)UnitTypes.Tank:
                temp = new Tank(OwnerType.Player1, 0, 0, 0);
                break;
            }
            return(temp);
        }
Ejemplo n.º 10
0
 public ResultStatus GetCombineToContainers(
     Combine combine,
     Combine_Request request,
     out Combine_Result result)
 {
     return(this.GetCombineToContainers(combine, (Combine_GetCombineToContainers_Parameters)null, request, out result));
 }
Ejemplo n.º 11
0
    ItemsTypes SetNextItemType(Combine combine)
    {
//		Debug.Log (combine.hCount + " " + combine.vCount);
        if (combine.hCount > 4 || combine.vCount > 4)
        {
            return(ItemsTypes.BOMB);
        }
        if (combine.hCount >= 3 && combine.vCount >= 3)
        {
            return(ItemsTypes.PACKAGE);
        }
        if (combine.hCount > 3 || combine.vCount > 3)
        {
            if (LevelManager.THIS.lastDraggedItem)
            {
                Vector2 dir = LevelManager.THIS.lastDraggedItem.moveDirection;
                if (Math.Abs(dir.x) > Math.Abs(dir.y))
                {
                    return(ItemsTypes.HORIZONTAL_STRIPPED);
                }
                else
                {
                    return(ItemsTypes.VERTICAL_STRIPPED);
                }
            }
            return((ItemsTypes)UnityEngine.Random.Range(1, 3));
        }
        return(ItemsTypes.NONE);
    }
Ejemplo n.º 12
0
    Combine FindCombine(Item item)
    {
        Combine combine  = null;
        Item    leftItem = item.GetLeftItem();

        if (CheckColor(item, leftItem) && !vChecking)
        {
            combine = FindCombineInDic(leftItem);
        }
        if (combine != null)
        {
            return(combine);
        }
        Item topItem = item.GetTopItem();

        if (CheckColor(item, topItem) && vChecking)
        {
            combine = FindCombineInDic(topItem);
        }
        if (combine != null)
        {
            return(combine);
        }

        return(new Combine());
    }
Ejemplo n.º 13
0
        ////////////////////////////////////////////////////////////////////////////////
        //
        ////////////////////////////////////////////////////////////////////////////////
        internal static Byte[] DecryptLsa(Byte[] secret, Byte[] key)
        {
            Byte[] combinedKey   = key;
            Byte[] splicedSecret = secret.Skip(28).Take(32).ToArray();

            Byte[] hash;
            using (SHA256 sha256 = new SHA256Managed())
            {
                for (Int32 i = 0; i < 1000; i++)
                {
                    combinedKey = Combine.combine(combinedKey, splicedSecret);
                }
                hash = sha256.ComputeHash(combinedKey);
            }

            Byte[] plaintextSecret = new Byte[0];
            for (Int32 i = 60; i < secret.Length; i += 16)
            {
                using (Aes aes = new AesManaged())
                {
                    aes.Key     = hash;
                    aes.Mode    = CipherMode.CBC;
                    aes.IV      = new Byte[] { 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
                    aes.Padding = PaddingMode.Zeros;
                    ICryptoTransform decryptor = aes.CreateDecryptor();
                    plaintextSecret = Combine.combine(plaintextSecret, decryptor.TransformFinalBlock(secret, i, 16));
                }
            }
            return(plaintextSecret);
        }
Ejemplo n.º 14
0
        //[a,b) 取a不取b
        public List <Point> GroupColumnArray()
        {
            if (blockPercent.Length == 0)
            {
                return(null);
            }

            List <Point> points = new List <Point>();

            int[] bestGroup = Combine.BestGroup(blockPercent, columnPercent);
            int   x1        = 0;

            for (int index = 0; index < bestGroup.Length; index++)
            {
                if (bestGroup[index] == 1)
                {
                    if (index > 0)
                    {
                        points.Add(new Point(x1, index - 1));
                    }
                    x1 = index;
                }
            }
            points.Add(new Point(x1, bestGroup.Length - 1));
            return(points);
        }
Ejemplo n.º 15
0
    /// <summary>
    /// 检测当前的Item 可以组合结果 left top 方向
    /// </summary>
    /// <param name="item">Item.</param>
    /// <param name="color">Color.</param>
    /// <param name="combine">Combine.</param>
    void CheckMatches(Item item, int color, ref Combine combine)
    {
        //返回 combine
        combine = FindCombine(item);

        AddItemToCombine(combine, item);
    }
Ejemplo n.º 16
0
        internal Boolean RPCBind()
        {
            SMB2Header header = new SMB2Header();

            header.SetCommand(new Byte[] { 0x09, 0x00 });
            header.SetCreditsRequested(new Byte[] { 0x01, 0x00 });
            header.SetMessageID(++messageId);
            header.SetProcessID(processId);
            header.SetTreeId(treeId);
            header.SetSessionID(sessionId);

            DCERPCBind bind = new DCERPCBind();

            bind.SetFragLength(new Byte[] { 0x48, 0x00 });
            bind.SetCallID(1);
            bind.SetNumCtxItems(new Byte[] { 0x01 });
            bind.SetInterface(new Byte[] { 0x81, 0xbb, 0x7a, 0x36, 0x44, 0x98, 0xf1, 0x35, 0xad, 0x32, 0x98, 0xf0, 0x38, 0x00, 0x10, 0x03 });
            bind.SetInterfaceVer(new Byte[] { 0x02, 0x00 });
            Byte[] bData = bind.GetRequest();

            SMB2WriteRequest writeRequest = new SMB2WriteRequest();

            writeRequest.SetGuidHandleFile(guidFileHandle);
            writeRequest.SetLength(bData.Length);
            bData = Combine.combine(writeRequest.GetRequest(), bData);

            if (signing)
            {
                header.SetFlags(new Byte[] { 0x08, 0x00, 0x00, 0x00 });
                header.SetSignature(sessionKey, ref bData);
            }
            Byte[] bHeader = header.GetHeader();

            return(Send(bHeader, bData));
        }
Ejemplo n.º 17
0
        ////////////////////////////////////////////////////////////////////////////////
        private byte[] newRoutingPacket(byte[] encryptedBytes, Int32 meta)
        {
            Int32 encryptedBytesLength = 0;

            if (encryptedBytes != null && encryptedBytes.Length > 0)
            {
                encryptedBytesLength = encryptedBytes.Length;
            }

            byte[] data = Encoding.ASCII.GetBytes(sessionId);
            data = Combine.combine(data, new byte[4] {
                0x01, Convert.ToByte(meta), 0x00, 0x00
            });
            data = Combine.combine(data, BitConverter.GetBytes(encryptedBytesLength));

            byte[] initializationVector = newInitializationVector(4);
            byte[] rc4Key            = Combine.combine(initializationVector, stagingKeyBytes);
            byte[] routingPacketData = EmpireStager.rc4Encrypt(rc4Key, data);

            routingPacketData = Combine.combine(initializationVector, routingPacketData);
            if (encryptedBytes != null && encryptedBytes.Length > 0)
            {
                routingPacketData = Combine.combine(routingPacketData, encryptedBytes);
            }

            return(routingPacketData);
        }
Ejemplo n.º 18
0
    /// <summary>
    /// Split field to appropriate rect fragments
    /// </summary>
    /// <param name="field"></param>
    /// <param name="rightBottomPosPattern"></param>
    /// <returns></returns>
    private static List <Combine> SplitFieldSegments(FieldBoard field, Vector2Int rightBottomPosPattern)
    {
        List <Combine> segments = new List <Combine>();

        for (var row = 0; row < field.fieldData.maxRows; row++)
        {
            for (var col = 0; col < field.fieldData.maxCols; col++)
            {
                var items = field
                            .GetFieldSeqment(new RectInt(col, row, col + rightBottomPosPattern.x, row + rightBottomPosPattern.y))
                            .WhereNotNull().Select(i => i.Item).WhereNotNull().ToList();
                var splitByColors = items.GroupBy(i => i.color);
                foreach (var color in splitByColors)
                {
                    var combine = new Combine {
                        items = color.ToList(), color = color.Key
                    };
                    segments.Add(combine);
                }
                col += rightBottomPosPattern.x;
            }

            row += rightBottomPosPattern.y;
        }
        return(segments);
    }
Ejemplo n.º 19
0
 internal Byte[] GetRequest()
 {
     Byte[] request = Combine.combine(WordCount, AndXCommand);
     request = Combine.combine(request, Reserved);
     request = Combine.combine(request, AndXOffset);
     return(Combine.combine(request, ByteCount));
 }
Ejemplo n.º 20
0
            public void MergesMetadata()
            {
                // Given
                TestExecutionContext context = new TestExecutionContext();
                IDocument            a       = new TestDocument(new Dictionary <string, object>
                {
                    { "a", 1 },
                    { "b", 2 }
                });
                IDocument b = new TestDocument(new Dictionary <string, object>
                {
                    { "b", 3 },
                    { "c", 4 }
                });
                Combine combine = new Combine();

                // When
                List <IDocument> results = combine.Execute(new[] { a, b }, context).ToList();  // Make sure to materialize the result list

                // Then
                CollectionAssert.AreEquivalent(
                    new Dictionary <string, object>
                {
                    { "a", 1 },
                    { "b", 3 },
                    { "c", 4 }
                }, Iterate(results.First().GetEnumerator()));
            }
Ejemplo n.º 21
0
        ////////////////////////////////////////////////////////////////////////////////
        //
        ////////////////////////////////////////////////////////////////////////////////
        internal static Byte[] GetHBootKey(Byte[] bootKey)
        {
            Byte[] F           = (Byte[])Registry.LocalMachine.OpenSubKey(@"SAM\SAM\Domains\Account").GetValue("F");
            Int32  hashVersion = BitConverter.ToInt32(F.Skip(0x68).Take(4).ToArray(), 0);

            switch (hashVersion)
            {
            case 1:
                using (MD5 md5 = new MD5CryptoServiceProvider())
                {
                    Byte[] compute = new Byte[0];
                    compute = Combine.combine(compute, F.Skip(0x70).Take(0x10).ToArray());
                    compute = Combine.combine(compute, qwerty);
                    compute = Combine.combine(compute, bootKey);
                    compute = Combine.combine(compute, numeric);
                    Byte[] rc4Key = md5.ComputeHash(compute);
                    return(Misc.RC4Encrypt(rc4Key, F.Skip(0x80).Take(0x20).ToArray()));
                }

            case 2:
                using (Aes aes = new AesCryptoServiceProvider())
                {
                    aes.Key     = bootKey;
                    aes.Padding = PaddingMode.Zeros;
                    aes.IV      = F.Skip(0x78).Take(16).ToArray();
                    aes.Mode    = CipherMode.CBC;
                    ICryptoTransform decryptor = aes.CreateDecryptor();
                    return(decryptor.TransformFinalBlock(F, 0x88, 16));
                }

            default:
                return(new Byte[0]);
            }
        }
Ejemplo n.º 22
0
            public void AppendsContent()
            {
                // Given
                IExecutionContext context = Substitute.For <IExecutionContext>();

                context
                .GetDocument(Arg.Any <IDocument>(), Arg.Any <string>(), Arg.Any <IEnumerable <KeyValuePair <string, object> > >())
                .Returns(x =>
                {
                    IDocument result = Substitute.For <IDocument>();
                    result.Content.Returns(x.ArgAt <string>(1));
                    return(result);
                });
                IDocument a = Substitute.For <IDocument>();

                a.Content.Returns(@"a");
                IDocument b = Substitute.For <IDocument>();

                b.Content.Returns(@"b");
                Combine combine = new Combine();

                // When
                List <IDocument> results = combine.Execute(new[] { a, b }, context).ToList();  // Make sure to materialize the result list

                // Then
                CollectionAssert.AreEqual(new [] { "ab" }, results.Select(x => x.Content));
            }
Ejemplo n.º 23
0
        internal Byte[] GetRequest()
        {
            Combine combine = new Combine();

            combine.Extend(Version);
            combine.Extend(VersionMinor);
            combine.Extend(PacketType);
            combine.Extend(PacketFlags);
            combine.Extend(DataRepresentation);
            combine.Extend(FragLength);
            combine.Extend(AuthLength);
            combine.Extend(CallID);
            combine.Extend(MaxXmitFrag);
            combine.Extend(MaxRecvFrag);
            combine.Extend(AssocGroup);
            combine.Extend(NumCtxItems);
            combine.Extend(Unknown);
            combine.Extend(ContextID);
            combine.Extend(NumTransItems);
            combine.Extend(Unknown2);
            combine.Extend(Interface);
            combine.Extend(InterfaceVer);
            combine.Extend(InterfaceVerMinor);
            combine.Extend(TransferSyntax);
            combine.Extend(TransferSyntaxVer);
            combine.Extend(ExtraData);
            return(combine.Retrieve());
        }
Ejemplo n.º 24
0
        internal void SetCallID(Int32 dwCallID, Byte[] AuthLevel, Byte[] NegotiateFlags)
        {
            CallID = BitConverter.GetBytes(dwCallID);

            if (3 == dwCallID)
            {
                Byte[] AuthType = { 0x0a };
                //Byte[] AuthLevel = {  };
                Byte[] AuthPadLength = { 0x00 };
                Byte[] AuthReserved  = { 0x00 };
                Byte[] ContextID3    = { 0x00, 0x00, 0x00, 0x00 };
                Byte[] Identifier    = { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00 };
                Byte[] MessageType   = { 0x01, 0x00, 0x00, 0x00 };
                //Byte[] NegotiateFlags = { 0x97, 0x82, 0x08, 0xe2 };
                Byte[] CallingWorkstationDomain = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
                Byte[] CallingWorkstationName   = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
                Byte[] OSVersion = { 0x06, 0x01, 0xb1, 0x1d, 0x00, 0x00, 0x00, 0x0f };

                Combine combine = new Combine();
                combine.Extend(AuthType);
                combine.Extend(AuthLevel);
                combine.Extend(AuthPadLength);
                combine.Extend(AuthReserved);
                combine.Extend(ContextID3);
                combine.Extend(Identifier);
                combine.Extend(MessageType);
                combine.Extend(NegotiateFlags);
                combine.Extend(CallingWorkstationDomain);
                combine.Extend(CallingWorkstationName);
                combine.Extend(OSVersion);
                ExtraData = Combine.combine(ExtraData, combine.Retrieve());
            }
        }
Ejemplo n.º 25
0
        ////////////////////////////////////////////////////////////////////////////////
        //
        ////////////////////////////////////////////////////////////////////////////////
        internal Boolean LogoffRequest()
        {
            SMB2Header header = new SMB2Header();
            header.SetCommand(new Byte[] { 0x02, 0x00 });
            header.SetCreditsRequested(new Byte[] { 0x01, 0x00 });
            header.SetMessageID(++messageId);
            header.SetProcessID(processId);
            header.SetTreeId(treeId);
            header.SetSessionID(sessionId);

            SMB2SessionLogoffRequest logoffRequest = new SMB2SessionLogoffRequest();
            Byte[] bData = logoffRequest.GetRequest();

            if (signing)
            {
                header.SetFlags(new Byte[] { 0x08, 0x00, 0x00, 0x00 });
                header.SetSignature(sessionKey, ref bData);
            }
            Byte[] bHeader = header.GetHeader();

            NetBIOSSessionService sessionService = new NetBIOSSessionService();
            sessionService.SetHeaderLength(bHeader.Length);
            sessionService.SetDataLength(bData.Length);
            Byte[] bSessionService = sessionService.GetNetBIOSSessionService();

            Byte[] bSend = Combine.combine(Combine.combine(bSessionService, bHeader), bData);
            streamSocket.Write(bSend, 0, bSend.Length);
            streamSocket.Flush();
            streamSocket.Read(recieve, 0, recieve.Length);

            if (GetStatus(recieve.Skip(12).Take(4).ToArray()))
                return true;
            else
                return false;
        }
Ejemplo n.º 26
0
        ////////////////////////////////////////////////////////////////////////////////
        //
        ////////////////////////////////////////////////////////////////////////////////
        public void NegotiateSMB2()
        {   
            SMB2Header header = new SMB2Header();
            header.SetCommand(new Byte[] { 0x00, 0x00 });
            header.SetCreditsRequested(new Byte[] { 0x00, 0x00 });
            header.SetMessageID(messageId);
            header.SetProcessID(processId);
            header.SetTreeId(treeId);
            header.SetSessionID(sessionId);
            Byte[] bHeader = header.GetHeader();

            SMB2NegotiateProtocolRequest protocols = new SMB2NegotiateProtocolRequest();
            Byte[] bData = protocols.GetProtocols();

            NetBIOSSessionService sessionService = new NetBIOSSessionService();
            sessionService.SetHeaderLength(bHeader.Length);
            sessionService.SetDataLength(bData.Length);
            Byte[] bSessionService = sessionService.GetNetBIOSSessionService();

            Byte[] send = Combine.combine(bSessionService, bHeader);
            send = Combine.combine(send, bData);
            streamSocket.Write(send, 0, send.Length);
            streamSocket.Flush();
            streamSocket.Read(recieve, 0, recieve.Length);
        }
Ejemplo n.º 27
0
        ////////////////////////////////////////////////////////////////////////////////
        //
        ////////////////////////////////////////////////////////////////////////////////
        internal void IoctlRequest(String share)
        {
            treeId = new Byte[] { 0x01, 0x00, 0x00, 0x00 };

            SMB2Header header = new SMB2Header();
            header.SetCommand(new Byte[] { 0x0b, 0x00 });
            header.SetCreditsRequested(new Byte[] { 0x01, 0x00 });
            header.SetMessageID(++messageId);
            header.SetProcessID(processId);
            header.SetTreeId(treeId);
            header.SetSessionID(sessionId);

            SMB2IoctlRequest ioctlRequest = new SMB2IoctlRequest();
            ioctlRequest.SetFileName(share);
            Byte[] bData = ioctlRequest.GetRequest();

            if (signing)
            {
                header.SetFlags(new Byte[] { 0x08, 0x00, 0x00, 0x00 });
                header.SetSignature(sessionKey, ref bData);
            }
            Byte[] bHeader = header.GetHeader();

            NetBIOSSessionService sessionService = new NetBIOSSessionService();
            sessionService.SetHeaderLength(bHeader.Length);
            sessionService.SetDataLength(bData.Length);
            Byte[] bSessionService = sessionService.GetNetBIOSSessionService();

            Byte[] bSend = Combine.combine(Combine.combine(bSessionService, bHeader), bData);
            streamSocket.Write(bSend, 0, bSend.Length);
            streamSocket.Flush();
            streamSocket.Read(recieve, 0, recieve.Length);
            treeId = new Byte[] { 0x00, 0x00, 0x00, 0x00 };
        }
Ejemplo n.º 28
0
        ////////////////////////////////////////////////////////////////////////////////
        //
        ////////////////////////////////////////////////////////////////////////////////
        internal void NTLMSSPNegotiate()
        {
            SMB2Header header = new SMB2Header();
            header.SetCommand(new Byte[] { 0x01, 0x00 });
            header.SetCreditsRequested(new Byte[] { 0x1f, 0x00 });
            header.SetMessageID(++messageId);
            header.SetProcessID(processId);
            header.SetTreeId(treeId);
            header.SetSessionID(sessionId);
            Byte[] bHeader = header.GetHeader();

            SMB2NTLMSSPNegotiate NTLMSSPNegotiate = new SMB2NTLMSSPNegotiate(version);
            NTLMSSPNegotiate.SetFlags(flags);
            Byte[] bNegotiate = NTLMSSPNegotiate.GetSMB2NTLMSSPNegotiate();
            
            SMB2SessionSetupRequest sessionSetup = new SMB2SessionSetupRequest();
            sessionSetup.SetSecurityBlob(bNegotiate);
            Byte[] bData = sessionSetup.GetSMB2SessionSetupRequest();

            NetBIOSSessionService sessionService = new NetBIOSSessionService();
            sessionService.SetHeaderLength(bHeader.Length);
            sessionService.SetDataLength(bData.Length);
            Byte[] bSessionService = sessionService.GetNetBIOSSessionService();

            Byte[] send = Combine.combine(bSessionService, bHeader);
            send = Combine.combine(send, bData);
            streamSocket.Write(send, 0, send.Length);
            streamSocket.Flush();
            streamSocket.Read(recieve, 0, recieve.Length);
        }
Ejemplo n.º 29
0
 public CombineResult(Combine combine, byte star, CardEnum min_card, byte card_num)
 {
     this.combine  = combine;
     this.star     = star;
     this.min_card = min_card;
     this.card_num = card_num;
 }
Ejemplo n.º 30
0
        public IEnumerator FruitsDestroy(GameObject[,] allObjects, float destroyTime)
        {
            TilesController tilesControll = new TilesController();
            List <Combine>  dieFruits     = new List <Combine>();

            yield return(new WaitForSeconds(destroyTime + 0.01f));

            for (int i = 0; i < allObjects.GetLength(0); i++)
            {
                for (int j = 0; j < allObjects.GetLength(1); j++)
                {
                    Combine combinedFruit = allObjects[i, j].GetComponent <Combine>();
                    if (combinedFruit != null)
                    {
                        if (combinedFruit.iDie)
                        {
                            dieFruits.Add(combinedFruit);
                            Vector2 fruitPos = allObjects[i, j].transform.position;
                            Object.Destroy(allObjects[i, j]);
                            allObjects[i, j] = tilesControll.CreateEmpty(fruitPos);
                            allObjects[i, j].GetComponent <Movable>().SetColRow(i, j);
                        }
                    }
                }
            }
            EventHolder.destroyEvent.Invoke();
            EventHolder.destroyFruits.Invoke(dieFruits);
            AudioManager.Instance.PlayExplosion();
            yield break;
        }
    private void GenerateNavMesh()
    {
        var map = (TilerMap)target;

        var collectionSize = 1;
        foreach (var cell in map.Cells)
        {
            foreach (var t in cell.Tiles)
            {
                var size = t.Collision.Length;
                if (size > collectionSize)
                    collectionSize = size;
            }
        }

        collectionSize = (int)Mathf.Sqrt(collectionSize);

        foreach (var cell in map.Cells)
        {
            var tiles = cell.Tiles;

            var goTrans = cell.transform.Find("navmesh");

            if (goTrans != null)
                DestroyImmediate(goTrans.gameObject);

            goTrans = new GameObject("navmesh").transform;

            goTrans.parent = cell.transform;
            goTrans.localPosition = new Vector3();

            var collection = new bool[map.TilesPerCell, map.TilesPerCell][];

            for (var y = 0; y < map.TilesPerCell; y++)
            {
                for (var x = 0; x < map.TilesPerCell; x++)
                {
                    collection[y, x] = tiles[y * map.TilesPerCell + x].Collision;
                }
            }

            var merged = Util.MergeArrays(collection, collectionSize);

            var c = new Combine();
            var r = c.FindRect(merged);

            var size = r.GetLength(0);
            var sizePerCollider = map.CellSize / size;
            var halfCellSize = map.CellSize / 2f;

            var offset = sizePerCollider / 2f;

            var p = new Point();

            for (var y = 0; y < size; y++)
            {
                for (var x = 0; x < size; x++)
                {
                    var start = r[y, x];
                    if (start != p)
                    {
                        var xx = (x + x + start.X - 1) / 2f;
                        var yy = (y + y - start.Y + 1) / 2f;

                        var posX = sizePerCollider * xx - (halfCellSize - offset);
                        var posY = sizePerCollider * yy - (halfCellSize - offset);

                        var go = GameObject.CreatePrimitive(PrimitiveType.Cube);
                        go.isStatic = true;
                        go.transform.parent = goTrans;

                        var goPos = new Vector3();
                        goPos.x = posX;
                        goPos.y = 0;
                        goPos.z = posY;

                        go.transform.localPosition = goPos;
                        go.transform.localScale = new Vector3(start.X * sizePerCollider, 1, start.Y * sizePerCollider);

                        GameObjectUtility.SetNavMeshLayer(go, 1);
                    }
                }
            }
        }

        NavMeshBuilder.ClearAllNavMeshes();
        NavMeshBuilder.BuildNavMesh();



        foreach (var cell in map.Cells)
        {
            var goTrans = cell.transform.Find("navmesh");
            DestroyImmediate(goTrans.gameObject);
        }
    }
    public void GenerateColliders()
    {
        var map = (TilerMap)target;

        var collectionSize = 1;
        foreach (var cell in map.Cells)
        {
            foreach (var t in cell.Tiles)
            {
                var size = t.Collision.Length;
                if (size > collectionSize)
                    collectionSize = size;
            }
        }

        collectionSize = (int)Mathf.Sqrt(collectionSize);

        foreach (var cell in map.Cells)
        {
            var tiles = cell.Tiles;

            var goTrans = cell.transform.Find("colliders");

            if (goTrans != null)
                DestroyImmediate(goTrans.gameObject);

            goTrans = new GameObject("colliders").transform;

            goTrans.parent = cell.transform;
            goTrans.localPosition = new Vector3();

            var collection = new bool[map.TilesPerCell, map.TilesPerCell][];

            for (var y = 0; y < map.TilesPerCell; y++)
            {
                for (var x = 0; x < map.TilesPerCell; x++)
                {
                    collection[y, x] = tiles[y * map.TilesPerCell + x].Collision;
                    
                }
            }

            var merged = Util.MergeArrays(collection, collectionSize);

            var c = new Combine();
            var r = c.FindRect(merged);

            var size = r.GetLength(0);
            var sizePerCollider = map.CellSize / size;
            var halfCellSize = map.CellSize / 2f;

            var offset = sizePerCollider / 2f;

            var p = new Point();

            for (var y = 0; y < size; y++)
            {
                for (var x = 0; x < size; x++)
                {
                    var start = r[y, x];
                    if (start != p)
                    {
                        var xx = (x + x + start.X - 1) / 2f;
                        var yy = (y + y - start.Y + 1) / 2f;

                        var posX = sizePerCollider * xx - (halfCellSize - offset);
                        var posY = sizePerCollider * yy - (halfCellSize - offset);

                        var go = new GameObject("c");
                        go.isStatic = true;
                        go.transform.parent = goTrans;
                        var bc = go.AddComponent<BoxCollider>();

                        bc.size = new Vector3(start.X * sizePerCollider, 1, start.Y * sizePerCollider);

                        var goPos = new Vector3();
                        goPos.x = posX;
                        goPos.y = map.transform.position.y + 0.5f;
                        goPos.z = posY;

                        go.transform.localPosition = goPos;
                    }
                }
            }
        }
    }
Ejemplo n.º 33
0
		public void GenerateMakefile (IProject project, Combine parentCombine)
		{
			throw new NotImplementedException ();
		}
Ejemplo n.º 34
0
 /// <summary>
 /// Combines the elements of a list by applying a binary function f to the elements
 /// from left to right, using the provided identity element.  For example, if he
 /// list is [1,2,3,4], the method computes f(f(f(f(identity,1),2),3),4).
 /// </summary>
 static int Fold (List<int> list, Combine f, int identity)
 {
     int result = identity;
     foreach (int n in list)
     {
         result = f(result, n);
     }
     return result;
 }