private void WEBpost_ScriptNotify(object sender, NotifyEventArgs e)
 {
     try
     {
         int codeId = 0;
         if (e.Value is String)
         {
             codeId = int.Parse(e.Value);
             var doc = new HtmlDocument();
             if (_originMode)
             {
                 doc.LoadHtml(_originHtml);
             }
             else
             {
                 doc.LoadHtml(html);
             }
             var pres     = doc.DocumentNode.SelectNodes("//pre");
             var pre      = pres[codeId];
             var codeText = pre.InnerText;
             codeText        = codeText.Replace("&lt;", "<");
             codeText        = codeText.Replace("&gt;", ">");
             CODE.OriginCode = codeText;
             CODE.Visibility = Visibility.Visible;
             CODE.Opacity    = 1;
             CODE.popin();
         }
     }
     catch
     {
         return;
     }
 }
Beispiel #2
0
 public interpreter(string codelst)
 {
     //Console.WriteLine(codelst);
     //Console.WriteLine("");
     if (codelst != "")
     {
         try
         {
             string[] pCodes = codelst.Split('\n');
             //for (int i = 0; i <= pCodes.Length - 1; i++)
             //{
             //    Console.WriteLine(i.ToString() + " " + pCodes[i] + " " + pCodes[i].Length.ToString());
             //}
             for (int i = 0; i < pCodes.Length - 1; i++)
             {
                 string   cl  = pCodes[i];
                 string[] ops = cl.Split('*');
                 CODE     ins = new CODE();
                 ins.op = ops[0];
                 ins.l  = Convert.ToInt32(ops[1]);
                 ins.a  = Convert.ToInt32(ops[2]);
                 pcode.Add(ins);
             }
         }
         catch (IOException ex)
         {
             Console.WriteLine(ex.Message);
         }
     }
 }
Beispiel #3
0
 public AsmCode(int HNDL, byte[] data)
 {
     CD        = new CODE();
     CD.DATA   = data;
     CD.LENGTH = data.Length;
     this.HNDL = HNDL;
 }
Beispiel #4
0
 public AsmCode(int HNDL, string data)
 {
     CD        = new CODE();
     CD.DATA   = STBA(data);
     CD.LENGTH = CD.DATA.Length;
     this.HNDL = HNDL;
 }
Beispiel #5
0
 private void button6_Click(object sender, EventArgs e)
 {
     fileName = Ultis.RemoveUnicode(emp.NAME) + "_" + CODE.TextDateString(dayStart) + "_" + CODE.TextDateString(dayEnd);
     frmWait  = new frm_Wait("Đang xuất file excel " + BLL_PARA.PathExcel + fileName + ".xlsx");
     exExcel  = new Thread(export);
     exExcel.Start();
     frmWait.ShowDialog();
 }
Beispiel #6
0
        private void SetStatus(bool valid, CODE error, IEntry <T> targetProperty)
        {
            targetProperty.Status = valid ? STATUS.VALID : STATUS.INVALID;

            if (!valid)
            {
                targetProperty.Code = error;
            }
        }
        private async Task ResumeAfterDialogueCall(IDialogContext context, IAwaitable <object> result)
        {
            //var tmp = result;
            //await Helpers.BotTranslator.PostTranslated(context, tmp.ToString(), context.MakeMessage().Locale);

            CODE code = await result as CODE;

            context.Done(code);
        }
        private async Task ResumeAfterDialogCall(IDialogContext context, IAwaitable <object> result)
        {
            CODE code = await result as CODE;

            if (code.dialog == DialogType.WISHLIST)
            {
                await EventHandler(context, code.activity);
            }
            context.Done(code);
        }
Beispiel #9
0
        public string InsertCode(CODE code)
        {
            codeDataContext db = new codeDataContext();

            try {
                db.CODE.InsertOnSubmit(code);
                db.SubmitChanges();
                return(code.CodeID);
            }
            catch {
                return("");
            }
        }
Beispiel #10
0
        private async Task ResumeAfterDialogCall(IDialogContext context, IAwaitable <object> result)
        {
            CODE code = await result as CODE;

            //child dialog invoked an event of this dialog
            if (code.dialog == DialogType.COMPARE)
            {
                await EventHandler(context, code.activity);
            }
            else
            {
                context.Done(code);
            }
        }
