View Full Version: Convertir le fichier compte de sphere vers RunUO

RunUO.FR Support > System > Convertir le fichier compte de sphere vers RunUO


Title: Convertir le fichier compte de sphere vers RunUO
Description: je traduit sa illico


crystal - July 4, 2003 02:40 PM (GMT)
Premierement placé sphereaccu.scp ou est placé runuo.exe
vérifier que vous n'avez pas le meme Login dans runUo et sphere
Verifier que le seul compte disponible soit celui de l'admin dans "accounts.xml"
Placer le script si dessous dans scripts/commands/ de votre serveur RunUO
Rebooter et tapez en jeu [scptoxml

Enjoy,
Gustavo

scptoxml.cs

CODE
using System;
using System.Reflection;
using Server.Items;
using Server.Targeting;
using Server.Accounting;
using System.IO;
//By Delfos
//Gustavo aka Gzy

namespace Server.Scripts.Commands
{
  public class scpTOxml
  {
     public static void Initialize()
     {
        Server.Commands.Register( "scpTOxml", AccessLevel.GameMaster, new CommandEventHandler( scpTOxml_OnCommand ) );
     }

     [Description( "Transfiere cuentas de sphereaccu.scp a accounts.xml" )]
     
     private static void scpTOxml_OnCommand( CommandEventArgs e )
     {
        MiLector ();
        e.Mobile.SendMessage( "Accounts.xml has been created" );
        //Account a = Accounts.AddAccount( uname, password );
        //a.AccessLevel = AccessLevel.Player;
     }
     
     private const string FILE_NAME = "sphereaccu.scp";
     private const string SUB_PASS = "PASSWORD=";

     public static void MiLector()
     {
        if (!File.Exists(FILE_NAME))
        {
           Console.WriteLine("{0} does not exist!", FILE_NAME);
           return;
        }
       
        StreamReader sr = File.OpenText(FILE_NAME);
        String input;
        String[] datosacco = new String[2];
        int comienzo;
        int comienzoPass;
        int cantidad;
       
        while ((input=sr.ReadLine())!=null)
        {
           if ((input.IndexOf('[')) >= 0)
           {
              comienzo = input.IndexOf('[') + 1;
              cantidad = input.IndexOf(']') - 1;
              datosacco[0] = input.Substring(comienzo, cantidad);
           }
           else if ((input.LastIndexOf(SUB_PASS)) >= 0)
           {
              comienzoPass = input.LastIndexOf(SUB_PASS) + 9;
              datosacco[1] = input.Substring(comienzoPass);
              //Console.WriteLine(datosacco[0]);
              //Console.WriteLine(datosacco[1]);
              Account a = Accounts.AddAccount(datosacco[0], datosacco[1]);
              //a.AccessLevel = AccessLevel.Player;
           }
        }
       
        Console.WriteLine ("The end of the stream has been reached.");
        sr.Close();
     }
  }
}




Hosted for free by InvisionFree