Esempio n. 1
0
    /// <summary>
    /// 出牌回调
    /// </summary>
    void ChuPaiCallBack()
    {
        PlayCard playCard = GameObject.Find("Player").GetComponent <PlayCard>();

        int[] pai = new int[20];

        int count = 0;

        if (playCard.CheckSelectCardsEx(pai, out count))
        {
            //    btnChuPai.SetActive(false);
            //    btnBuChu.SetActive(false);
        }

        //CardSprite[] sprites = playCard.GetComponentsInChildren<CardSprite>();
        //for (int i = 0; i < sprites.Length; i++)
        //{
        //    if (sprites[i].Select)
        //    {
        //        pai[count++] = sprites[i].Poker.GetId;
        //    }
        //}

        //num = selectedCardsList.Count;


        MsgManager m_Msg = GetMsgMgr();



        m_Msg.SendChuPai(pai, count);
    }
Esempio n. 2
0
    void Awake()
    {
        reverse        = 0;
        curPoint       = 0;
        nextPoint      = 1;
        speed          = 4;
        domainWidth    = 6.0f;
        pointNum       = Random.Range(3, 6);
        findEnemy      = false;
        haveFoundEnemy = false;
        patrolPoints   = new Vector3[pointNum];
        // Debug.Log (pointNum);
        // draw a domain need to be patroled
        DrawRectangle();
        // set patrol points
        SetPatrolPoints();
        m_Animator = gameObject.GetComponent <Animator>();

        float yRotation = Angle(transform.position, patrolPoints [nextPoint], new Vector3(transform.position.x, 0, 1));

        if (patrolPoints [nextPoint].x < transform.position.x && patrolPoints [nextPoint].z < transform.position.z)
        {
            yRotation += 90;
        }
        if (patrolPoints [nextPoint].x < transform.position.x)
        {
            yRotation = -yRotation;
        }
        transform.rotation = Quaternion.Euler(0, yRotation, 0);
        msgm = Singleton <MsgManager> .Instance;
    }
Esempio n. 3
0
            private static SessionStateStoreData Deserialize(
                HttpContext context,
                Stream stream)
            {
                int timeout;
                SessionStateItemCollection  stateItemCollection;
                HttpStaticObjectsCollection staticObjects;

                try
                {
                    BinaryReader reader = new BinaryReader(stream);
                    timeout = reader.ReadInt32();
                    bool flag = reader.ReadBoolean();
                    int  num  = reader.ReadBoolean() ? 1 : 0;
                    stateItemCollection = !flag ? new SessionStateItemCollection() : SessionStateItemCollection.Deserialize(reader);
                    staticObjects       = num == 0 ? SessionStateUtility.GetSessionStaticObjects(context) : HttpStaticObjectsCollection.Deserialize(reader);
                    if (reader.ReadByte() != byte.MaxValue)
                    {
                        throw new ProviderException(MsgManager.GetMsg(ErrRes.INVALID_SESSION_STATE));
                    }
                }
                catch (EndOfStreamException ex)
                {
                    throw new ProviderException(MsgManager.GetMsg(ErrRes.INVALID_SESSION_STATE));
                }
                return(new SessionStateStoreData((ISessionStateItemCollection)stateItemCollection, staticObjects, timeout));
            }
        public override bool DeleteRole(string roleName, bool throwOnPopulatedRole)
        {
            bool flag;

            Util.CheckParameter(ref roleName, true, true, true, 256, "roleName");
            OracleConnectionHolder connection    = null;
            OracleCommand          oracleCommand = null;

            try
            {
                try
                {
                    connection    = OracleConnectionHelper.GetConnection(this.m_OracleConnectionString);
                    oracleCommand = new OracleCommand("ora_aspnet_Roles_DeleteRole", connection.Connection)
                    {
                        CommandTimeout = this.m_CommandTimeout,
                        CommandType    = CommandType.StoredProcedure
                    };
                    oracleCommand.Parameters.Add(new OracleParameter("OutResult", OracleDbType.Int32, ParameterDirection.ReturnValue));
                    oracleCommand.Parameters[0].DbType = DbType.Int32;
                    oracleCommand.Parameters.Add(new OracleParameter("ApplicationName_", OracleDbType.NVarchar2));
                    oracleCommand.Parameters[1].Value = this.m_ApplicationName;
                    oracleCommand.Parameters.Add(new OracleParameter("RoleName_", OracleDbType.NVarchar2));
                    oracleCommand.Parameters[2].Value = roleName;
                    oracleCommand.Parameters.Add(new OracleParameter("DeleteOnlyIfRoleIsEmpty", OracleDbType.Int32));
                    if (!throwOnPopulatedRole)
                    {
                        oracleCommand.Parameters[3].Value = 0;
                    }
                    else
                    {
                        oracleCommand.Parameters[3].Value = 1;
                    }
                    oracleCommand.ExecuteNonQuery();
                    int value = (int)oracleCommand.Parameters[0].Value;
                    if (value == -3005)
                    {
                        throw new ProviderException(MsgManager.GetMsg(ErrRes.ROLE_IS_NOT_EMPTY, new string[0]));
                    }
                    flag = value == 0;
                }
                catch
                {
                    throw;
                }
            }
            finally
            {
                if (oracleCommand != null)
                {
                    oracleCommand.Dispose();
                }
                if (connection != null)
                {
                    connection.Close();
                    connection = null;
                }
            }
            return(flag);
        }
