Exemplo n.º 1
0
        /// <summary>
        /// Creates a new printer port.
        /// </summary>
        public void CreatePort()
        {
            switch (_protocol)
            {
            case PortProtocolType.Raw:
                PrintPortManager.AddRawPort(PortName, PortNumber, Address, SnmpEnabled, "public", 1);
                break;

            case PortProtocolType.LPR:
                PrintPortManager.AddLprPort(PortName, PortNumber, Address, Queue, SnmpEnabled, "public", 1);
                break;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new printer port.
        /// </summary>
        public void CreatePort()
        {
            switch (Protocol)
            {
            case 1:     // RAW
                PrintPortManager.AddRawPort(PortName, PortNumber, Address, SnmpEnabled, SnmpCommunity, SnmpDevIndex);
                break;

            case 2:     // LPR
                PrintPortManager.AddLprPort(PortName, PortNumber, Address, Queue, SnmpEnabled, SnmpCommunity, SnmpDevIndex);
                break;
            }
        }
Exemplo n.º 3
0
        private void CreatePort()
        {
            LprPrinterPortInfo lprPortInfo = _printQueueInfo.PrinterPort as LprPrinterPortInfo;

            if (lprPortInfo != null)
            {
                TraceFactory.Logger.Debug("Creating LPR port. Queue Name = {0}".FormatWith(lprPortInfo.QueueName));
                PrintPortManager.AddLprPort(_portName, _printQueueInfo.PortNumber, _printQueueInfo.Address, lprPortInfo.QueueName, _printQueueInfo.SnmpEnabled, "public", 1);
            }
            else
            {
                TraceFactory.Logger.Debug("Creating RAW port.");
                PrintPortManager.AddRawPort(_portName, _printQueueInfo.PortNumber, _printQueueInfo.Address, _printQueueInfo.SnmpEnabled, "public", 1);
            }
        }
        /// <summary>
        /// Installs the PrintDriver With LPR Queue Details as in activity Data
        /// </summary>
        private void InstallPrintDriverWithLPRQueue()
        {
            DriverDetails driver = CreateDriver(_activityData.PrintDriver, _pluginSettings["PrintDriverServer"]);

            UpdateStatus($"Installing driver from {driver.InfPath}");
            ExecutionServices.SystemTrace.LogDebug($"Installing driver from {driver.InfPath}");
            DriverInstaller.Install(driver);
            UpdateStatus("Driver Installation Completed");

            UpdateStatus(string.Format("Creating LPR Port connecting to HPAC Server :{0}, QueueName : {1}", _hpacServerIP, _activityData.LprQueueName));
            ExecutionServices.SystemTrace.LogDebug($"Creating LPR Port connecting to HPAC Server :{_hpacServerIP}, QueueName : {_activityData.LprQueueName}");
            string portName = string.Format("_IP {0}_{1}", _hpacServerIP, _activityData.LprQueueName);

            PrintPortManager.AddLprPort(portName, LprPrinterPortInfo.DefaultPortNumber, _hpacServerIP, _activityData.LprQueueName);
            UpdateStatus("Port Creation Completed");

            UpdateStatus(string.Format("Creating LocalPrintDevice with Driver :{0} and port : {1}", driver.Name, portName));
            ExecutionServices.SystemTrace.LogDebug(string.Format("Creating LocalPrintDevice with Driver :{0} and port : {1}", driver.Name, portName));

            string queueName = string.Format("{0} ({1})", driver.Name, portName);

            if (!PrintQueueInstaller.IsInstalled(queueName))
            {
                PrintQueueInstaller.CreatePrintQueue(queueName, driver.Name, portName, driver.PrintProcessor);
                PrintQueueInstaller.WaitForInstallationComplete(queueName, driver.Name);
                UpdateStatus("Print Device Installation Completed");
            }

            PrintQueue queue = PrintQueueController.GetPrintQueue(queueName);

            if (_activityData.IsDefaultPrinter)
            {
                PrintQueueController.SetDefaultQueue(queue);
                UpdateStatus("Setting the Installed Print Device as a default Print Device");
            }

            ConfigurePrinterAttributes(queue);
            UpdateStatus("Printer Attributes Configuration Completed");
        }
Exemplo n.º 5
0
 /// <summary>
 /// Deletes an existing printer port.
 /// </summary>
 public void DeletePort()
 {
     PrintPortManager.DeletePort(PortName);
 }