刪除Player上指定的媒體檔案

來源:互聯網
上載者:User
 #region 磁碟空間管理:刪除Player上指定的媒體檔案

public void CommandSetManageDisk(byte gid, byte did,string deletestring)
{
// 分包發送
string ManageDiskStr = deletestring;
byte i = 0;
Encoding GB2312Encoding = UnicodeEncoding.GetEncoding("GB2312");
byte[] ManageDisk = GB2312Encoding.GetBytes(ManageDiskStr);
byte [] myManageDisk = new byte [300];
int txtLength = ManageDisk.Length;

int packetizationtimer = txtLength / 300;
int packetizationresidue = txtLength % 300;
int packetizationsender;
//如果沒有餘數,發包時就不用多發一次
if (packetizationresidue > 0)
{
packetizationsender = packetizationtimer + 1;
}
else
{
packetizationsender = packetizationtimer;
}
//開始分包發送
for (i = 0; i < packetizationsender; i++)
{
if (i < packetizationtimer)
{
Array.Copy(ManageDisk, i * 300, myManageDisk, 0, 300);
}
else
{
Array.Copy(ManageDisk, i * 300, myManageDisk, 0, packetizationresidue);
}

PlayerMessages.SetManageDisk setmanagedisk = new PlayerMessages.SetManageDisk();
setmanagedisk.direct = 0x02;
setmanagedisk.category = 0x03;
setmanagedisk.type = 0x10;

setmanagedisk.GroupID = gid ;
setmanagedisk.DeviceID = did ;
setmanagedisk.Sequence = i;
setmanagedisk.size = 300;
if (i == (packetizationsender-1)) {

setmanagedisk.Sequence=0xFF;
setmanagedisk.size =(ushort)packetizationresidue;

}

setmanagedisk.DeleteFile = myManageDisk;

byte[] data = PlayerMessages.StructToBytes(setmanagedisk);
ssock.OnUDPDataSend(data);
}
}


PlayerMessages.SetManageDisk 是struct,UDP包的資料結構
setmanagedisk.Sequence = i;表示包的序號,0xFF表示最後一個包

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.