public virtual bool LoadXML(System.Xml.XmlElement ele) { foreach (System.Xml.XmlElement ch in ele) { ParamBase.Type ty = ParamBase.FromSerializationType(ch.Name); if (ty == ParamBase.Type.Invalid) { continue; } System.Xml.XmlAttribute attrName = ch.Attributes["name"]; if (attrName == null) { continue; } string paramName = attrName.Value; ParamBase pb = this.GetParam(paramName, ty); if (pb == null) { continue; } pb.SetValueFromString(ch.InnerText); System.Xml.XmlAttribute attrViz = ch.Attributes["visible"]; if (attrViz != null) { pb.visible = ParamBool.ConvertFromString(attrViz.Value); } } return(true); }
protected ParamBase(ParamBase param) { searchGrid = param.searchGrid; DiagonalMovement = param.DiagonalMovement; startNode = param.startNode; endNode = param.endNode; }
public virtual bool LoadXML(System.Xml.XmlElement ele, Dictionary <string, LLDNBase> directory) { foreach (System.Xml.XmlElement ch in ele) { ParamBase.Type ty = ParamBase.FromSerializationType(ch.Name); if (ty == ParamBase.Type.Invalid) { continue; } System.Xml.XmlAttribute attrName = ch.Attributes["name"]; if (attrName == null) { continue; } string paramName = attrName.Value; ParamBase pb = this.GetParam(paramName, ty); if (pb == null) { continue; } pb.SetValueFromString(ch.InnerText, directory); } return(true); }
public ParamBase(ParamBase param) { m_searchGrid = param.m_searchGrid; DiagonalMovement = param.DiagonalMovement; m_startNode = param.m_startNode; m_endNode = param.m_endNode; }
/** Override this method to revise the provided parameter database to reflect the "parameters" specified in the * given meta-individual. 'Run' is the current run number for this individual's evaluation. */ public void ModifyParameters(IEvolutionState state, IParameterDatabase database, int run, Individual metaIndividual) { if (!(metaIndividual is DoubleVectorIndividual)) { state.Output.Fatal("Meta-individual is not a DoubleVectorIndividual."); } var individual = (DoubleVectorIndividual)metaIndividual; var species = (FloatVectorSpecies)individual.Species; double[] genome = individual.genome; IParameter pb = ParamBase.Push(P_PARAM); for (int i = 0; i < genome.Length; i++) { IParameter p = pb.Push("" + i); String param = state.Parameters.GetString(p, null); if (param == null) { state.Output.Fatal("Meta parameter number " + i + " missing.", p); } // load it database.SetParameter(new Parameter(param), "" + Map(state, genome, species, i)); } }
protected ParamBase(ParamBase param) { MsearchGrid = param.MsearchGrid; DiagonalMovement = param.DiagonalMovement; MstartNode = param.MstartNode; MendNode = param.MendNode; }
public static bool HasUnit(this ParamBase p) { if (p == null) { throw new ArgumentNullException("p"); } return(string.IsNullOrWhiteSpace(p.CvUnitAccession) == false); }
public static bool HasValue(this ParamBase p) { if (p == null) { throw new ArgumentNullException("p"); } return(p.Value != null); }
// 创建GM账号,返回true创建成功 public bool createGMUser(ParamBase param) { m_gmUser = new GMUser(param); if (!m_gmUser.isLogin) { m_retData.Add("result", RetCode.RET_GM_LOGIN_FAILED); } return(m_gmUser.isLogin); }
/* * 作为状态机基类,要求子类传入玩家属性 */ public virtual void Init(StateBase defaultState, ParamBase parameter) { this.defaultState = defaultState; /* * 状态机进入默认状态 */ TransactionState(defaultState); }
public ParamConnection GetParamConnection(string name) { ParamBase pb = GetParam(name, ParamBase.Type.PCMInput); if (pb == null) { return(null); } return((ParamConnection)pb); }
/// <summary> /// Get the node's enum parameter matching a specified name. /// </summary> /// <param name="name">The name of the parameter to retrive</param> /// <returns>The found parameter, or null if none was found.</returns> public ParamEnum GetParamEnum(string name) { ParamBase pb = GetParam(name, ParamBase.Type.Enum); if (pb == null) { return(null); } return((ParamEnum)pb); }
public ParamText GetParamText(string name) { ParamBase pb = GetParam(name, ParamBase.Type.Text); if (pb == null) { return(null); } return((ParamText)pb); }
/// <summary> /// Get the node's bool parameter matching a specified name. /// </summary> /// <param name="name">The name of the parameter to retrive.</param> /// <returns>The found parameter, or null if none was found.</returns> public ParamBool GetBoolParam(string name) { ParamBase pb = GetParam(name, ParamBase.Type.Bool); if (pb == null) { return(null); } return((ParamBool)pb); }
/// <summary> /// Get the node's float parameter matching a specified name. /// </summary> /// <param name="name">The name of the paramter to retrieve.</param> /// <returns>The found parameter, or null if none was found.</returns> public ParamFloat GetFloatParam(string name) { ParamBase pb = GetParam(name, ParamBase.Type.Float); if (pb == null) { return(null); } return((ParamFloat)pb); }
/// <summary> /// 注册 /// </summary> public void SignUp() { SocketIO.Ins.OpenSocket(); string uname = username.text; string upwd = password.text; ParamBase param = new ParamBase(); param.name = uname; string paramstr = JsonConvert.SerializeObject(param); SocketIO.Ins.sdgSocket.Emit("ReqSignUp", paramstr); }
public override string doDyop(object param) { ParamBase p = (ParamBase)param; p.fieldIndex = 2; bool cres = createGMUser(p); if (!cres) { return(Helper.genJsonStr(m_retData)); } if (!p.checkSign(m_gmUser)) { m_retData.Add("result", RetCode.RET_SIGN_ERROR); return(Helper.genJsonStr(m_retData)); } Player player = new Player(p.m_playerAcc, m_gmUser); if (!player.m_isExists) { m_retData.Add("result", RetCode.RET_NO_PLAYER); return(Helper.genJsonStr(m_retData)); } if (!player.isOwner(m_gmUser.m_acc)) { m_retData.Add("result", RetCode.RET_NO_RIGHT); return(Helper.genJsonStr(m_retData)); } string url = string.Format(CONST.URL_CLEAR_FAILED_LOGIN, p.m_playerAcc); var ret = HttpPost.Get(new Uri(url)); if (ret != null) { string retStr = Encoding.UTF8.GetString(ret); if (retStr == "0") { m_retData.Add("result", RetCode.RET_SUCCESS); } else { m_retData.Add("result", RetCode.RET_OP_FAILED); } } else { m_retData.Add("result", RetCode.RET_OP_FAILED); } return(Helper.genJsonStr(m_retData)); }
public static bool HasUnit(this ParamBase p, string unitAccession) { if (p == null) { throw new ArgumentNullException("p"); } if (unitAccession == null) { throw new ArgumentNullException("unitAccession"); } return(p.CvUnitAccession != null && p.CvUnitAccession.Equals(unitAccession, StringComparison.InvariantCultureIgnoreCase)); }
public virtual bool SaveXML(System.Xml.XmlElement ele) { foreach (ParamBase pb in this.genParams) { string paramType = ParamBase.ToSerializationType(pb.type); System.Xml.XmlElement paramEle = ele.OwnerDocument.CreateElement(paramType); paramEle.SetAttribute("name", pb.name); paramEle.InnerText = pb.GetStringValue(); paramEle.SetAttribute("visible", ParamBool.ConvertToString(pb.visible)); ele.AppendChild(paramEle); } return(true); }
/// <summary> /// 登录 /// </summary> public void Login() { SocketIO.Ins.OpenSocket(); string uname = username.text; string upwd = password.text; CurrentPlayer.Ins.user.username = uname; CurrentPlayer.Ins.user.password = upwd; ParamBase param = new ParamBase(); param.name = uname; string paramstr = JsonConvert.SerializeObject(param); SocketIO.Ins.sdgSocket.Emit("ReqSignIn", paramstr); }
public static long GetInt64OrDefault(this ParamBase p) { if (p == null) { throw new ArgumentNullException("p"); } if (p.HasValue()) { return(p.Value.ToInt64(ParamEditExtension.FormatProvider)); } else { return(default(long)); } }
public static IConvertible GetValueOrDefault(this ParamBase p) { if (p == null) { throw new ArgumentNullException("p"); } if (p.HasValue()) { return(p.Value); } else { return(null); } }
public static float GetSingleOrDefault(this ParamBase p) { if (p == null) { throw new ArgumentNullException("p"); } if (p.HasValue()) { return(p.Value.ToSingle(ParamEditExtension.FormatProvider)); } else { return(default(float)); } }
public static char GetCharOrDefault(this ParamBase p) { if (p == null) { throw new ArgumentNullException("p"); } if (p.HasValue()) { return(p.Value.ToChar(ParamEditExtension.FormatProvider)); } else { return(default(char)); } }
public static bool GetBooleanOrDefault(this ParamBase p) { if (p == null) { throw new ArgumentNullException("p"); } if (p.HasValue()) { return(p.Value.ToBoolean(ParamEditExtension.FormatProvider)); } else { return(default(Boolean)); } }
public static IConvertible GetValue(this ParamBase p) { if (p == null) { throw new ArgumentNullException("p"); } if (p.HasValue()) { return(p.Value); } else { throw new InvalidOperationException("Param value not set."); } }
public static float GetSingle(this ParamBase p) { if (p == null) { throw new ArgumentNullException("p"); } if (p.HasValue()) { return(p.Value.ToSingle(ParamEditExtension.FormatProvider)); } else { throw new InvalidOperationException("Param value not set."); } }
static void Main(string[] args) { Console.WriteLine("WebRTC Test Pattern Server Demo"); CancellationTokenSource cts = new CancellationTokenSource(); // Start web socket. Console.WriteLine("Starting web socket server..."); var webSocketServer = new WebSocketServer(IPAddress.Any, WEBSOCKET_PORT); webSocketServer.AddWebSocketService <WebRTCWebSocketPeer>("/", (peer) => peer.CreatePeerConnection = CreatePeerConnection); webSocketServer.Start(); Console.WriteLine($"Waiting for web socket connections on {webSocketServer.Address}:{webSocketServer.Port}..."); Console.WriteLine("Press ctrl-c to exit."); ManualResetEvent exitMre = new ManualResetEvent(false); Console.CancelKeyPress += delegate(object sender, ConsoleCancelEventArgs e) { e.Cancel = true; cts.Cancel(); exitMre.Set(); }; ParamBase encoderParams = new ParamBase(); encoderParams.MaxFrameRate = 60.0F; encoderParams.PicWidth = 640; encoderParams.PicHeight = 480; encoderParams.RateControl = RateControlModes.RC_BITRATE_MODE; encoderParams.TargetBitrate = 5000000; encoderParams.UsageType = UsageType.CAMERA_VIDEO_REAL_TIME; SourcePicture sourcePicture = new SourcePicture(); sourcePicture.PicWidth = 640; sourcePicture.PicHeight = 480; sourcePicture.ColorFormat = (int)VideoFormats.VideoFormatI420; encoder = new Encoder(); encoder.KeyframeInterval = 5; encoder.Initialize(encoderParams); encoder.SetSourcePictureParameters(sourcePicture); exitMre.WaitOne(); encoder.Dispose(); }
public GMUser(ParamBase param) { string sqlServer = WebConfigurationManager.AppSettings["mysql"]; m_sqlDb = new MySqlDbServer(sqlServer); string sqlCmd = string.Format(CONST.SQL_QUERY_GM_USER, TableName.GM_ACCOUNT, param.m_gmAccount, param.m_gmPwd, CONST.FIELD_SET[param.fieldIndex]); Dictionary <string, object> r = m_sqlDb.queryOne(sqlCmd, MySqlDbName.DB_XIANXIA); if (r != null) { do { m_acc = Convert.ToString(r["acc"]); string dbPwd = Convert.ToString(r["pwd"]); if (m_acc != param.m_gmAccount) { m_isLogin = false; break; } if (dbPwd != param.m_gmPwd) { m_isLogin = false; break; } m_accType = Convert.ToInt32(r["accType"]); if (m_accType != AccType.ACC_API) { m_isLogin = false; break; } m_devSecretKey = Convert.ToString(r["devSecretKey"]); readFieldValue(r, param.fieldIndex); m_isLogin = true; } while (false); } }
public IHasValue SetCvParam(string accession) { if (string.IsNullOrWhiteSpace(accession)) { throw new ArgumentNullException("accession"); } if (HasCvParam(accession)) { Param = ParamContainer.CvParams[accession]; } else { CvParam param = new CvParam(accession); ParamContainer.CvParams.Add(param); Param = param; } return(new HasValue(this)); }