Exemplo n.º 1
0
 public service1()
 {
     NetCard.NetCard n = new NetCard.NetCard();
     m_ipAddress = n.getComputerIP();
     FileServerWinClient.CallbackMessage pCallback = new FileServerWinClient.CallbackMessage(CallbackMessage);
     m_fileServerClient.SetCallback(pCallback);
     m_fileServerClient.SetIpAddress(m_ipAddress);
 }
Exemplo n.º 2
0
        void Initialize()
        {
            try
            {
                NetCard.NetCard n = new NetCard.NetCard();
                m_ipAddress = n.getComputerIP();
                while (m_ipAddress == "0.0.0.0")
                {
                    Thread.Sleep(10000);
                    m_ipAddress = n.getComputerIP();
                }
                File.WriteAllText("c:\\WCFStreamingClient.txt", "Initialized done: ip " + m_ipAddress);

                clsRegistry reg = new clsRegistry();
                m_fieldGuid = reg.GetStringValue(Registry.LocalMachine, "SOFTWARE\\Goji solutions\\Field", "Guid");
                if (reg.strRegError != null)
                {
                    m_fieldGuid = "error no guid";
                }

                FileServerWinClient.CallbackMessage pCallback = new FileServerWinClient.CallbackMessage(CallbackMessage);
                m_fileServerClient.SetCallback(pCallback);


                string strValue = reg.GetStringValue(
                    Registry.LocalMachine,
                    "SOFTWARE\\Goji solutions\\Field\\Watson",
                    "FileOwnerUserName");

                if (reg.strRegError == null)
                {
                    m_FileOwnerUserName = strValue;
                }
                else
                {
                    m_FileOwnerUserName = "******";
                }


                strValue = reg.GetStringValue(
                    Registry.LocalMachine,
                    "SOFTWARE\\Goji solutions\\Field\\Watson",
                    "WatsonStatus");
                if (reg.strRegError == null && strValue == "running")
                {
                    string userName;
                    userName = reg.GetStringValue(Registry.LocalMachine,
                                                  "SOFTWARE\\Goji solutions\\Field\\Watson",
                                                  "OperateUserName");

                    if (reg.strRegError != null)
                    {
                        pCallback(600, m_ipAddress, string.Empty, string.Empty, "Operator Owner does not exists", 0, DateTime.Now, 0, string.Empty);
                        return;
                    }

                    strValue = reg.GetStringValue(
                        Registry.LocalMachine,
                        "SOFTWARE\\Goji solutions\\Field\\Watson",
                        "StartWatchMonitorDirectory");
                    if (reg.strRegError == null)
                    {
                        if (Directory.Exists(strValue) == true)
                        {
                            m_fileServerClient.StartWatch(strValue, "*.bin", true, userName);
                        }
                    }
                }
            }
            catch (Exception err)
            {
                File.AppendAllText("c:\\GojiWCFStreamingClient.txt", err.Message);
            }
        }