Exemplo n.º 1
0
 public static void SetTimeStamp(GWLicense lic)
 {
     if (lic != null)
     {
         lic.Header.CreateDate = DateTime.Now;
     }
 }
Exemplo n.º 2
0
        public static bool LoadBytes(GWLicense lic, byte[] bArray)
        {
            if (lic == null || bArray == null || bArray.Length != BytesLength)
            {
                return(false);
            }

            byte[] bDate = new byte[CreateDateLength];
            Array.Copy(bArray, CreateDateOffset, bDate, 0, CreateDateLength);

            string strDate = Encoder.GetString(bDate);

            lic.Header.CreateDate = DateTime.ParseExact(strDate, DateFormat, null);

            int offset = DevicesOffset;

            foreach (DeviceLicense dl in lic.Devices)
            {
                if ((offset + 1) >= BytesLength)
                {
                    break;
                }
                byte[] bList = new byte[] { bArray[offset++], bArray[offset++] };
                dl.SetValue(bList);
            }

            return(true);
        }
Exemplo n.º 3
0
        public static GWLicense GetDefaultLicense()
        {
            GWLicense lic = new GWLicense();

            lic.Devices.Add(new DeviceLicense(DeviceName.SQL_IN, DeviceType.SQL, DirectionType.INBOUND, 0xFF00));
            lic.Devices.Add(new DeviceLicense(DeviceName.SQL_OUT, DeviceType.SQL, DirectionType.OUTBOUND, 0x0300));
            lic.Devices.Add(new DeviceLicense(DeviceName.GC_SOCKET_IN, DeviceType.SOCKET, DirectionType.INBOUND, 0x0300));
            lic.Devices.Add(new DeviceLicense(DeviceName.GC_SOCKET_OUT, DeviceType.SOCKET, DirectionType.OUTBOUND, 0x0300));
            lic.Devices.Add(new DeviceLicense(DeviceName.HL7_XML_IN, DeviceType.XML, DirectionType.INBOUND, 0x0300));
            lic.Devices.Add(new DeviceLicense(DeviceName.XML_HL7_OUT, DeviceType.XML, DirectionType.OUTBOUND, 0x0300));
            lic.Devices.Add(new DeviceLicense(DeviceName.FILE_IN, DeviceType.FILE, DirectionType.INBOUND, 0x0300));
            lic.Devices.Add(new DeviceLicense(DeviceName.FILE_OUT, DeviceType.FILE, DirectionType.OUTBOUND, 0x0300));
            //lic.Devices.Add(new DeviceLicense(DeviceName.DICOM_MPPS_IN, DeviceType.DICOM, DirectionType.INBOUND, 0x0000));
            lic.Devices.Add(new DeviceLicense(DeviceName.DICOM_MWL_OUT, DeviceType.DICOM, DirectionType.OUTBOUND, 0x0300));
            lic.Devices.Add(new DeviceLicense(DeviceName.RDET_MWL_OUT, DeviceType.RDET, DirectionType.OUTBOUND, 0x0300));
            lic.Devices.Add(new DeviceLicense(DeviceName.XREG_IN, DeviceType.XReg, DirectionType.INBOUND, 0x0300, true));
            lic.Devices.Add(new DeviceLicense(DeviceName.HL7_SENDER, DeviceType.HL7, DirectionType.OUTBOUND, 0x0300));
            lic.Devices.Add(new DeviceLicense(DeviceName.DICOM_SSCP_IN, DeviceType.DICOM, DirectionType.INBOUND, 0xFF00));
            lic.Devices.Add(new DeviceLicense(DeviceName.HL7_RECEIVER, DeviceType.HL7, DirectionType.INBOUND, 0x0300));

            //lic.Devices.Add(new DeviceLicense(DeviceName.DICOM_QR_SCU, DeviceType.DICOM, DirectionType.BIDIRECTIONAL, 0x0000));
            //lic.Devices.Add(new DeviceLicense(DeviceName.DICOM_GPWL_SCP, DeviceType.DICOM, DirectionType.BIDIRECTIONAL, 0x0000));
            //lic.Devices.Add(new DeviceLicense(DeviceName.DICOM_GPWL_SCU, DeviceType.DICOM, DirectionType.BIDIRECTIONAL, 0x0000));
            //lic.Devices.Add(new DeviceLicense(DeviceName.DICOM_GPPS_SCP, DeviceType.DICOM, DirectionType.BIDIRECTIONAL, 0x0000));
            //lic.Devices.Add(new DeviceLicense(DeviceName.DICOM_GPPS_SCU, DeviceType.DICOM, DirectionType.BIDIRECTIONAL, 0x0000));
            //lic.Devices.Add(new DeviceLicense(DeviceName.DICOM_MWL_IN, DeviceType.DICOM, DirectionType.INBOUND, 0x0000));
            //lic.Devices.Add(new DeviceLicense(DeviceName.DICOM_MPPS_OUT, DeviceType.DICOM, DirectionType.OUTBOUND, 0x0000));
            //lic.Devices.Add(new DeviceLicense(DeviceName.DAP_INOUT, DeviceType.DAP, DirectionType.BIDIRECTIONAL, 0x0000));

            return(lic);
        }
