Ejemplo n.º 1
0
        protected override void OnStart(string[] args)
        {
            Log1.Logger("Patcher").Info("Starting Patch server");
            Thread t = new Thread(new ThreadStart(StartAsync));

            t.Start();
        }
Ejemplo n.º 2
0
        protected override void OnStart(string[] args)
        {
            Log1.Logger("Zeus.Service").Info("Starting Zeus server");
            Thread t = new Thread(new ThreadStart(StartAsync));

            t.Start();
        }
Ejemplo n.º 3
0
        private void DoNoAuthLogin(INetworkConnection con, Packet pMsg)
        {
            try
            {
                PacketLoginRequest p = pMsg as PacketLoginRequest;
                ServerUser.AccountName  = Guid.NewGuid().ToString(); // assign random session name
                ServerUser.OwningServer = MyServer.ServerUserID;
                Log1.Logger("LoginServer.Inbound.Login").Info("No-auth assigned user name " + ServerUser.AccountName + " from " + RemoteIP + " is attempting login...");
                Log1.Logger("LoginServer.UserIPMap").Info("User [" + p.AccountName + "] from [" + RemoteIP + "] is attempting login.");
                string msg = "";

                PacketLoginResult result = CreateLoginResultPacket();
                if (result.ReplyCode == ReplyType.OK)
                {
                    ServerUser.AuthTicket      = Guid.NewGuid();
                    ServerUser.IsAuthenticated = true;
                    ServerUser.ID = Guid.NewGuid(); // generate random ID for this session

                    ServerUser.Profile.UserRoles = new string[0];
                    result.Parms.SetProperty("AccountName", ServerUser.AccountName);
                    result.Parms.SetProperty(-1, ServerUser.Profile.UserRoles);
                    result.Parms.SetProperty(-2, ServerUser.Profile.MaxCharacters);
                    ConnectionManager.AuthorizeUser(ServerUser);
                }
                pMsg.ReplyPacket = result;
                Log1.Logger("LoginServer.Inbound.Login").Info("Game client *" + ServerUser.AccountName + "* authentication: " + result.ReplyCode.ToString() + ". " + result.ReplyMessage);
            }
            catch (Exception e)
            {
                Log1.Logger("LoginServer.Inbound.Login").Error("Exception thrown whilst player attempted login. " + e.Message, e);
                KillConnection("Error logging in.");
            }
        }
Ejemplo n.º 4
0
        // pass in the path of an XML file containing the socket policy
        public PolicyServer(string policyFile)
        {
            try
            {
                // Load the policy file
                m_policy = File.ReadAllBytes(policyFile);

                // Create the Listening Socket
                m_listener = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);

                // Put the socket into dual mode to allow a single socket
                // to accept both IPv4 and IPv6 connections
                // Otherwise, server needs to listen on two sockets,
                // one for IPv4 and one for IPv6
                // NOTE: dual-mode sockets are supported on Vista and later
                m_listener.SetSocketOption(SocketOptionLevel.IPv6, (SocketOptionName)27, 0);

                m_listener.Bind(new IPEndPoint(IPAddress.IPv6Any, 943));
                m_listener.Listen(25);
                m_listener.BeginAccept(new AsyncCallback(OnConnection), null);
                Log1.Logger("Network").Info("Silverlight Policy Server running on port 943.");
            }
            catch (Exception e)
            {
                Log1.Logger("Server.Network").Error("Error starting Silverlight Policy server on this process. " + e.Message, e);
            }
        }
Ejemplo n.º 5
0
        public static string[] GetInstalledServices()
        {
            string[]    rsl = new string[0];
            RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wisp\Servers");

            if (key == null)
            {
                return(rsl);
            }
            string[] servers = key.GetSubKeyNames();
            rsl = new string[servers.Length];
            for (int i = 0; i < servers.Length; i++)
            {
                try
                {
                    string       server     = servers[i];
                    string       serverName = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Wisp\Servers\" + server, "ServiceName", "");
                    string       desc       = (string)Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Wisp\Servers\" + server, "Description", "");
                    ServiceState state      = ServiceInstaller.GetServiceStatus(serverName);
                    rsl[i] = serverName + "|" + state.ToString() + "|" + desc;
                }
                catch (Exception e)
                {
                    Log1.Logger("Service").Error("Failed to get installed Wisp service info. " + e.Message);
                }
            }

            return(rsl);
        }
