public static AppState LoadConfig() { // set some initial options in case SchemeType t = SchemeType.Complement; RgbColor c = new RgbColor(); try { // TODO: a real config mechanism? the .NET one is poor in mono string[] lines = File.ReadAllLines(configrc); foreach (string l in lines) { string[] components = l.Split("=".ToCharArray(), 2); switch (components[0]) { case "color": c = ColorUtils.FromHtml(components[1].Trim()); break; case "scheme": Enum.TryParse(components[1], out t); break; default: break; } } } catch (Exception) { // just load some defaults } return(new AppState(c.ToHsv(), t)); }
public static string GetSchemeLiteral(this SchemeType schemeType) { switch (schemeType) { case SchemeType.Blob: return("blob"); case SchemeType.Ftp: return("ftp"); case SchemeType.Gopher: return("gopher"); case SchemeType.Http: return("http"); case SchemeType.Https: return("https"); case SchemeType.Ws: return("ws"); case SchemeType.Wss: return("wss"); case SchemeType.File: return("file"); case SchemeType.Other: return("null"); default: return(null); } }
public void Execute() { Debug.Log("正在清理缓存..."); SchemeType scheme = Setting.GetCurSchemeType(); if (scheme == SchemeType.Client_CSharp_To_FlatBuffer) { Tools.DeleteFilesWithoutFolder(Setting.GenerateByteFilePath); Tools.DeleteFilesWithoutFolder(Setting.GenerateFlatCodePath); } else if (scheme == SchemeType.Server_Java_To_Json) { Tools.DeleteFilesWithoutFolder(Setting.GenServerJavaJsonFilePath); Tools.DeleteFilesWithoutFolder(Setting.GenJavaServerJsonCodePath); } else if (scheme == SchemeType.UnKown) { MessageBox.Show("Excel路径不能为空!"); return; } AddDelayRun(() => { Debug.Log("清理完毕.准备读取配表.."); m_Instance.Procedure_ReadExcel(); }); }
public void Produce_OnExit() { string outCodePath = UserSetting.Instance.GetCurOutFlatBufferCodePath(); string outBytesPath = UserSetting.Instance.GetCurOutByteFilePath(); Tools.DeleteFilesWithoutFolder(outCodePath); Tools.DeleteFilesWithoutFolder(outBytesPath); AddDelayRun(() => { SchemeType scheme = Setting.GetCurSchemeType(); if (scheme == SchemeType.Client_CSharp_To_FlatBuffer) { Tools.CopyDirectory(Setting.GenerateFlatCodePath, outCodePath); Tools.CopyDirectory(Setting.GenerateByteFilePath, outBytesPath); } else if (scheme == SchemeType.Server_Java_To_Json) { Tools.CopyDirectory(Setting.GenJavaServerJsonCodePath, outCodePath); Tools.CopyDirectory(Setting.GenServerJavaJsonFilePath, outBytesPath); } var result = MessageBox.Show("生成成功!", "提示", MessageBoxButtons.OK); if (result == DialogResult.OK) { Program.Exit(); } }); }
/// <summary> /// 转换订单显示状态 /// </summary> /// <param name="progressStatus">方案状态</param> /// <param name="ticketStatus">出票状态</param> /// <returns>显示状态</returns> public static string OrderStatusName(SchemeType schemeType, ProgressStatus progressStatus, TicketStatus ticketStatus = TicketStatus.Ticketed, BonusStatus bonusStatus = BonusStatus.Waitting, bool isPrizeMoney = false, bool isMine = true, bool isViturl = false) { if (isViturl) { return("已撤单"); //如果是虚拟订单,则该订单为已撤单 } switch (progressStatus) { case ProgressStatus.Waitting: return("待开始"); case ProgressStatus.AutoStop: return("自动停止"); case ProgressStatus.Aborted: return("撤单"); case ProgressStatus.Running: case ProgressStatus.Complate: switch (ticketStatus) { case TicketStatus.Waitting: return("待投注"); case TicketStatus.Ticketing: return("投注中"); case TicketStatus.Ticketed: if (progressStatus == ProgressStatus.Complate) { switch (bonusStatus) { case BonusStatus.Waitting: return("未开奖"); case BonusStatus.Awarding: return("开奖中"); case BonusStatus.Error: return("开奖错误"); case BonusStatus.Lose: return("未中奖"); case BonusStatus.Win: return(isPrizeMoney ? "已派奖" : "已中奖"); default: return("已完成"); } } else { return(schemeType == SchemeType.TogetherBetting && !isMine ? "已跟单" : "已出票"); } case TicketStatus.PrintTicket: return("已打票"); case TicketStatus.Skipped: return("被跳过"); case TicketStatus.Error: return("出票失败"); case TicketStatus.Abort: return("撤单"); default: return("待投注"); } default: return("待开始"); } }
/// <summary> /// Parses the command line given to it. /// </summary> /// <param name="args"> /// The arguments given to the program. This is usually found in /// the Main function. /// </param> /// <param name="defaultColor"> /// The color to use if none was found in the arguments. Note that /// this can be one you saved in a configuration file, for example. /// </param> /// <param name="defaultScheme"> /// The scheme to use if none was found in the arguments. Note that /// this can be one you saved in a configuration file, for example. /// </param> /// <param name="initialPaletteFile"> /// The palette file to use if none was found in the arguments. If /// the frontend doesn't support this, it will be ignored anyways. /// </param> /// <returns>The application state the frontend will load.</returns> public static AppInitState ParseArgs(string[] args, HsvColor defaultColor, SchemeType defaultScheme, string initialPaletteFile = null) { HsvColor c = defaultColor; SchemeType t = defaultScheme; string p = initialPaletteFile; List <string> u = new List <string>(); ParsingMode m = ParsingMode.Normal; foreach (string a in args) { switch (m) { case ParsingMode.Color: c = ColorUtils.FromString(a); m = ParsingMode.Normal; break; case ParsingMode.Scheme: Enum.TryParse(a, out t); m = ParsingMode.Normal; break; case ParsingMode.PaletteFile: p = a; m = ParsingMode.Normal; break; default: // find flags if (a == "-t") { m = ParsingMode.Scheme; } else if (a == "-c") { m = ParsingMode.Color; } else if (a == "-p") { m = ParsingMode.PaletteFile; } else { u.Add(a); } break; } } return(new AppInitState() { MixerState = new AppState(c, t), PaletteFileName = p, UnparsedArgs = u }); }
public ExportScheme(IStringLocalizer <Localization> localizer, SchemeType schemeType) { if (localizer == null) { throw new ArgumentNullException(nameof(localizer)); } this.localizer = localizer; SchemeType = schemeType; }
/// <summary> /// Creates a new application controller. /// </summary> /// <param name="c">The initial colour to use.</param> /// <param name="scheme">The initial scheme to use.</param> public AppController(HsvColor c, SchemeType scheme) { UndoHistory = new Stack <AppState>(); RedoHistory = new Stack <AppState>(); // set this directly because SetColor will do the dirty work for us SchemeType = scheme; SetColor(c, false); // this will set Results }
public static void SaveConfig(RgbColor c, SchemeType t) { try { File.WriteAllLines(configrc, new string[] { "color=" + c.ToHtml(), "scheme=" + t.ToString() }); } catch (Exception) { } }
public IActionResult Get(int id) { SchemeType schemeType = _context.SchemeType.FirstOrDefault(x => x.SchemeTypeID == id); if (schemeType == null) { return(NotFound()); } return(new ObjectResult(schemeType)); }
public IActionResult Post([FromBody] SchemeType schemeType) { if (schemeType == null) { return(BadRequest()); } _context.SchemeType.Add(schemeType); _context.SaveChanges(); return(Ok(schemeType)); }
public IActionResult Delete(int id) { SchemeType schemeType = _context.SchemeType.FirstOrDefault(x => x.SchemeTypeID == id); if (schemeType == null) { return(NotFound()); } _context.SchemeType.Remove(schemeType); _context.SaveChanges(); return(Ok(schemeType)); }
/// <summary> /// Set the current scheme type and generate the Results in the /// Results property. /// </summary> /// <param name="t">The new scheme type.</param> /// <param name="keepHistory"> /// If you want to update the undo stack. Note that it will only update it if /// the current scheme and new scheme are different. /// </param> /// <param name="fireEvent"> /// If you want to fire the event. /// </param> public void SetSchemeType(SchemeType t, bool keepHistory = true, bool fireEvent = true) { if (keepHistory && SchemeType != t) { PushUndo(); } SchemeType = t; GetSchemeResults(); if (fireEvent) { OnResultChanged(new EventArgs()); } }
/// <summary> /// Loads the EncryptionParameters from an input stream overwriting the current /// EncryptionParameters. /// </summary> /// /// <param name="stream">The stream to load the EncryptionParameters from</param> /// <exception cref="System.ArgumentNullException">if stream is null</exception> /// <exception cref="System.ArgumentException">if parameters cannot be read correctly</exception> /// <seealso cref="Save(EncryptionParameters, Stream)">See Save(EncryptionParameters, Stream) to save an EncryptionParameters instance.</seealso> public static EncryptionParameters Load(Stream stream) { if (null == stream) { throw new ArgumentNullException(nameof(stream)); } try { EncryptionParameters parms = null; using (BinaryReader reader = new BinaryReader(stream, Encoding.UTF8, leaveOpen: true)) { SchemeType scheme = (SchemeType)reader.ReadInt32(); parms = new EncryptionParameters(scheme); parms.PolyModulusDegree = reader.ReadUInt64(); int coeffModulusCount = reader.ReadInt32(); List <SmallModulus> coeffModulus = new List <SmallModulus>(coeffModulusCount); for (int i = 0; i < coeffModulusCount; i++) { SmallModulus sm = new SmallModulus(); sm.Load(reader.BaseStream); coeffModulus.Add(sm); } parms.CoeffModulus = coeffModulus; if (scheme == SchemeType.BFV) { SmallModulus plainModulus = new SmallModulus(); plainModulus.Load(reader.BaseStream); parms.PlainModulus = plainModulus; } parms.NoiseStandardDeviation = reader.ReadDouble(); } return(parms); } catch (EndOfStreamException ex) { throw new ArgumentException("End of stream reached", ex); } catch (IOException ex) { throw new ArgumentException("Could not read Encryption Parameters", ex); } }
/// <summary>Serves as the default hash function.</summary> /// <returns>A hash code for the current object.</returns> public override int GetHashCode() { unchecked { var hc = 17L; hc = (hc * 23) + SchemeType.GetHashCode(); if (Description != null) { hc = (hc * 23) + StringComparer.Ordinal.GetHashCode(Description); } return(((int)(hc >> 32)) ^ (int)hc); } }
public SshConnectionInfo(String p) { Scheme = SchemeType.ANON; String user = null; String host = null; if (p.StartsWith("ssh://")) { Scheme = SchemeType.SSH; p = p.Substring(6); } else if (p.StartsWith("scp://")) { Scheme = SchemeType.SCP; p = p.Substring(6); } else if (p.StartsWith("sftp://")) { Scheme = SchemeType.SFTP; p = p.Substring(7); } Int32 ip = p.IndexOf(':'); Int32 ii = p.IndexOf('@'); /* Avoid initial @ */ if (ii == 0) { p = p.Substring(1); ii = -1; } if (ii > 0) { user = p.Substring(0, ii); host = p.Substring(ii + 1); } else { user = null; host = p; } Host = host; User = user; }
public static Color[] GetColorPalette(Color mainColor, SchemeType type) { switch (type) { case SchemeType.Monochromatic: return GetColorPaletteMonochromatic(mainColor); case SchemeType.Analogous: return GetColorPaletteAnalogous(mainColor,30f,4); case SchemeType.Triadic: return GetColorPaletteAngleDiff(mainColor, 120f); case SchemeType.SplitComplement: return GetColorPaletteAngleDiff(mainColor, 150f); case SchemeType.Complement: return GetColorPaletteComplement(mainColor); } return null; }
public void AddVariables(SchemeType type, BaseDdsVariables variables) { switch (type) { case SchemeType.Provider: foreach (var ddsVariable in variables.Variables) { this.ProviderScheme.AddVariable(ddsVariable); } break; case SchemeType.Requester: foreach (var ddsVariable in variables.Variables) { this.RequesterScheme.AddVariable(ddsVariable); } break; } }
/// <summary> /// 拆票后,保存数字彩订单到Redis库中 /// </summary> public static void AddToRunningOrder_SZC(SchemeType schemeType, string gameCode, string gameType, string orderId, string keyLine, bool stopAfterBonus, string issuseNumber, List <RedisTicketInfo> ticketList) { if (ticketList.Count <= 0) { return; } //把彩种、玩法、期号为Key,订单json存入List IDatabase db = null;// RedisHelper.DB_Running_Order; if (gameCode == "CTZQ") { db = RedisHelper.DB_Running_Order_CTZQ; } if (new string[] { "SSQ", "DLT", "FC3D", "PL3", "OZB" }.Contains(gameCode)) { db = RedisHelper.DB_Running_Order_SCZ_DP; } if (new string[] { "CQSSC", "JX11X5", "SD11X5", "GD11X5", "GDKLSF", "JSKS", "SDKLPK3" }.Contains(gameCode)) { db = RedisHelper.DB_Running_Order_SCZ_GP; } if (db == null) { throw new Exception(string.Format("找不到{0}对应的库", gameCode)); } var fullKey = (gameCode.ToUpper() == "CTZQ" || gameCode.ToUpper() == "OZB") ? string.Format("{0}_{1}_{2}_{3}", gameCode, gameType, RedisKeys.Key_Running_Order_List, issuseNumber) : string.Format("{0}_{1}_{2}", gameCode, RedisKeys.Key_Running_Order_List, issuseNumber); //fullKey = GetUsableList(fullKey); var orderInfo = new RedisOrderInfo { SchemeId = orderId, KeyLine = keyLine, StopAfterBonus = stopAfterBonus, TicketList = ticketList, SchemeType = schemeType, }; var json = JsonHelper.Serialize <RedisOrderInfo>(orderInfo); db.ListRightPushAsync(fullKey, json); }
/// <summary> /// 转换方案类型名称 /// </summary> /// <param name="schemeType">方案类型</param> /// <returns>方案类型名称</returns> public static string SchemeTypeName(SchemeType schemeType, bool isSimple = false) { switch (schemeType) { case SchemeType.ChaseBetting: return(isSimple ? "追" : "追号"); case SchemeType.GeneralBetting: return(isSimple ? "" : "代购"); case SchemeType.TogetherBetting: return(isSimple ? "合" : "合买"); case SchemeType.SingleCopy: return(isSimple ? "" : "抄单"); default: return(schemeType.ToString()); } }
private static string getMethodStr(SchemeType st) { string methodStr; switch (st) { case SchemeType.Caesar: methodStr = "caesar"; break; case SchemeType.Affine: methodStr = "affine"; break; case SchemeType.Columnar: methodStr = "columnar"; break; case SchemeType.RailFence: methodStr = "railfence"; break; case SchemeType.Substitution: methodStr = "substitution"; break; case SchemeType.Transposition: methodStr = "transposition"; break; case SchemeType.Vigenere: methodStr = "vigenere"; break; default: methodStr = ""; break; } return(methodStr); }
public static Color[] GetColorPalette(Color mainColor, SchemeType type) { switch (type) { case SchemeType.Monochromatic: return(GetColorPaletteMonochromatic(mainColor)); case SchemeType.Analogous: return(GetColorPaletteAnalogous(mainColor, 30f, 4)); case SchemeType.Triadic: return(GetColorPaletteAngleDiff(mainColor, 120f)); case SchemeType.SplitComplement: return(GetColorPaletteAngleDiff(mainColor, 150f)); case SchemeType.Complement: return(GetColorPaletteComplement(mainColor)); } return(null); }
/// <summary> /// TODO: Summary /// </summary> /// <param name="schemeType"></param> /// <returns></returns> public static ushort GetDefaultPort(this SchemeType schemeType) { switch (schemeType) { case SchemeType.Ftp: return(21); case SchemeType.Gopher: return(70); case SchemeType.Ws: case SchemeType.Http: return(80); case SchemeType.Https: case SchemeType.Wss: return(443); default: return(0); } }
private static void SendUriSchemeMessage(IDictionary<string, string> uriArgs, SchemeType schemeType) { var content = string.Empty; var isUri = false; if (uriArgs.ContainsKey("text")) { content = WebUtility.UrlDecode(uriArgs["text"]); } if (uriArgs.ContainsKey("url")) { content = WebUtility.UrlDecode(uriArgs["url"]); isUri = true; } Messenger.Default.Send(new UriSchemeMessage(content, isUri, schemeType)); }
public void ApplyColorScheme(SchemeType type, ColorRamp colorRamp, StyleElement shapeElement, int categoryStartIndex, int categoryEndIndex) { _categories.ApplyColorScheme3((tkColorSchemeType)type, colorRamp.GetInternal(), (tkShapeElements)shapeElement, categoryStartIndex, categoryEndIndex); }
// Use this for initialization void Awake () { if (MenuController.schemeType != SchemeType.NOT_SET) { controllerScheme = MenuController.schemeType; controllerIds = MenuController.controllerIds; } SetControls(); }
public void set(SchemeSymbol symbol, SchemeType type) { _symbolTable[symbol.value] = type; }
/// <summary> /// Creates a new application state representation. /// </summary> /// <param name="c">The color to use.</param> /// <param name="t">The scheme to use.</param> public AppState(HsvColor c, SchemeType t) { Color = c; SchemeType = t; }
public UriSchemeMessage(string content, bool isUri, SchemeType schemeType) { Content = content; IsUri = isUri; SchemeType = schemeType; }
/// <summary> /// Add Update Data /// </summary> /// <param name="model"></param> /// <returns>Jsonresponse</returns> public JsonResponse AddUpdate(SchemeType model) { try { // If these condition true the data was not exsits in the database if (!IsExsits(model.Name, model.ID)) { // If model.ID == 0 the data goes to the Add part. if (model.ID == 0) { model.IsActive = model.IsActive; model.CreatedOn = DateTime.Now; model.CreatedBy = GetUserID(); model.ModifiedOn = DateTime.Now; model.ModifiedBy = GetUserID(); _context.Set <SchemeType>().Add(model); int i = _context.SaveChanges(); if (i != 0) { resp.Status = Constants.ResponseStatus.Success; resp.Message = Constants.Service.Data_insert_success; } else { resp.Message = Constants.Service.Data_insert_failed; } } // Else data goes to the Update part. else { resp.Message = Constants.Service.Data_Update_failed; var models = GetData(model.ID); if (models != null) { models.Name = model.Name; models.IsActive = model.IsActive; models.ModifiedOn = DateTime.Now; models.ModifiedBy = GetUserID(); _context.Set <SchemeType>().Update(models); int i = _context.SaveChanges(); if (i != 0) { resp.Status = Constants.ResponseStatus.Success; resp.Message = Constants.Service.Data_Update_success; } else { resp.Status = Constants.ResponseStatus.Failed; resp.Message = Constants.Service.Data_Update_failed; } } } } // The data was in the database so, It return the else part else { resp.Message = Constants.ControllerMessage.Data_Exsists; } } catch (Exception) { resp.Message = Constants.Service.Common_message; } return(resp); }
public SchemeModel(SchemeType sType) { SType = sType; Nodes = new List <Node>(); Cores = new List <Core>(); }
public static string Break(SchemeType method, string plain, string key) { return(SendTo(String.Format(breakUrl, getMethodStr(method), plain))); }
public static string Decrypt(SchemeType method, string plain, string key) { return(SendTo(String.Format(decryptUrl, getMethodStr(method), plain, key))); }
public static string Encrypt(SchemeType method, string plain, string key) { return(SendTo(String.Format(encryptUrl, getMethodStr(method), plain, key))); //这里返回的可能是错误信息(如密钥不正确等),也可能是结果 }
/// <summary> /// Creates an empty encryption parameters. /// </summary> /// /// <remarks> /// Creates an empty encryption parameters. At a minimum, the user needs to specify /// the parameters <see cref="PolyModulusDegree"/>, <see cref="CoeffModulus"/>, and /// <see cref="PlainModulus"/> for the parameters to be valid. /// </remarks> /// <param name="scheme">Scheme for the encryption parameters</param> /// <exception cref="System.ArgumentException">if given scheme is not available</exception> public EncryptionParameters(SchemeType scheme) { NativeMethods.EncParams_Create((int)scheme, out IntPtr ptr); NativePtr = ptr; }