Esempio n. 5
0
    public void SaveLocalPlayerName()
    {
        if (localPlayerNameInput.text == "")
        {
            MsgManager.SetTheMsg("ERROR: You have to give some NAME in the input field which says: " + localPlayerNameInput.placeholder.GetComponent <Text>().text, 8f);
        }
        else
        {
            if (idForLocalPlayer != null && playerMadeAHighScoreCheck)
            {
                playerName = localPlayerNameInput.text;
                localHighscoreList[idForLocalPlayer].name = playerName;
                GetLocalHighScore();
            }
            else
            {
                playerName = localPlayerNameInput.text;
            }

            PlayerPrefs.SetString("LocalPlayerName", playerName);


            highscoreLocalNamePanel.SetActive(false);
            hScoreLocalNameConfigBtn.SetActive(true);
        }
    }
Esempio n. 6
0
    public void OpenMenu(string whatMenu)
    {
        MsgManager.MakeAMessage("Has abierto el menu: " + whatMenu, Color.white, 5f);
        foreach (Transform child in windows.transform)
        {
            GameObject g = child.gameObject;
            if (g.name == whatMenu)
            {
                // Es este.
                if (!imOcultado(g))
                {
                    addToProcessUI(false, g);
                }
            }
            else
            {
                // Pon en posicion inicial

                if (!imMostrado(g))
                {
                    addToProcessUI(true, g);
                }
            }
        }
    }
Esempio n. 7
0
 private void RegisterMessage()
 {
     MsgManager.Register(this, "LoadingRow", new Action <DataGridRowEventArgs>(e =>
     {
         var data = e.Row.Item as TestData;
         if (data == null)
         {
             return;
         }
         if (data.IntValue < 2000)
         {
             e.Row.Background = Brushes.LightSteelBlue;
         }
         else if (data.IntValue < 5000)
         {
             e.Row.Background = Brushes.CornflowerBlue;
         }
         else if (data.IntValue < 8000)
         {
             e.Row.Background = Brushes.LightPink;
         }
         else
         {
             e.Row.Background = Brushes.LightGreen;
         }
     }));
 }
Esempio n. 8
0
        public ActionResult Message()
        {
            UserInfo                 user        = Session["Userinfo"] as UserInfo;
            IMsgBLL                  msgBLL      = new MsgManager();
            IUserInfoBLL             userInfoBLL = new UserInfoManager();
            IEnumerable <Msg>        model       = msgBLL.LoadEntity(u => u.ReceiveId == user.Id);
            Dictionary <int, string> list        = new Dictionary <int, string>();

            //没有数据返回Null
            try
            {
                if (model.First() == null)
                {
                }
            }
            catch
            {
                ViewData.Model = null;
                return(View());
            }
            //序列化数据
            foreach (var item in model)
            {
                UserInfo us = userInfoBLL.LoadEntity(u => u.Id == item.SendId).FirstOrDefault();
                list[Convert.ToInt32(item.SendId)] = us.Name;
            }
            ViewData["NameList"] = list;
            ViewData.Model       = model;
            return(View());
        }
Esempio n. 9
0
    // Use this for initialization
    void Start()
    {
        MsgManager m = new MsgManager();

        m.DoMessage(100);
        m.DoMessageDele(200, 4545);
        Debug.Log("++++++++++++++++++++++++++++++++++++++++");
        m.DoMessageDele(100);
        m.DoMessageDele(300);
        m.DoMessageDele(200, 1212);

        Debug.Log("121212");
        //double a = 350;
        //for(int i=1;i<=30;++i)
        //{
        //    a = (a * 0.055) + a;
        //    Debug.Log(i +":"+a);
        //}
        //Type magicType = Type.GetType("Message");
        //ConstructorInfo magicConstructor = magicType.GetConstructor(Type.EmptyTypes);
        //object magicClassObject = magicConstructor.Invoke(new object[] { });

        // Get the ItsMagic method and invoke with a parameter value of 100

        //MethodInfo magicMethod = magicType.GetMethod("ItsMagic");
        //object magicValue = magicMethod.Invoke(magicClassObject, new object[] { 100 });

        //Debug.Log("MethodInfo.Invoke() Example\n");
        //Debug.Log(magicValue);
    }
