コード例 #1
0
ファイル: Init.cs プロジェクト: muhammedikinci/FuzzyCore
 public Init(InitType Type)
 {
     staticInitData.Current_Init_Type = Type;
     if (!string.IsNullOrEmpty(Type.FirstConsole_Message))
     {
         Console.WriteLine(Type.FirstConsole_Message);
     }
     if (Type.Wcf_Running)
     {
         Host = new ServiceHost(typeof(Services.FuzzyService));
         Host.Open();
         if (Host.State == CommunicationState.Opened)
         {
             Message.Write("WCF Service is Running", ConsoleMessage.MessageType.BACKPROCESS);
         }
     }
     if (Type.Server_Running)
     {
         Server = new FuzzyServer(new IPEndPoint(IPAddress.Parse(Type.ServerProp.IP), int.Parse(Type.ServerProp.Port)));
         Server.Init(Type);
         Console.WriteLine("Listening : " + Type.ServerProp.IP + ":" + Type.ServerProp.Port);
     }
     if (Type.Logging)
     {
         BackgroundWorker.FilePath       = Type.Paths.LogFile;
         BackgroundWorker.WaitingSeconds = Type.LoggingTime;
         BackgroundWorker worker    = new BackgroundWorker();
         bool             isworking = true;
         worker.StartWorker(ref isworking);
         if (isworking == true)
         {
             Console.WriteLine("Çalışıyor");
         }
     }
 }
コード例 #2
0
        public Init(string ProgramJsonPathArg, Action <Client> AcceptTask, Action <string, Client> ReceiveTask, string Ip = "127.0.0.1", string Port = "111", bool StartServer = true, bool StartWCFService = true, bool StartReceive = true, bool StartAccept = true)
        {
            Message.Write("Advanced Initializing Started", ConsoleMessage.MessageType.BACKPROCESS);
            //Program.Json Exits
            ProgramJsonPath = ProgramJsonPathArg;
            if (File.Exists(ProgramJsonPath))
            {
                Message.Write("Program.Json - Ready!", ConsoleMessage.MessageType.SUCCESS);
            }
            else
            {
                Message.Write("Program.Json - NotFound!", ConsoleMessage.MessageType.ERROR);
            }

            //Wcf Service Start
            if (StartWCFService)
            {
                Host = new ServiceHost(typeof(Services.FuzzyService));
                Host.Open();
            }

            //Socket Server Start
            Server              = new FuzzyServer(new IPEndPoint(IPAddress.Parse(Ip), int.Parse(Port)));
            Server.AcceptTask   = AcceptTask;
            Server.ReceiverTask = ReceiveTask;
            if (StartServer)
            {
                Server.startListen();
            }
        }
コード例 #3
0
ファイル: Init.cs プロジェクト: muhammedikinci/FuzzyCore
        public Init(string ProgramJsonPathArg, string LogFilePath, int LoggingTime, Action <Client> AcceptTask, Action <string, Client> ReceiveTask, InitType.Type initilizeType = InitType.Type.BASIC, string Ip = "127.0.0.1", string Port = "111", bool StartServer = true, bool StartWCFService = true, bool StartReceive = true, bool StartAccept = true)
        {
            InitType Type = new InitType();

            Type.Paths      = new FilePaths();
            Type.ServerProp = new Props();

            Type.initType = initilizeType;
            Message.Write("Advanced Initializing Started", ConsoleMessage.MessageType.BACKPROCESS);
            //Program.Json Exits
            Type.Paths.ProgramJson = ProgramJsonPathArg;
            if (File.Exists(Type.Paths.ProgramJson))
            {
                Message.Write("Program.Json - Ready!", ConsoleMessage.MessageType.SUCCESS);
            }
            else
            {
                Message.Write("Program.Json - NotFound!", ConsoleMessage.MessageType.ERROR);
            }

            Type.Paths.LogFile = LogFilePath;
            Type.LoggingTime   = LoggingTime;

            //Wcf Service Start
            if (StartWCFService)
            {
                Host = new ServiceHost(typeof(Services.FuzzyService));
                Host.Open();
            }

            //Socket Server Start
            Server              = new FuzzyServer(new IPEndPoint(IPAddress.Parse(Ip), int.Parse(Port)));
            Server.AcceptTask   = AcceptTask;
            Server.ReceiverTask = ReceiveTask;
            if (StartServer)
            {
                Server.Init(Type);
            }
            //
            //Log Inıt
            //
            BackgroundWorker.FilePath       = Type.Paths.LogFile;
            BackgroundWorker.WaitingSeconds = Type.LoggingTime;
            BackgroundWorker worker    = new BackgroundWorker();
            bool             isworking = true;

            worker.StartWorker(ref isworking);
            if (isworking == true)
            {
                Console.WriteLine("Çalışıyor");
            }
        }
コード例 #4
0
 //Basic Start Initializing
 public Init()
 {
     Message.Write("Basic Initializing", ConsoleMessage.MessageType.BACKPROCESS);
     ProgramJsonPath = "Program.json";
     Host            = new ServiceHost(typeof(Services.FuzzyService));
     Host.Open();
     if (Host.State == CommunicationState.Opened)
     {
         Message.Write("WCF Service is Running", ConsoleMessage.MessageType.BACKPROCESS);
     }
     Server = new FuzzyServer(new IPEndPoint(IPAddress.Any, 5959));
     Server.startListen();
 }
コード例 #5
0
ファイル: Init.cs プロジェクト: muhammedikinci/FuzzyCore
        //Basic Start Initializing
        public Init()
        {
            InitType Type = new InitType();

            Type.Paths      = new FilePaths();
            Type.ServerProp = new Props();
            //Information Message
            Message.Write("Basic Initializing", ConsoleMessage.MessageType.BACKPROCESS);

            //
            //File Paths Init
            //
            Type.Paths.ProgramJson    = "Program.json";
            Type.Paths.MacPermissions = "Permissions/Mac.json";
            Type.Paths.IpPermissions  = "Permissions/Ip.json";

            Type.Paths.LogFile = "Logs\\Log.json";
            Type.LoggingTime   = 10;
            Type.Logging       = true;
            //
            //WCF Service Init
            //
            Host = new ServiceHost(typeof(Services.FuzzyService));
            Host.Open();
            if (Host.State == CommunicationState.Opened)
            {
                Message.Write("WCF Service is Running", ConsoleMessage.MessageType.BACKPROCESS);
            }

            //
            //Fuzzy Server Init
            //
            Server = new FuzzyServer(new IPEndPoint(IPAddress.Any, 5959));
            Server.Init(Type);

            //
            //Log Inıt
            //
            BackgroundWorker.FilePath       = Type.Paths.LogFile;
            BackgroundWorker.WaitingSeconds = Type.LoggingTime;
            BackgroundWorker worker    = new BackgroundWorker();
            bool             isworking = true;

            worker.StartWorker(ref isworking);
            if (isworking == true)
            {
                Console.WriteLine("Logger is working!");
            }
        }