Ejemplo n.º 6
0
 protected override bool OnFileStreamComplete(string fileName, long totalFileLengthBytes, int subType, string arg)
 {
     PatchFileSent++;
     if (ServerUser != null && ServerUser.MyConnection != null)
     {
         Log1.Logger("Patch").Info("Sent [" + ((int)Util.ConvertBytesToMegabytes(totalFileLengthBytes)).ToString() + "MB] patch to " + ServerUser.MyConnection.RemoteEndPoint.ToString());
     }
     return(base.OnFileStreamComplete(fileName, totalFileLengthBytes, subType, arg));
 }
Ejemplo n.º 7
0
        protected override void OnStart(string[] args)
        {
            // Initialize the server in a worker thread, or the Windows Service system may abort the
            // application because it's taking too long to "start up"
            Log1.Logger("Server").Info("Starting server. Please wait...");
            Thread t = new Thread(new ThreadStart(StartAsync));

            t.Start();
        }
Ejemplo n.º 8
0
        protected override void OnStop()
        {
            if (m_Server == null)
            {
                return;
            }

            Log1.Logger("Patcher").Info("Stopping Patch server...");
            m_Server.StopServer();
        }
Ejemplo n.º 9
0
        protected override void OnStop()
        {
            if (m_Server == null)
            {
                return;
            }

            Log1.Logger("Zeus.Service").Info("Stopping Zeus server...");
            m_Server.StopServer();
        }