Esempio n. 10
0
 public MsgManager GetMsgMgr()
 {
     if (!m_MsgMgr)
     {
         m_MsgMgr = GameObject.Find("GameController").GetComponent <MsgManager>();
     }
     return(m_MsgMgr);
 }
Esempio n. 11
0
    /// <summary>
    /// 下载需要更新的资源
    /// </summary>
    /// <param name="needDownload_dic"></param>
    /// <returns></returns>
    IEnumerator DownloadAsset(Dictionary <string, MD5_FileInfo> needDownload_dic)
    {
        int has_download_count  = 0;
        int need_download_count = needDownload_dic.Count;

        foreach (var pair in needDownload_dic)
        {
            string path = Util.PathCombine(AppConst.Res_Download_Address, Client.GetHttpServerBundleDir(), pair.Key);
            Debug.Log(path);

            WWW www = new WWW("http://" + path);
            while (!www.isDone)
            {
                yield return(null);
            }
            if (string.IsNullOrEmpty(www.error))
            {
                string file_path = Util.PathCombine(Client.GetPersistentPath(), pair.Key);
                string file_md5  = Util.GetBytesMD5(www.bytes);
                if (string.Equals(file_md5, pair.Value.MD5))                    //下载完成后,对Md5的教研
                {
                    string directory = file_path.Substring(0, file_path.LastIndexOf('/'));
                    if (!Directory.Exists(directory))
                    {
                        Directory.CreateDirectory(directory);
                    }
                    File.WriteAllBytes(file_path, www.bytes);
                    downloaded_dic.Add(pair.Key, pair.Value);
                    has_download_count++;
                    MsgManager.Broadcast(Msg.Res_Download_One, new object[] { (float)has_download_count / (float)need_download_count, pair.Key });
                }
                else
                {
                    //教研出错的话,需要加到下载队列中,重新下载
                    Debug.LogError("下载出错  " + pair.Key);
                }
            }
            else
            {
                Debug.Log(string.Format("下载出错    {0}    因为   {1} ", pair.Key, www.error));
            }
        }

        if (has_download_count == need_download_count)
        {
            ExportDownloadedMD5(downloaded_dic);
            MsgManager.Broadcast(Msg.Res_DownLoad_Finish, null);
            Debug.Log("下载完成");
        }
        else
        {
            Debug.Log(string.Format("下载进度  download_count    {0}   need_download  {1}", has_download_count, need_download_count));
        }
    }
Esempio n. 12
0
 public void RestartGame()
 {
     if (localPlayerNameInput.isFocused)
     {
         MsgManager.SetTheMsg("WARNING: Cannot restart the game before you stop editing your name! (The input is in focus)", 8f);
     }
     else
     {
         Application.LoadLevel(Application.loadedLevel);
     }
 }
Esempio n. 13
0
    // Update is called once per frame
    void Update()
    {
        GameManager.fps = (int)(1f / Time.unscaledDeltaTime);
        if (GameManager.fps <= 20)
        {
            fpsCheckTimer -= 1f * Time.deltaTime;
            if (fpsCheckTimer <= 0)
            {
                fpsCheckTimer = 99f;
                MsgManager.SetTheMsg("WARNING: You should consider changing your graphics settings to med or low!"
                                     + "\nPress <color=blue>'ESC'</color> and select the setting...", 8f);
            }
        }

        powerUpTimer -= 1f * Time.deltaTime;
        if (powerUpTimer < 0 && !canSpawnPowerUp)
        {
            powerUpTimer    = powerUpTimerTime; // reset the poweruptimer
            canSpawnPowerUp = true;
        }

        enemyCarSpawnTimer -= 1f * Time.deltaTime;
        if (enemyCarSpawnTimer <= 0f)
        {
            enemyCarCanSpawn   = true;
            enemyCarSpawnTimer = howSoonCanNewEnemyCarSpawn;
        }


        if (Input.GetKeyUp(KeyCode.Space) && GameManager.gameOver)
        {
            if (localPlayerNameInput.isFocused)
            {
                MsgManager.SetTheMsg("WARNING: Cannot restart the game before you stop editing your name! (The input is in focus)", 8f);
            }
            else
            {
                Application.LoadLevel(Application.loadedLevel);
            }
        }

        if (Input.GetKeyUp(KeyCode.Escape))
        {
            if (wannaQuitPanel.activeInHierarchy)
            {
                wannaQuitPanel.SetActive(false);
            }
            else
            {
                wannaQuitPanel.SetActive(true);
            }
        }
    }