Exemplo n.º 4
0
        public void RefreshList(GWLicense license)
        {
            if (license == null)
            {
                return;
            }
            this._lblDate.Text = "Date Modified: " + license.Header.CreateDate.ToShortDateString();

            int index = 1;

            this._lstLicense.Items.Clear();
            foreach (DeviceLicense lic in license.Devices)
            {
                ListViewItem item = new ListViewItem((index++).ToString());
                item.SubItems.Add(lic.Name.ToString());
                item.SubItems.Add(lic.Type.ToString());
                item.SubItems.Add(lic.Direction.ToString());
                item.SubItems.Add(lic.GetMaxInstanceCount());
                item.SubItems.Add(lic.GetMaxDayCount());
                item.SubItems.Add(lic.FeatureCode.ToString());
                //item.SubItems.Add("Ox" + lic.FunctionControl.ToString("X"));
                item.Tag = lic;
                this._lstLicense.Items.Add(item);
            }
        }
Exemplo n.º 5
0
        public GWLicense Default()
        {
            GWLicense license = GWLicenseHelper.GetDefaultLicense();

            GWLicenseHelper.SetTimeStamp(license);
            RefreshList(license);
            return(license);
        }
Exemplo n.º 6
0
        public GWLicense Reset(ILogging log)
        {
            Form           frm     = this._lstLicense.FindForm();
            GWLicenseAgent a       = new GWLicenseAgent();
            GWLicense      license = a.LoginGetLicenseLogout(frm, log);

            RefreshList(license);
            return(license);
        }
Exemplo n.º 7
0
        private GWLicense _LoginGetLicenseLogout(Form frm, ILogging log)
        {
            try
            {
                GWLicense license = null;
                if (log != null)
                {
                    log.Write("-- Read License Begin --");
                }

                if (frm != null)
                {
                    frm.Cursor = Cursors.WaitCursor;
                }
                GWLicenseResult res = Login(log);
                if (frm != null)
                {
                    frm.Cursor = Cursors.Default;
                }

                if (res.Success)
                {
                    if (log != null)
                    {
                        log.Write("Login software dog succeeded.");
                    }

                    res = ReadLicense(log);
                    if (res.Success)
                    {
                        if (log != null)
                        {
                            log.Write("Read GC Gateway license data from dog succeeded.");
                        }
                        license = res.License;
                    }
                }

                if (log != null)
                {
                    log.Write("-- Read License End --");
                }
                return(license);
            }
            catch (Exception err)
            {
                if (log != null)
                {
                    log.Write("-- Read License Error --");
                    log.Write(LogType.Error, err.ToString());
                }
                return(null);
            }
        }
Exemplo n.º 8
0
        public static byte[] GetBytes(GWLicense lic)
        {
            if (lic == null)
            {
                return(null);
            }

            int length;

            byte[] bTemp;
            byte[] bArray = new byte[BytesLength];

            bTemp  = Encoder.GetBytes(lic.Header.Title);
            length = bTemp.Length; if (length > CreateDateOffset)
            {
                length = CreateDateOffset;
            }
            Array.Copy(bTemp, 0, bArray, 0, length);

            bTemp  = Encoder.GetBytes(lic.Header.CreateDate.ToString(DateFormat));
            length = bTemp.Length; if (length > CreateDateLength)
            {
                length = CreateDateLength;
            }
            Array.Copy(bTemp, 0, bArray, CreateDateOffset, length);

            int offset = DevicesOffset;

            foreach (DeviceLicense dl in lic.Devices)
            {
                if ((offset + 1) >= BytesLength)
                {
                    break;
                }

                byte[] bList = dl.GetValue();
                if (bList == null || bList.Length < 1)
                {
                    bList = new byte[] { 0, 0 }
                }
                ;

                bArray[offset++] = bList[0];
                bArray[offset++] = bList[1];
            }

            return(bArray);
        }
Exemplo n.º 9
0
 private void DoLoginGetLicenseLogout()
 {
     _license = _LoginGetLicenseLogout(null, _log);
     _event.Set();
 }