Jump to content

  • Log In with Google      Sign In   
  • Create Account

Landi20

Member Since 14 Feb 2012
Offline Last Active Oct 17 2014 11:27 AM

#5168515 How load a 3d model with sharpdx

Posted by Landi20 on 22 July 2014 - 05:24 PM

i can´t load a 3d model with sharpdx 2.6.2

this is my code

  static void Main()
    {
        if (!SharpDevice.IsDirectX11Supported())
        {
            System.Windows.Forms.MessageBox.Show("DirectX11 Not Supported");
            return;
        }

        //render form
        RenderForm form = new RenderForm();
        form.Text = "Tutorial 17: Query";
        //frame rate counter
        SharpFPS fpsCounter = new SharpFPS();


        using (SharpDevice device = new SharpDevice(form))
        {
            //load font
            SharpBatch font = new SharpBatch(device, "textfont.dds");

            //load model from wavefront obj file
            SharpMesh earth = SharpMesh.CreateFromObj(device, "../../../Models/planets/earth.obj");
            SharpMesh moon = SharpMesh.CreateFromObj(device, "../../../Models/planets/moon.obj");

            //init shader
            SharpShader shader = new SharpShader(device, "../../HLSL.txt",
                new SharpShaderDescription() { VertexShaderFunction = "VS", PixelShaderFunction = "PS" },
                new InputElement[] {  
                        new InputElement("POSITION", 0, Format.R32G32B32_Float, 0, 0),
                        new InputElement("NORMAL", 0, Format.R32G32B32_Float, 12, 0),
                        new InputElement("TEXCOORD", 0, Format.R32G32_Float, 24, 0)
                    });

            //init constant buffer
            Buffer11 buffer = shader.CreateBuffer<Data>();

            Query pipelineQuery = new Query(device.Device, new QueryDescription() { Flags = QueryFlags.None, Type = QueryType.PipelineStatistics });

            QueryDataPipelineStatistics stats = new QueryDataPipelineStatistics();


            //init frame counter
            fpsCounter.Reset();

            int lastX = 0;
            float currentAngle = 200;
            form.MouseMove += (sender, e) =>
            {
                if (e.Button == System.Windows.Forms.MouseButtons.Left)
                {
                    currentAngle += (lastX - e.X);
                }
                lastX = e.X;
            };

            //main loop
            RenderLoop.Run(form, () =>
            {
                //Resizing
                if (device.MustResize)
                {
                    device.Resize();
                    font.Resize();
                }

                //apply states
                device.UpdateAllStates();

                //clear color
                device.Clear(Color.CornflowerBlue);

                //apply shader
                shader.Apply();


                //apply constant buffer to shader
                device.DeviceContext.VertexShader.SetConstantBuffer(0, buffer);
                device.DeviceContext.PixelShader.SetConstantBuffer(0, buffer);

                //set transformation matrix
                float ratio = (float)form.ClientRectangle.Width / (float)form.ClientRectangle.Height;
                Matrix projection = Matrix.PerspectiveFovLH(3.14F / 3.0F, ratio, 1F, 1000.0F);
                Matrix view = Matrix.LookAtLH(new Vector3(0, 0, -250), new Vector3(), Vector3.UnitY);
                Matrix world = Matrix.Translation(0, 0, 200) * Matrix.RotationY(MathUtil.DegreesToRadians(currentAngle));

                //light direction
                Vector3 lightDirection = new Vector3(0.5f, 0, -1);
                lightDirection.Normalize();


                Data sceneInformation = new Data()
                {
                    world = world,
                    worldViewProjection = world * view * projection,
                    lightDirection = new Vector4(lightDirection, 1)
                };

                //write data inside constant buffer
                device.UpdateData<Data>(buffer, sceneInformation);

                //draw mesh
                moon.Begin();
                for (int i = 0; i < moon.SubSets.Count; i++)
                {
                    device.DeviceContext.PixelShader.SetShaderResource(0, moon.SubSets[i].DiffuseMap);
                    moon.Draw(i);
                }

                //begin analizing
                device.DeviceContext.Begin(pipelineQuery);

                world = Matrix.RotationY(Environment.TickCount / 2000.0F);
                sceneInformation = new Data()
                {
                    world = world,
                    worldViewProjection = world * view * projection,
                    lightDirection = new Vector4(lightDirection, 1)
                };

                //write data inside constant buffer
                device.UpdateData<Data>(buffer, sceneInformation);

                //draw mesh
                earth.Begin();
                for (int i = 0; i < earth.SubSets.Count; i++)
                {
                    device.DeviceContext.PixelShader.SetShaderResource(0, earth.SubSets[i].DiffuseMap);
                    earth.Draw(i);
                }
                //end analizing
                device.DeviceContext.End(pipelineQuery);

                //get result
                while (!device.DeviceContext.GetData<QueryDataPipelineStatistics>(pipelineQuery, AsynchronousFlags.None, out stats))
                {
                }

                //begin drawing text
                font.Begin();

                //draw string
                fpsCounter.Update();
                font.DrawString("Earth Stats : FPS: " + fpsCounter.FPS, 0, 0, Color.White);

                //print earth stats
                font.DrawString("Earth Stats : Rotate Moon To Cover Earth ", 0, 30, Color.White);
                font.DrawString(string.Format("Primitive Count: {0}", stats.IAPrimitiveCount), 0, 60, Color.White);
                font.DrawString(string.Format("Vertex Count Count: {0}", stats.IAVerticeCount), 0, 90, Color.White);
                font.DrawString(string.Format("Vertex Shader Execution: {0}", stats.VSInvocationCount), 0, 120, Color.White);
                font.DrawString(string.Format("Pixel Shader Execution: {0}", stats.PSInvocationCount), 0, 150, Color.White);

                //flush text to view
                font.End();
                //present
                device.Present();




            });

            //release resource
            font.Dispose();
            earth.Dispose();
            moon.Dispose();
            buffer.Dispose();
            pipelineQuery.Dispose();
        }
    }