Esempio n. 14
0
    void Awake()
    {
        _instance = this;
        msgLabel  = transform.Find("Label").GetComponent <UILabel> ();
        tween     = this.GetComponent <TweenAlpha> ();

        EventDelegate ed = new EventDelegate(this, "OnTweenFinished");

        tween.onFinished.Add(ed);

        gameObject.SetActive(false);
    }
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
     transform.GetChild(0).gameObject.SetActive(false);
 }
Esempio n. 16
0
        public override void CreateRole(string roleName)
        {
            Util.CheckParameter(ref roleName, true, true, true, 256, "roleName");
            OracleConnectionHolder connection    = null;
            OracleCommand          oracleCommand = null;

            try
            {
                try
                {
                    connection    = OracleConnectionHelper.GetConnection(this.m_OracleConnectionString);
                    oracleCommand = new OracleCommand("ora_aspnet_Roles_CreateRole", connection.Connection)
                    {
                        CommandTimeout = this.m_CommandTimeout,
                        CommandType    = CommandType.StoredProcedure
                    };
                    oracleCommand.Parameters.Add(new OracleParameter("OutResult", OracleDbType.Int32, ParameterDirection.ReturnValue));
                    oracleCommand.Parameters[0].DbType = DbType.Int32;
                    oracleCommand.Parameters.Add(new OracleParameter("ApplicationName_", OracleDbType.NVarchar2));
                    oracleCommand.Parameters[1].Value = this.m_ApplicationName;
                    oracleCommand.Parameters.Add(new OracleParameter("RoleName_", OracleDbType.NVarchar2));
                    oracleCommand.Parameters[2].Value = roleName;
                    oracleCommand.ExecuteNonQuery();
                    int value = (int)oracleCommand.Parameters[0].Value;
                    if (value == -3000)
                    {
                        int      pROVIDERROLEALREADYEXISTS = ErrRes.PROVIDER_ROLE_ALREADY_EXISTS;
                        string[] strArrays = new string[] { roleName };
                        throw new ProviderException(MsgManager.GetMsg(pROVIDERROLEALREADYEXISTS, strArrays));
                    }
                    if (value == 0)
                    {
                        return;
                    }
                }
                catch
                {
                    throw;
                }
            }
            finally
            {
                if (oracleCommand != null)
                {
                    oracleCommand.Dispose();
                }
                if (connection != null)
                {
                    connection.Close();
                    connection = null;
                }
            }
        }
Esempio n. 17
0
        /// <summary>
        /// 主页视图
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            ViewData["User"] = Session["Userinfo"];
            UserInfo us     = Session["Userinfo"] as UserInfo;
            IMsgBLL  msgBLL = new MsgManager();

            ViewData["Msg"] = msgBLL.LoadEntity(u => u.ReceiveId == us.Id);
            //if (us.Grade==0)
            //{
            //    return Redirect("/Home/UserIndex");
            //}
            return(View());
        }
Esempio n. 18
0
            public override void Initialize(string name, NameValueCollection config)
            {
                if (config == null)
                {
                    throw new ArgumentNullException(nameof(config));
                }
                if (string.IsNullOrEmpty(name))
                {
                    name = "Oracle.Web.SessionState.OracleSessionStateStoreProvider";
                }
                Util.HandleDescriptionAttribute(config, ErrRes.SESSIONSTATE_PROVIDER_DESCRIPTION);
                base.Initialize(name, config);
                this.m_CommandTimeout = Convert.ToInt32(Util.GetConfigValue(config["commandTimeout"], "30"));
                if (this.m_CommandTimeout < 0 || this.m_CommandTimeout > int.MaxValue)
                {
                    throw new ProviderException(MsgManager.GetMsg(ErrRes.PROVIDER_INVALID_COMMANDTIMEOUT_VALUE));
                }
                this.m_OracleConnectionString = Util.ReadConnectionString(config).Trim();
                config.Remove("connectionStringName");
                config.Remove("commandTimeout");
                Util.CheckForUnrecognizedAttribute(config);
                this.pApplicationName = HttpRuntime.AppDomainAppId;
                OracleConnectionHolder connectionHolder = (OracleConnectionHolder)null;
                OracleCommand          oracleCommand    = (OracleCommand)null;

                try
                {
                    connectionHolder = OracleConnectionHelper.GetConnection(this.m_OracleConnectionString);
                    oracleCommand    = new OracleCommand("ora_aspnet_SessnApp_GetAppID", connectionHolder.Connection);
                    ((DbCommand)oracleCommand).CommandTimeout = this.m_CommandTimeout;
                    ((DbCommand)oracleCommand).CommandType    = CommandType.StoredProcedure;
                    oracleCommand.Parameters.Add(new OracleParameter("OutResult", (OracleDbType)112, ParameterDirection.ReturnValue));
                    ((DbParameter)oracleCommand.Parameters[0]).DbType = DbType.Int32;
                    oracleCommand.Parameters.Add(new OracleParameter("appName_", (OracleDbType)119, 280));
                    ((DbParameter)oracleCommand.Parameters[1]).Value = (object)this.pApplicationName;
                    oracleCommand.Parameters.Add(new OracleParameter("appId_", (OracleDbType)120, ParameterDirection.Output));
                    ((DbParameter)oracleCommand.Parameters[2]).Size   = 16;
                    ((DbParameter)oracleCommand.Parameters[2]).DbType = DbType.Binary;
                    ((DbCommand)oracleCommand).ExecuteNonQuery();
                    this.m_appID = new Guid((byte[])((DbParameter)oracleCommand.Parameters[2]).Value).ToString();
                }
                catch
                {
                    throw;
                }
                finally
                {
                    ((Component)oracleCommand)?.Dispose();
                    connectionHolder?.Close();
                }
            }
