Here are the examples of the csharp api System.Guid.GetHashCode() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
539 Examples
19
Source : Extention.UrlHelper.cs
with MIT License
from Coldairarrow
with MIT License
from Coldairarrow
public static string Scrpit(this UrlHelper helper, string scriptVirtualPath)
{
int version = 0;
if(GlobalSwitch.RunModel== RunModel.LocalTest)
{
version = Guid.NewGuid().GetHashCode();
}
else
{
string filePath = helper.RequestContext.HttpContext.Server.MapPath(scriptVirtualPath);
FileInfo fileInfo = new FileInfo(filePath);
version = fileInfo.LastWriteTime.GetHashCode();
}
return helper.Content($"{scriptVirtualPath}?_v={version}");
}
19
Source : UEditorController.cs
with Apache License 2.0
from crazyants
with Apache License 2.0
from crazyants
private string GetFileName(string fileType, string ext = "")
{
var random = new Random(Guid.NewGuid().GetHashCode());
return string.Format("{0}/{1}{2}{3}", fileType, DateTime.Now.ToString("yyyy/MM/dd/HHmmss"), random.Next(100000, 1000000), ext);
}
19
Source : DefaultPushNotificationHandler.android.cs
with MIT License
from CrossGeeks
with MIT License
from CrossGeeks
public virtual void OnReceived(IDictionary<string, object> parameters)
{
System.Diagnostics.Debug.WriteLine($"{DomainTag} - OnReceived");
if (parameters.TryGetValue(SilentKey, out object silent) && (silent.ToString() == "true" || silent.ToString() == "1"))
return;
Context context = Application.Context;
int notifyId = 0;
string replacedle = context.ApplicationInfo.LoadLabel(context.PackageManager);
var message = string.Empty;
var tag = string.Empty;
if (!string.IsNullOrEmpty(AzurePushNotificationManager.NotificationContentTextKey) && parameters.TryGetValue(AzurePushNotificationManager.NotificationContentTextKey, out object notificationContentText))
message = notificationContentText.ToString();
else if (parameters.TryGetValue(AlertKey, out object alert))
message = $"{alert}";
else if (parameters.TryGetValue(Boreplacedy, out object body))
message = $"{body}";
else if (parameters.TryGetValue(MessageKey, out object messageContent))
message = $"{messageContent}";
else if (parameters.TryGetValue(SubreplacedleKey, out object subreplacedle))
message = $"{subreplacedle}";
else if (parameters.TryGetValue(TextKey, out object text))
message = $"{text}";
if (!string.IsNullOrEmpty(AzurePushNotificationManager.NotificationContentreplacedleKey) && parameters.TryGetValue(AzurePushNotificationManager.NotificationContentreplacedleKey, out object notificationContentreplacedle))
replacedle = notificationContentreplacedle.ToString();
else if (parameters.TryGetValue(replacedleKey, out object replacedleContent))
{
if (!string.IsNullOrEmpty(message))
replacedle = $"{replacedleContent}";
else
message = $"{replacedleContent}";
}
if (parameters.TryGetValue(IdKey, out object id))
{
try
{
notifyId = Convert.ToInt32(id);
}
catch (Exception ex)
{
// Keep the default value of zero for the notify_id, but log the conversion problem.
System.Diagnostics.Debug.WriteLine($"Failed to convert {id} to an integer {ex}");
}
}
if (parameters.TryGetValue(TagKey, out object tagContent))
tag = tagContent.ToString();
try
{
if (parameters.TryGetValue(SoundKey, out object sound))
{
var soundName = sound.ToString();
int soundResId = context.Resources.GetIdentifier(soundName, "raw", context.PackageName);
if (soundResId == 0 && soundName.IndexOf('.') != -1)
{
soundName = soundName.Substring(0, soundName.LastIndexOf('.'));
soundResId = context.Resources.GetIdentifier(soundName, "raw", context.PackageName);
}
AzurePushNotificationManager.SoundUri = new Android.Net.Uri.Builder()
.Scheme(ContentResolver.SchemeAndroidResource)
.Path($"{context.PackageName}/{soundResId}")
.Build();
}
}
catch (Resources.NotFoundException ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
if (AzurePushNotificationManager.SoundUri == null)
AzurePushNotificationManager.SoundUri = RingtoneManager.GetDefaultUri(RingtoneType.Notification);
try
{
if (parameters.TryGetValue(IconKey, out object icon) && icon != null)
{
try
{
AzurePushNotificationManager.IconResource = context.Resources.GetIdentifier($"{icon}", "drawable", Application.Context.PackageName);
if (AzurePushNotificationManager.IconResource == 0)
{
AzurePushNotificationManager.IconResource = context.Resources.GetIdentifier($"{icon}", "mipmap", Application.Context.PackageName);
}
}
catch (Resources.NotFoundException ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
if (AzurePushNotificationManager.IconResource == 0)
AzurePushNotificationManager.IconResource = context.ApplicationInfo.Icon;
else
{
string name = context.Resources.GetResourceName(AzurePushNotificationManager.IconResource);
if (name == null)
AzurePushNotificationManager.IconResource = context.ApplicationInfo.Icon;
}
}
catch (Resources.NotFoundException ex)
{
AzurePushNotificationManager.IconResource = context.ApplicationInfo.Icon;
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
try
{
if (parameters.TryGetValue(LargeIconKey, out object largeIcon) && largeIcon != null)
{
AzurePushNotificationManager.LargeIconResource = context.Resources.GetIdentifier($"{largeIcon}", "drawable", Application.Context.PackageName);
if (AzurePushNotificationManager.LargeIconResource == 0)
{
AzurePushNotificationManager.LargeIconResource = context.Resources.GetIdentifier($"{largeIcon}", "mipmap", Application.Context.PackageName);
}
}
if (AzurePushNotificationManager.LargeIconResource != 0)
{
string name = context.Resources.GetResourceName(AzurePushNotificationManager.LargeIconResource);
if (name == null)
AzurePushNotificationManager.LargeIconResource = 0;
}
}
catch (Resources.NotFoundException ex)
{
AzurePushNotificationManager.LargeIconResource = 0;
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
if (parameters.TryGetValue(ColorKey, out object color) && color != null)
{
try
{
AzurePushNotificationManager.Color = Color.ParseColor(color.ToString());
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"{DomainTag} - Failed to parse color {ex}");
}
}
Intent resultIntent = typeof(Activity).IsreplacedignableFrom(AzurePushNotificationManager.NotificationActivityType) ? new Intent(Application.Context, AzurePushNotificationManager.NotificationActivityType) : (AzurePushNotificationManager.DefaultNotificationActivityType == null ? context.PackageManager.GetLaunchIntentForPackage(context.PackageName) : new Intent(Application.Context, AzurePushNotificationManager.DefaultNotificationActivityType));
Bundle extras = new Bundle();
foreach (var p in parameters)
extras.PutString(p.Key, p.Value.ToString());
if (extras != null)
{
extras.PutInt(ActionNotificationIdKey, notifyId);
extras.PutString(ActionNotificationTagKey, tag);
resultIntent.PutExtras(extras);
}
if (AzurePushNotificationManager.NotificationActivityFlags != null)
{
resultIntent.SetFlags(AzurePushNotificationManager.NotificationActivityFlags.Value);
}
int requestCode = new Java.Util.Random().NextInt();
var pendingIntent = PendingIntent.GetActivity(context, requestCode, resultIntent,PendingIntentFlags.UpdateCurrent);
var chanId = AzurePushNotificationManager.DefaultNotificationChannelId;
if (parameters.TryGetValue(ChannelIdKey, out object channelId) && channelId != null)
{
chanId = $"{channelId}";
}
var notificationBuilder = new NotificationCompat.Builder(context, chanId)
.SetSmallIcon(AzurePushNotificationManager.IconResource)
.SetContentreplacedle(replacedle)
.SetContentText(message)
.SetAutoCancel(true)
.SetContentIntent(pendingIntent);
if(AzurePushNotificationManager.LargeIconResource != 0)
{
Bitmap largeIconBitmap = BitmapFactory.DecodeResource(context.Resources, AzurePushNotificationManager.LargeIconResource);
notificationBuilder.SetLargeIcon(largeIconBitmap);
}
var deleteIntent = new Intent(context,typeof(PushNotificationDeletedReceiver));
var pendingDeleteIntent = PendingIntent.GetBroadcast(context, requestCode, deleteIntent,PendingIntentFlags.CancelCurrent);
notificationBuilder.SetDeleteIntent(pendingDeleteIntent);
if (Build.VERSION.SdkInt < Android.OS.BuildVersionCodes.O)
{
if (parameters.TryGetValue(PriorityKey, out object priority) && priority != null)
{
var priorityValue = $"{priority}";
if (!string.IsNullOrEmpty(priorityValue))
{
switch (priorityValue.ToLower())
{
case "max":
notificationBuilder.SetPriority((int)Android.App.NotificationPriority.Max);
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
break;
case "high":
notificationBuilder.SetPriority((int)Android.App.NotificationPriority.High);
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
break;
case "default":
notificationBuilder.SetPriority((int)Android.App.NotificationPriority.Default);
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
break;
case "low":
notificationBuilder.SetPriority((int)Android.App.NotificationPriority.Low);
break;
case "min":
notificationBuilder.SetPriority((int)Android.App.NotificationPriority.Min);
break;
default:
notificationBuilder.SetPriority((int)Android.App.NotificationPriority.Default);
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
break;
}
}
else
{
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
}
}
else
{
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
}
try
{
notificationBuilder.SetSound(AzurePushNotificationManager.SoundUri);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"{DomainTag} - Failed to set sound {ex}");
}
}
// Try to resolve (and apply) localized parameters
ResolveLocalizedParameters(notificationBuilder, parameters);
if (AzurePushNotificationManager.Color != null)
notificationBuilder.SetColor(AzurePushNotificationManager.Color.Value);
if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBean)
{
// Using BigText notification style to support long message
var style = new NotificationCompat.BigTextStyle();
style.BigText(message);
notificationBuilder.SetStyle(style);
}
string category = string.Empty;
if (parameters.TryGetValue(CategoryKey, out object categoryContent))
category = categoryContent.ToString();
if (parameters.TryGetValue(ActionKey, out object actionContent))
category = actionContent.ToString();
var notificationCategories = CrossAzurePushNotification.Current?.GetUserNotificationCategories();
if (notificationCategories != null && notificationCategories.Length > 0)
{
IntentFilter intentFilter = null;
foreach (var userCat in notificationCategories)
{
if (userCat != null && userCat.Actions != null && userCat.Actions.Count > 0)
{
foreach (var action in userCat.Actions)
{
var aRequestCode = Guid.NewGuid().GetHashCode();
if (userCat.Category.Equals(category, StringComparison.CurrentCultureIgnoreCase))
{
Intent actionIntent = null;
PendingIntent pendingActionIntent = null;
if (action.Type == NotificationActionType.Foreground)
{
actionIntent = typeof(Activity).IsreplacedignableFrom(AzurePushNotificationManager.NotificationActivityType) ? new Intent(Application.Context, AzurePushNotificationManager.NotificationActivityType) : (AzurePushNotificationManager.DefaultNotificationActivityType == null ? context.PackageManager.GetLaunchIntentForPackage(context.PackageName) : new Intent(Application.Context, AzurePushNotificationManager.DefaultNotificationActivityType));
if (AzurePushNotificationManager.NotificationActivityFlags != null)
{
actionIntent.SetFlags(AzurePushNotificationManager.NotificationActivityFlags.Value);
}
extras.PutString(ActionIdentifierKey, action.Id);
actionIntent.PutExtras(extras);
pendingActionIntent = PendingIntent.GetActivity(context, aRequestCode, actionIntent, PendingIntentFlags.UpdateCurrent);
}
else
{
actionIntent = new Intent(context, typeof(PushNotificationActionReceiver));
extras.PutString(ActionIdentifierKey, action.Id);
actionIntent.PutExtras(extras);
pendingActionIntent = PendingIntent.GetBroadcast(context, aRequestCode, actionIntent, PendingIntentFlags.UpdateCurrent);
}
notificationBuilder.AddAction(context.Resources.GetIdentifier(action.Icon, "drawable", Application.Context.PackageName), action.replacedle, pendingActionIntent);
}
}
}
}
}
OnBuildNotification(notificationBuilder, parameters);
NotificationManager notificationManager = (NotificationManager)context.GetSystemService(Context.NotificationService);
notificationManager.Notify(tag, notifyId, notificationBuilder.Build());
}
19
Source : DefaultPushNotificationHandler.android.cs
with MIT License
from CrossGeeks
with MIT License
from CrossGeeks
public virtual void OnReceived(IDictionary<string, object> parameters)
{
System.Diagnostics.Debug.WriteLine($"{DomainTag} - OnReceived");
if ((parameters.TryGetValue(SilentKey, out var silent) && (silent.ToString() == "true" || silent.ToString() == "1")) || (IsInForeground() && (!(!parameters.ContainsKey(ChannelIdKey) && parameters.TryGetValue(PriorityKey, out var imp) && ($"{imp}" == "high" || $"{imp}" == "max")) || (!parameters.ContainsKey(PriorityKey) && !parameters.ContainsKey(ChannelIdKey) && FirebasePushNotificationManager.DefaultNotificationChannelImportance != NotificationImportance.High && FirebasePushNotificationManager.DefaultNotificationChannelImportance != NotificationImportance.Max))))
{
return;
}
var context = Application.Context;
var notifyId = 0;
var replacedle = context.ApplicationInfo.LoadLabel(context.PackageManager);
var message = string.Empty;
var tag = string.Empty;
var showWhenVisible = FirebasePushNotificationManager.ShouldShowWhen;
var soundUri = FirebasePushNotificationManager.SoundUri;
var largeIconResource = FirebasePushNotificationManager.LargeIconResource;
var smallIconResource = FirebasePushNotificationManager.IconResource;
var notificationColor = FirebasePushNotificationManager.Color;
var chanId = FirebasePushNotificationManager.DefaultNotificationChannelId;
if (!string.IsNullOrEmpty(FirebasePushNotificationManager.NotificationContentTextKey) && parameters.TryGetValue(FirebasePushNotificationManager.NotificationContentTextKey, out var notificationContentText))
{
message = notificationContentText.ToString();
}
else if (parameters.TryGetValue(AlertKey, out var alert))
{
message = $"{alert}";
}
else if (parameters.TryGetValue(Boreplacedy, out var body))
{
message = $"{body}";
}
else if (parameters.TryGetValue(MessageKey, out var messageContent))
{
message = $"{messageContent}";
}
else if (parameters.TryGetValue(SubreplacedleKey, out var subreplacedle))
{
message = $"{subreplacedle}";
}
else if (parameters.TryGetValue(TextKey, out var text))
{
message = $"{text}";
}
if (!string.IsNullOrEmpty(FirebasePushNotificationManager.NotificationContentreplacedleKey) && parameters.TryGetValue(FirebasePushNotificationManager.NotificationContentreplacedleKey, out var notificationContentreplacedle))
{
replacedle = notificationContentreplacedle.ToString();
}
else if (parameters.TryGetValue(replacedleKey, out var replacedleContent))
{
if (!string.IsNullOrEmpty(message))
{
replacedle = $"{replacedleContent}";
}
else
{
message = $"{replacedleContent}";
}
}
if (parameters.TryGetValue(IdKey, out var id))
{
try
{
notifyId = Convert.ToInt32(id);
}
catch (Exception ex)
{
// Keep the default value of zero for the notify_id, but log the conversion problem.
System.Diagnostics.Debug.WriteLine($"Failed to convert {id} to an integer {ex}");
}
}
if (parameters.TryGetValue(ShowWhenKey, out var shouldShowWhen))
{
showWhenVisible = $"{shouldShowWhen}".ToLower() == "true";
}
if (parameters.TryGetValue(TagKey, out var tagContent))
{
tag = tagContent.ToString();
}
try
{
if (parameters.TryGetValue(SoundKey, out var sound))
{
var soundName = sound.ToString();
var soundResId = context.Resources.GetIdentifier(soundName, "raw", context.PackageName);
if (soundResId == 0 && soundName.IndexOf(".") != -1)
{
soundName = soundName.Substring(0, soundName.LastIndexOf('.'));
soundResId = context.Resources.GetIdentifier(soundName, "raw", context.PackageName);
}
soundUri = new Android.Net.Uri.Builder()
.Scheme(ContentResolver.SchemeAndroidResource)
.Path($"{context.PackageName}/{soundResId}")
.Build();
}
}
catch (Resources.NotFoundException ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
if (soundUri == null)
{
soundUri = RingtoneManager.GetDefaultUri(RingtoneType.Notification);
}
try
{
if (parameters.TryGetValue(IconKey, out var icon) && icon != null)
{
try
{
smallIconResource = context.Resources.GetIdentifier(icon.ToString(), "drawable", Application.Context.PackageName);
if (smallIconResource == 0)
{
smallIconResource = context.Resources.GetIdentifier($"{icon}", "mipmap", Application.Context.PackageName);
}
}
catch (Resources.NotFoundException ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
if (smallIconResource == 0)
{
smallIconResource = context.ApplicationInfo.Icon;
}
else
{
var name = context.Resources.GetResourceName(smallIconResource);
if (name == null)
{
smallIconResource = context.ApplicationInfo.Icon;
}
}
}
catch (Resources.NotFoundException ex)
{
smallIconResource = context.ApplicationInfo.Icon;
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
try
{
if (parameters.TryGetValue(LargeIconKey, out var largeIcon) && largeIcon != null)
{
largeIconResource = context.Resources.GetIdentifier($"{largeIcon}", "drawable", Application.Context.PackageName);
if (largeIconResource == 0)
{
largeIconResource = context.Resources.GetIdentifier($"{largeIcon}", "mipmap", Application.Context.PackageName);
}
}
if (largeIconResource > 0)
{
var name = context.Resources.GetResourceName(largeIconResource);
if (name == null)
{
largeIconResource = 0;
}
}
}
catch (Resources.NotFoundException ex)
{
largeIconResource = 0;
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
if (parameters.TryGetValue(ColorKey, out var color) && color != null)
{
try
{
notificationColor = Color.ParseColor(color.ToString());
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"{DomainTag} - Failed to parse color {ex}");
}
}
var resultIntent = typeof(Activity).IsreplacedignableFrom(FirebasePushNotificationManager.NotificationActivityType) ? new Intent(Application.Context, FirebasePushNotificationManager.NotificationActivityType) : (FirebasePushNotificationManager.DefaultNotificationActivityType == null ? context.PackageManager.GetLaunchIntentForPackage(context.PackageName) : new Intent(Application.Context, FirebasePushNotificationManager.DefaultNotificationActivityType));
var extras = new Bundle();
foreach (var p in parameters)
{
extras.PutString(p.Key, p.Value.ToString());
}
if (extras != null)
{
extras.PutInt(ActionNotificationIdKey, notifyId);
extras.PutString(ActionNotificationTagKey, tag);
resultIntent.PutExtras(extras);
}
if (FirebasePushNotificationManager.NotificationActivityFlags != null)
{
resultIntent.SetFlags(FirebasePushNotificationManager.NotificationActivityFlags.Value);
}
var requestCode = new Java.Util.Random().NextInt();
var pendingIntent = PendingIntent.GetActivity(context, requestCode, resultIntent, PendingIntentFlags.UpdateCurrent);
if (parameters.TryGetValue(ChannelIdKey, out var channelId) && channelId != null)
{
chanId = $"{channelId}";
}
var notificationBuilder = new NotificationCompat.Builder(context, chanId)
.SetSmallIcon(smallIconResource)
.SetContentreplacedle(replacedle)
.SetContentText(message)
.SetAutoCancel(true)
.SetWhen(Java.Lang.JavaSystem.CurrentTimeMillis())
.SetContentIntent(pendingIntent);
if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBeanMr1)
{
notificationBuilder.SetShowWhen(showWhenVisible);
}
if (largeIconResource > 0)
{
var largeIconBitmap = BitmapFactory.DecodeResource(context.Resources, largeIconResource);
notificationBuilder.SetLargeIcon(largeIconBitmap);
}
var deleteIntent = new Intent(context, typeof(PushNotificationDeletedReceiver));
deleteIntent.PutExtras(extras);
var pendingDeleteIntent = PendingIntent.GetBroadcast(context, requestCode, deleteIntent, PendingIntentFlags.CancelCurrent);
notificationBuilder.SetDeleteIntent(pendingDeleteIntent);
if (Build.VERSION.SdkInt < Android.OS.BuildVersionCodes.O)
{
if (parameters.TryGetValue(PriorityKey, out var priority) && priority != null)
{
var priorityValue = $"{priority}";
if (!string.IsNullOrEmpty(priorityValue))
{
switch (priorityValue.ToLower())
{
case "max":
notificationBuilder.SetPriority(NotificationCompat.PriorityMax);
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
break;
case "high":
notificationBuilder.SetPriority(NotificationCompat.PriorityHigh);
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
break;
case "default":
notificationBuilder.SetPriority(NotificationCompat.PriorityDefault);
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
break;
case "low":
notificationBuilder.SetPriority(NotificationCompat.PriorityLow);
break;
case "min":
notificationBuilder.SetPriority(NotificationCompat.PriorityMin);
break;
default:
notificationBuilder.SetPriority(NotificationCompat.PriorityDefault);
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
break;
}
}
else
{
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
}
}
else
{
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
}
try
{
notificationBuilder.SetSound(soundUri);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"{DomainTag} - Failed to set sound {ex}");
}
}
// Try to resolve (and apply) localized parameters
ResolveLocalizedParameters(notificationBuilder, parameters);
if (notificationColor != null)
{
notificationBuilder.SetColor(notificationColor.Value);
}
if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBean)
{
// Using BigText notification style to support long message
var style = new NotificationCompat.BigTextStyle();
style.BigText(message);
notificationBuilder.SetStyle(style);
}
var category = string.Empty;
if (parameters.TryGetValue(CategoryKey, out var categoryContent))
{
category = categoryContent.ToString();
}
if (parameters.TryGetValue(ActionKey, out var actionContent))
{
category = actionContent.ToString();
}
var notificationCategories = CrossFirebasePushNotification.Current?.GetUserNotificationCategories();
if (notificationCategories != null && notificationCategories.Length > 0)
{
foreach (var userCat in notificationCategories)
{
if (userCat != null && userCat.Actions != null && userCat.Actions.Count > 0)
{
foreach (var action in userCat.Actions)
{
var aRequestCode = Guid.NewGuid().GetHashCode();
if (userCat.Category.Equals(category, StringComparison.CurrentCultureIgnoreCase))
{
Intent actionIntent = null;
PendingIntent pendingActionIntent = null;
if (action.Type == NotificationActionType.Foreground)
{
actionIntent = typeof(Activity).IsreplacedignableFrom(FirebasePushNotificationManager.NotificationActivityType) ? new Intent(Application.Context, FirebasePushNotificationManager.NotificationActivityType) : (FirebasePushNotificationManager.DefaultNotificationActivityType == null ? context.PackageManager.GetLaunchIntentForPackage(context.PackageName) : new Intent(Application.Context, FirebasePushNotificationManager.DefaultNotificationActivityType));
if (FirebasePushNotificationManager.NotificationActivityFlags != null)
{
actionIntent.SetFlags(FirebasePushNotificationManager.NotificationActivityFlags.Value);
}
extras.PutString(ActionIdentifierKey, action.Id);
actionIntent.PutExtras(extras);
pendingActionIntent = PendingIntent.GetActivity(context, aRequestCode, actionIntent, PendingIntentFlags.UpdateCurrent);
}
else
{
actionIntent = new Intent(context, typeof(PushNotificationActionReceiver));
extras.PutString(ActionIdentifierKey, action.Id);
actionIntent.PutExtras(extras);
pendingActionIntent = PendingIntent.GetBroadcast(context, aRequestCode, actionIntent, PendingIntentFlags.UpdateCurrent);
}
notificationBuilder.AddAction(new NotificationCompat.Action.Builder(context.Resources.GetIdentifier(action.Icon, "drawable", Application.Context.PackageName), action.replacedle, pendingActionIntent).Build());
}
}
}
}
}
OnBuildNotification(notificationBuilder, parameters);
var notificationManager = (NotificationManager)context.GetSystemService(Context.NotificationService);
notificationManager.Notify(tag, notifyId, notificationBuilder.Build());
}
19
Source : DefaultPushNotificationHandler.android.cs
with MIT License
from CrossGeeks
with MIT License
from CrossGeeks
public virtual void OnReceived(IDictionary<string, object> parameters)
{
System.Diagnostics.Debug.WriteLine($"{DomainTag} - OnReceived");
if ((parameters.TryGetValue(SilentKey, out var silent) && (silent.ToString() == "true" || silent.ToString() == "1")) || (IsInForeground() && (!(!parameters.ContainsKey(ChannelIdKey) && parameters.TryGetValue(PriorityKey, out var imp) && ($"{imp}" == "high" || $"{imp}" == "max")) || (!parameters.ContainsKey(PriorityKey) && !parameters.ContainsKey(ChannelIdKey) && PushNotificationManager.DefaultNotificationChannelImportance != NotificationImportance.High && PushNotificationManager.DefaultNotificationChannelImportance != NotificationImportance.Max))))
{
return;
}
Context context = Application.Context;
var notifyId = 0;
var replacedle = context.ApplicationInfo.LoadLabel(context.PackageManager);
var message = string.Empty;
var tag = string.Empty;
var notificationNumber = 0;
var showWhenVisible = PushNotificationManager.ShouldShowWhen;
var soundUri = PushNotificationManager.SoundUri;
var largeIconResource = PushNotificationManager.LargeIconResource;
var smallIconResource = PushNotificationManager.IconResource;
var notificationColor = PushNotificationManager.Color;
var chanId = PushNotificationManager.DefaultNotificationChannelId;
if (!string.IsNullOrEmpty(PushNotificationManager.NotificationContentTextKey) && parameters.TryGetValue(PushNotificationManager.NotificationContentTextKey, out var notificationContentText))
{
message = notificationContentText.ToString();
}
else if (parameters.TryGetValue(AlertKey, out var alert))
{
message = $"{alert}";
}
else if (parameters.TryGetValue(Boreplacedy, out var body))
{
message = $"{body}";
}
else if (parameters.TryGetValue(MessageKey, out var messageContent))
{
message = $"{messageContent}";
}
else if (parameters.TryGetValue(SubreplacedleKey, out var subreplacedle))
{
message = $"{subreplacedle}";
}
else if (parameters.TryGetValue(TextKey, out var text))
{
message = $"{text}";
}
if (!string.IsNullOrEmpty(PushNotificationManager.NotificationContentreplacedleKey) && parameters.TryGetValue(PushNotificationManager.NotificationContentreplacedleKey, out var notificationContentreplacedle))
{
replacedle = notificationContentreplacedle.ToString();
}
else if (parameters.TryGetValue(replacedleKey, out var replacedleContent))
{
if (!string.IsNullOrEmpty(message))
{
replacedle = $"{replacedleContent}";
}
else
{
message = $"{replacedleContent}";
}
}
if (parameters.TryGetValue(IdKey, out var id))
{
try
{
notifyId = Convert.ToInt32(id);
}
catch (Exception ex)
{
// Keep the default value of zero for the notify_id, but log the conversion problem.
System.Diagnostics.Debug.WriteLine($"Failed to convert {id} to an integer {ex}");
}
}
if (parameters.TryGetValue(NumberKey, out var num))
{
try
{
notificationNumber = Convert.ToInt32(num);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"Failed to convert {num} to an integer {ex}");
}
}
if (parameters.TryGetValue(ShowWhenKey, out var shouldShowWhen))
{
showWhenVisible = $"{shouldShowWhen}".ToLower() == "true";
}
if (parameters.TryGetValue(TagKey, out var tagContent))
{
tag = tagContent.ToString();
}
try
{
if (parameters.TryGetValue(SoundKey, out var sound))
{
var soundName = sound.ToString();
var soundResId = context.Resources.GetIdentifier(soundName, "raw", context.PackageName);
if (soundResId == 0 && soundName.IndexOf('.') != -1)
{
soundName = soundName.Substring(0, soundName.LastIndexOf('.'));
soundResId = context.Resources.GetIdentifier(soundName, "raw", context.PackageName);
}
soundUri = new Android.Net.Uri.Builder()
.Scheme(ContentResolver.SchemeAndroidResource)
.Path($"{context.PackageName}/{soundResId}")
.Build();
}
}
catch (Resources.NotFoundException ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
if (soundUri == null)
{
soundUri = RingtoneManager.GetDefaultUri(RingtoneType.Notification);
}
try
{
if (parameters.TryGetValue(IconKey, out var icon) && icon != null)
{
try
{
smallIconResource = context.Resources.GetIdentifier(icon.ToString(), "drawable", Application.Context.PackageName);
if (smallIconResource == 0)
{
smallIconResource = context.Resources.GetIdentifier($"{icon}", "mipmap", Application.Context.PackageName);
}
}
catch (Resources.NotFoundException ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
if (smallIconResource == 0)
smallIconResource = context.ApplicationInfo.Icon;
else
{
var name = context.Resources.GetResourceName(smallIconResource);
if (name == null)
{
smallIconResource = context.ApplicationInfo.Icon;
}
}
}
catch (Resources.NotFoundException ex)
{
smallIconResource = context.ApplicationInfo.Icon;
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
try
{
if (parameters.TryGetValue(LargeIconKey, out object largeIcon) && largeIcon != null)
{
largeIconResource = context.Resources.GetIdentifier($"{largeIcon}", "drawable", Application.Context.PackageName);
if (largeIconResource == 0)
{
largeIconResource = context.Resources.GetIdentifier($"{largeIcon}", "mipmap", Application.Context.PackageName);
}
}
if (largeIconResource > 0)
{
string name = context.Resources.GetResourceName(largeIconResource);
if (name == null)
largeIconResource = 0;
}
}
catch (Resources.NotFoundException ex)
{
largeIconResource = 0;
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
if (parameters.TryGetValue(ColorKey, out var color) && color != null)
{
try
{
notificationColor = Color.ParseColor(color.ToString());
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"{DomainTag} - Failed to parse color {ex}");
}
}
Intent resultIntent = typeof(Activity).IsreplacedignableFrom(PushNotificationManager.NotificationActivityType) ? new Intent(Application.Context, PushNotificationManager.NotificationActivityType) : (PushNotificationManager.DefaultNotificationActivityType == null ? context.PackageManager.GetLaunchIntentForPackage(context.PackageName) : new Intent(Application.Context, PushNotificationManager.DefaultNotificationActivityType));
var extras = new Bundle();
foreach (var p in parameters)
extras.PutString(p.Key, p.Value.ToString());
if (extras != null)
{
extras.PutInt(ActionNotificationIdKey, notifyId);
extras.PutString(ActionNotificationTagKey, tag);
resultIntent.PutExtras(extras);
}
if (PushNotificationManager.NotificationActivityFlags != null)
{
resultIntent.SetFlags(PushNotificationManager.NotificationActivityFlags.Value);
}
var requestCode = new Java.Util.Random().NextInt();
var pendingIntent = PendingIntent.GetActivity(context, requestCode, resultIntent, PendingIntentFlags.UpdateCurrent);
if (parameters.TryGetValue(ChannelIdKey, out var channelId) && channelId != null)
{
chanId = $"{channelId}";
}
var notificationBuilder = new NotificationCompat.Builder(context, chanId)
.SetSmallIcon(smallIconResource)
.SetContentreplacedle(replacedle)
.SetContentText(message)
.SetAutoCancel(true)
.SetWhen(Java.Lang.JavaSystem.CurrentTimeMillis())
.SetContentIntent(pendingIntent);
if (notificationNumber > 0)
{
notificationBuilder.SetNumber(notificationNumber);
}
if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBeanMr1)
{
notificationBuilder.SetShowWhen(showWhenVisible);
}
if (largeIconResource > 0)
{
Bitmap largeIconBitmap = BitmapFactory.DecodeResource(context.Resources, largeIconResource);
notificationBuilder.SetLargeIcon(largeIconBitmap);
}
if (parameters.TryGetValue(FullScreenIntentKey, out var fullScreenIntent) && ($"{fullScreenIntent}" == "true" || $"{fullScreenIntent}" == "1"))
{
var fullScreenPendingIntent = PendingIntent.GetActivity(context, requestCode, resultIntent, PendingIntentFlags.UpdateCurrent);
notificationBuilder.SetFullScreenIntent(fullScreenPendingIntent, true);
notificationBuilder.SetCategory(NotificationCompat.CategoryCall);
parameters[PriorityKey] = "high";
}
var deleteIntent = new Intent(context, typeof(PushNotificationDeletedReceiver));
deleteIntent.PutExtras(extras);
var pendingDeleteIntent = PendingIntent.GetBroadcast(context, requestCode, deleteIntent, PendingIntentFlags.UpdateCurrent);
notificationBuilder.SetDeleteIntent(pendingDeleteIntent);
if (Build.VERSION.SdkInt < BuildVersionCodes.O)
{
if (parameters.TryGetValue(PriorityKey, out var priority) && priority != null)
{
var priorityValue = $"{priority}";
if (!string.IsNullOrEmpty(priorityValue))
{
switch (priorityValue.ToLower())
{
case "max":
notificationBuilder.SetPriority(NotificationCompat.PriorityMax);
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
break;
case "high":
notificationBuilder.SetPriority(NotificationCompat.PriorityHigh);
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
break;
case "default":
notificationBuilder.SetPriority(NotificationCompat.PriorityDefault);
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
break;
case "low":
notificationBuilder.SetPriority(NotificationCompat.PriorityLow);
break;
case "min":
notificationBuilder.SetPriority(NotificationCompat.PriorityMin);
break;
default:
notificationBuilder.SetPriority(NotificationCompat.PriorityDefault);
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
break;
}
}
else
{
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
}
}
else
{
notificationBuilder.SetVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 });
}
try
{
notificationBuilder.SetSound(soundUri);
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"{DomainTag} - Failed to set sound {ex}");
}
}
// Try to resolve (and apply) localized parameters
ResolveLocalizedParameters(notificationBuilder, parameters);
if (notificationColor != null)
notificationBuilder.SetColor(notificationColor.Value);
if (Build.VERSION.SdkInt >= BuildVersionCodes.JellyBean)
{
// Using BigText notification style to support long message
var style = new NotificationCompat.BigTextStyle();
style.BigText(message);
notificationBuilder.SetStyle(style);
}
var category = string.Empty;
if (parameters.TryGetValue(CategoryKey, out var categoryContent))
category = categoryContent.ToString();
if (parameters.TryGetValue(ActionKey, out var actionContent))
category = actionContent.ToString();
var notificationCategories = CrossPushNotification.Current?.GetUserNotificationCategories();
if (notificationCategories != null && notificationCategories.Length > 0)
{
foreach (var userCat in notificationCategories)
{
if (userCat != null && userCat.Actions != null && userCat.Actions.Count > 0)
{
foreach (var action in userCat.Actions)
{
var aRequestCode = Guid.NewGuid().GetHashCode();
if (userCat.Category.Equals(category, StringComparison.CurrentCultureIgnoreCase))
{
Intent actionIntent = null;
PendingIntent pendingActionIntent = null;
NotificationCompat.Action nAction = null;
if (action.Type == NotificationActionType.Foreground)
{
actionIntent = typeof(Activity).IsreplacedignableFrom(PushNotificationManager.NotificationActivityType) ? new Intent(Application.Context, PushNotificationManager.NotificationActivityType) : (PushNotificationManager.DefaultNotificationActivityType == null ? context.PackageManager.GetLaunchIntentForPackage(context.PackageName) : new Intent(Application.Context, PushNotificationManager.DefaultNotificationActivityType));
if (PushNotificationManager.NotificationActivityFlags != null)
{
actionIntent.SetFlags(PushNotificationManager.NotificationActivityFlags.Value);
}
extras.PutString(ActionIdentifierKey, action.Id);
actionIntent.PutExtras(extras);
pendingActionIntent = PendingIntent.GetActivity(context, aRequestCode, actionIntent, PendingIntentFlags.UpdateCurrent);
nAction = new NotificationCompat.Action.Builder(context.Resources.GetIdentifier(action.Icon, "drawable", Application.Context.PackageName), action.replacedle, pendingActionIntent).Build();
}
else if (action.Type == NotificationActionType.Reply)
{
var input = new RemoteInput.Builder("Result").SetLabel(action.replacedle).Build();
actionIntent = new Intent(context, typeof(PushNotificationReplyReceiver));
extras.PutString(ActionIdentifierKey, action.Id);
actionIntent.PutExtras(extras);
pendingActionIntent = PendingIntent.GetBroadcast(context, aRequestCode, actionIntent, PendingIntentFlags.UpdateCurrent);
nAction = new NotificationCompat.Action.Builder(context.Resources.GetIdentifier(action.Icon, "drawable", Application.Context.PackageName), action.replacedle, pendingActionIntent)
.SetAllowGeneratedReplies(true)
.AddRemoteInput(input)
.Build();
}
else
{
actionIntent = new Intent(context, typeof(PushNotificationActionReceiver));
extras.PutString(ActionIdentifierKey, action.Id);
actionIntent.PutExtras(extras);
pendingActionIntent = PendingIntent.GetBroadcast(context, aRequestCode, actionIntent, PendingIntentFlags.UpdateCurrent);
nAction = new NotificationCompat.Action.Builder(context.Resources.GetIdentifier(action.Icon, "drawable", Application.Context.PackageName), action.replacedle, pendingActionIntent).Build();
}
notificationBuilder.AddAction(nAction);
}
}
}
}
}
OnBuildNotification(notificationBuilder, parameters);
var notificationManager = (NotificationManager)context.GetSystemService(Context.NotificationService);
notificationManager.Notify(tag, notifyId, notificationBuilder.Build());
}
19
Source : Scenario.cs
with MIT License
from csf-dev
with MIT License
from csf-dev
public override int GetHashCode()
{
return idenreplacedy.GetHashCode();
}
19
Source : ShortGuid.cs
with MIT License
from csharpvitamins
with MIT License
from csharpvitamins
public override int GetHashCode() => underlyingGuid.GetHashCode();
19
Source : UnpooledWriteStreamTests.cs
with MIT License
from cuteant
with MIT License
from cuteant
[Fact]
public async Task WriteBytesAsyncPartialWrite()
{
const int CopyLength = 200 * 1024;
const int SourceLength = 300 * 1024;
const int BufferCapacity = 400 * 1024;
var bytes = new byte[SourceLength];
var random = new Random(Guid.NewGuid().GetHashCode());
random.NextBytes(bytes);
IByteBuffer buffer = Unpooled.Buffer(BufferCapacity);
int initialWriterIndex = buffer.WriterIndex;
using (var stream = new PortionedMemoryStream(bytes, Enumerable.Repeat(1, int.MaxValue).Select(_ => random.Next(1, 10240))))
{
await buffer.WriteBytesAsync(stream, CopyLength);
}
replacedert.Equal(CopyLength, buffer.WriterIndex - initialWriterIndex);
replacedert.True(ByteBufferUtil.Equals(Unpooled.WrappedBuffer(bytes.Slice(0, CopyLength)), buffer));
}
19
Source : End2EndTests.cs
with MIT License
from cuteant
with MIT License
from cuteant
static int GetRandomPacketId() => Guid.NewGuid().GetHashCode() & ushort.MaxValue;
19
Source : NoiseEx.cs
with Apache License 2.0
from CyanCode
with Apache License 2.0
from CyanCode
public static Generator Turbulence(this Generator source, float frequency, float power)
{
return new Turbulence(source, Guid.NewGuid().GetHashCode())
{
Frequency = frequency,
Power = power,
OctaveCount = 6
};
}
19
Source : Extensions.cs
with GNU General Public License v3.0
from CypherCore
with GNU General Public License v3.0
from CypherCore
public static byte[] GenerateRandomKey(this byte[] s, int length)
{
var random = new Random((int)((uint)(Guid.NewGuid().GetHashCode() ^ 1 >> 89 << 2 ^ 42)).LeftRotate(13));
var key = new byte[length];
for (int i = 0; i < length; i++)
{
int randValue;
do
{
randValue = (int)((uint)random.Next(0xFF)).LeftRotate(1) ^ i;
} while (randValue > 0xFF && randValue <= 0);
key[i] = (byte)randValue;
}
return key;
}
19
Source : NetworkProfile.cs
with MIT License
from dahall
with MIT License
from dahall
public override int GetHashCode() => Id.GetHashCode();
19
Source : BackgroundCopyJob.cs
with MIT License
from dahall
with MIT License
from dahall
public override int GetHashCode() => ID.GetHashCode();
19
Source : PowerManager.cs
with MIT License
from dahall
with MIT License
from dahall
public override int GetHashCode() => Guid.GetHashCode();
19
Source : SubscriptionToken.cs
with Mozilla Public License 2.0
from daixin10310
with Mozilla Public License 2.0
from daixin10310
public override int GetHashCode()
{
return _token.GetHashCode();
}
19
Source : App.cs
with MIT License
from daltskin
with MIT License
from daltskin
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.AppName != null)
hashCode = hashCode * 59 + this.AppName.GetHashCode();
if (this.AppId != null)
hashCode = hashCode * 59 + this.AppId.GetHashCode();
hashCode = hashCode * 59 + this.AppType.GetHashCode();
hashCode = hashCode * 59 + this.PrincipalType.GetHashCode();
if (this.Clreplacedifications != null)
hashCode = hashCode * 59 + this.Clreplacedifications.GetHashCode();
if (this.DisplayName != null)
hashCode = hashCode * 59 + this.DisplayName.GetHashCode();
if (this.Description != null)
hashCode = hashCode * 59 + this.Description.GetHashCode();
hashCode = hashCode * 59 + this.SingleInstance.GetHashCode();
if (this.IconImage != null)
hashCode = hashCode * 59 + this.IconImage.GetHashCode();
if (this.InstallMetadata != null)
hashCode = hashCode * 59 + this.InstallMetadata.GetHashCode();
if (this.Owner != null)
hashCode = hashCode * 59 + this.Owner.GetHashCode();
if (this.CreatedDate != null)
hashCode = hashCode * 59 + this.CreatedDate.GetHashCode();
if (this.LastUpdatedDate != null)
hashCode = hashCode * 59 + this.LastUpdatedDate.GetHashCode();
if (this.LambdaSmartApp != null)
hashCode = hashCode * 59 + this.LambdaSmartApp.GetHashCode();
if (this.WebhookSmartApp != null)
hashCode = hashCode * 59 + this.WebhookSmartApp.GetHashCode();
if (this.Ui != null)
hashCode = hashCode * 59 + this.Ui.GetHashCode();
return hashCode;
}
}
19
Source : CommandResult.cs
with MIT License
from daltskin
with MIT License
from daltskin
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.Id != null)
hashCode = hashCode * 59 + this.Id.GetHashCode();
hashCode = hashCode * 59 + this.Status.GetHashCode();
return hashCode;
}
}
19
Source : CreateAppResponse.cs
with MIT License
from daltskin
with MIT License
from daltskin
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.App != null)
hashCode = hashCode * 59 + this.App.GetHashCode();
if (this.OauthClientId != null)
hashCode = hashCode * 59 + this.OauthClientId.GetHashCode();
if (this.OauthClientSecret != null)
hashCode = hashCode * 59 + this.OauthClientSecret.GetHashCode();
return hashCode;
}
}
19
Source : InstallConfiguration.cs
with MIT License
from daltskin
with MIT License
from daltskin
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.InstalledAppId != null)
hashCode = hashCode * 59 + this.InstalledAppId.GetHashCode();
if (this.ConfigurationId != null)
hashCode = hashCode * 59 + this.ConfigurationId.GetHashCode();
hashCode = hashCode * 59 + this.ConfigurationStatus.GetHashCode();
if (this.CreatedDate != null)
hashCode = hashCode * 59 + this.CreatedDate.GetHashCode();
if (this.LastUpdatedDate != null)
hashCode = hashCode * 59 + this.LastUpdatedDate.GetHashCode();
return hashCode;
}
}
19
Source : InstallConfigurationDetail.cs
with MIT License
from daltskin
with MIT License
from daltskin
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.InstalledAppId != null)
hashCode = hashCode * 59 + this.InstalledAppId.GetHashCode();
if (this.ConfigurationId != null)
hashCode = hashCode * 59 + this.ConfigurationId.GetHashCode();
hashCode = hashCode * 59 + this.ConfigurationStatus.GetHashCode();
if (this.Config != null)
hashCode = hashCode * 59 + this.Config.GetHashCode();
if (this.CreatedDate != null)
hashCode = hashCode * 59 + this.CreatedDate.GetHashCode();
if (this.LastUpdatedDate != null)
hashCode = hashCode * 59 + this.LastUpdatedDate.GetHashCode();
return hashCode;
}
}
19
Source : PagedLocation.cs
with MIT License
from daltskin
with MIT License
from daltskin
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.LocationId != null)
hashCode = hashCode * 59 + this.LocationId.GetHashCode();
if (this.Name != null)
hashCode = hashCode * 59 + this.Name.GetHashCode();
return hashCode;
}
}
19
Source : Room.cs
with MIT License
from daltskin
with MIT License
from daltskin
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.RoomId != null)
hashCode = hashCode * 59 + this.RoomId.GetHashCode();
if (this.LocationId != null)
hashCode = hashCode * 59 + this.LocationId.GetHashCode();
if (this.Name != null)
hashCode = hashCode * 59 + this.Name.GetHashCode();
if (this.BackgroundImage != null)
hashCode = hashCode * 59 + this.BackgroundImage.GetHashCode();
return hashCode;
}
}
19
Source : Location.cs
with MIT License
from daltskin
with MIT License
from daltskin
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.LocationId != null)
hashCode = hashCode * 59 + this.LocationId.GetHashCode();
if (this.Name != null)
hashCode = hashCode * 59 + this.Name.GetHashCode();
if (this.CountryCode != null)
hashCode = hashCode * 59 + this.CountryCode.GetHashCode();
hashCode = hashCode * 59 + this.Lareplacedude.GetHashCode();
hashCode = hashCode * 59 + this.Longitude.GetHashCode();
hashCode = hashCode * 59 + this.RegionRadius.GetHashCode();
if (this.TemperatureScale != null)
hashCode = hashCode * 59 + this.TemperatureScale.GetHashCode();
if (this.TimeZoneId != null)
hashCode = hashCode * 59 + this.TimeZoneId.GetHashCode();
if (this.Locale != null)
hashCode = hashCode * 59 + this.Locale.GetHashCode();
if (this.BackgroundImage != null)
hashCode = hashCode * 59 + this.BackgroundImage.GetHashCode();
if (this.AdditionalProperties != null)
hashCode = hashCode * 59 + this.AdditionalProperties.GetHashCode();
return hashCode;
}
}
19
Source : GenerateAppOAuthResponse.cs
with MIT License
from daltskin
with MIT License
from daltskin
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.OauthClientDetails != null)
hashCode = hashCode * 59 + this.OauthClientDetails.GetHashCode();
if (this.OauthClientId != null)
hashCode = hashCode * 59 + this.OauthClientId.GetHashCode();
if (this.OauthClientSecret != null)
hashCode = hashCode * 59 + this.OauthClientSecret.GetHashCode();
return hashCode;
}
}
19
Source : PagedMessageTemplate.cs
with MIT License
from daltskin
with MIT License
from daltskin
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.AppId != null)
hashCode = hashCode * 59 + this.AppId.GetHashCode();
if (this.MessageTemplateKey != null)
hashCode = hashCode * 59 + this.MessageTemplateKey.GetHashCode();
return hashCode;
}
}
19
Source : Schedule.cs
with MIT License
from daltskin
with MIT License
from daltskin
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.InstalledAppId != null)
hashCode = hashCode * 59 + this.InstalledAppId.GetHashCode();
if (this.LocationId != null)
hashCode = hashCode * 59 + this.LocationId.GetHashCode();
if (this.ScheduledExecutions != null)
hashCode = hashCode * 59 + this.ScheduledExecutions.GetHashCode();
if (this.Name != null)
hashCode = hashCode * 59 + this.Name.GetHashCode();
if (this.Cron != null)
hashCode = hashCode * 59 + this.Cron.GetHashCode();
return hashCode;
}
}
19
Source : InstalledApp.cs
with MIT License
from daltskin
with MIT License
from daltskin
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.InstalledAppId != null)
hashCode = hashCode * 59 + this.InstalledAppId.GetHashCode();
hashCode = hashCode * 59 + this.InstalledAppType.GetHashCode();
hashCode = hashCode * 59 + this.InstalledAppStatus.GetHashCode();
if (this.DisplayName != null)
hashCode = hashCode * 59 + this.DisplayName.GetHashCode();
if (this.AppId != null)
hashCode = hashCode * 59 + this.AppId.GetHashCode();
if (this.ReferenceId != null)
hashCode = hashCode * 59 + this.ReferenceId.GetHashCode();
if (this.LocationId != null)
hashCode = hashCode * 59 + this.LocationId.GetHashCode();
if (this.Owner != null)
hashCode = hashCode * 59 + this.Owner.GetHashCode();
if (this.Notices != null)
hashCode = hashCode * 59 + this.Notices.GetHashCode();
if (this.CreatedDate != null)
hashCode = hashCode * 59 + this.CreatedDate.GetHashCode();
if (this.LastUpdatedDate != null)
hashCode = hashCode * 59 + this.LastUpdatedDate.GetHashCode();
if (this.Ui != null)
hashCode = hashCode * 59 + this.Ui.GetHashCode();
if (this.IconImage != null)
hashCode = hashCode * 59 + this.IconImage.GetHashCode();
hashCode = hashCode * 59 + this.Clreplacedifications.GetHashCode();
hashCode = hashCode * 59 + this.PrincipalType.GetHashCode();
hashCode = hashCode * 59 + this.RestrictionTier.GetHashCode();
hashCode = hashCode * 59 + this.SingleInstance.GetHashCode();
return hashCode;
}
}
19
Source : PagedApp.cs
with MIT License
from daltskin
with MIT License
from daltskin
public override int GetHashCode()
{
unchecked // Overflow is fine, just wrap
{
int hashCode = 41;
if (this.AppName != null)
hashCode = hashCode * 59 + this.AppName.GetHashCode();
if (this.AppId != null)
hashCode = hashCode * 59 + this.AppId.GetHashCode();
hashCode = hashCode * 59 + this.AppType.GetHashCode();
if (this.Clreplacedifications != null)
hashCode = hashCode * 59 + this.Clreplacedifications.GetHashCode();
if (this.DisplayName != null)
hashCode = hashCode * 59 + this.DisplayName.GetHashCode();
if (this.Description != null)
hashCode = hashCode * 59 + this.Description.GetHashCode();
if (this.IconImage != null)
hashCode = hashCode * 59 + this.IconImage.GetHashCode();
if (this.Owner != null)
hashCode = hashCode * 59 + this.Owner.GetHashCode();
if (this.CreatedDate != null)
hashCode = hashCode * 59 + this.CreatedDate.GetHashCode();
if (this.LastUpdatedDate != null)
hashCode = hashCode * 59 + this.LastUpdatedDate.GetHashCode();
return hashCode;
}
}
19
Source : MoveSchedule.cs
with GNU General Public License v3.0
from darakeon
with GNU General Public License v3.0
from darakeon
public override Int32 GetHashCode()
{
return Guid.GetHashCode();
}
19
Source : EchoProcedureTests.cs
with Apache License 2.0
from DataAction
with Apache License 2.0
from DataAction
private void ExecuteProcedure(string connectionString)
{
using (var connection = new AseConnection(connectionString))
{
var expected = Guid.NewGuid().GetHashCode();
var parameters = new DynamicParameters();
parameters.Add("@RETURN_VALUE", -1, DbType.Int32, ParameterDirection.ReturnValue);
parameters.Add("@nEchoValueReturn", -1, DbType.Int32, ParameterDirection.Output);
parameters.Add("@nEchoValue", expected, DbType.Int32, ParameterDirection.Input);
using (var multi = connection.QueryMultiple("sp_test_echo", parameters, commandType: CommandType.StoredProcedure))
{
var t1Echo = multi.Read<int>().FirstOrDefault();
var t2Echo = multi.Read<int>().FirstOrDefault();
replacedert.AreEqual(expected, t1Echo);
replacedert.AreEqual(expected + 1, t2Echo);
var rReturn = parameters.Get<int>("@RETURN_VALUE");
var rOutput = parameters.Get<int>("@nEchoValueReturn");
replacedert.AreEqual(expected, rReturn);
replacedert.AreEqual(expected, rOutput);
}
}
}
19
Source : AggregateRootWithEventSourcing.cs
with MIT License
from daxnet
with MIT License
from daxnet
public override int GetHashCode() => this.id.GetHashCode();
19
Source : ServiceInfo.cs
with Apache License 2.0
from DeepOceanSoft
with Apache License 2.0
from DeepOceanSoft
public override int GetHashCode()
{
return ServiceId.GetHashCode();
}
19
Source : BulkItem.cs
with MIT License
from delawarePro
with MIT License
from delawarePro
public override int GetHashCode()
{
unchecked
{
return (FieldId.GetHashCode() * 397) ^
(Language == null ? 0 : StringComparer.OrdinalIgnoreCase.GetHashCode(Language)) ^
Version.GetHashCode();
}
}
19
Source : AggregateId.cs
with MIT License
from devmentors
with MIT License
from devmentors
public override int GetHashCode()
{
return Value.GetHashCode();
}
19
Source : MetadataBlock.cs
with Apache License 2.0
from dnSpy
with Apache License 2.0
from dnSpy
public override int GetHashCode()
{
return Hash.Combine(
Hash.Combine(this.Pointer.GetHashCode(), this.Size),
Hash.Combine(this.ModuleVersionId.GetHashCode(), this.GenerationId.GetHashCode()));
}
19
Source : MetadataContextId.cs
with Apache License 2.0
from dnSpy
with Apache License 2.0
from dnSpy
public override int GetHashCode()
{
return ModuleVersionId.GetHashCode();
}
19
Source : OverridesBenchmarks.cs
with MIT License
from dodopizza
with MIT License
from dodopizza
[Benchmark]
[BenchmarkCategory("GetHashCode")]
[ArgumentsSource(nameof(GuidArgs))]
public int guid_GetHashCode(Guid guid)
{
return guid.GetHashCode();
}
19
Source : Utility.Algorithm.cs
with MIT License
from DonnYep
with MIT License
from DonnYep
public static int RandomRange(int minValue, int maxValue)
{
if (minValue >= maxValue)
throw new ArgumentNullException("RandomRange : minValue is greater than or equal to maxValue");
int seed = Guid.NewGuid().GetHashCode();
Random random = new Random(seed);
int result = random.Next(minValue, maxValue);
return result;
}
19
Source : RandomUtility.cs
with MIT License
from dotnet-toolbelt
with MIT License
from dotnet-toolbelt
public static Random GetUniqueRandom()
{
return new Random(Guid.NewGuid().GetHashCode());
}
19
Source : SortVersion.cs
with MIT License
from dotnetGame
with MIT License
from dotnetGame
public override int GetHashCode()
{
return m_NlsVersion * 7 | m_SortId.GetHashCode();
}
19
Source : Address.generated.cs
with MIT License
from Drizin
with MIT License
from Drizin
public override int GetHashCode()
{
unchecked
{
int hash = 17;
hash = hash * 23 + (AddressLine1 == null ? 0 : AddressLine1.GetHashCode());
hash = hash * 23 + (AddressLine2 == null ? 0 : AddressLine2.GetHashCode());
hash = hash * 23 + (City == null ? 0 : City.GetHashCode());
hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
hash = hash * 23 + (PostalCode == null ? 0 : PostalCode.GetHashCode());
hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode());
hash = hash * 23 + (StateProvinceId == default(int) ? 0 : StateProvinceId.GetHashCode());
return hash;
}
}
19
Source : AddressType.generated.cs
with MIT License
from Drizin
with MIT License
from Drizin
public override int GetHashCode()
{
unchecked
{
int hash = 17;
hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
hash = hash * 23 + (Name == null ? 0 : Name.GetHashCode());
hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode());
return hash;
}
}
19
Source : ProductDescription.generated.cs
with MIT License
from Drizin
with MIT License
from Drizin
public override int GetHashCode()
{
unchecked
{
int hash = 17;
hash = hash * 23 + (Description == null ? 0 : Description.GetHashCode());
hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode());
return hash;
}
}
19
Source : ProductInventory.generated.cs
with MIT License
from Drizin
with MIT License
from Drizin
public override int GetHashCode()
{
unchecked
{
int hash = 17;
hash = hash * 23 + (Bin == default(byte) ? 0 : Bin.GetHashCode());
hash = hash * 23 + (LocationId == default(short) ? 0 : LocationId.GetHashCode());
hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
hash = hash * 23 + (ProductId == default(int) ? 0 : ProductId.GetHashCode());
hash = hash * 23 + (Quanreplacedy == default(short) ? 0 : Quanreplacedy.GetHashCode());
hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode());
hash = hash * 23 + (Shelf == null ? 0 : Shelf.GetHashCode());
return hash;
}
}
19
Source : SalesOrderDetail.generated.cs
with MIT License
from Drizin
with MIT License
from Drizin
public override int GetHashCode()
{
unchecked
{
int hash = 17;
hash = hash * 23 + (CarrierTrackingNumber == null ? 0 : CarrierTrackingNumber.GetHashCode());
hash = hash * 23 + (LineTotal == default(decimal) ? 0 : LineTotal.GetHashCode());
hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
hash = hash * 23 + (OrderQty == default(short) ? 0 : OrderQty.GetHashCode());
hash = hash * 23 + (ProductId == default(int) ? 0 : ProductId.GetHashCode());
hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode());
hash = hash * 23 + (SalesOrderId == default(int) ? 0 : SalesOrderId.GetHashCode());
hash = hash * 23 + (SpecialOfferId == default(int) ? 0 : SpecialOfferId.GetHashCode());
hash = hash * 23 + (UnitPrice == default(decimal) ? 0 : UnitPrice.GetHashCode());
hash = hash * 23 + (UnitPriceDiscount == default(decimal) ? 0 : UnitPriceDiscount.GetHashCode());
return hash;
}
}
19
Source : BusinessEntity.generated.cs
with MIT License
from Drizin
with MIT License
from Drizin
public override int GetHashCode()
{
unchecked
{
int hash = 17;
hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode());
return hash;
}
}
19
Source : BusinessEntityAddress.generated.cs
with MIT License
from Drizin
with MIT License
from Drizin
public override int GetHashCode()
{
unchecked
{
int hash = 17;
hash = hash * 23 + (AddressId == default(int) ? 0 : AddressId.GetHashCode());
hash = hash * 23 + (AddressTypeId == default(int) ? 0 : AddressTypeId.GetHashCode());
hash = hash * 23 + (BusinessEnreplacedyId == default(int) ? 0 : BusinessEnreplacedyId.GetHashCode());
hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode());
return hash;
}
}
19
Source : BusinessEntityContact.generated.cs
with MIT License
from Drizin
with MIT License
from Drizin
public override int GetHashCode()
{
unchecked
{
int hash = 17;
hash = hash * 23 + (BusinessEnreplacedyId == default(int) ? 0 : BusinessEnreplacedyId.GetHashCode());
hash = hash * 23 + (ContactTypeId == default(int) ? 0 : ContactTypeId.GetHashCode());
hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
hash = hash * 23 + (PersonId == default(int) ? 0 : PersonId.GetHashCode());
hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode());
return hash;
}
}
19
Source : Document.generated.cs
with MIT License
from Drizin
with MIT License
from Drizin
public override int GetHashCode()
{
unchecked
{
int hash = 17;
hash = hash * 23 + (ChangeNumber == default(int) ? 0 : ChangeNumber.GetHashCode());
hash = hash * 23 + (Doreplacedent1 == null ? 0 : Doreplacedent1.GetHashCode());
hash = hash * 23 + (DoreplacedentLevel == null ? 0 : DoreplacedentLevel.GetHashCode());
hash = hash * 23 + (DoreplacedentSummary == null ? 0 : DoreplacedentSummary.GetHashCode());
hash = hash * 23 + (FileExtension == null ? 0 : FileExtension.GetHashCode());
hash = hash * 23 + (FileName == null ? 0 : FileName.GetHashCode());
hash = hash * 23 + (FolderFlag == default(bool) ? 0 : FolderFlag.GetHashCode());
hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
hash = hash * 23 + (Owner == default(int) ? 0 : Owner.GetHashCode());
hash = hash * 23 + (Revision == null ? 0 : Revision.GetHashCode());
hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode());
hash = hash * 23 + (Status == default(byte) ? 0 : Status.GetHashCode());
hash = hash * 23 + (replacedle == null ? 0 : replacedle.GetHashCode());
return hash;
}
}
19
Source : EmailAddress.generated.cs
with MIT License
from Drizin
with MIT License
from Drizin
public override int GetHashCode()
{
unchecked
{
int hash = 17;
hash = hash * 23 + (BusinessEnreplacedyId == default(int) ? 0 : BusinessEnreplacedyId.GetHashCode());
hash = hash * 23 + (EmailAddress1 == null ? 0 : EmailAddress1.GetHashCode());
hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode());
hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode());
return hash;
}
}
See More Examples