Error    1    The type 'SharpDX.Windows.RenderForm' is defined in an assembly that is not referenced. You must add a reference to assembly 'SharpDX, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null'.    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    526    9    Central
Error    2    The best overloaded method match for 'SharpHelper.SharpDevice.SharpDevice(SharpDX.Windows.RenderForm, bool)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    526    37    Central
Error    3    Argument 1: cannot convert from 'SharpDX.Windows.RenderForm [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.dll]' to 'SharpDX.Windows.RenderForm'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    526    53    Central
Error    4    The type 'SharpDX.Direct3D11.InputElement' is defined in an assembly that is not referenced. You must add a reference to assembly 'SharpDX.Direct3D11, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null'.    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    536    13    Central
Error    5    The best overloaded method match for 'SharpHelper.SharpShader.SharpShader(SharpHelper.SharpDevice, string, SharpHelper.SharpShaderDescription, SharpDX.Direct3D11.InputElement[])' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    536    34    Central
Error    6    Argument 4: cannot convert from 'SharpDX.Direct3D11.InputElement[] [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.Direct3D11.dll]' to 'SharpDX.Direct3D11.InputElement[]'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    538    17    Central
Error    7    The type or namespace name 'Data' could not be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    545    51    Central
Error    8    The type 'SharpDX.Direct3D11.Device' is defined in an assembly that is not referenced. You must add a reference to assembly 'SharpDX.Direct3D11, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null'.    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    547    13    Central
Error    9    The best overloaded method match for 'SharpDX.Direct3D11.Query.Query(SharpDX.Direct3D11.Device, SharpDX.Direct3D11.QueryDescription)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    547    35    Central
Error    10    Argument 1: cannot convert from 'SharpDX.Direct3D11.Device' to 'SharpDX.Direct3D11.Device [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.Direct3D11.dll]'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    547    45    Central
Error    11    The best overloaded method match for 'SharpHelper.SharpDevice.Clear(SharpDX.Color4)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    580    17    Central
Error    12    The type 'SharpDX.Color4' is defined in an assembly that is not referenced. You must add a reference to assembly 'SharpDX, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null'.    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    580    17    Central
Error    13    Argument 1: cannot convert from 'SharpDX.Color' to 'SharpDX.Color4'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    580    30    Central
Error    14    The type 'SharpDX.Direct3D11.DeviceContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'SharpDX.Direct3D11, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null'.    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    587    17    Central
Error    15    'SharpDX.Direct3D11.DeviceContext' does not contain a definition for 'VertexShader' and no extension method 'VertexShader' accepting a first argument of type 'SharpDX.Direct3D11.DeviceContext' could be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    587    38    Central
Error    16    'SharpDX.Direct3D11.DeviceContext' does not contain a definition for 'PixelShader' and no extension method 'PixelShader' accepting a first argument of type 'SharpDX.Direct3D11.DeviceContext' could be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    588    38    Central
Error    17    The type or namespace name 'Data' could not be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    601    17    Central
Error    18    The type or namespace name 'Data' could not be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    601    45    Central
Error    19    The type or namespace name 'Data' could not be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    609    35    Central
Error    20    The type 'SharpDX.Direct3D11.ShaderResourceView' is defined in an assembly that is not referenced. You must add a reference to assembly 'SharpDX.Direct3D11, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null'.    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    615    21    Central
Error    21    'SharpDX.Direct3D11.DeviceContext' does not contain a definition for 'PixelShader' and no extension method 'PixelShader' accepting a first argument of type 'SharpDX.Direct3D11.DeviceContext' could be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    615    42    Central
Error    22    'SharpDX.Direct3D11.DeviceContext' does not contain a definition for 'Begin' and no extension method 'Begin' accepting a first argument of type 'SharpDX.Direct3D11.DeviceContext' could be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    620    38    Central
Error    23    The type or namespace name 'Data' could not be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    623    40    Central
Error    24    The type or namespace name 'Data' could not be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    631    35    Central
Error    25    'SharpDX.Direct3D11.DeviceContext' does not contain a definition for 'PixelShader' and no extension method 'PixelShader' accepting a first argument of type 'SharpDX.Direct3D11.DeviceContext' could be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    637    42    Central
Error    26    'SharpDX.Direct3D11.DeviceContext' does not contain a definition for 'End' and no extension method 'End' accepting a first argument of type 'SharpDX.Direct3D11.DeviceContext' could be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    641    38    Central
Error    27    'SharpDX.Direct3D11.DeviceContext' does not contain a definition for 'GetData' and no extension method 'GetData' accepting a first argument of type 'SharpDX.Direct3D11.DeviceContext' could be found (are you missing a using directive or an assembly reference?)    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    644    46    Central
Error    28    The best overloaded method match for 'SharpHelper.SharpBatch.DrawString(string, int, int, SharpDX.Color)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    653    17    Central
Error    29    The type 'SharpDX.Color' is defined in an assembly that is not referenced. You must add a reference to assembly 'SharpDX, Version=2.6.0.0, Culture=neutral, PublicKeyToken=null'.    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    653    17    Central
Error    30    Argument 4: cannot convert from 'SharpDX.Color [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.dll]' to 'SharpDX.Color'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    653    79    Central
Error    31    The best overloaded method match for 'SharpHelper.SharpBatch.DrawString(string, int, int, SharpDX.Color)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    656    17    Central
Error    32    Argument 4: cannot convert from 'SharpDX.Color [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.dll]' to 'SharpDX.Color'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    656    85    Central
Error    33    The best overloaded method match for 'SharpHelper.SharpBatch.DrawString(string, int, int, SharpDX.Color)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    657    17    Central
Error    34    Argument 4: cannot convert from 'SharpDX.Color [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.dll]' to 'SharpDX.Color'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    657    103    Central
Error    35    The best overloaded method match for 'SharpHelper.SharpBatch.DrawString(string, int, int, SharpDX.Color)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    658    17    Central
Error    36    Argument 4: cannot convert from 'SharpDX.Color [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.dll]' to 'SharpDX.Color'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    658    104    Central
Error    37    The best overloaded method match for 'SharpHelper.SharpBatch.DrawString(string, int, int, SharpDX.Color)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    659    17    Central
Error    38    Argument 4: cannot convert from 'SharpDX.Color [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.dll]' to 'SharpDX.Color'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    659    113    Central
Error    39    The best overloaded method match for 'SharpHelper.SharpBatch.DrawString(string, int, int, SharpDX.Color)' has some invalid arguments    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    660    17    Central
Error    40    Argument 4: cannot convert from 'SharpDX.Color [c:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\packages\SharpDX.2.6.2\Bin\DirectX11-Signed-net40\SharpDX.dll]' to 'SharpDX.Color'    C:\Users\Pedro\Dropbox\GAMES\NeoforceControls-SharpDX-master\Central\Code\Layout.cs    660    112    Central
 




