This file contains hidden or 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 hidden or 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]; | |
} |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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); | |
} |
NewerOlder