Ejemplo n.º 10
0
        public WispServerProcess() : base()
        {
            try
            {
                //CharacterUtil.Instance.LoadCharacterTemplate();
                Factory.Instance.Register(typeof(WispConfigSettings), () => new WispConfigSettings());
                Factory.Instance.Register(typeof(WispUsersInfo), () => new WispUsersInfo());
                Factory.Instance.Register(typeof(WispUserDetail), () => new WispUserDetail());
                Factory.Instance.Register(typeof(WispCharacterDetail), () => new WispCharacterDetail(-1));
                Factory.Instance.Register(typeof(CommandData), delegate { return(new CommandData()); });

                NetworkConnection.RegisterPacketCreationDelegate((int)PacketType.PacketStream, 1, delegate { return(new PacketStream()); });

                //Roles.CreateRole("Administrator");
                //Membership.CreateUser("WispAdmin", "wisp123", "admin@home");
                //Roles.AddUserToRole("WispAdmin", "Administrator");

                AllowRemote = ConfigHelper.GetStringConfig("AllowRemoteConnections", "FALSE").ToUpper() == "TRUE";
                if (AllowRemote && !RequireAuthentication)
                {
                    Log1.Logger("Server").Warn("RequireAuthentication config was set to FALSE. This is not allowed for Zeus.  Disallowing remote connections.");
                    AllowRemote = false;
                }


                //PerfMon.TrackSystemCounter("% Processor Time", "Processor", "_Total");
                //for (int i = 0; i < Environment.ProcessorCount; i++)
                //{
                //    PerfMon.TrackSystemCounter("% Processor Time", "Processor", i.ToString());
                //}

                //PerfMon.TrackSystemCounter("% Processor Time", "Process", PerfMon.ProcessName);
                //PerfMon.TrackSystemCounter("Thread Count", "Process", PerfMon.ProcessName);
                //PerfMon.TrackSystemCounter("Private Bytes", "Process", PerfMon.ProcessName);
                //PerfMon.TrackSystemCounter("# Bytes in all Heaps", ".NET CLR Memory", PerfMon.ProcessName);
                //PerfMon.TrackSystemCounter("Available MBytes", "Memory", "");
                //PerfMon.TrackSystemCounter("Contention Rate / sec", ".NET CLR LocksAndThreads", PerfMon.ProcessName);
                //PerfMon.TrackSystemCounter("Total # of Contentions", ".NET CLR LocksAndThreads", PerfMon.ProcessName);

                //PerfMon.AddCustomCounter("Packets Out", "Number of packets sent per second.", System.Diagnostics.PerformanceCounterType.RateOfCountsPerSecond32);
                //PerfMon.AddCustomCounter("Packets In", "Number of packets received per second.", System.Diagnostics.PerformanceCounterType.RateOfCountsPerSecond32);
                //PerfMon.AddCustomCounter("Live Connections", "Number of connected sockets.", System.Diagnostics.PerformanceCounterType.NumberOfItems32);
                //PerfMon.AddCustomCounter("Bandwidth Out", "Number of bytes sent per second.", System.Diagnostics.PerformanceCounterType.RateOfCountsPerSecond32);
                //PerfMon.AddCustomCounter("Bandwidth In", "Number of bytes received per second.", System.Diagnostics.PerformanceCounterType.RateOfCountsPerSecond32);

                //PerfMon.InstallCustomCounters();

                //PerfMon.StartSamplingCounters();
            }
            catch (Exception e)
            {
                Log1.Logger("Server").Fatal("Zeus failed to initialize. ", e);
            }
        }
 public static void _user()
 {
     if (condition == 1)
     {
         Console.WriteLine(user);
         Log1.PopulateLog($"{user} shows username");
     }
     else
     {
         Console.WriteLine("log in first");
     }
 }
 public static void ID()
 {
     if (condition == 1)
     {
         Console.WriteLine(id);
         Log1.PopulateLog("user request id");
     }
     else
     {
         Console.WriteLine("log in first");
         Log1.PopulateLog("unknown tried to request id");
     }
 }
 public static void guest()
 {
     if (condition == 0)
     {
         Console.WriteLine(true);
         Log1.PopulateLog("guest is user");
     }
     else
     {
         Console.WriteLine(false);
         Log1.PopulateLog($"{user} is logged in");
     }
 }
 public static void validate(string User, string Password)
 {
     if (User == user && Password == password && condition == 1)
     {
         Console.WriteLine("Already Logged in");
         Log1.PopulateLog("user validated");
     }
     else
     {
         Console.WriteLine("Log in first");
         Log1.PopulateLog("unknown tried to validate");
     }
 }
 public static void check()
 {
     if (condition == 1)
     {
         Console.WriteLine(true);
         Log1.PopulateLog($"{user} is logged in");
     }
     else
     {
         Console.WriteLine(false);
         Log1.PopulateLog("unknown tried to check");
     }
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Unzips a file to a directory.
        /// </summary>
        /// <param name="zipFile">the file to unzip</param>
        /// <returns></returns>
        public static bool UnzipFile(string zipFile, string targetDirectory)
        {
            try
            {
                using (ZipInputStream s = new ZipInputStream(File.OpenRead(zipFile)))
                {
                    ZipEntry theEntry;
                    while ((theEntry = s.GetNextEntry()) != null)
                    {
                        string path          = Path.Combine(targetDirectory, theEntry.Name);
                        string directoryName = Path.GetDirectoryName(path);
                        string fileName      = Path.GetFileName(path);

                        // create directory
                        if (directoryName.Length > 0 && !Directory.Exists(directoryName))
                        {
                            Directory.CreateDirectory(directoryName);
                        }

                        if (fileName != String.Empty)
                        {
                            using (FileStream streamWriter = File.Create(Path.GetFullPath(path)))
                            {
                                int    size = 2048;
                                byte[] data = new byte[2048];
                                while (true)
                                {
                                    size = s.Read(data, 0, data.Length);
                                    if (size > 0)
                                    {
                                        streamWriter.Write(data, 0, size);
                                    }
                                    else
                                    {
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Log1.Logger("Server").Error("Failed to unzip file [" + zipFile + "] to [" + targetDirectory + "].", e);
                return(false);
            }

            return(true);
        }
 public static void login(string User, string Password)
 {
     if (User == user && Password == password)
     {
         Console.WriteLine("Logged in");
         Log1.PopulateLog("Logged in");
         condition = 1;
         loginTime = DateTime.Now;
     }
     else
     {
         Console.WriteLine("Wrong password and/or username");
         Log1.PopulateLog("unknown tried to log in");
     }
 }
Ejemplo n.º 18
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     if (args.Length == 0 || args[0].ToLower().Trim() != "standalone")
     {
         ServiceBase[] ServicesToRun;
         ServicesToRun = new ServiceBase[]       { new Zeus() };
         Log1.Logger("Server").Info("Starting server. Please wait...");
         ServiceBase.Run(ServicesToRun);
     }
     else
     {
         // you will have to manually kill the process either through the
         // debugger or the task manager
         Zeus service = new Zeus();
         service.Setup();
         System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
     }
 }
Ejemplo n.º 19
0
        // Called when we receive a connection from a client
        public void OnConnection(IAsyncResult res)
        {
            Socket client = null;

            try
            {
                client = m_listener.EndAccept(res);
            }
            catch (SocketException)
            {
                return;
            }

            Log1.Logger("Network").Info("Silverlight connection from " + client.RemoteEndPoint.ToString());
            // handle this policy request with a PolicyConnection
            PolicyConnection pc = new PolicyConnection(client, m_policy);

            // look for more connections
            m_listener.BeginAccept(new AsyncCallback(OnConnection), null);
        }
Ejemplo n.º 20
0
        private void OnClientMachineInfo(INetworkConnection con, Packet rep)
        {
            PacketReply   p  = rep as PacketReply;
            StringBuilder sb = new StringBuilder();
            string        ip = "";

            if (con.IsAlive)
            {
                ip = con.RemoteEndPoint.ToString();
            }
            sb.AppendLine("\r\n=-=-= Client Spec [" + ip + "] =-=-=");
            foreach (Property prop in p.Parms.AllProperties)
            {
                sb.AppendLine(prop.StringValue);
            }
            sb.Append("=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=");
            Log1.Logger("UserMetrics").Info(sb.ToString());

            // Let the client go.
            SendVersionIsCurrent();
        }
Ejemplo n.º 21
0
        public static bool IsWispService(string name)
        {
            string[] services = GetInstalledServices();
            string[] parts;
            for (int i = 0; i < services.Length; i++)
            {
                parts = services[i].Split(char.Parse("|"));
                if (parts.Length != 3)
                {
                    Log1.Logger("Service").Error("GetInstalledServices array was malformed.  Wisp Registry entry may be corrupt => " + services[i]);
                    continue;
                }

                if (parts[0].ToLower() == name.ToLower())
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 22
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            // Handle running the server service in standalone mode, i.e. outside of the
            // Windows Service sandbox.  Just start the process with the argument
            // "standalone" to run it as a regular application.  You can set this
            // argument in the "Project->Properties->Debug" options for easy debugging.

            if (args.Length == 0 || args[0].ToLower().Trim() != "standalone")
            {
                ServiceBase[] ServicesToRun;
                ServicesToRun = new ServiceBase[] { new WispService() };
                Log1.Logger("Server").Info("Starting server.");
                ServiceBase.Run(ServicesToRun);
            }
            else
            {
                // you will have to manually kill the process either through the
                // debugger or the task manager
                WispService service = new WispService();
                service.Setup();
                System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
            }
        }
Ejemplo n.º 23
0
 static void Main(string[] args)
 {
     try
     {
         if (args.Length > 0)
         {
             if (args[0] == "/i")
             {
                 Log1.Logger("Patcher").Info("Installing PatchServer as service...");
                 InstallService(Assembly.GetExecutingAssembly().Location);
             }
             else if (args[0] == "/u")
             {
                 Log1.Logger("Patcher").Info("UnInstalling PatchServer as service...");
                 WispServiceTools.ServiceInstaller.Uninstall("Patchy");
             }
             else if (args[0] == "standalone")
             {
                 Log1.Logger("Patcher").Info("Running PatchServer in standalone...");
                 PatchServer MyService = new PatchServer();
                 MyService.Setup();
                 System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
             }
         }
         else
         {
             ServiceBase[] ServicesToRun;
             ServicesToRun = new ServiceBase[] { new PatchServer() };
             Log1.Logger("Patcher").Info("Starting Patch server as service.");
             ServiceBase.Run(ServicesToRun);
         }
     }
     catch (Exception e)
     {
         Log1.Logger("Patcher").Info("Fatal error: " + e.Message);
     }
 }
Ejemplo n.º 24
0
 private void StartAsync()
 {
     m_Server = new WispServerProcess();
     m_Server.StartServer();
     Log1.Logger("Zeus.Service").Info("Ready.");
 }
        public void ParameterChange(object msgobj)
        {
            MainNetworkClass networkmain = (MainNetworkClass)msgobj;

            PLCTelnet2 = new TelnetClient();
            #region Connection PLC1,PLC2,Micron Server
            Log1.Info("ParameterChange Thread Start");
            while (!bTerminate)
            {
                try
                {
                    Thread.Sleep(100);
                    #region PLC 1
                    //PLC Read Write Cycle
                    if (PLCTelnet != null)
                    {
                        if (PLCTelnet.connected)
                        {
                            #region Parameter Change
                            //bool bypass = true;



                            if ((PLCWriteCommand[459] == 0x08 && PLCQueryRx[263] == 0x08))  //D419 and D126
                            {
                                byte[] PName = new byte[2];
                                Array.Copy(PLCQueryRx, 265, PName, 0, 2); //D127
                                Int32 PNint = (Int32)(BitConverter.ToInt16(PName, 0));
                                ParaName = PNint.ToString();


                                byte[] POld = new byte[4];
                                Array.Copy(PLCQueryRx, 267, POld, 0, 4); //D128~D129
                                Int32 POldint = (Int32)(BitConverter.ToInt32(POld, 0));
                                ParaOldValue = POldint.ToString();



                                byte[] PNew = new byte[4];
                                Array.Copy(PLCQueryRx, 271, PNew, 0, 4); //D130~D131
                                Int32 PNewint = (Int32)(BitConverter.ToInt32(PNew, 0));
                                ParaNewValue = PNewint.ToString();

                                if (PNint != -9999 && POldint != -9999 && PNewint != -9999 && parameterflag == 0)
                                {
                                    try
                                    {
                                        ParaName = ParameterDesPLC1(int.Parse(ParaName));


                                        networkmain.Client_SendParameterchange1(ParaName, ParaOldValue, ParaNewValue);
                                        parameter.Info("parameter change at PLC1 " + ParaName + "," + ParaOldValue + "," + ParaNewValue);
                                    }
                                    catch {
                                    }

                                    Thread.Sleep(10);
                                    PLCWriteCommand[469] = 0x07;//D424
                                    parameterflag        = 1;
                                }

                                if (PNint == -9999 && parameterflag == 1)
                                {
                                    PLCWriteCommand[469] = 0x00;//D424
                                    parameterflag        = 0;
                                }
                            }
                            if (PLCQueryRx[263] == 0x0F && PLCWriteCommand[459] == 0x08)
                            {
                                PLCWriteCommand[459] = 0x00;
                                string token = networkmain.Token1.ToString();
                                networkmain.Client_SendParameterchangeLogout("DENY", "1", "1", token);
                                parameter.Info("parameter change at PLC1 logout " + token);
                            }



                            #endregion


                            #region


                            #endregion

                            #region 1DM Each Stop

                            try{
                                if ((PLCQueryRx[PLCQueryRx_DM198] == 0x01) &&
                                    (PLCQueryRx6[PLCQueryRx_DM5199] == 0x01))

                                {
                                    RoyalFlush();


                                    PLCWriteCommand[PLCWriteCommand_DM303] = 0x07;

                                    PLCWriteCommand6[PLCWriteCommand_DM5353] = 0x07;
                                }
                                else
                                {
                                    PLCWriteCommand[PLCWriteCommand_DM303] = 0x00;

                                    PLCWriteCommand6[PLCWriteCommand_DM5353] = 0x00;
                                }
                            }

                            catch (Exception ex)
                            {
                                Log1.Info(ex.ToString());
                            }

                            #endregion



                            #region test DM6110 to DM6499 Reading

                            byte[] TestPara = new byte[2];
                            Array.Copy(PLCQueryRxPara, 11, TestPara, 0, 2); //D6100
                            Int32 TestPara1      = (Int32)(BitConverter.ToInt16(TestPara, 0));
                            int   TestParastring = TestPara1;
                            if (TestParastring > 0)
                            {
                                //Blocktest.Info("PLC1 Testing DM6100 ," + TestParastring);
                            }

                            byte[] TestPara2 = new byte[2];
                            Array.Copy(PLCQueryRxPara, 809, TestPara2, 0, 2); //D6499
                            Int32 TestPara3       = (Int32)(BitConverter.ToInt16(TestPara2, 0));
                            int   TestParastring1 = TestPara3;
                            if (TestParastring1 > 0)
                            {
                                // Blocktest.Info("PLC1 Testing DM6499 ," + TestParastring1);
                            }


                            #endregion
                        }
                    }
                    #endregion
                    #region PLC 2
                    if (PLCTelnet2.connected)
                    {
                        #region Parameter Change
                        //bool bypass = true;

                        if ((PLCWriteCommand6[315] == 0x08 && PLCQueryRx6[353] == 0x08)) //  ,D5347,D5171
                        {
                            byte[] PName = new byte[2];
                            Array.Copy(PLCQueryRx6, 303, PName, 0, 2);  //D5146
                            Int32 PNint = (Int32)(BitConverter.ToInt16(PName, 0));
                            ParaName1 = PNint.ToString();


                            byte[] POld = new byte[4];
                            Array.Copy(PLCQueryRx6, 383, POld, 0, 4);  //D5186~D5187
                            Int32 POldint = (Int32)(BitConverter.ToInt32(POld, 0));
                            ParaOldValue1 = POldint.ToString();



                            byte[] PNew = new byte[4];
                            Array.Copy(PLCQueryRx6, 387, PNew, 0, 4);  //D5188~D5189
                            Int32 PNewint = (Int32)(BitConverter.ToInt32(PNew, 0));
                            ParaNewValue1 = PNewint.ToString();

                            if (PNint != -9999 && POldint != -9999 && PNewint != -9999 && parameterflag2 == 0)
                            {
                                try
                                {
                                    ParaName1 = ParameterDesPLC2(int.Parse(ParaName1));



                                    networkmain.Client_SendParameterchange1(ParaName1, ParaOldValue1, ParaNewValue1);
                                    parameter.Info("parameter change at PLC2 " + ParaName1 + "," + ParaOldValue1 + "," + ParaNewValue1);
                                }
                                catch
                                {
                                }
                                Thread.Sleep(10);
                                PLCWriteCommand6[465] = 0x07;//D5422
                                parameterflag2        = 1;
                            }

                            if (PNint == -9999 && parameterflag2 == 1)
                            {
                                PLCWriteCommand6[465] = 0x00;//D5422
                                parameterflag2        = 0;
                            }



                            #region Sealer parameter

                            byte[] SealerPName = new byte[2];
                            Array.Copy(PLCQueryRx6, 279, SealerPName, 0, 2);  //D5134
                            Int32 SealerPNint = (Int32)(BitConverter.ToInt16(SealerPName, 0));
                            SealerParaName = SealerPNint.ToString();


                            byte[] SealerPOld = new byte[12];
                            Array.Copy(PLCQueryRx6, 281, SealerPOld, 0, 12);  //D5135~D5140
                            Int32 SealerPOldint = (Int32)(BitConverter.ToInt16(SealerPOld, 0));
                            SealerParaOldValue = SealerPOldint.ToString();
                            string SealerOld = System.Text.Encoding.Default.GetString(SealerPOld);



                            byte[] SealerPNew = new byte[12];
                            Array.Copy(PLCQueryRx6, 371, SealerPNew, 0, 12);  //D5180~D5185
                            Int32 SealerPNewint = (Int32)(BitConverter.ToInt16(SealerPNew, 0));
                            SealerParaNewValue = SealerPNewint.ToString();
                            string SealerNew = System.Text.Encoding.Default.GetString(SealerPNew);

                            if (SealerPNint > 0 && SealerPOldint > 0 && SealerPNewint > 0 && Sealerparameterflag == 0)
                            {
                                networkmain.Client_SendParameterchange1(SealerParaName, SealerOld, SealerNew);
                                parameter.Info("Sealer parameter change at PLC2 " + SealerParaName + "," + SealerOld + "," + SealerNew);
                                Thread.Sleep(10);
                                PLCWriteCommand6[479] = 0x07;//D5429
                                Sealerparameterflag   = 1;
                            }

                            if (SealerPNint == 0 && Sealerparameterflag == 1)
                            {
                                PLCWriteCommand6[479] = 0x00;//D5429
                                Sealerparameterflag   = 0;
                            }



                            #endregion
                        }


                        if (PLCQueryRx6[353] == 0x0F && PLCWriteCommand6[315] == 0x08)
                        {
                            PLCWriteCommand6[315] = 0x00;
                            string token = networkmain.Token2.ToString();
                            networkmain.Client_SendParameterchangeLogout("DENY", "1", "2", token);
                            parameter.Info("parameter change at PLC2 logout " + token);
                        }



                        #endregion



                        #region check st5 RJ result


                        //byte[] bcarrayst5check = new byte[10];
                        //Array.Copy(PLCQueryRx6, 121, bcarrayst5check, 0, 10);  //D5055
                        //St5CheckFL = System.Text.Encoding.Default.GetString(bcarrayst5check);
                        //if (St5CheckFL !="\0\0\0\0\0\0\0\0\0\0")
                        //{
                        //    checkresultST5.Info("FL For ST5 give to ST6" + St5CheckFL);
                        //}

                        //else
                        //{
                        //    St5CheckFL = "\0\0\0\0\0\0\0\0\0\0";
                        //}
                        //byte[] bcarrayst5checkRJ = new byte[2];
                        //Array.Copy(PLCQueryRx6, 219, bcarrayst5checkRJ, 0, 2);  //D5104
                        //string   St5CheckFLRJ = System.Text.Encoding.Default.GetString(bcarrayst5checkRJ);

                        //checkresultST5.Info("FL RJ For ST5 give to ST6" + St5CheckFLRJ);



                        // byte[] bcarrayst5checkS1 = new byte[2];
                        // Array.Copy(PLCQueryRx6, 165, bcarrayst5checkS1, 0, 2);  //D5077
                        // string   St5CheckFLS1 = System.Text.Encoding.Default.GetString(bcarrayst5checkS1);

                        //checkresultST5.Info("FL RJ For ST5 Sealer 1 give from Server===>" + St5CheckFLS1);

                        //byte[] bcarrayst5checkS2 = new byte[2];
                        // Array.Copy(PLCQueryRx6, 167, bcarrayst5checkS2, 0, 2);  //D5078
                        // string   St5CheckFLS2 = System.Text.Encoding.Default.GetString(bcarrayst5checkS2);

                        //checkresultST5.Info("FL RJ For ST5 Sealer 2 give from Server===>" + St5CheckFLS2);



                        // byte[] bcarrayst5checkS3 = new byte[2];
                        // Array.Copy(PLCQueryRx6, 169, bcarrayst5checkS3, 0, 2);  //D5077
                        // string   St5CheckFLS3 = System.Text.Encoding.Default.GetString(bcarrayst5checkS3);

                        // checkresultST5.Info("FL RJ For ST5 Sealer 3 give from Server===>" + St5CheckFLS3);



                        #endregion



                        #region test DM6110 to DM6499 Reading

                        byte[] TestPara = new byte[2];
                        Array.Copy(PLCQueryRxParaPlc2, 11, TestPara, 0, 2);    //D6100
                        Int32 TestPara1      = (Int32)(BitConverter.ToInt16(TestPara, 0));
                        int   TestParastring = TestPara1;
                        if (TestParastring > 0)
                        {
                            // Blocktest.Info("PLC2 Testing DM6100 ," + TestParastring);
                        }

                        byte[] TestPara2 = new byte[2];
                        Array.Copy(PLCQueryRxParaPlc2, 809, TestPara2, 0, 2);    //D6499
                        Int32 TestPara3       = (Int32)(BitConverter.ToInt16(TestPara2, 0));
                        int   TestParastring1 = TestPara3;
                        if (TestParastring1 > 0)
                        {
                            //Blocktest.Info("PLC2 Testing DM6499 ," + TestParastring1);
                        }


                        #endregion
                    }


                    #endregion
                }
                catch (Exception ex)
                {
                    Log1.Info(ex.ToString());
                }
                // Log1.Info(" ParameterChange Thread Exit");
            }//try first

            #endregion
        }
Ejemplo n.º 26
0
 protected override void OnShutdown()
 {
     Log1.Logger("Patcher").Info("Machine shutting down.");
 }
 public static void logout()
 {
     condition = 0;
     Console.WriteLine("logged out");
     Log1.PopulateLog($"{user} logged out");
 }
Ejemplo n.º 28
0
 private void StartAsync()
 {
     m_Server = new PatchServerProcess();
     m_Server.StartServer();
     Log1.Logger("Patcher").Info("Ready.");
 }
Ejemplo n.º 29
0
 protected override void OnShutdown()
 {
     Log1.Logger("Zeus.Service").Info("Machine shutting down.");
 }
 public static void lastLogin()
 {
     Console.WriteLine(loginTime);
     Log1.PopulateLog($"{user} last log in");
 }