Beispiel #11
0
        public void WriteCode(CODE code)
        {
            m_asm.Line(m_bin.GetPos());

            switch (code)
            {
            case CODE.CODE_END: m_asm.Put("end "); break;

            case CODE.CODE_MOV: m_asm.Put("mov "); break;

            case CODE.CODE_ADD: m_asm.Put("add "); break;

            case CODE.CODE_SUB: m_asm.Put("sub "); break;

            case CODE.CODE_MUL: m_asm.Put("mul "); break;

            case CODE.CODE_DIV: m_asm.Put("div "); break;

            case CODE.CODE_INC: m_asm.Put("inc "); break;

            case CODE.CODE_DEC: m_asm.Put("dec "); break;

            case CODE.CODE_FUNC: m_asm.Put("func "); break;

            case CODE.CODE_CMP: m_asm.Put("cmp "); break;

            case CODE.CODE_GOTO: m_asm.Put("goto "); break;

            case CODE.CODE_PUSH: m_asm.Put("push "); break;

            case CODE.CODE_POP: m_asm.Put("pop "); break;

            case CODE.CODE_CASE: m_asm.Put("case "); break;

            default: m_asm.Put("Error"); break;
            }

            m_bin.WriteByte('c');
            m_bin.WriteByte((byte)code);
        }
Beispiel #12
0
        public override bool OnVar(ScriptLine line, string name)
        {
            var op = string.Empty;

            line.Skip(" \t");
            if (!line.GetOperator(ref op, "=+-*/%"))
            {
                //if (!op[0]) return true;
                //Error("OnVar1: !op [{0}] ", op);
                //return false;
                return(true);
            }

            CODE code = 0;

            if (op.Equals("="))
            {
                code = CODE.CODE_MOV;
            }
            else if (op.Equals("+="))
            {
                code = CODE.CODE_ADD;
            }
            else if (op.Equals("-="))
            {
                code = CODE.CODE_SUB;
            }
            else if (op.Equals("*="))
            {
                code = CODE.CODE_MUL;
            }
            else if (op.Equals("/="))
            {
                code = CODE.CODE_DIV;
            }
            else if (op.Equals("++"))
            {
                code = CODE.CODE_INC;
            }
            else if (op.Equals("--"))
            {
                code = CODE.CODE_DEC;
            }
            else if (op.Equals("%="))
            {
                code = CODE.CODE_MOD;
            }
            else
            {
                Error("OnVar2: [{0}]  operator error1", op);
                return(false);
            }

            WriteCode(code);
            WriteVar(name);
            if (code == CODE.CODE_INC || code == CODE.CODE_DEC)
            {
                return(true);
            }
            if (!Value(line))
            {
                Error("{0} OnVar: !Value(line)", name);
                return(false);
            }
            return(true);
        }
Beispiel #13
0
 private void Rb_huffman_Checked(object sender, RoutedEventArgs e)
 {
     CodingMethod = CODE.CODE_HUFFMAN;
     filter       = "Huffman Coded File(*.hfm)|*.hfm";
 }
Beispiel #14
0
 private string saveImg(/*Bitmap bmp,*/ string name)
 {
     try
     {
         // Save Image
         string filename = BLL_PARA.PathHistory + Ultis.RemoveUnicode(DAL_EMPLOYEE.GetFullName(int.Parse(name))) + CODE.timeString(DateTime.Now) + ".Jpg";
         //FileStream fstream = new FileStream(filename, FileMode.Create);
         //bmp.Save(fstream, System.Drawing.Imaging.ImageFormat.Jpeg);
         //fstream.Close();
         return(filename);
     }
     catch (Exception)
     {
         return("");
     }
 }
Beispiel #15
0
 //헤더
 public PacketHeader(int size, int num, CODE type)
 {
     PackSize = size;
     PackNum  = num;
     code     = type;
 }
Beispiel #16
0
 public string InsertCode(CODE code)
 {
     return(cs.InsertCode(code));
 }
Beispiel #17
0
        public string InserCodeService(string codeData)
        {
            CODE code = JSONHelper.JsonDeserialize_JsonTo <CODE>(codeData);

            return(InsertCode(code));
        }
 public DoWorkRresponse(CODE code, string msg)
 {
     Code = code;
     Msg = msg;
 }
Beispiel #19
0
 private void Rb_arithmetic_Checked(object sender, RoutedEventArgs e)
 {
     CodingMethod = CODE.CODE_ARITHMETIC;
     filter       = "Arithmetic Coded File(*.atm)|*.atm";
 }
Beispiel #20
0
 private void Rb_lz_Checked(object sender, RoutedEventArgs e)
 {
     CodingMethod = CODE.CODE_LZ;
     filter       = "LZ Coded File(*.lz)|*.lz";
 }