#5164756 encryption my password

Posted by Landi20 on 04 July 2014 - 10:04 AM

i make my game and i want encrypte my password like this $P$DzZ6dPRg/zHF6G3vRHgskT1.FwoX9k/

but my result it is $H$9tUnBmMHAOlbeljxTdJHG/OBfZhstH1

this is my code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using MySql.Data.MySqlClient;
using System.Windows.Forms;
using System.Security.Cryptography;
using System.Security;
using System.Net.Sockets;
using System.IO;
namespace TomShane.Neoforce.Central.Code
{
    class Login
    {
       
        public int id_user;
        String username;
        String password;
        public int tipo;
       public int Id
        {

            get { return id_user; }
            set { id_user = value; }
        }
        public String Username
        {
            get { return username; }
            set { username = value; }
        }
        public String Password
        {
            get { return password; }
            set { password = value; }
        }
        public int Tipo
        {
            get { return tipo; }
            set { tipo = value; }
        }
         private string itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
 
        /// <summary>
        /// Compares the password string given with the hash retrieved from your database.
        /// </summary>
        /// <param name="password">Plaintext password.</param>
        /// <param name="hash">Hash from a SQL database</param>
        /// <returns>True if the password is correct, False otherwise.</returns>
        public bool phpbbCheckHash(string password, string hash)
        {
            if (hash.Length == 34) return (hashCryptPrivate(ASCIIEncoding.ASCII.GetBytes(password), hash, itoa64) == hash);
            return false;
        }
 
