Exemplo n.º 1
0
 static int GenerateMd5Str(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         GenerateMd5 obj  = (GenerateMd5)ToLua.CheckObject(L, 1, typeof(GenerateMd5));
         string      arg0 = ToLua.CheckString(L, 2);
         string      o    = obj._GenerateMd5Str(arg0);
         LuaDLL.lua_pushstring(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
        private async void BtnVerifyMd5_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(TxtFilePathMd5.Text) || string.IsNullOrWhiteSpace(TxtMd5Provided.Text))
            {
                return;
            }
            LblresultMd5.Content      = "Working...";
            BtnVerifyMd5.IsEnabled    = false;
            TxtMd5Provided.IsReadOnly = true;

            GenerateMd5 md5    = new GenerateMd5(TxtFilePathMd5.Text);
            string      result = await md5.GenerateFromFileAsync();

            string providedhash = TxtMd5Provided.Text.ToUpper();

            LblresultMd5.Content      = result.Equals(providedhash) ? "Verified" : "Error does not match";
            TxtMd5Provided.IsReadOnly = false;
            BtnVerifyMd5.IsEnabled    = true;
        }
Exemplo n.º 3
0
    static int _CreateGenerateMd5(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 0)
            {
                GenerateMd5 obj = new GenerateMd5();
                ToLua.PushObject(L, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: ByteArray.New"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }