/// <summary> /// カレンダーデータを取得する /// </summary> /// <returns></returns> private Dictionary <string, bool> GetCalendarData() { try { string siteUrl = UrlTextBox.Text.Trim(); var parameters = GetParameter(); char delimit = CsvTypeRadio.Checked ? ',' : '\t'; List <string[]> errMsg = new List <string[]>(); EncodeType charset = EncodeType.UTF8; if (EncodeSJISRadio.Checked) { charset = EncodeType.SHIFT_JIS; } if (EncodeEUCRadio.Checked) { charset = EncodeType.EUC_JP; } if (EncodeUTF16Radio.Checked) { charset = EncodeType.UTF16; } Dictionary <string, bool> result = AsyncUtil.RunSync(() => GetCalendarValueFromWeb(errMsg, siteUrl, parameters, delimit, charset)); if (errMsg.Count > 0) { this.ShowWarningDialog(errMsg[0][0], errMsg[0][1]); } return(result); } catch (Exception ex) { throw Program.ThrowException(ex); } }
public CopiedTrack(ACB_Waveform waveform, AFS2_Entry awbEntry) { TrackBytes = awbEntry?.bytes; Streaming = (bool)waveform?.Streaming; Loop = (waveform?.LoopFlag == 0) ? false : true; encodeType = waveform.EncodeType; }
public static string FullEncode(string origString, EncodeType Type) { string newString = ""; char[] chars = origString.ToCharArray(); foreach (Char strChars in chars) { if (Type == EncodeType.UrlEncode) { newString += "%" + charToHexString(strChars); } if (Type == EncodeType.UrlEncodeUTF8) { newString += "%u00" + charToHexString(strChars); } if (Type == EncodeType.AmpHex) { newString += "�" + charToHexString(strChars) + ";"; } if (Type == EncodeType.AmpHash) { newString += "&#" + AmpHash(strChars.ToString()) + ";"; } } return(newString); }
/// <summary> /// 将字节按指定类型解码成字符串 /// </summary> /// <param name="arr">待解码字节数组</param> /// <param name="type">编码类型</param> /// <returns></returns> public static string GetString(this byte[] arr, EncodeType type) { string result = ""; switch (type) { case EncodeType.Encode: result = GetString(arr); break; case EncodeType.Hex: var sBuilder = new StringBuilder(); for (int i = 0; i < arr.Length; i++) { // 16进制 sBuilder.Append(arr[i].ToString("x2")); } result = sBuilder.ToString(); break; case EncodeType.Base64: result = Convert.ToBase64String(arr); break; } return(result); }
public static string CharEncode(string origString, string EncChars, EncodeType Type) { string newString = ""; Char[] origArray = origString.ToCharArray(); foreach (Char strArray in origArray) { if (EncChars.Contains(strArray.ToString())) { if (Type == EncodeType.UrlEncode) newString += "%" + charToHexString(strArray); if (Type == EncodeType.UrlEncodeUTF8) newString += "%u00" + charToHexString(strArray); if (Type == EncodeType.AmpHex) newString += "�" + charToHexString(strArray) + ";"; if (Type == EncodeType.AmpHash) newString += "�" + AmpHash(strArray.ToString()) + ";"; if (Type == EncodeType.HtmlEncode) newString += HttpUtility.HtmlEncode(strArray.ToString()); } else { newString += strArray; } } return newString; }
/// <summary> /// Encode content to badges /// </summary> /// <param name="encodeType"></param> /// <param name="protocol"></param> /// <param name="content"></param> /// <param name="receiver"></param> /// <returns></returns> public List <Badge> Encode(EncodeType encodeType, Protocol protocol, string content, string receiver = "") { BigInteger bigInt = 0; var maxDataBits = 35; // bit 0 -> type if (encodeType == EncodeType.Unicast) { bigInt |= 1; } else { maxDataBits += 13; } // encode content (application layer) var contentInt = ContentEncoder.EncodeContent(protocol, content, maxDataBits); // transaction var transactionInt = GenerateTransactionCode(encodeType, protocol, bigInt, contentInt, receiver); // phyiscal var badges = E2HttpProtocol.GenerateBadges(transactionInt); return(badges); }
private static object CreateNewParm(EncodeType encodeType) { object parm = new object(); switch (encodeType) { case EncodeType.RsaEncode: case EncodeType.RsaDecode: break; case EncodeType.HtmlEncode: case EncodeType.HtmlDecode: parm = 0; break; case EncodeType.UrlEncode: case EncodeType.UrlDecode: parm = new UrlEncodeParm(); break; case EncodeType.UnicodeEncode: case EncodeType.UnicodeDecode: break; case EncodeType.Base64Encode: case EncodeType.Base64Decode: parm = "utf-8"; break; case EncodeType.MD5Encode: break; } return(parm); }
Int32 OnHeaderData(Byte[] buf, Int32 size, Int32 nmemb, Object extraData) { try { string s = System.Text.Encoding.ASCII.GetString(buf); //Match m = Regex.Match(s, @"Set-Cookie:\s*(.*?)(;\s*expires\s*=|;\s*domain\s*=|;\s*path\s*=|\r\n)", RegexOptions.Singleline); //if (m.Success) // Cookie = m.Result("$1"); Match m = Regex.Match(s, @"Content-Length:\s*(\d+)", RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.IgnoreCase); if (m.Success) { content_length = int.Parse(m.Result("$1")); received_length = 0; return(size * nmemb); } m = Regex.Match(s, @"Content-Encoding:\s*(\w+)", RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.IgnoreCase); if (m.Success) { if (m.Result("$1").Contains("gzip")) { encode_type = EncodeType.GZIP; result_ms = new MemoryStream(); gzip = new GZipStream(result_ms, CompressionMode.Decompress); } else if (m.Result("$1").Contains("deflate")) { encode_type = EncodeType.DEFLATE; result_ms = new MemoryStream(); deflate = new DeflateStream(result_ms, CompressionMode.Decompress); } return(size * nmemb); } m = Regex.Match(s, @"Content-Type:\s*(.+)", RegexOptions.Singleline | RegexOptions.Compiled | RegexOptions.IgnoreCase); if (m.Success) { if (!Regex.IsMatch(m.Result("$1"), WR.DownloadableContentTypePattern, RegexOptions.Compiled | RegexOptions.IgnoreCase)) { easy.Cleanup(); WR.web_routine_status = WebRoutineStatus.UNACCEPTABLE_CONTENT_TYPE; WR.log.Write("Unacceptable Content-Type:" + m.Result("$1")); } return(size * nmemb); } } catch (ThreadAbortException) { } catch (Exception error) { WR.log.Error(error); } return(size * nmemb); }
public static CharMap CharMap(this EncodeType EncodeType) { if (CharMaps.ContainsKey(EncodeType)) { return(CharMaps[EncodeType]); } throw new Exception("Bảng mã không tồn tại."); }
public string ConvertFrom(EncodeType fromEncodeType, string text) { var fromMap = fromEncodeType.CharMap(); text = DecodeInternal(text, fromMap); text = EncodeInternal(text, myMap); return(text); }
public string ConvertTo(EncodeType toEncodeType, string text) { var toMap = toEncodeType.CharMap(); text = DecodeInternal(text, myMap); text = EncodeInternal(text, toMap); return(text); }
public override System.Xml.XmlNode ToXml(System.Xml.XmlNode node) { var ctl = node.OwnerDocument.CreateElement("barcode"); Helper.XmlHelper.AddAttribute("encoding", EncodeType.ToString(), ctl); Helper.XmlHelper.AddAttribute("text", Text, ctl); Helper.XmlHelper.AddAttribute("text-visible", ShowText.ToString(), ctl); return(base.ToXml(ctl)); }
public string ScreenShotJPG(string path, Camera cam) { m_Camera = cam; m_SavePath = path + m_Camera.name + " " + (Screen.width * m_Scaler) + "x" + (Screen.height * m_Scaler) + " " + System.DateTime.Now.ToString("dddd MMM dd yyyy HH_mm_ss") + System.DateTime.Now.Millisecond.ToString() + ".jpg"; m_EncodeType = EncodeType.JPG; m_RenderAtEndOfFrame = true; return(m_SavePath); }
/// <summary> /// 加盐加密 /// </summary> /// <param name="message">被加密消息</param> /// <param name="encodeType">加密类型</param> /// <param name="salt">随机字符串(盐)</param> /// <returns>加密结果(大写十六进制形式)</returns> public static string SaltEncodeString(this string message, EncodeType encodeType, string salt) { switch (encodeType) { case EncodeType.MD5: return((message + salt).GetMD5()); default: return((message + salt).GetSHA256()); } }
static EncodeMethod() { var types = Assembly.GetExecutingAssembly().DefinedTypes.Where(dt => dt.IsClass && dt.IsGenericTypeDefinition && Array.Exists(dt.GetInterfaces(), t => t.GetGenericTypeDefinition() == typeof(IEncoder <>))); types?.ToList().ForEach(item => { EncodeType et = (item.GetCustomAttribute(typeof(EncodeTypeAttribute)) as EncodeTypeAttribute).encodetype; if (et != EncodeType.None && !typesdic.ContainsKey(et)) { typesdic.Add(et, item); } }); }
/// <summary> /// /// </summary> /// <param name="input"></param> /// <param name="encodeMode"></param> /// <returns></returns> public static byte[]? Encode(this byte[] input, EncodeType encodeMode) { using HashAlgorithm encoder = encodeMode switch { EncodeType.MD5 => MD5.Create(), EncodeType.SHA1 => SHA1.Create(), EncodeType.SHA256 => SHA256.Create(), EncodeType.SHA384 => SHA384.Create(), EncodeType.SHA512 => SHA512.Create(), _ => throw new ArgumentOutOfRangeException(nameof(encodeMode)), }; return(encoder?.ComputeHash(input)); }
public void UndoableReplaceTrack(byte[] trackBytes, bool streaming, EncodeType encodeType) { if (WaveformWrapper == null) { return; } List <IUndoRedo> undos = WrapperRoot.AcbFile.ReplaceTrackOnWaveform(WaveformWrapper.WaveformRef, trackBytes, streaming, encodeType); undos.AddRange(WrapperRoot.AcbFile.UpdateCueLength(CueWrapper.CueRef)); UpdateProperties(); undos.Add(new UndoActionDelegate(this, "UpdateProperties", true)); UndoManager.Instance.AddUndo(new CompositeUndo(undos, "Replace Track")); }
public static XEncodeAndDecodeBase GetEncodeAndDecodeTool(EncodeType type) { switch (type) { case EncodeType.DesEncode: return(new XDesEncodeDecode()); case EncodeType.Md5: return(new XMD5EncodeAndDecode()); default: return(null); } }
public static string EncodeUrlParameter(EncodeType encodeType, string name, string value, UrlParameterSeparator prepend = UrlParameterSeparator.None, bool allowBlank = true) { if (null == name) { throw new ArgumentNullException("name"); } if (null == value) { throw new ArgumentNullException("value"); } value = value.Trim(); if (allowBlank || !string.IsNullOrEmpty(value)) { Func<string, string> encoder = (s) => { return EncodeType.Url == encodeType ? HttpUtility.UrlEncode(s) : HttpUtility.HtmlEncode(s); }; return String.Format(CultureInfo.InvariantCulture, "{0}{1}={2}", prepend.ToEnumValueString(), encoder(name), encoder(value)); } return string.Empty; }
/// <summary> /// 编码操作 /// </summary> /// <typeparam name="T">输入数据类型</typeparam> /// <param name="encodeType">指定的编码方式</param> /// <param name="str">输入的待编码变量 可以是object int String等 最终都会通过Convert.ToString转化为字符串</param> /// <param name="parm">非通用字段 例如编码结果大小写 连续编码次数等</param> /// <returns>返回编码后的结果</returns> public static T Encode <T>(EncodeType encodeType, T str, object parm = null) { var encodertype = typesdic[encodeType]; if (encodertype == null) { return(str); } if (parm == null) { parm = CreateNewParm(encodeType); } return(((IEncoder <T>)Activator.CreateInstance(encodertype.MakeGenericType(typeof(T)))).Encode(str, parm)); }
public Func <EncodeType, Func <string, string> > FromTo(EncodeType fromEncodeType) { var fromMap = fromEncodeType.CharMap(); return((toEncodeType) => { var toMap = toEncodeType.CharMap(); return (string text) => { text = DecodeInternal(text, fromMap); text = EncodeInternal(text, toMap); return text; }; }); }
internal static string getTextBuf(Stream fs, EncodeType encode) { byte[] strLength = new byte[4]; fs.Read(strLength, 0, 4); int Length = BitConverter.ToInt32(strLength, 0); byte[] StrBuf = new byte[Length]; fs.Read(StrBuf, 0, Length); if (encode == EncodeType.UTF8) { return(Encoding.UTF8.GetString(StrBuf)); } else { return(Encoding.Unicode.GetString(StrBuf)); } }
private XmlViewerVM(XmlViewerService service, CommandBindingCollection commandBindings, BigworldXmlReader reader) { _dispatcher = Dispatcher.CurrentDispatcher; _service = service; _encodeType = reader.EncodeType; var document = XDocument.Load(reader); document.TrimText(); this.Content = document.ToString(); this.SavedContent = this.Content; commandBindings.Add(new CommandBinding(ApplicationCommands.Save, this.ExecuteSave, this.CanExecuteSave)); commandBindings.Add(new CommandBinding(ApplicationCommands.SaveAs, this.ExecuteSaveAs)); }
private static BigInteger GenerateTransactionCode(EncodeType encodeType, Protocol protocol, BigInteger bigInt, BigInteger contentInt, string receiver) { // bit 1 - 13 -> ID / Extended body text bigInt <<= 13; if (encodeType == EncodeType.Unicast) { var receiverInt = ContentEncoder.EncodeContent(Protocol.UNICODE, receiver, int.MaxValue); bigInt |= receiverInt % 0x1FFF; } else if (encodeType == EncodeType.Broadcast) { var extendedContent = contentInt >> 35; bigInt |= extendedContent; } Console.WriteLine(bigInt.ToBinaryString()); // bit 14 - 18 -> Protocol type bigInt <<= 5; bigInt |= (int)protocol; // bit 19 - 21 -> CheckSum bigInt <<= 3; bigInt |= CheckSum(contentInt); // bit 22 - 56 -> Body text bigInt <<= 35; switch (protocol) { case Protocol.UNICODE: case Protocol.ASCII: case Protocol.ALPHABET: Console.WriteLine(contentInt.ToBinaryString()); var contentLeftOver = contentInt & 0x7FFFFFFFF; Console.WriteLine(contentLeftOver.ToBinaryString()); Console.WriteLine(); bigInt |= contentLeftOver; break; } var transactionInt = bigInt; return(transactionInt); }
public static QueryString DecodeQueryString(QueryString queryString, EncodeType type) { QueryString newQueryString = new QueryString(); string nm; string val; foreach (string name in queryString) { nm = name; switch (type) { case EncodeType.None: val = HttpContext.Current.Server.UrlDecode(queryString[name]); break; case EncodeType.Hex: val = DeHex(queryString[name]); break; case EncodeType.GZip: val = Compression.DeCompress(HttpContext.Current.Server.UrlDecode(queryString[name]), CompressionType.GZip); break; case EncodeType.BZip2: val = Compression.DeCompress(HttpContext.Current.Server.UrlDecode(queryString[name]), CompressionType.BZip2); break; case EncodeType.GZipHex: val = DeHex(Compression.DeCompress(HttpContext.Current.Server.UrlDecode(queryString[name]), CompressionType.GZip)); break; case EncodeType.BZip2Hex: val = DeHex(Compression.DeCompress(HttpContext.Current.Server.UrlDecode(queryString[name]), CompressionType.BZip2)); break; default: val = DeHex(queryString[name]); break; } newQueryString.Add(nm, val); } return(newQueryString); }
public string ScreenShotPNG(string path, Camera cam, bool AddDatTime) { m_Camera = cam; if (AddDatTime) { m_SavePath = path + m_Camera.name + " " + (Screen.width * m_Scaler) + "x" + (Screen.height * m_Scaler) + " " + System.DateTime.Now.ToString("dddd MMM dd yyyy HH_mm_ss") + System.DateTime.Now.Millisecond.ToString() + ".png"; } else { m_SavePath = path + ".png"; } m_EncodeType = EncodeType.PNG; m_RenderAtEndOfFrame = true; return(m_SavePath); }
//Only converts between supported formats! public static FileType GetFileType(EncodeType encodeType) { switch (encodeType) { case EncodeType.HCA: case EncodeType.HCA_ALT: return(FileType.Hca); case EncodeType.ADX: return(FileType.Adx); case EncodeType.ATRAC9: return(FileType.Atrac9); default: return(FileType.NotSet); } }
//高字节范围:B0~F7 //低字节范围:A1~FE private string ByteToString(byte[] b, EncodeType flag) { if (b == null) { return(""); } //if (isValidGBK(b) == false) return ""; Encoding enc; string str = ""; if (flag == EncodeType.ISO88591 || flag == EncodeType.UTF8) { enc = Encoding.GetEncoding("UTF-8"); str = enc.GetString(b); } else { byte[] arr; if (b.Length > 2 && ((b[0] == 0xfe && b[1] == 0xff) || (b[1] == 0xfe && b[0] == 0xff))) { arr = new byte[b.Length - 2]; Array.Copy(b, 2, arr, 0, b.Length - 2); enc = Encoding.GetEncoding("UTF-16"); } else { arr = b; enc = Encoding.GetEncoding("GBK"); } str = enc.GetString(arr); } string[] group = str.Split('\0'); string ret = ""; foreach (string s in group) { ret += s; } return(ret); }
public static string EncodeUrlParameter(EncodeType encodeType, string name, string value, UrlParameterSeparator prepend = UrlParameterSeparator.None, bool allowBlank = true) { if (null == name) { throw new ArgumentNullException("name"); } if (null == value) { throw new ArgumentNullException("value"); } value = value.Trim(); if (allowBlank || !string.IsNullOrEmpty(value)) { Func <string, string> encoder = (s) => { return(EncodeType.Url == encodeType?HttpUtility.UrlEncode(s) : HttpUtility.HtmlEncode(s)); }; return(String.Format(CultureInfo.InvariantCulture, "{0}{1}={2}", prepend.ToEnumValueString(), encoder(name), encoder(value))); } return(string.Empty); }
public static QueryString EncodeQueryString(QueryString queryString, EncodeType type) { QueryString newQueryString = new QueryString(); string nm = String.Empty; string val = String.Empty; foreach (string name in queryString) { nm = name; val = queryString[name]; switch (type) { case EncodeType.None: newQueryString.Add(nm, HttpContext.Current.Server.UrlEncode(val)); break; case EncodeType.Hex: newQueryString.Add(nm, Hex(val)); break; case EncodeType.GZip: newQueryString.Add(nm, HttpContext.Current.Server.UrlEncode(Compression.Compress(val, CompressionType.GZip))); break; case EncodeType.BZip2: newQueryString.Add(nm, HttpContext.Current.Server.UrlEncode(Compression.Compress(val, CompressionType.BZip2))); break; case EncodeType.GZipHex: newQueryString.Add(nm, HttpContext.Current.Server.UrlEncode(Compression.Compress(Hex(val), CompressionType.GZip))); break; case EncodeType.BZip2Hex: newQueryString.Add(nm, HttpContext.Current.Server.UrlEncode(Compression.Compress(Hex(val), CompressionType.BZip2))); break; } } return(newQueryString); }
/// <summary> /// UTF-8 与 GB2312 编码互转 /// </summary> /// <param name="content">要转换的内容</param> /// <param name="outType">要输出的编码类型(枚举)</param> public static string UrlEncode(this string content, EncodeType outType) { if (string.IsNullOrEmpty(content)) { return(string.Empty); } switch (outType) { case EncodeType.GB2312: HttpContext.Current.Session.CodePage = (int)EncodeType.UTF8; content = HttpContext.Current.Server.UrlEncode(content); break; case EncodeType.UTF8: HttpContext.Current.Session.CodePage = (int)EncodeType.GB2312; content = HttpContext.Current.Server.UrlEncode(content); break; } HttpContext.Current.Session.CodePage = (int)outType; return(content); }
public static string CharEncode(string origString, string EncChars, EncodeType Type) { string newString = ""; Char[] origArray = origString.ToCharArray(); foreach (Char strArray in origArray) { if (EncChars.Contains(strArray.ToString())) { if (Type == EncodeType.UrlEncode) { newString += "%" + charToHexString(strArray); } if (Type == EncodeType.UrlEncodeUTF8) { newString += "%u00" + charToHexString(strArray); } if (Type == EncodeType.AmpHex) { newString += "�" + charToHexString(strArray) + ";"; } if (Type == EncodeType.AmpHash) { newString += "�" + AmpHash(strArray.ToString()) + ";"; } if (Type == EncodeType.HtmlEncode) { newString += HttpUtility.HtmlEncode(strArray.ToString()); } } else { newString += strArray; } } return(newString); }
/// <summary> /// Clone a server. /// </summary> /// <returns> /// Returns the information about the newly created clone. /// </returns> public static string Clone(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Server/clone"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Re-images a server with the template requested. If the 'force' flag is passed /// it will rebuild the filesystem on the server before restoring. This option is not /// usually needed, but if regular restores are failing, it can fix some scenarios. /// </summary> public static string Restore(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Storm/Template/restore"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Stop a server. The 'force' flag will do a hard stop of the server from the /// parent server. Otherwise, it will issue a halt command to the server and /// shutdown normally. /// </summary> public static string Shutdown(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Storm/Server/shutdown"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Fires off a process to image the server right now. Since the image /// won't be created immediately, we can't return the information about it. /// </summary> public static string Create(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Storm/Image/create"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Get a list of unresolved notifications for an account or server. More /// information about the data structure can be found in the storm/alerts/details /// method. /// </summary> public static string Current(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Notifications/current"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Closes a ticket /// </summary> public static string Close(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Support/Ticket/close"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Returns the details of the active support alert. /// </summary> public static string GetActive(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Support/Alert/getActive"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Get a total price for a product, including other useful information that /// will affect the order. /// </summary> /// <returns> /// The 'balance' is the amount of money on the account that will be used prior to /// attempting to charge your credit card for the server creation. /// The 'initial' amount is the amount you need to prepay for the server for now /// until your next billing date. /// The 'cc_chage' amount is the amount that will be charged to your credit card, /// if your account is set to the credit card payment method. /// 'approved' is a boolean. If true then this purchase would be allowed by the /// system. /// </returns> public static string Price(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Product/price"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Converts path elements to a product code and alias. /// </summary> public static string GetProductCodeFromPath(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Product/getProductCodeFromPath"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Lists the domains for an account that are not linked to a server. /// </summary> public static string ListOrphans(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Server/VirtualDomain/listOrphans"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Links an existing orphaned add-on domain to a shared subaccnt. /// </summary> public static string ReLink(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Server/VirtualDomain/relink"; return APIHandler.Post (method, options, encoding); }
public static string FullEncode(string origString, EncodeType Type) { string newString = ""; char[] chars = origString.ToCharArray(); foreach (Char strChars in chars) { if (Type == EncodeType.UrlEncode) newString += "%" + charToHexString(strChars); if (Type == EncodeType.UrlEncodeUTF8) newString += "%u00" + charToHexString(strChars); if (Type == EncodeType.AmpHex) newString += "�" + charToHexString(strChars) + ";"; if (Type == EncodeType.AmpHash) newString += "&#" + AmpHash(strChars.ToString()) + ";"; } return newString; }
public static bool CreateUser(string name, string passwd, EncodeType encodeType) { string response = ExecuteWith(String.Format("-cb{0} {1} {2} {3}", (char) encodeType, Db, name, passwd)); return response.Contains("created."); }
/// <summary> /// Returns the number of free VIRs a given type of shared account receives. /// </summary> public static string FreeCount(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Server/VirtualDomain/freecount"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Returns the version of the of the api your are using. /// </summary> public static string Version( EncodeType encoding = EncodeType.JSON) { object options = string.Empty; string method = "/Utilities/Info/version"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Charges the credit card on file for the given account the given amount, and /// applies those new funds to the account. Currently this method is only useful /// for credit card accounts. A forbidden exception will be thrown if used with /// a check account. /// </summary> public static string Make(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Billing/Payment/make"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Adds customer feedback for a specific ticket transaction. The transaction is /// specified by the time key, which is the time of the transaction to which /// feedback is being added. Rating is typically "good" or "poor". /// </summary> public static string AddTransactionFeedback(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Support/Ticket/addTransactionFeedback"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Returns a projection of what the given account's next bill will look like /// at their next bill date. /// </summary> public static string Next(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Billing/Invoice/next"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Resolve an existing open notification. It will be marked as 'resolved' and no /// longer be returned by the 'current' method. /// </summary> public static string Resolve(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Notifications/resolve"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Get a paginated list of block storage clusters, including the zone that the /// cluster is in. /// </summary> public static string List(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Storage/Block/Cluster/list"; return APIHandler.Post (method, options, encoding); }
//byte[] bufWrite = new byte[1024*16]; // 写入头部信息 public BinByteBufWriter WriteHead(uint lua_code, EncodeType enc_type) { if (App.config.trace_bin_sndrcv && (null != PBBase.CPBBase.g_pIPBLogger)) { PBBase.CPBBase.g_pIPBLogger.WriteLog("INFO", "WriteHead", string.Format("lua_code:{0}({1}) enc_type:{2}", lua_code, (OpCodes_C2S)lua_code, enc_type)); } BinByteBufWriter bw = new BinByteBufWriter(); bw.enableTraceBin(App.config.trace_encdec_detail); //bw.Init (bufWrite, 0, bufWrite.Length); if (4 == GetPkgHdrPkgSize()) { bw.WriteUInt32(0); // len } else { bw.WriteUInt16(0); // len } bw.WriteUInt16((UInt16)lua_code); // lua code bw.WriteByte((byte)enc_type);//Network.GetEncodeTypeByte((int)enc_type,(int)lua_code)); // encode if (IsPkgHdrEnablePacketId()) { bw.WriteUInt32((UInt32)0); // packet_id } //包头不压缩 bw.SetPBC(Network.IsPBCBinPkg(lua_code)); return bw; }
/// <summary> /// Delete a volume, including any and all data stored on it. The volume must not /// be attached to any instances to call this method. /// </summary> public static string Delete(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Storage/Block/Volume/delete"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Get information about a specific image. /// </summary> public static string Details(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Storm/Image/details"; return APIHandler.Post (method, options, encoding); }
private void ProcessSymbolFieldInstruction(DocumentNode dn, string instr, ref int i, ref EncodeType encodeType) { int iStart = 0; switch (instr[i++]) { case 'a': encodeType = EncodeType.Ansi; break; case 'u': encodeType = EncodeType.Unicode; break; case 'j': encodeType = EncodeType.ShiftJis; break; case 'h': // linespacing instruction: ignore break; case 's': if (i < instr.Length && instr[i] == ' ') i++; // font size in points, not half-points iStart = i; for (; i < instr.Length && instr[i] != ' '; i++) { continue; } string ptString = instr.Substring(iStart, i - iStart); // Now convert number part bool ret = true; double d = 0f; try { d = System.Convert.ToDouble(ptString, CultureInfo.InvariantCulture); } catch (System.OverflowException) { ret = false; } catch (System.FormatException) { ret = false; } if (ret) { dn.FormatState.FontSize = (long)((d * 2) + 0.5); } break; case 'f': // Font Name if (i < instr.Length && instr[i] == ' ') { i++; } if (i < instr.Length && instr[i] == '"') { i++; } iStart = i; for (; i < instr.Length && instr[i] != '"'; i++) { continue; } string name = instr.Substring(iStart, i - iStart); // Move past trailing double-quote i++; if (name != null && name.Length > 0) { dn.FormatState.Font = _converterState.FontTable.DefineEntryByName(name); } break; } }
/// <summary> /// Update details about your server, including the backup and bandwidth plans, and /// the hostname ('domain') we have on file. /// /// Updating the 'domain' field will not change the actual hostname on the server. /// It merely updates what our records show. /// </summary> public static string Update(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Storm/Server/update"; return APIHandler.Post (method, options, encoding); }
private void ConvertSymbolCharValueToText(DocumentNode dn, int nChar, EncodeType encodeType) { switch (encodeType) { case EncodeType.Unicode: if (nChar < 0xFFFF) { char[] unicodeChar = new char[1]; unicodeChar[0] = (char)nChar; dn.AppendXamlEncoded(new string(unicodeChar)); } break; case EncodeType.ShiftJis: if (nChar < 0xFFFF) { // NB: How to interpret this numeric value as Shift-JIS? Encoding ec = Encoding.GetEncoding(932); int nChars = nChar > 256 ? 2 : 1; byte[] ba = new byte[2]; if (nChars == 1) { ba[0] = (byte)nChar; } else { ba[0] = (byte)((nChar >> 8) & 0xFF); ba[1] = (byte)(nChar & 0xFF); } dn.AppendXamlEncoded(ec.GetString(ba, 0, nChars)); } break; default: if (nChar < 256) { // Keep the byte char value as the unicode char singleChar = (char) nChar; dn.AppendXamlEncoded(new string(singleChar, 1)); } break; } }
/// <summary> /// Get a paginated list of backups for a particular server. More information about /// the data returned can be found under the documentation for storm/backup/details /// </summary> public static string List(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Storm/Backup/list"; return APIHandler.Post (method, options, encoding); }
/// <summary> /// Get a list of notifications for a specific server. Information about the data /// returned can here be found in storm/alerts/details /// </summary> public static string History(object options, EncodeType encoding = EncodeType.JSON) { string method = "/Server/history"; return APIHandler.Post (method, options, encoding); }