public override int GetHashCode() { int hash = 1; if (Title.Length != 0) { hash ^= Title.GetHashCode(); } if (LongDescription.Length != 0) { hash ^= LongDescription.GetHashCode(); } if (ImageGsFilePath.Length != 0) { hash ^= ImageGsFilePath.GetHashCode(); } if (LatE6 != 0) { hash ^= LatE6.GetHashCode(); } if (LngE6 != 0) { hash ^= LngE6.GetHashCode(); } if (ImageServingUrl.Length != 0) { hash ^= ImageServingUrl.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public int ExtractPicturesFromDescription() { int insert_index = 0; if (LongDescription != null) { string[] imgs = LongDescription.Split(new string[] { "<img " }, StringSplitOptions.RemoveEmptyEntries); if (imgs.Length > 1) { for (int i = 1; i < imgs.Length; i++) { string[] src = imgs[i].Split(new string[] { "src=" }, StringSplitOptions.None); if (src.Length > 1) { string[] path = src[1].Split(new char[] { '"' }); { if (path.Length > 2) { if (path[1].Length > 10) { bool duplicate = false; foreach (GeocachePicture gp in Pictures) { string cs1 = gp.Path; string cs2 = path[1]; cs1 = cs1.Substring(cs1.Length - 10, 10); cs2 = cs2.Substring(cs2.Length - 10, 10); if (cs1.Equals(cs2)) { duplicate = true; } } if (!duplicate) { GeocachePicture p = new GeocachePicture(); p.OriginalPath = path[1]; p.Path = path[1]; Pictures.Add(p); //.Insert(insert_index, p); insert_index++; } } } } } } } } return(insert_index); }
public override string GetStepParameters() { var parameters = new List <string>(); parameters.Add(GlobalId != null ? GlobalId.ToStepValue() : "$"); parameters.Add(OwnerHistory != null ? OwnerHistory.ToStepValue() : "$"); parameters.Add(Name != null ? Name.ToStepValue() : "$"); parameters.Add(Description != null ? Description.ToStepValue() : "$"); parameters.Add(ObjectType != null ? ObjectType.ToStepValue() : "$"); parameters.Add(Identification != null ? Identification.ToStepValue() : "$"); parameters.Add(LongDescription != null ? LongDescription.ToStepValue() : "$"); parameters.Add(PredefinedType.ToStepValue()); return(string.Join(", ", parameters.ToArray())); }
public override string GetStepParameters() { var parameters = new List <string>(); parameters.Add(GlobalId != null ? GlobalId.ToStepValue() : "$"); parameters.Add(OwnerHistory != null ? OwnerHistory.ToStepValue() : "$"); parameters.Add(Name != null ? Name.ToStepValue() : "$"); parameters.Add(Description != null ? Description.ToStepValue() : "$"); parameters.Add(ApplicableOccurrence != null ? ApplicableOccurrence.ToStepValue() : "$"); parameters.Add(HasPropertySets != null ? HasPropertySets.ToStepValue() : "$"); parameters.Add(Identification != null ? Identification.ToStepValue() : "$"); parameters.Add(LongDescription != null ? LongDescription.ToStepValue() : "$"); parameters.Add(ProcessType != null ? ProcessType.ToStepValue() : "$"); parameters.Add(PredefinedType.ToStepValue()); return(string.Join(", ", parameters.ToArray())); }
public OdcmProperty Clone(string name) { return(new OdcmProperty(name ?? Name?.Clone() as string) { ContainsTarget = ContainsTarget, IsLink = IsLink, IsRequired = IsRequired, IsCollection = IsCollection, IsNullable = IsNullable, DefaultValue = DefaultValue?.Clone() as string, Class = Class, Description = Description?.Clone() as string, LongDescription = LongDescription?.Clone() as string, ParentPropertyType = ParentPropertyType, Projection = Projection?.Clone() as OdcmProjection, ReadOnly = ReadOnly, }); }
public virtual void FinishLoad(int zoneObjectSyncValue = -1) { if (zoneObjectSyncValue != -1) { ZoneObjectSyncLoad(zoneObjectSyncValue); } if (_flavorOptions != null && _flavorOptions.Count != 0) { foreach (string key in FlavorOptions.Keys) { int selectedPosition = GlobalReference.GlobalValues.Random.Next(FlavorOptions[key].Count); string selectedFlavorOption = FlavorOptions[key][selectedPosition]; ShortDescription = ShortDescription.Replace(key, selectedFlavorOption); LongDescription = LongDescription.Replace(key, selectedFlavorOption); ExamineDescription = ExamineDescription.Replace(key, selectedFlavorOption); SentenceDescription = SentenceDescription.Replace(key, selectedFlavorOption); for (int i = 0; i < KeyWords.Count; i++) { KeyWords[i] = KeyWords[i].Replace(key, selectedFlavorOption); } } } ILoadableItems loadableItem = this as ILoadableItems; if (loadableItem != null) { if (loadableItem.LoadableItems.Count > 0) { foreach (ILoadPercentage percentage in loadableItem.LoadableItems) { if (percentage.Load) { AddItem(this, percentage.Object); percentage.Object.FinishLoad(); } } } } }
public override string GetStepParameters() { var parameters = new List <string>(); parameters.Add(GlobalId != null ? GlobalId.ToStepValue() : "$"); parameters.Add(OwnerHistory != null ? OwnerHistory.ToStepValue() : "$"); parameters.Add(Name != null ? Name.ToStepValue() : "$"); parameters.Add(Description != null ? Description.ToStepValue() : "$"); parameters.Add(ObjectType != null ? ObjectType.ToStepValue() : "$"); parameters.Add(Identification != null ? Identification.ToStepValue() : "$"); parameters.Add(LongDescription != null ? LongDescription.ToStepValue() : "$"); parameters.Add(Status != null ? Status.ToStepValue() : "$"); parameters.Add(WorkMethod != null ? WorkMethod.ToStepValue() : "$"); parameters.Add(IsMilestone != null ? IsMilestone.ToStepValue() : "$"); parameters.Add(Priority != null ? Priority.ToStepValue() : "$"); parameters.Add(TaskTime != null ? TaskTime.ToStepValue() : "$"); parameters.Add(PredefinedType.ToStepValue()); return(string.Join(", ", parameters.ToArray())); }
public virtual void ZoneObjectSyncLoad(int syncValue) { if (ZoneSyncOptions.Count != 0) { foreach (string key in ZoneSyncOptions.Keys) { string selectedFlavorOption = ZoneSyncOptions[key][syncValue]; ShortDescription = ShortDescription.Replace(key, selectedFlavorOption); LongDescription = LongDescription.Replace(key, selectedFlavorOption); ExamineDescription = ExamineDescription.Replace(key, selectedFlavorOption); if (SentenceDescription != null) //rooms do not have sentence descriptions { SentenceDescription = SentenceDescription.Replace(key, selectedFlavorOption); } if (key == "ZoneSyncKeywords") { KeyWords.AddRange(selectedFlavorOption.Split(',')); } } } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Ean != null) { hashCode = hashCode * 59 + Ean.GetHashCode(); } if (Type != null) { hashCode = hashCode * 59 + Type.GetHashCode(); } if (Status != null) { hashCode = hashCode * 59 + Status.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (Streams != null) { hashCode = hashCode * 59 + Streams.GetHashCode(); } if (LevelSubjects != null) { hashCode = hashCode * 59 + LevelSubjects.GetHashCode(); } if (Models != null) { hashCode = hashCode * 59 + Models.GetHashCode(); } if (TrialAccessUrl != null) { hashCode = hashCode * 59 + TrialAccessUrl.GetHashCode(); } if (DefaultAccessUrl != null) { hashCode = hashCode * 59 + DefaultAccessUrl.GetHashCode(); } if (ShortDescription != null) { hashCode = hashCode * 59 + ShortDescription.GetHashCode(); } if (LongDescription != null) { hashCode = hashCode * 59 + LongDescription.GetHashCode(); } if (Media != null) { hashCode = hashCode * 59 + Media.GetHashCode(); } if (RelatedProducts != null) { hashCode = hashCode * 59 + RelatedProducts.GetHashCode(); } if (BundledProducts != null) { hashCode = hashCode * 59 + BundledProducts.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if Product instances are equal /// </summary> /// <param name="other">Instance of Product to be compared</param> /// <returns>Boolean</returns> public bool Equals(Product other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Ean == other.Ean || Ean != null && Ean.Equals(other.Ean) ) && ( Type == other.Type || Type != null && Type.Equals(other.Type) ) && ( Status == other.Status || Status != null && Status.Equals(other.Status) ) && ( Name == other.Name || Name != null && Name.Equals(other.Name) ) && ( Streams == other.Streams || Streams != null && Streams.SequenceEqual(other.Streams) ) && ( LevelSubjects == other.LevelSubjects || LevelSubjects != null && LevelSubjects.SequenceEqual(other.LevelSubjects) ) && ( Models == other.Models || Models != null && Models.SequenceEqual(other.Models) ) && ( TrialAccessUrl == other.TrialAccessUrl || TrialAccessUrl != null && TrialAccessUrl.Equals(other.TrialAccessUrl) ) && ( DefaultAccessUrl == other.DefaultAccessUrl || DefaultAccessUrl != null && DefaultAccessUrl.Equals(other.DefaultAccessUrl) ) && ( ShortDescription == other.ShortDescription || ShortDescription != null && ShortDescription.Equals(other.ShortDescription) ) && ( LongDescription == other.LongDescription || LongDescription != null && LongDescription.Equals(other.LongDescription) ) && ( Media == other.Media || Media != null && Media.Equals(other.Media) ) && ( RelatedProducts == other.RelatedProducts || RelatedProducts != null && RelatedProducts.SequenceEqual(other.RelatedProducts) ) && ( BundledProducts == other.BundledProducts || BundledProducts != null && BundledProducts.SequenceEqual(other.BundledProducts) )); }
public async Task Help(CommandContext ctx, string command = null) { try { if (command != null) { if (!ctx.CommandsNext.RegisteredCommands.Any(x => x.Value.Module.ModuleType.Name.ToLower() == command.ToLower())) { LongDescription Desc = new LongDescription("not available currently"); string usg = ""; try { Desc = ctx.CommandsNext.RegisteredCommands[command].CustomAttributes.OfType <LongDescription>().First(); } catch { } Usage Usage = new Usage("not available currently"); try { Usage = ctx.CommandsNext.RegisteredCommands[command].CustomAttributes.OfType <Usage>().First(); } catch { } var emb = new DiscordEmbedBuilder(); Console.WriteLine("embs"); emb.WithTitle(ctx.CommandsNext.RegisteredCommands[command].Module.ModuleType.Name); if (ctx.CommandsNext.RegisteredCommands[command].Aliases.Count != 0) { emb.AddField("Aliases", $"``{string.Join("``, ``", ctx.CommandsNext.RegisteredCommands[command].Aliases)}``"); } emb.AddField("Description", Desc.value); foreach (var usages in Usage.value) { usg += $"m%{command} {usages}\n"; } emb.AddField("Usage", usg); await ctx.RespondAsync(embed : emb.Build()); return; } else if (ctx.CommandsNext.RegisteredCommands.Any(x => x.Value.Module.ModuleType.Name.ToLower() == command.ToLower())) { var disemb = new DiscordEmbedBuilder(); string list = $"List of {ctx.CommandsNext.RegisteredCommands.First(x => x.Value.Module.ModuleType.Name.ToLower() == command.ToLower()).Value.Module.ModuleType.Name}\n\n"; foreach (var Command in ctx.CommandsNext.RegisteredCommands.Where(x => x.Value.Module.ModuleType.Name.ToLower() == command.ToLower())) { if (ctx.Prefix.Contains(ctx.Client.CurrentUser.Id.ToString())) { list += $"\n**m%{Command.Key}** *|-|* {Command.Value.Description}"; } else { list += $"\n**{ctx.Prefix}{Command.Key}** *|-|* {Command.Value.Description}"; } } disemb.WithDescription(list); disemb.AddField("General Info", "" + "Developer of the original bot: ohlookitsderpy#3939\n" + "Current developer: Speyd3r#3939\n" + "Avatar by: Chillow#1945 [Twitter](https://twitter.com/SaikoSamurai)\n" + "Support server: [Invite](https://discord.gg/YPPA2Pu)\n" + "Bot invite: [Invite Link](https://meek.moe/miku)\n" + "Support: [PayPal](https://paypal.me/speyd3r)|[Patreon](https://patreon.com/speyd3r)"); await ctx.RespondAsync(embed : disemb.Build()); return; } } var inter = ctx.Client.GetInteractivity(); Dictionary <string, List <DiscordEmbedBuilder> > Helps = new Dictionary <string, List <DiscordEmbedBuilder> >(); foreach (var Command in ctx.CommandsNext.RegisteredCommands) { if (ctx.CommandsNext.RegisteredCommands.Any(x => x.Value.Aliases.Any(y => y == Command.Key))) { continue; } var mod = Command.Value.Module.ModuleType.Name; if (!Helps.Any(x => x.Key == mod)) { Helps.Add(mod, new List <DiscordEmbedBuilder>()); } if (Helps[mod].Count == 0 || Helps[mod]?.Last().Fields.Count == 15) { Helps[mod].Add(new DiscordEmbedBuilder()); Helps[mod].Last().WithTitle(mod); } if (ctx.Prefix.Contains(ctx.Client.CurrentUser.Id.ToString())) { Helps[mod].Last().AddField($"m%{Command.Key}", $"{Command.Value.Description}", true); } else { Helps[mod].Last().AddField($"{ctx.Prefix}{Command.Key}", $"{Command.Value.Description}.", true); } } List <Page> All = new List <Page>(); string cats = "**"; foreach (var cat in Helps) { if (cats.Length != 0) { cats += ", " + cat.Key; } else { cats += cat.Key; } foreach (var com in cat.Value) { All.Add(new Page(embed: com)); } } cats += "**"; All.Insert(0, new Page(embed: new DiscordEmbedBuilder() .WithTitle("Hatsune Miku Discord Bot") .WithDescription("Heyo! This is the new and updated version of the Hatsune Miku Discord Bot, currently still in development, so things like\n" + "-Playlists\n" + "-Some Text Commands and Descriptions\n" + "are still missing but will be re-added over the next couple of days/weeks\n\n" + $"Current Category List consists of {cats}, all commands are displayed on the following pages (use the reactions to switch pages)\n" + $"For a more indepth view if certain commands you can use ``{ctx.Prefix}help (commandname)`` to see A more detailed description and usage\n") .AddField("General Info", "" + "Developer of the original bot: ohlookitsderpy#3939\n" + "Current Developer: Speyd3r#3939\n" + "Avatar by: Chillow#1945 ❤ [Twitter](https://twitter.com/SaikoSamurai)\n" + "Support server: [Invite](https://discord.gg/YPPA2Pu)\n" + "Bot invite: [Invite Link](https://meek.moe/miku)\n" + "Support: [PayPal](https://paypal.me/speyd3r)|[Patreon](https://patreon.com/speyd3r)"))); //.WithFooter("Next update at").WithTimestamp(Bot.Guilds[ctx.Guild.Id].UpdateTime) await inter.SendPaginatedMessageAsync(ctx.Channel, ctx.User, All, timeoutoverride : TimeSpan.FromMinutes(5)); } catch (Exception ex) { await ctx.RespondAsync("Something went wrong :( either I'm missing the permissions to add reactions, to use embeds, to manage messages or all of those. If you are sure that I have all those permissions, join discord.gg/YPPA2Pu and slap ``@Speyd3r#3939``"); Console.WriteLine(ex); } }
public override int GetHashCode() { return(LongDescription.GetHashCode()); }
public void Write(EndianBinaryWriter er) { er.Write(ShortDescription.PadRight(64, '\0'), Encoding.Unicode, false); er.Write(LongDescription.PadRight(128, '\0'), Encoding.Unicode, false); er.Write(Publisher.PadRight(64, '\0'), Encoding.Unicode, false); }