Example #1
0
            internal DomainLicense(byte[] encryptedLicense, LicenseVerifier v)
            {
                Decrypted = v.Decrypt(encryptedLicense);
                Encrypted = encryptedLicense;
                string[] lines = Decrypted.Split('\n');
                foreach (string l in lines)
                {
                    int colon = l.IndexOf(':');
                    if (colon < 1)
                    {
                        continue;
                    }
                    string key   = l.Substring(0, colon).Trim().ToLowerInvariant();
                    string value = l.Substring(colon + 1).Trim();

                    switch (key)
                    {
                    case "domain": Domain = value; break;

                    case "owner": OwnerName = value; break;

                    case "issued": Issued = DateTime.Parse(value); break;

                    case "expires": Expires = DateTime.Parse(value); break;

                    case "features":
                        List <Guid> ids   = new List <Guid>();
                        string[]    parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                        foreach (string p in parts)
                        {
                            ids.Add(new Guid(p));
                        }
                        Features = ids;
                        break;
                    }
                }
            }
Example #2
0
            internal DomainLicense(byte[] encryptedLicense, LicenseVerifier v)
            {
                Decrypted =v.Decrypt(encryptedLicense);
                Encrypted = encryptedLicense;
                string[] lines = Decrypted.Split('\n');
                foreach (string l in lines) {
                    int colon = l.IndexOf(':');
                    if (colon < 1) continue;
                    string key = l.Substring(0, colon).Trim().ToLowerInvariant();
                    string value = l.Substring(colon + 1).Trim();

                    switch(key){
                        case "domain": Domain = value; break;
                        case "owner": OwnerName = value; break;
                        case "issued" : Issued = DateTime.Parse(value); break;
                        case "expires": Expires = DateTime.Parse(value); break;
                        case "features":
                            List<Guid> ids = new List<Guid>();
                            string[] parts = value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                            foreach (string p in parts) {
                                ids.Add(new Guid(p));
                            }
                            Features = ids;
                            break;
                    }

                }
            }