Esempio n. 1
0
        public void Save(string file)
        {
            this.file = file;
            string outfile = "";

            if (Nick != null)
            {
                outfile += "Nick " + Nick + "\n";
            }
            if (otherNick != null)
            {
                outfile += "otherNick " + otherNick + "\n";
            }
            if (User != null)
            {
                outfile += "User " + User + "\n";
            }
            if (Real != null)
            {
                outfile += "Real " + Real + "\n";
            }
            if (Host != null)
            {
                outfile += "Host " + Host + "\n";
            }
            if (domain != null)
            {
                outfile += "Domain " + domain + "\n";
            }
            if (port != -1)
            {
                outfile += "Port " + port.ToString() + "\n";
            }
            outfile += "useSSL " + useSSL.ToString() + "\n";
            if (name != null)
            {
                outfile += "Name " + name + "\n";
            }
            if (wwwFolder != null)
            {
                outfile += "WWWFolder " + wwwFolder + "\n";
            }
            if (dataFolder != null)
            {
                outfile += "DataFolder " + dataFolder + "\n";
            }
            if (version != null)
            {
                outfile += "Version " + version + "\n";
            }
            foreach (string chan in channels)
            {
                outfile += "Channel " + chan + "\n";
            }
            EncFile.WriteAllText(file, outfile);
        }
 public void Save()
 {
     try
     {
         string output = "";
         foreach (KeyValuePair <string, byte[]> login in Logins)
         {
             output += OperatorLevels[login.Key] + " " + login.Key + " " + ByteArrayToString(login.Value);
         }
         Directory.CreateDirectory(server.Data);
         EncFile.WriteAllText(server.Data + Path.DirectorySeparatorChar + "operatorList.db", output);
     }
     catch { }
 }
 public void Load()
 {
     try
     {
         if (File.Exists(server.Data + Path.DirectorySeparatorChar + "operatorList.db"))
         {
             string input = EncFile.ReadAllText(server.Data + Path.DirectorySeparatorChar + "operatorList.db");
             while (!string.IsNullOrEmpty(input))
             {
                 int level = int.Parse(input.Split(' ')[0]);
                 input = input.Substring(input.IndexOf(' ') + 1);
                 string user = input.Split(' ')[0];
                 input = input.Substring(user.Length + 1);
                 byte[] hash = StringToByteArray(input.Substring(0, 64));
                 Logins[user]         = hash;
                 OperatorLevels[user] = level;
                 input = input.Substring(64);
             }
         }
     }
     catch { }
 }
Esempio n. 4
0
        public Server(string file)
        {
            this.file = file;
            if (File.Exists(file))
            {
                foreach (string line in EncFile.ReadAllLines(file))
                {
                    string[] split = line.Split(' ');
                    if (split.Length >= 2)
                    {
                        switch (split[0])
                        {
                        case "Nick":
                            Nick = split[1];
                            break;

                        case "otherNick":
                            otherNick = split[1];
                            break;

                        case "User":
                            User = split[1];
                            break;

                        case "Real":
                            Real = split[1];
                            break;

                        case "Host":
                            Host = split[1];
                            break;

                        case "Domain":
                            domain = split[1];
                            break;

                        case "Port":
                            port = int.Parse(split[1]);
                            break;

                        case "Channel":
                            channels.Add(split[1]);
                            break;

                        case "useSSL":
                            useSSL = bool.Parse(split[1]);
                            break;

                        case "Name":
                            name = line.Substring(split[0].Length + 1);
                            break;

                        case "DataFolder":
                            dataFolder = line.Substring(split[0].Length + 1);
                            break;

                        case "WWWFolder":
                            wwwFolder = line.Substring(split[0].Length + 1);
                            break;

                        case "Version":
                            version = line.Substring(split[0].Length + 1);
                            break;
                        }
                    }
                }
            }
        }