Skip to content

Main Project Advanced

Muhammed İKİNCİ edited this page Aug 30, 2017 · 1 revision
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FuzzyCore.Server;
using FuzzyCore.Database;
using FuzzyCore.Database.Models;
using System.Net;
using System.Net.Sockets;

namespace TT
{
    class Program
    {
        static void Main(string[] args)
        {
            ConsoleMessage message = new ConsoleMessage();
            FuzzyServer Server = new FuzzyServer(new IPEndPoint(IPAddress.Any, 222));
            Server.AcceptTask = new Action<Client>((Client cl) =>
            {
                Console.WriteLine(cl.ID);
                Console.WriteLine(cl.LASTCONNECTIONTIME);
                Console.WriteLine(cl.SOCKET.RemoteEndPoint);
            });
            Server.ReceiverTask = new Action<string, Client>((string str, Client cl) => {
                Console.WriteLine(cl.ID);
                Console.WriteLine(cl.LASTCONNECTIONTIME);
                Console.WriteLine(cl.SOCKET.RemoteEndPoint);
            });
            Server.startListen();
            if (Server.socketState)
            {
                message.Write("Listening 127.0.0.1:222", ConsoleMessage.MessageType.PROCESS);
            }
            dataBase db = new dataBase(dataBase.databases.MONGODB, "NetworkApp");
            UserOperations op = new UserOperations(db);
            User CurrentUser = op.Get("muhammed", "1357911");
            if (CurrentUser.permission != "FAIL")
            {
                message.Write(CurrentUser.name, ConsoleMessage.MessageType.SUCCESS);
            }
            else
            {
                message.Write(CurrentUser.permission, ConsoleMessage.MessageType.ERROR);
            }
            Console.ReadLine();
        }
    }
}
Clone this wiki locally