Esempio n. 19
0
        /// <summary>
        /// 删除信息
        /// </summary>
        /// <returns></returns>
        public ActionResult DelMsg()
        {
            int     id     = Convert.ToInt32(Request["id"]);
            IMsgBLL msgBLL = new MsgManager();
            Msg     msg    = msgBLL.LoadEntity(u => u.MsgId == id).FirstOrDefault();

            if (msgBLL.DeleteEntity(msg))
            {
                return(Content("<script>window.location.href='/Home/Message';</script>"));//刷新页面
            }
            else
            {
                return(Content("<script>alert('删除失败!');window.location.href='/Home/Message';</script>"));//刷新页面
            }
        }
Esempio n. 20
0
        private void button3_Click(object sender, EventArgs e)
        {
            string [] lines = { tID1.Text.ToString(), tIP01.Text.ToString(), tIP02.Text.ToString(), tIP03.Text.ToString(), tIP04.Text.ToString(), tID2.Text.ToString(), tIP11.Text.ToString(), tIP12.Text.ToString(), tIP13.Text.ToString(), tIP14.Text.ToString(), tID3.Text.ToString(), tIP21.Text.ToString(), tIP22.Text.ToString(), tIP23.Text.ToString(), tIP24.Text.ToString(), tID4.Text.ToString(), tIP31.Text.ToString(), tIP32.Text.ToString(), textBox14.Text.ToString(), textBox13.Text.ToString() };

            if (textBox_path_id.Enabled == false)
            {
                MsgManager.saveIPmsg("IP.txt".ToString(), lines);
            }
            else
            {
                MsgManager.saveIPmsg(textBox_path_id.Text.ToString(), lines);
            }
            MessageBox.Show("设置成功");
            this.Close();
        }
Esempio n. 21
0
    IEnumerator GetHighScoreFromWeb()
    {
        WWWForm form = new WWWForm();

        form.AddField("game", "BackToThe80s"); // Check this in PHP so not everybody could check the scores

        WWW www = new WWW(serverUrl + getHScores, form);


        yield return(www);

        if (string.IsNullOrEmpty(www.error))
        {
            // Fill the highscore class itemlist with the database jsondata
            highscores = JsonUtility.FromJson <HighscoreItemArray>(www.text);

            // populate the list
            string newList = "";
            for (int i = 0; i < highscores.highscores.Length; i++)
            {
                newList += (i + 1).ToString() + " "
                           + highscores.highscores[i].name + " "
                           + highscores.highscores[i].score.ToString() + "\n";
            }
            // add the hscore list to the highscore panel
            highScorePanel.gameObject.GetComponent <HighscoreList>().highscoreList.text = newList;

            if (GameManager.debugIsOn)
            {
                Debug.Log("<color=green>User data got: </color>" + www.text);
            }
            // show the panel!
            highScorePanel.SetActive(true);
        }
        else
        {
            if (www.text.Contains("ERROR! No Access!"))
            {
                MsgManager.SetTheMsg("Error: There is something wrong with the PHP code!");
            }
            else
            {
                MsgManager.SetTheMsg("Error: Cannot get the highscores from the web!?!");
            }

            MsgManager.SetTheMsg("Error: Cannot get the highscores from the web!?!");
        }
    }
