This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Created by Ullrich Schäfer on 16/08/14. | |
// Bitmasks are a bit tricky in swift | |
// See http://natecook.com/blog/2014/07/swift-options-bitmask-generator/ | |
//enum LogFlag: Int32 { | |
// case Error = 0b1 | |
// case Warn = 0b10 | |
// case Info = 0b100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
w3wp.exe Error: 0 : [IdentityServer3.Core.Configuration.Hosting.ErrorPageFilterAttribute]: 07/07/15 04:14:12 +00:00 -- Exception accessing: /identity/permissions | |
System.InvalidOperationException: Sequence contains more than one element | |
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source) | |
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.DeserializeConvertable(JsonConverter converter, JsonReader reader, Type objectType, Object existingValue) | |
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty containerProperty, String id) | |
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id) | |
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.SetPropertyValue(JsonProperty property, JsonConverter propertyConverter, JsonContainerContract containerContract, Js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (BOOL) shouldAllowRotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation | |
{ | |
NSString* currentOrientation = @""; | |
switch (interfaceOrientation) | |
{ | |
case UIInterfaceOrientationLandscapeLeft: | |
currentOrientation = @"UIInterfaceOrientationLandscapeLeft"; | |
break; | |
case UIInterfaceOrientationLandscapeRight: | |
currentOrientation = @"UIInterfaceOrientationLandscapeRight"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// LocalizationHelper.h | |
// | |
// Created by Wim Haanstra on 9/30/10. | |
// Copyright 2010 Wim Haanstra. All rights reserved. | |
// | |
#import | |
@interface LocalizationHelper : NSObject { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// LocalizationHelper.h | |
// | |
// Created by Wim Haanstra on 9/30/10. | |
// Copyright 2010 Wim Haanstra. All rights reserved. | |
// | |
#import | |
@interface LocalizationHelper : NSObject { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool IsInt(this string text) | |
{ | |
int integer = 0; | |
return Int32.TryParse(text, out integer); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static public string ToValidFileName(this string name) | |
{ | |
string invalidChars = Regex.Escape(new string(Path.GetInvalidFileNameChars())); | |
string invalidReStr = string.Format(@"[{0}]+", invalidChars); | |
return Regex.Replace(name, invalidReStr, "_"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string ToSHA1(this string text, Encoding enc) | |
{ | |
byte[] buffer = enc.GetBytes(text); | |
SHA1CryptoServiceProvider cryptoTransformSHA1 = | |
new SHA1CryptoServiceProvider(); | |
string hash = BitConverter.ToString( | |
cryptoTransformSHA1.ComputeHash(buffer)).Replace("-", ""); | |
return hash; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string Encrypt(this string Message, string passphrase = "") | |
{ | |
if (passphrase == "") | |
passphrase = ConfigurationManager.AppSettings["encrpytionPassphrase"]; | |
byte[] Results; | |
System.Text.UTF8Encoding UTF8 = new System.Text.UTF8Encoding(); | |
MD5CryptoServiceProvider HashProvider = new MD5CryptoServiceProvider(); | |
byte[] TDESKey = HashProvider.ComputeHash(UTF8.GetBytes(passphrase)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation | |
{ | |
return [WHUtilities shouldAllowRotateToInterfaceOrientation:interfaceOrientation]; | |
} |
OlderNewer