Пример #1
0
        /// <summary>
        /// Sets the app config - writes and cplits the returned string
        /// </summary>
        /// <param connect="c"></param>
        public void SetConfig(Connect c)
        {
            string         set      = c.WriteConnection("1");
            IList <string> eachPath = set.Split('*').Reverse().ToList <string>();

            if (eachPath.Count == 5)
            {
                Output    = Output + eachPath[4];
                Source    = Source + eachPath[3];
                LogName   = LogName + eachPath[2];
                ThumbName = ThumbName + eachPath[1];
                string lPaths = eachPath[0];

                IList <string> each = lPaths.Split(';').Reverse().ToList <string>();
                each.ToList().ForEach(ListPaths.Add);
            }
        }
Пример #2
0
        /// <summary>
        /// Connects to the server and gets the logs
        /// Adds the command according to the message enum
        /// </summary>
        public void ConnectToServer()
        {
            Console.WriteLine("got to log");
            string info = c.WriteConnection("2");

            Console.WriteLine("read " + info);
            IList <string> eachPath = info.Split('*').Reverse().ToList <string>();

            for (int i = 0; i < eachPath.Count; i++)
            {
                IList <string> each = eachPath[i].Split(',').Reverse().ToList <string>();
                if (each.Count == 2)
                {
                    lock (lockObj)
                    {
                        Int32.TryParse(each[1], out int x);
                        if (x == (int)MessageTypeEnum.INFO)
                        {
                            ListCommands.Add(new CommandInfo(MessageTypeEnum.INFO.ToString(), each[0]));
                        }
                        if (x == (int)MessageTypeEnum.FAIL)
                        {
                            ListCommands.Add(new CommandInfo(MessageTypeEnum.FAIL.ToString(), each[0]));
                        }
                        if (x == (int)MessageTypeEnum.WARNING)
                        {
                            ListCommands.Add(new CommandInfo(MessageTypeEnum.WARNING.ToString(), each[0]));
                        }
                    }
                }
            }
            //creates a new thread to always be listening for connection
            Thread t = new Thread(() => c.ReadConnection());

            t.Start();
        }