private void AddIdentity(string name, string version, string hintPath) { if (name.IsNullOrEmpty()) { throw new ArgumentNullException("name"); } foreach (char c in name) { if (!char.IsLetterOrDigit(c) && c != '.' && c != '_') { throw new Exception(PlugInConst.ManifestIdentity + " name contains invalid character: '" + c + "'"); } } Version v = PlugInReference.ParseVersion(version, hintPath); if (PrimaryVersion == null) { PrimaryVersion = v; } if (PrimaryIdentity == null) { PrimaryIdentity = name; } Identities.Add(name, v); }
private void InitDbIdentity() { if (_dbId == null) { lock (_lockObject) { if (_dbId == null) { var identity = Identities.FirstOrDefault(); if (identity == null) { var guid = Guid.NewGuid().ToByteArray(); identity = new IdentityEntity() { Data = guid }; Identities.Add(identity); SaveChanges(); } _dbId = identity.Data; Console.WriteLine($"SQLite ID:{_dbId.ToHexString()}"); } } } }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var values = new Identities(); IdentityType?currentKey = null; while (reader.Read()) { switch (reader.TokenType) { case JsonToken.PropertyName: IdentityType?key = GetEnum((string)reader.Value); if (!key.HasValue) { throw new SerializationException($"Did not recognize {reader.Value} as a valid Identity Type."); } currentKey = key.Value; break; case JsonToken.String: if (currentKey.HasValue && reader.Value != null) { values.Add(currentKey.Value, (string)reader.Value); } break; case JsonToken.EndObject: return(values); } } return(values); }
private int AddUpdateEntry(Update update, XDocument updateXmlDoc) { var newUpdateIndex = Identities.Count; Identities.Add(update.Identity); IdentityToIndex.Add(update.Identity, newUpdateIndex); IndexToIdentity.Add(newUpdateIndex, update.Identity); if (update is Detectoid) { UpdateTypeMap.Add(newUpdateIndex, (uint)UpdateType.Detectoid); Categories.TryAdd(update.Identity, update); } else if (update is Classification) { UpdateTypeMap.Add(newUpdateIndex, (uint)UpdateType.Classification); Categories.TryAdd(update.Identity, update); } else if (update is Product) { UpdateTypeMap.Add(newUpdateIndex, (uint)UpdateType.Product); Categories.TryAdd(update.Identity, update); } else if (update is SoftwareUpdate) { UpdateTypeMap.Add(newUpdateIndex, (uint)UpdateType.Software); Updates.TryAdd(update.Identity, update); } else if (update is DriverUpdate) { UpdateTypeMap.Add(newUpdateIndex, (uint)UpdateType.Driver); Updates.TryAdd(update.Identity, update); } ExtractAndIndexTitle(newUpdateIndex, updateXmlDoc); AddedUpdates.Add(newUpdateIndex, update); AddUpdateBundleInformation(newUpdateIndex, update.Identity, updateXmlDoc); AddPrerequisiteInformation(newUpdateIndex, update.Identity, updateXmlDoc); AddUpdateFileInformationToIndex(newUpdateIndex, update.Identity, updateXmlDoc); ExtractSupersedingInformation(newUpdateIndex, update.Identity, updateXmlDoc); if (update is DriverUpdate) { ExtractAndIndexDriverMetadata(newUpdateIndex, updateXmlDoc); } ExtractAndIndexKbArticle(newUpdateIndex, updateXmlDoc, update); return(newUpdateIndex); }
public Wallet() { Identities.Clear(); Identities.Add(new Identity { Label = "NewIdentity", IsDefault = true, Lock = false, Extra = null, Controls = new List <Control> { new Control("6Pxxxxxxxxx", "1") }, Ontid = "did:ont:AMxxxxxxxxxxxxxxxxxxxxxxx" }); Accounts.Add(new Account { Address = "TA6xxxxxxxxxxxx", Key = "6Pxxxxxxxxxxx", Hash = "sha256", Label = "NewAccount", PublicKey = "1202xxxxxxxxxxxxxx", SignatureScheme = "SHA256withECDSA", PasswordHash = "passwordhash" }); Scrypt = new Scrypt(16384, 8, 8); }
public override void Init() { License.LicenseKey = "LicenseKey"; // Write License Key this.LoggingLevel = WebScraper.LogLevel.All; // All Events Are Logged HttpIdentity identity = new HttpIdentity(); identity.HttpRequestHeaders.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; " + "Windows NT 5.2; .NET CLR 1.0.3705;)"); foreach (var UA in IronWebScraper.CommonUserAgents.ChromeDesktopUserAgents) { Identities.Add(new HttpIdentity() { UserAgent = UA, UseCookies = true }); } this.Request(this._url, Parse); }
private void OnCfgDefinitionsModified(object sender, EventArgs e) { NewsgroupsConfiguration cfg = (NewsgroupsConfiguration)sender; // take over the copies from local userIdentities and nntpServers // to app.FeedHandler.Identity and app.FeedHandler.NntpServers Identities.Clear(); if (cfg.ConfiguredIdentities != null) { foreach (UserIdentity ui in cfg.ConfiguredIdentities.Values) { Identities.Add(ui.Name, (UserIdentity)ui.Clone()); } } Save(); IBanditFeedSource extension = app.BanditFeedSourceExtension; if (extension != null) { lock (extension.NntpServers) { extension.NntpServers.Clear(); if (cfg.ConfiguredNntpServers != null) { foreach (NntpServerDefinition sd in cfg.ConfiguredNntpServers.Values) { extension.NntpServers.Add(sd.Name, (NntpServerDefinition)sd.Clone()); } } extension.SaveNntpServers(); } } RaiseNewsServerDefinitionsModified(); RaiseIdentityDefinitionsModified(); }