本文整理汇总了C#中Decoder类的典型用法代码示例。如果您正苦于以下问题:C# Decoder类的具体用法?C# Decoder怎么用?C# Decoder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Decoder类属于命名空间,在下文中一共展示了Decoder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Decode
public uint Decode(Decoder rangeDecoder)
{
uint newBound = (uint)(rangeDecoder.Range >> kNumBitModelTotalBits) * (uint)Prob;
if (rangeDecoder.Code < newBound)
{
rangeDecoder.Range = newBound;
Prob += (kBitModelTotal - Prob) >> kNumMoveBits;
if (rangeDecoder.Range < Decoder.kTopValue)
{
rangeDecoder.Code = (rangeDecoder.Code << 8) | (byte)rangeDecoder.Stream.ReadByte();
rangeDecoder.Range <<= 8;
}
return 0;
}
else
{
rangeDecoder.Range -= newBound;
rangeDecoder.Code -= newBound;
Prob -= (Prob) >> kNumMoveBits;
if (rangeDecoder.Range < Decoder.kTopValue)
{
rangeDecoder.Code = (rangeDecoder.Code << 8) | (byte)rangeDecoder.Stream.ReadByte();
rangeDecoder.Range <<= 8;
}
return 1;
}
}
示例2: Decode
/// <summary>
/// Decodes an encoded frame.
/// </summary>
/// <param name="encodedFrame">The encoded frame.</param>
/// <returns></returns>
public override VideoBuffer Decode(byte[] encodedFrame)
{
if (Decoder == null)
{
Decoder = new Decoder();
}
if (Padep.SequenceNumberingViolated)
{
Decoder.NeedsKeyFrame = true;
return null;
}
// vp8 -> frame
var width = 0;
var height = 0;
var frame = Decoder.Decode(encodedFrame, out width, out height);
if (frame == null)
{
return null;
}
try
{
return new VideoBuffer(width, height, new VideoPlane(frame, width), VideoFormat.I420);
}
catch (Exception ex)
{
Log.Error("Could not convert decoded image to video buffer.", ex);
return null;
}
}
示例3: EventHandler_ConfirmationStatus
public void EventHandler_ConfirmationStatus(string message)
{
Decoder decode_test = new Decoder();
OrderClass obj = new OrderClass();
obj = decode_test.decryptString(message);
if (obj.get_senderId() == this.name)
{
Console.WriteLine("\n\n\n*************** ORDER STATUS ***************");
Console.WriteLine("Travel {0} placed an order of {1} ticktes to Airline {2}", obj.get_senderId(), obj.get_amount(), obj.get_receiverId());
Console.WriteLine("The price of each ticket is ${0}", obj.get_unitprice());
Console.WriteLine("The total amount charged is : ${0}", obj.get_totalamount());
Console.WriteLine("The order is charged to card number : {0}", obj.get_cardNo());
if (obj.get_confirmationstatus())
{
Console.WriteLine("Congratulations !! the order has been processed. Have a safe Flight !");
}
else
{
Console.WriteLine("No Tickets Available. Your order could not be processed at this time !");
}
stopWatch.Stop();
timeSpan = stopWatch.Elapsed;
Console.WriteLine("Total time taken for order confirmation: " + timeSpan.Milliseconds);
Console.WriteLine("**************************************************");
Console.WriteLine("\n\n\n");
}
}
示例4: TestWithPointers
public void TestWithPointers()
{
var path = Path.Combine(new[] { "..", "..", "TestData", "MaxMind-DB", "test-data", "maps-with-pointers.raw" });
var stream = new ThreadLocal<Stream>(() => new MemoryStream(File.ReadAllBytes(path)));
using (stream)
{
var decoder = new Decoder(stream, 0);
var node = decoder.Decode(0).Node;
Assert.That(node.Value<string>("long_key"), Is.EqualTo("long_value1"));
node = decoder.Decode(22).Node;
Assert.That(node.Value<string>("long_key"), Is.EqualTo("long_value2"));
node = decoder.Decode(37).Node;
Assert.That(node.Value<string>("long_key2"), Is.EqualTo("long_value1"));
node = decoder.Decode(50).Node;
Assert.That(node.Value<string>("long_key2"), Is.EqualTo("long_value2"));
node = decoder.Decode(55).Node;
Assert.That(node.Value<string>("long_key"), Is.EqualTo("long_value1"));
node = decoder.Decode(57).Node;
Assert.That(node.Value<string>("long_key2"), Is.EqualTo("long_value2"));
}
}
示例5: TestWithPointers
public void TestWithPointers()
{
var path = Path.Combine("..", "..", "TestData", "MaxMind-DB", "test-data", "maps-with-pointers.raw");
using (var database = new ArrayReader(path))
{
var decoder = new Decoder(database, 0);
var node = decoder.Decode(0).Node;
Assert.That(node.Value<string>("long_key"), Is.EqualTo("long_value1"));
node = decoder.Decode(22).Node;
Assert.That(node.Value<string>("long_key"), Is.EqualTo("long_value2"));
node = decoder.Decode(37).Node;
Assert.That(node.Value<string>("long_key2"), Is.EqualTo("long_value1"));
node = decoder.Decode(50).Node;
Assert.That(node.Value<string>("long_key2"), Is.EqualTo("long_value2"));
node = decoder.Decode(55).Node;
Assert.That(node.Value<string>("long_key"), Is.EqualTo("long_value1"));
node = decoder.Decode(57).Node;
Assert.That(node.Value<string>("long_key2"), Is.EqualTo("long_value2"));
}
}
示例6: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Decoder dcode = new Decoder();
string mErr = "";
// 檢查使用者權限但不存入登入紀錄
//Check_Power("3002", false);
if (Request["fl_url"] != null)
{
lb_fl_url.Text = dcode.DeCode(Request["fl_url"].Trim());
if (lb_fl_url.Text == Album.Root)
mErr = "根目錄不可刪除\\n";
else
{
lb_path.Text = Server.MapPath(lb_fl_url.Text);
#region 取得目前目錄的名稱
lb_al_name.Text = lb_fl_url.Text.Replace(Album.Root,"").Replace("//","");
if (!Directory.Exists(lb_path.Text))
mErr = "找不到指定的路徑\\n";
#endregion
}
}
else
mErr = "參數傳送錯誤!\\n";
if (mErr != "")
lt_show.Text = "<script language=\"javascript\">alert(\"" + mErr + "\");parent.close_all();parent.clean_win();</script>";
}
}
示例7: ReturnsFalseIfTheInstructionIsNotValid
public void ReturnsFalseIfTheInstructionIsNotValid()
{
var decoder = new Decoder(new Registry());
OpcodeAddressModePair pair;
Assert.That(decoder.TryDecode(0xFF, out pair), Is.False, @"TryDecode returned
true for an invalid instruction, which is not expected.");
}
示例8: getOneCell
public static string getOneCell(string AirlineName)
{
if (sem_empty.WaitOne(300))
{
for (int i = 0; i < 3; i++)
{
if (IsEmpty[i] == false)
{
string ObjectString = buffer[i];
Decoder decode_test = new Decoder();
OrderClass obj = new OrderClass();
if (ObjectString != null)
{
obj = decode_test.decryptString(ObjectString);
//Console.WriteLine("string name passed is {0} actual name is {1}", AirlineName, obj.get_receiverId());
if (obj.get_receiverId() == AirlineName)
{
//Console.WriteLine("Readposition is {0}\n", i);
mutex_lock.WaitOne();
buffer[i] = null;
IsEmpty[i] = true;
mutex_lock.ReleaseMutex();
sem_full.Release();
return ObjectString;
}
}
}
}
sem_empty.Release();
}
return null;
}
示例9: Decode
public uint Decode(Decoder rangeDecoder)
{
uint m = 1;
for (int bitIndex = _numBitLevels; bitIndex > 0; bitIndex--)
m = (m << 1) + _models[m].Decode(rangeDecoder);
return m - ((uint)1 << _numBitLevels);
}
示例10: DecodeLzma
private static byte[] DecodeLzma(byte[] lzmaByteArray)
{
byte[] result = null;
Decoder decoder = new Decoder();
using (MemoryStream memoryStream = new MemoryStream(lzmaByteArray))
{
memoryStream.Seek(0L, SeekOrigin.Begin);
using (MemoryStream memoryStream2 = new MemoryStream())
{
byte[] array = new byte[5];
if (memoryStream.Read(array, 0, 5) != 5)
{
throw new Exception("input .lzma is too short");
}
long num = 0L;
for (int i = 0; i < 8; i++)
{
int num2 = memoryStream.ReadByte();
if (num2 < 0)
{
throw new Exception("Can't Read 1");
}
num |= (long)((long)((ulong)((byte)num2)) << 8 * i);
}
decoder.SetDecoderProperties(array);
long inSize = memoryStream.Length - memoryStream.Position;
decoder.Code(memoryStream, memoryStream2, inSize, num, null);
result = memoryStream2.ToArray();
}
}
return result;
}
示例11: DecodeNormal
public byte DecodeNormal(Decoder rangeDecoder)
{
uint symbol = 1;
do
symbol = (symbol << 1) | m_Decoders[symbol].Decode(rangeDecoder);
while (symbol < 0x100);
return (byte)symbol;
}
示例12: Texture
public Texture(Decoder scs)
{
m_vStorageObject = scs;
m_vScImageTypes = new Dictionary<byte, Type>();
m_vScImageTypes.Add(0, typeof(ImageRgba8888));
m_vScImageTypes.Add(2, typeof(ImageRgba4444));
m_vScImageTypes.Add(4, typeof(ImageRgb565));
m_vTextureId = (short)m_vStorageObject.GetTextures().Count();
}
示例13: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Decoder dcode = new Decoder();
string mErr = "", fl_name = "", fl_url = "", fpath = "";
// 檢查使用者權限,但不存登入紀錄
//Check_Power("3002", false);
if (Request["fl_name"] == null || Request["fl_url"] == null)
mErr = "參數傳送錯誤!\\n";
else
{
fl_name = Request["fl_name"].Trim().ToLower();
fl_url = dcode.DeCode(Request["fl_url"].Trim());
if (fl_name == "" || fl_url == "")
mErr = "參數傳送錯誤!\\n";
}
#region 取得相片資訊
if (mErr == "") {
fpath = Server.MapPath(fl_url);
if (fpath.Substring(fpath.Length - 1, 1) != "\\")
fpath += "\\";
string[] mFiles = Directory.GetFiles(fpath, fl_name);
if (mFiles.Length > 0)
{
FileInfo fi_obj = new FileInfo(mFiles[0].ToString());
lb_ac_name.Text = fl_name;
lb_ac_size.Text = fi_obj.Length.ToString("N0");
lb_init_time.Text = fi_obj.LastWriteTime.ToString("yyyy/MM/dd HH:mm:ss");
lb_ac_type.Text = fi_obj.Extension.ToLower();
#region 讀取圖檔資料
using (System.Drawing.Image img_obj = System.Drawing.Image.FromFile(fpath + fl_name))
{
lb_ac_wh.Text = img_obj.Width.ToString() + " × " + img_obj.Height.ToString();
}
#endregion
}
else
mErr = "找不到指定的相片!\\n";
mFiles = null;
}
#endregion
if (mErr != "")
lt_show.Text = "<script language=javascript>alert(\"" + mErr + "\");parent.close_all();parent.clean_win();</script>";
}
}
示例14: lb_ok_Click
protected void lb_ok_Click(object sender, EventArgs e)
{
string mErr = "";
string mg_pass, mg_pass1;
// 載入公用函數
Common_Func cfc = new Common_Func();
mg_pass = tb_mg_pass.Text.Trim();
mg_pass1 = tb_mg_pass1.Text.Trim();
if (mg_pass == "")
mErr = mErr + "「新登入密碼」沒有輸入!\\n";
else
if (cfc.CheckSQL(mg_pass))
mErr = mErr + "「新登入密碼」請勿使用特殊符號!\\n";
else if (mg_pass.Length > 12 || mg_pass.Length < 4)
mErr = mErr + "「新登入密碼」長度為4~12個字!\\n";
if (mg_pass != mg_pass1)
mErr = mErr + "「新登入密碼」與「新密碼確認」不相同!\\n";
if (mErr == "")
{
using (SqlConnection Sql_conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["AppSysConnectionString"].ConnectionString))
{
string SqlString = "";
Decoder decoder = new Decoder();
Sql_conn.Open();
// 建立 SQL 修改資料的語法
SqlString = "Update Manager Set mg_pass = @mg_pass";
SqlString = SqlString + " Where mg_sid = @mg_sid";
using (SqlCommand Sql_Command = new SqlCommand(SqlString, Sql_conn))
{
Sql_Command.Parameters.AddWithValue("@mg_pass", decoder.EnCode(mg_pass));
Sql_Command.Parameters.AddWithValue("@mg_sid", lb_pg_mg_sid.Text);
Sql_Command.ExecuteNonQuery();
}
}
}
if (mErr == "")
{
mErr = "alert('密碼變更完成,新密碼該員於下次登入時生效!\\n');location.replace('10051.aspx" + lb_page.Text + "');";
}
else
mErr = "alert('" + mErr + "')";
lt_show.Text = "<script language=javascript>" + mErr + "</script>";
}
示例15: btnOpen_Click
private void btnOpen_Click(object sender, EventArgs e)
{
if (openFileDialog.ShowDialog() == DialogResult.OK && !string.IsNullOrWhiteSpace(openFileDialog.FileName))
{
txtFileName.Text = openFileDialog.FileName;
Decoder decoder = new Decoder(openFileDialog.FileName);
gvData.DataSource = decoder.DecodeData;
}
}