public override void Initialize() { tPulse = (TPulse)PlugInHandler.GetPluginByType(typeof(TPulse)); //Loading Friends DB if (File.Exists(FriendsDB.DefaultFile)) { FriendsList = FriendsDB.Load(FriendsDB.DefaultFile); } else { FriendsList.Save(FriendsDB.DefaultFile); } //Adding commands tPulse.Commands.ChatCommands.Add(new Command("", FriendCommand, "friend")); tPulse.Commands.ChatCommands.Add(new Command("", MessageCommand, "fmsg")); tPulse.Commands.ChatCommands.Add(new Command("", MessageAllCommand, "fall")); //Commands.ChatCommands.Add(new Command("", MessageCommand, "sendcoord")); tPulse.Commands.OnPlayerLogin += new PlayerLoginHandler(PlayerLogin); //Hooks.WorldHooks.SaveWorld += new Hooks.WorldHooks.SaveWorldD(WorldHooks_SaveWorld); tPulse.OnWorldSaved += new WorldSavedHandler(OnWorldSaved); }
public static FriendsDB Load(string path) { FriendsDB db = new FriendsDB(); bf.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple; FileStream fin = File.OpenRead(path); db = (FriendsDB)bf.Deserialize(fin); fin.Close(); return db; }
public static FriendsDB Load(string path) { FriendsDB db = new FriendsDB(); bf.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple; FileStream fin = File.OpenRead(path); db = (FriendsDB)bf.Deserialize(fin); fin.Close(); return(db); }