Esempio n. 22
0
    void UpdateRes()
    {
        old_res_dic = GetMd5_Old();
        StartCoroutine(DownLoadNewMD5());
        CheckNeedDownDic();

        if (need_download_dic.Count == 0)
        {
            MsgManager.Broadcast(Msg.Res_DownLoad_Finish, null);
        }
        else
        {
            MsgManager.Broadcast(Msg.Res_Download_Start, new object[] { res_total_size });
            StartCoroutine(DownloadAsset(need_download_dic));
        }
    }
Esempio n. 23
0
    void CheckNetworkStatus()
    {
        if (Application.internetReachability == NetworkReachability.NotReachable)
        {
            networkIsConnected = false;

            // Tell user this error
            MsgManager.SetTheMsg("Error: No Internet connection! \nHighscores will only be local and you cannot login!", 7f);

            if (GameManager.debugIsOn)
            {
                Debug.Log("Network Error: check your connection!");
            }
        }
        else
        {
            networkIsConnected = true;
        }
    }
Esempio n. 24
0
        /// <summary>
        /// 发送信息
        /// </summary>
        /// <returns></returns>
        public ActionResult SendMsg()
        {
            string name = Request["SendName"];
            string txt  = Request["SendTxt"];

            if (name.Equals("*"))
            {
                IUserInfoBLL userInfoBLL = new UserInfoManager();
                IMsgBLL      msgBLL      = new MsgManager();
                UserInfo     inu         = Session["Userinfo"] as UserInfo;
                int          nums        = 0;
                if (msgBLL.AddUserEntities(inu.Id, txt, out nums))
                {
                    return(Content("<script>alert('成功发送" + nums + "条消息');window.location.href='/Home/Message';</script>"));//刷新页面
                }
                else
                {
                    return(Content("<script>alert('发送失败!');history.go(-1);</script>"));//不刷新退回页面
                }
            }
            else
            {
                IUserInfoBLL userInfoBLL = new UserInfoManager();
                IMsgBLL      msgBLL      = new MsgManager();
                UserInfo     inu         = Session["Userinfo"] as UserInfo;
                UserInfo     us          = userInfoBLL.LoadEntity(u => u.Name == name).FirstOrDefault();
                Msg          msg         = new Msg();
                msg.SendId      = inu.Id;
                msg.ReceiveId   = us.Id;
                msg.MsgTxt      = txt;
                msg.MsgSendTime = DateTime.Now.ToLocalTime();
                if (msgBLL.AddEntity(msg))
                {
                    return(Content("<script>alert('发送成功!');window.location.href='/Home/Message';</script>"));//刷新页面
                }
                else
                {
                    return(Content("<script>alert('发送失败!');history.go(-1);</script>"));//不刷新退回页面
                }
            }
        }
Esempio n. 25
0
 public override void Initialize(string name, NameValueCollection config)
 {
     if (config == null)
     {
         throw new ArgumentNullException("config");
     }
     if (string.IsNullOrEmpty(name))
     {
         name = "Cdt.Membership.Security.OracleRoleProvider";
     }
     Util.HandleDescriptionAttribute(config, ErrRes.ROLE_PROVIDER_DESCRIPTION);
     base.Initialize(name, config);
     this.m_CommandTimeout = Convert.ToInt32(Util.GetConfigValue(config["commandTimeout"], "30"));
     if (this.m_CommandTimeout < 0 || this.m_CommandTimeout > 2147483647)
     {
         throw new ProviderException(MsgManager.GetMsg(ErrRes.PROVIDER_INVALID_COMMANDTIMEOUT_VALUE, new string[0]));
     }
     this.m_OracleConnectionString = Util.ReadConnectionString(config).Trim();
     this.m_ApplicationName        = Util.ReadAndVerifyApplicationName(config);
     config.Remove("connectionStringName");
     config.Remove("applicationName");
     config.Remove("commandTimeout");
     Util.CheckForUnrecognizedAttribute(config);
 }
Esempio n. 26
0
 private void Start()
 {
     MsgManager.Register(Msg.CheckRes, this, "CheckUpdate");
 }
Esempio n. 27
0
        private void mx_root_Loaded(object sender, RoutedEventArgs e)
        {
            HwndSource source = PresentationSource.FromVisual(this) as HwndSource;

            if (source != null)
            {
                source.AddHook(WndProc);
            }

            m_msgMng = new MsgManager();
            mx_viewFrame.Child = m_msgMng.m_GLHost;
            m_msgMng.m_GLHost.MessageHook += new HwndSourceHook(ControlMsgFilter);
        }
