赞
踩
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Text.Json;
- using System.Threading;
-
- namespace WeChatMessageRecovery
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("WeChat Message Recovery Tool");
- Console.WriteLine("Contact QQ: 771811549");
-
- // 模拟消息存储
- MessageStore messageStore = new MessageStore();
- messageStore.SaveMessage("user1", "Hello, this is a test message.");
- messageStore.SaveMessage("user2", "Another message for testing.");
-
- // 模拟消息撤回
- messageStore.DeleteMessage("user1");
-
- // 模拟找回撤回的消息
- string recoveredMessage = messageStore.RecoverMessage("user1");
- if (recoveredMessage != null)
- {
- Console.WriteLine("Recovered Message: " + recoveredMessage);
- }
- else
- {
- Console.WriteLine("No message found for user1");
- }
-
- // Keep console window open
- Console.WriteLine("Press any key to exit...");
- Console.ReadKey();
- }
- }
-
- public class MessageStore
- {
- private Dictionary<string, string> messages;
- private string logFilePath = "messages.json";
-
- public MessageStore()
- {
- messages = new Dictionary<string, string>();
- LoadMessages();
- }
-
- public void SaveMessage(string user, string message)
- {
- messages[user] = message;
- SaveMessages();
- }
-
- public void DeleteMessage(string user)
- {
- if (messages.ContainsKey(user))
- {
- messages.Remove(user);
- SaveMessages();
- }
- }
-
- public string RecoverMessage(string user)
- {
- if (messages.ContainsKey(user))
- {
- return messages[user];
- }
- else
- {
- return null;
- }
- }
-
- private void SaveMessages()
- {
- string json = JsonSerializer.Serialize(messages);
- File.WriteAllText(logFilePath, json);
- }
-
- private void LoadMessages()
- {
- if (File.Exists(logFilePath))
- {
- string json = File.ReadAllText(logFilePath);
- messages = JsonSerializer.Deserialize<Dictionary<string, string>>(json);
- }
- }
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。