当前位置: 首页>>代码示例>>C#>>正文


C# Decoder类代码示例

本文整理汇总了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;
     }
 }
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:27,代码来源:Lzma.cs

示例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;
            }
        }
开发者ID:QuickBlox,项目名称:quickblox-dotnet-sdk,代码行数:36,代码来源:Vp8Codec.cs

示例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");

            }
        }
开发者ID:veenarajan,项目名称:AirlineTicketSystem,代码行数:32,代码来源:TravelAgency.cs

示例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"));
            }
        }
开发者ID:Wolfium,项目名称:MaxMind-DB-Reader-dotnet,代码行数:27,代码来源:PointerTest.cs

示例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"));
            }
        }
开发者ID:RalphSim,项目名称:MaxMind-DB-Reader-dotnet,代码行数:26,代码来源:PointerTest.cs

示例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>";
        }
    }
开发者ID:fping1245,项目名称:test20121224,代码行数:35,代码来源:30023.aspx.cs

示例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.");
 }
开发者ID:joshpeterson,项目名称:mos,代码行数:7,代码来源:DecoderTests.cs

示例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;
        }
开发者ID:veenarajan,项目名称:AirlineTicketSystem,代码行数:33,代码来源:MultiCellBuffer.cs

示例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);
 }
开发者ID:BclEx,项目名称:AdamsyncEx,代码行数:7,代码来源:BitTreeDecoder.cs

示例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;
 }
开发者ID:softbreakers,项目名称:setup_soma_code,代码行数:32,代码来源:DecodeDeserializeUtils.cs

示例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;
 }
开发者ID:proxymoron,项目名称:Sulakore,代码行数:8,代码来源:LzmaDecoder.cs

示例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();
 }
开发者ID:doio,项目名称:Ultrapowa-SC-Editor,代码行数:9,代码来源:Texture.cs

示例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>";
        }
    }
开发者ID:fping1245,项目名称:test20121224,代码行数:56,代码来源:3002622.aspx.cs

示例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>";
    }
开发者ID:fping1245,项目名称:test20121224,代码行数:54,代码来源:10051_pass.aspx.cs

示例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;

            }
        }
开发者ID:recodernew,项目名称:NgtSynchronize,代码行数:11,代码来源:fmDecoder.cs


注:本文中的Decoder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。