Esempio n. 28
0
        public override void RemoveUsersFromRoles(string[] userNames, string[] roleNames)
        {
            Util.CheckArrayParameter(ref roleNames, true, true, true, 256, "roleNames");
            Util.CheckArrayParameter(ref userNames, true, true, true, 256, "userNames");
            string empty = string.Empty;
            string str   = string.Empty;
            OracleConnectionHolder connection    = null;
            OracleCommand          oracleCommand = null;

            try
            {
                try
                {
                    connection    = OracleConnectionHelper.GetConnection(this.m_OracleConnectionString);
                    oracleCommand = new OracleCommand("ora_aspnet_UIR_RemUsersFmRoles", connection.Connection)
                    {
                        CommandTimeout = this.m_CommandTimeout,
                        CommandType    = CommandType.StoredProcedure
                    };
                    OracleParameter oracleParameter = oracleCommand.Parameters.Add("OutResult", OracleDbType.Int32, ParameterDirection.ReturnValue);
                    oracleParameter.DbType = DbType.Int32;
                    OracleParameter mApplicationName = oracleCommand.Parameters.Add("ApplicationName_", OracleDbType.NVarchar2);
                    mApplicationName.Value = this.m_ApplicationName;
                    OracleParameter length = oracleCommand.Parameters.Add("UserNames_", OracleDbType.NVarchar2);
                    length.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
                    length.Size           = (int)userNames.Length;
                    length.Value          = userNames;
                    OracleParameter length1 = oracleCommand.Parameters.Add("UserNames_Arr_Size", OracleDbType.Int32);
                    length1.Value = (int)userNames.Length;
                    OracleParameter oracleParameter1 = oracleCommand.Parameters.Add("RoleNames_", OracleDbType.NVarchar2);
                    oracleParameter1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
                    oracleParameter1.Size           = (int)roleNames.Length;
                    oracleParameter1.Value          = roleNames;
                    OracleParameter length2 = oracleCommand.Parameters.Add("RoleNames_Arr_Size", OracleDbType.Int32);
                    length2.Value = (int)roleNames.Length;
                    OracleParameter oracleParameter2 = oracleCommand.Parameters.Add("UserName", OracleDbType.NVarchar2, OracleRoleProvider.MAX_NAME_SIZE);
                    oracleParameter2.Direction = ParameterDirection.Output;
                    OracleParameter oracleParameter3 = oracleCommand.Parameters.Add("RoleName", OracleDbType.NVarchar2, OracleRoleProvider.MAX_NAME_SIZE);
                    oracleParameter3.Direction = ParameterDirection.Output;
                    oracleCommand.ExecuteNonQuery();
                    int value = (int)oracleCommand.Parameters[0].Value;
                    if (oracleCommand.Parameters[6].Value.ToString() != "null")
                    {
                        str = oracleCommand.Parameters[6].Value.ToString();
                    }
                    if (oracleCommand.Parameters[7].Value.ToString() != "null")
                    {
                        empty = oracleCommand.Parameters[7].Value.ToString();
                    }
                    int num = value;
                    switch (num)
                    {
                    case -3004:
                    {
                        int      pROVIDERTHISUSERNOTFOUND = ErrRes.PROVIDER_THIS_USER_NOT_FOUND;
                        string[] strArrays = new string[] { str };
                        throw new ProviderException(MsgManager.GetMsg(pROVIDERTHISUSERNOTFOUND, strArrays));
                    }

                    case -3003:
                    {
                        int      pROVIDERTHISUSERALREADYNOTINROLE = ErrRes.PROVIDER_THIS_USER_ALREADY_NOT_IN_ROLE;
                        string[] strArrays1 = new string[] { str, empty };
                        throw new ProviderException(MsgManager.GetMsg(pROVIDERTHISUSERALREADYNOTINROLE, strArrays1));
                    }

                    case -3002:
                    {
                        break;
                    }

                    case -3001:
                    {
                        int      pROVIDERROLENOTFOUND = ErrRes.PROVIDER_ROLE_NOT_FOUND;
                        string[] strArrays2           = new string[] { empty };
                        throw new ProviderException(MsgManager.GetMsg(pROVIDERROLENOTFOUND, strArrays2));
                    }

                    default:
                    {
                        if (num != 0)
                        {
                            goto case -3002;
                        }
                        return;
                    }
                    }
                }
                catch
                {
                    throw;
                }
            }
            finally
            {
                if (oracleCommand != null)
                {
                    oracleCommand.Dispose();
                }
                if (connection != null)
                {
                    connection.Close();
                    connection = null;
                }
            }
        }
