Example #1
0
        public void TestPrintServer()
        {
            Select         auto         = new Select();
            var            ping         = new Ping();
            XmlReadOrWrite xml          = new XmlReadOrWrite();
            var            t            = auto.AllFullModel();
            var            printServer  = new PrintServer(@"\\i7751-sys030");
            var            prQueue      = printServer.GetPrintQueues();
            var            allSerNumber = auto.AllSerNumber();
            var            listPrinters = (from printer in prQueue
                                           select new Printers()
            {
                Description = printer.Description,
                Name = printer.Name,
                Ip = "10.177.172." + Regex.Match(printer.QueuePort.Name, @"(\d+)(?!.*\d)").Value,
                HasToner = printer.HasToner
            }
                                           ).ToList();
            //foreach (var fullModel in t)
            //{
            //    var findModel = Regex.Match(fullModel.NameModel, @"(\d+)(?!.*\d)").Value;
            //    foreach (var pr in listPrinters)
            //    {
            //        if (pr.Description.Contains(findModel))
            //        {
            //            pr.ModelId = fullModel.IdModel;
            //            pr.FullUrl =
            //                string.Format(
            //                    string.IsNullOrWhiteSpace(fullModel.UrlModel) ? "http://{0}" : fullModel.UrlModel,
            //                    pr.Ip);
            //            pr.IdClass = fullModel.IdClasification;

            //            PingReply pingReply = null;
            //            pingReply = ping.Send(pr.Ip);
            //            // if (pr.Ip == "10.177.172.149")
            //            //{
            //            if (pingReply.Status == IPStatus.Success)
            //            {
            //                pr.SerialNumber = StepTraining(allSerNumber, pr.FullUrl);
            //                Dispose();
            //            }
            //            else
            //            {
            //                pr.Error = "Удаленный IP не пингуется";
            //            }
            //            // }
            //        }
            //    }
            //}
            //xml.CreateXmlFile("D:\\Test.xml", listPrinters, typeof(List<Printers>));
            //auto.Dispose();
            //var mfuSerNum = new List<string>()
            //{
            //    "3389259968",
            //    "3389258155",
            //    "3389258163",
            //    "5311734336",
            //    "5311734360",
            //    "5311734220",
            //    "5311734263",
            //    "3398312405",
            //    "VNC3X07936"

            //};
            //StepTraining(mfuSerNum, "https://10.177.172.136/DevMgmt/ProductConfigDyn.xml");  //
        }