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
services.Configure<ApiBehaviorOptions>(options => | |
{ | |
options.SuppressModelStateInvalidFilter = true; | |
}); |
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
using Octokit; | |
using Polly; | |
using System; | |
using System.Collections.Generic; | |
using System.Collections.ObjectModel; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Reflection; | |
using System.Text; |
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
using System.Management; | |
namespace Windows.Security.FileSystem | |
{ | |
public class BitLocker | |
{ | |
private readonly string _computerIp; | |
public BitLocker(string computerIp) | |
{ |
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 ProcessStartInfo GetProcessStartInfo(string domain,string username, string password, string path,string args) | |
{ | |
SecureString securePwd = new SecureString(); | |
foreach (char ch in _password) | |
securePwd.AppendChar(ch); | |
ProcessStartInfo processInfo = new ProcessStartInfo(path); | |
processInfo.UserName = username; |
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 async Task<IHttpActionResult> SaveFile(string diskFolderPath) | |
{ | |
var path = Path.GetTempPath(); | |
if (!Request.Content.IsMimeMultipartContent("form-data")) | |
{ | |
throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.UnsupportedMediaType)); | |
} | |
MultipartFormDataStreamProvider streamProvider = new MultipartFormDataStreamProvider(path); |
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
if (Request.Properties.ContainsKey("MS_HttpContext")) | |
{ | |
var ctx = Request.Properties["MS_HttpContext"] as HttpContextWrapper; | |
if (ctx != null) | |
{ | |
var ip = ctx.Request.UserHostAddress; | |
return ip; | |
} | |
} |
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 class PersianCalendarUtility | |
{ | |
public static string ConvertToPersianDate(DateTime? dateTime) | |
{ | |
return ConvertToPersianDate(dateTime, false); | |
} | |
public static string ConvertToPersianDate(DateTime? dateTime, bool showTime = false) | |
{ | |
if(!dateTime.HasValue) |
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 IsValid(string nationalCode) | |
{ | |
if (nationalCode.Trim().Length != 10) | |
return false; | |
try | |
{ | |
var controlBit = int.Parse(nationalCode[9].ToString()); | |
var sum = 0; |
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 GetEnumDisplayName(this Enum value,string unknownValue="Unknown") | |
{ | |
if(value == null) | |
{ | |
return unknownValue; | |
} | |
var type = value.GetType(); | |
if (!type.IsEnum) throw new ArgumentException(String.Format("Type '{0}' is not Enum", type)); | |
var members = type.GetMember(value.ToString()); |
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 IsValid(string shabaCode) | |
{ | |
if (string.IsNullOrWhiteSpace(shabaCode)) | |
return false; | |
shabaCode = shabaCode.Trim(); | |
if (!shabaCode.ToLower().StartsWith("ir")) | |
return false; |
NewerOlder