        /// <summary>
        /// This function will return the resulting hash from the password string you specify.
        /// </summary>
        /// <param name="password">String to hash.</param>
        /// <returns>Encrypted hash.</returns>
        /// <remarks>
        /// Although this will return the md5 for an older password, I have not added
        /// support for older passwords, so they will not work with this class unless
        /// I or someone else updates it.
        /// </remarks>
        public string phpbb_hash(string password)
        {
            // Generate a random string from a random number with the length of 6.
            // You could use a static string instead, doesn't matter. E.g.
            // byte[] random = ASCIIEncoding.ASCII.GetBytes("abc123");
            byte[] random = ASCIIEncoding.ASCII.GetBytes(new Random().Next(100000, 999999).ToString());
 
            string hash = hashCryptPrivate(ASCIIEncoding.ASCII.GetBytes(password), hashGensaltPrivate(random, itoa64), itoa64);
 
            if (hash.Length == 34) return hash;
 
            return sMD5(password);
        }
 
        /// <summary>
        /// The workhorse that encrypts your hash.
        /// </summary>
        /// <param name="password">String to be encrypted. Use: ASCIIEncoding.ASCII.GetBytes();</param>
        /// <param name="genSalt">Generated salt.</param>
        /// <param name="itoa64">The itoa64 string.</param>
        /// <returns>The encrypted hash ready to be compared.</returns>
        /// <remarks>
        /// password:  Saves conversion inside the function, lazy coding really.
        /// genSalt:   Returns from hashGensaltPrivate(random, itoa64);
        /// return:    Compare with phpbbCheckHash(password, hash)
        /// </remarks>
        private string hashCryptPrivate(byte[] password, string genSalt, string itoa64)
        {
            string output = "*";
            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
            if (!genSalt.StartsWith("$H$")) return output;
            //   $count_log2 = strpos($itoa64, $setting[3]);
            int count_log2 = itoa64.IndexOf(genSalt[3]);
            if (count_log2 < 7 || count_log2 > 30) return output;
 
            int count = 1 << count_log2;
            byte[] salt = ASCIIEncoding.ASCII.GetBytes(genSalt.Substring(4, 8));
 
            if (salt.Length != 8) return output;
 
            byte[] hash = md5.ComputeHash(Combine(salt, password));
 
            do
            {
                hash = md5.ComputeHash(Combine(hash, password));
            } while (count-- > 1);
 
            output = genSalt.Substring(0, 12);
            output += hashEncode64(hash, 16, itoa64);
 
            return output;
        }
 