Esempio n. 29
0
        public override string[] GetUsersInRole(string roleName)
        {
            string[] strArrays;
            Util.CheckParameter(ref roleName, true, true, true, 256, "roleName");
            OracleConnectionHolder connection       = null;
            OracleCommand          oracleCommand    = null;
            OracleDataReader       oracleDataReader = null;

            try
            {
                try
                {
                    StringCollection stringCollections = new StringCollection();
                    connection    = OracleConnectionHelper.GetConnection(this.m_OracleConnectionString);
                    oracleCommand = new OracleCommand("ora_aspnet_UIR_GetUsersInRoles", connection.Connection)
                    {
                        CommandTimeout = this.m_CommandTimeout,
                        CommandType    = CommandType.StoredProcedure
                    };
                    OracleParameter oracleParameter = oracleCommand.Parameters.Add("OutResult", OracleDbType.Int32, ParameterDirection.ReturnValue);
                    oracleParameter.DbType = DbType.Int32;
                    OracleParameter mApplicationName = oracleCommand.Parameters.Add("ApplicationName_", OracleDbType.NVarchar2);
                    mApplicationName.Value = this.m_ApplicationName;
                    oracleCommand.Parameters.Add("RoleName_", OracleDbType.NVarchar2).Value      = roleName;
                    oracleCommand.Parameters.Add("UserCursor", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
                    oracleDataReader = oracleCommand.ExecuteReader();
                    int value = (int)oracleCommand.Parameters[0].Value;
                    while (oracleDataReader.Read())
                    {
                        stringCollections.Add(oracleDataReader.GetString(0));
                    }
                    if (stringCollections.Count >= 1)
                    {
                        string[] strArrays1 = new string[stringCollections.Count];
                        stringCollections.CopyTo(strArrays1, 0);
                        strArrays = strArrays1;
                    }
                    else
                    {
                        int num = value;
                        if (num == -3001)
                        {
                            int      pROVIDERROLENOTFOUND = ErrRes.PROVIDER_ROLE_NOT_FOUND;
                            string[] strArrays2           = new string[] { roleName };
                            throw new ProviderException(MsgManager.GetMsg(pROVIDERROLENOTFOUND, strArrays2));
                        }
                        strArrays = (num != 0 ? new string[0] : new string[0]);
                    }
                }
                catch
                {
                    throw;
                }
            }
            finally
            {
                if (oracleDataReader != null)
                {
                    oracleDataReader.Dispose();
                }
                if (oracleCommand != null)
                {
                    oracleCommand.Dispose();
                }
                if (connection != null)
                {
                    connection.Close();
                    connection = null;
                }
            }
            return(strArrays);
        }
Esempio n. 30
0
 void Awake()
 {
     instance = this;
 }
Esempio n. 31
0
    /// <summary>
    /// 资源的解压
    /// </summary>
    /// <returns></returns>
    IEnumerator MoveStreamingAssetsToPersisdentPath()
    {
        string streamingPath  = Client.GetStreamingDataPath();       //随包资源目录
        string persistentPath = Client.GetPersistentPath();          //持久化资源目录

        if (Directory.Exists(persistentPath))
        {
            Directory.Delete(persistentPath, true);
        }
        Directory.CreateDirectory(persistentPath);

        //先找到MD5 匹配文件
        string inFile  = Client.GetStreamingMD5Path();
        string outFile = Client.GetPersistentMD5Path();

        if (File.Exists(outFile))
        {
            File.Delete(outFile);
        }

        if (Application.platform == RuntimePlatform.Android)
        {
            WWW www = new WWW(inFile);
            yield return(www);

            if (www.isDone)
            {
                File.WriteAllBytes(outFile, www.bytes);
            }
            yield return(0);
        }
        else
        {
            File.Copy(inFile, outFile, true);
        }
        yield return(new WaitForEndOfFrame());

        //释放所有文件到数据目录
        string[] files = File.ReadAllLines(outFile);
        MsgManager.Broadcast(Msg.Res_Release_Start, new object[] { files.Length });
        foreach (var file in files)
        {
            string[] fs = file.Split('|');
            inFile  = Path.Combine(streamingPath, fs[0]);
            outFile = Path.Combine(persistentPath, fs[0]);

            string dir = Path.GetDirectoryName(outFile);
            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(dir);
            }

            if (Application.platform == RuntimePlatform.Android)
            {
                WWW www = new WWW(inFile);
                yield return(www);

                if (www.isDone)
                {
                    File.WriteAllBytes(outFile, www.bytes);
                }
                yield return(0);
            }
            else
            {
                if (File.Exists(outFile))
                {
                    File.Delete(outFile);
                }
                File.Copy(inFile, outFile, true);
            }
            MsgManager.Broadcast(Msg.Res_Release_One, null);
            yield return(new WaitForEndOfFrame());
        }
        //解包完更新
        UpdateRes();
    }