        /// <summary>
        /// Private function to concat byte arrays.
        /// </summary>
        /// <param name="b1">Source array.</param>
        /// <param name="b2">Array to add to the source array.</param>
        /// <returns>Combined byte array.</returns>
        private byte[] Combine(byte[] b1, byte[] b2)
        {
            byte[] retVal = new byte[b1.Length + b2.Length];
            Array.Copy(b1, 0, retVal, 0, b1.Length);
            Array.Copy(b2, 0, retVal, b1.Length, b2.Length);
            return retVal;
        }
 
        /// <summary>
        /// Encode the hash.
        /// </summary>
        /// <param name="input">The hash to encode.</param>
        /// <param name="count">[This parameter needs documentation].</param>
        /// <param name="itoa64">The itoa64 string.</param>
        /// <returns>Encoded hash.</returns>
        private string hashEncode64(byte[] input, int count, string itoa64)
        {
            string output = "";
            int i = 0; int value = 0;
 
            do
            {
                value = input[i++];
                output += itoa64[value & 0x3f];
 
                if (i < count) value |= input[i] << 8;
                output += itoa64[(value >> 6) & 0x3f];
                if (i++ >= count)
                    break;
 
                if (i < count) value |= input[i] << 16;
                output += itoa64[(value >> 12) & 0x3f];
                if (i++ >= count)
                    break;
 
                output += itoa64[(value >> 18) & 0x3f];
 
            } while (i < count);
 
            return output;
        }
 
        /// <summary>
        /// Generate salt for hash generation.
        /// </summary>
        /// <param name="input">Any random information.</param>
        /// <param name="itoa64">The itoa64 string.</param>
        /// <returns>Generated salt string</returns>
        private string hashGensaltPrivate(byte[] input, string itoa64)
        {
            int iteration_count_log2 = 6;
 
            string output = "$H$";
            output += itoa64[Math.Min(iteration_count_log2 + 5, 30)];
            output += hashEncode64(input, 6, itoa64);
 
            return output;
        }
 
        /// <summary>
        /// Returns a hexadecimal string representation for the encrypted MD5 parameter.
        /// </summary>
        /// <param name="password">String to be encrypted.</param>
        /// <returns>String</returns>
        private string sMD5(string password) { return sMD5(password, false); }
 
        /// <summary>
        /// Returns a hexadecimal string representation for the encrypted MD5 parameter.
        /// </summary>
        /// <param name="password">String to be encrypted.</param>
        /// <param name="raw">Whether or not to produce a raw string.</param>
        /// <returns>String</returns>
        private string sMD5(string password, bool raw)
        {
            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
            if (raw) return Encoding.ASCII.GetString(md5.ComputeHash(Encoding.ASCII.GetBytes(password)));
            else return BitConverter.ToString(md5.ComputeHash(Encoding.ASCII.GetBytes(password))).Replace("-", "");
        }
    
   
     }



#5163075 problem change screen xna

Posted by Landi20 on 26 June 2014 - 01:54 PM

topic can be close problem as be solve




#5160371 problem change screen xna

Posted by Landi20 on 13 June 2014 - 03:44 PM

the problem is execute the game and make the login if the StateManager.PushState(GameRef.StartMenuScreen); in the function private void ProcessComplete(Headers header, ErrorCodes Erro)

give a message of server is offline

i put my interecode in github

this is the link to my code https://github.com/Kammikazy/Firstgame




#5041195 mysql_query in c

Posted by Landi20 on 09 March 2013 - 11:07 AM

i solve the problem




#4973596 create a connection client

Posted by Landi20 on 26 August 2012 - 04:21 PM

how i solve my problem
someone can help me


PARTNERS