Пример #1
0
        /// <summary>
        /// Parsing the response to get the field "pull_count
        /// </summary>
        /// <param name="Response"></param>
        /// <returns></returns>
        public static int ParseJson(string Response)
        {
            int Count = 0;
            //Parsing the response to get the field "pull_count"
            //-------------------------------------------------

            JObject Ob;

            Ob = JObject.Parse(Response);

#if DEBUG
            using (var tw1 = new StreamWriter("Response.txt", true))
            {
                tw1.WriteLine(Ob.ToString());
                tw1.Close();
            }
#endif
            string name = Ob["pull_count"].ToString();

#if DEBUG
            Console.WriteLine("count = {0}", name);
#endif
            Count = Convert.ToInt32(name);


            return(Count);
        }
Пример #2
0
        //三节身体小蛇
        public Snake(GameObject _prefab, Vector3 _pos,
                     Vector3 _dir, float _moveSpan, float _moveWait, float _scale, Control _controller) : base(_prefab, _pos, null, null)
        {
            active     = false;
            controller = _controller;
            preFab     = _prefab;

            this.direction = _dir;
            this.moveSpan  = _moveSpan;
            this.moveWait  = _moveWait;
            this.dest      = direction * moveSpan + Position;
            this.timer     = _moveWait;
            this.scale     = _scale;

            this.Ob.name = "head";
            this.SetColor(new Color(0.3f, 0.1f, 0.1f));

            bodyBegain = new SnakeNode(_prefab, this.Position - this.Ob.transform.forward * _scale, this, null);
            bodyBegain.SetColor(Color.gray);
            bodyBegain.Ob.name = "bodybegain";

            tail         = new SnakeNode(_prefab, bodyBegain.Ob.transform.position - bodyBegain.Ob.transform.forward * _scale, bodyBegain, null);
            tail.Ob.name = "tail";
            tail.SetColor(new Color(0.3f, 0.0f, 0.3f));

            this.SetNext(bodyBegain);
            bodyBegain.SetNext(tail);

            //Component
            Ob.AddComponent <SnakeCollision>();

            //Bodynum & Effected
            effectbodyNum = 0;
        }
Пример #3
0
        //GET /v2/repositories/(namespace)/(repository)/tags
        /// <summary>
        /// Obtain all tags or specific tag of a repository: (repname is the Docker repository name) in format json text
        /// </summary>
        /// <param name="repname"> name of the Docker repository on whish you want to get all tags </param>
        /// <returns>List of images tags  </returns>
        public static async System.Threading.Tasks.Task <String> DockGetTagsOb(string repname)
        {
            string url;

            url = "https://hub.docker.com/v2/repositories/" + repname + "/tags";

            string Response;

            Response = await GetHttpRep(url);

            JObject Ob;

            Ob = JObject.Parse(Response);

            string Rep;

            Rep = Ob.ToString(); // liste des tags au format texte (plus lisible)

//#if DEBUG
            //Console.WriteLine(Response);   // liste des tags au format json
            //Console.WriteLine("   ");
            //Console.WriteLine(Rep);        // liste des tags au format texte (plus lisible)
//#endif
            return(Rep);
        }
Пример #4
0
    public void AddEnemy(int type, int x, int z, int dir, string data)
    {
        Ob ob = new Ob(type, x, z, dir);

        ob.SetExtraData(data);
        enemyList.Add(ob);
    }
        protected override ValidationResult IsValid(object value, ValidationContext contexteVal)
        {
            bool b  = true;
            Ob   ob = new Ob();

            if (ExplorationObjet.Existe(contexteVal.ObjectInstance, "id"))
            {
                ob.id = (int)ExplorationObjet.Valeur(contexteVal.ObjectInstance, "id");
            }
            else
            {
                b = false;
            }

            if (!b)
            {
                return(new ValidationResult("Kolossale Error :("));
            }

            switch (_modele)
            {
            case "Utilisateur":
                b = !(new UtilisateurServiceAPI().EstUtilisee(ob.id));
                break;

            case "Role":
                b = !(new RoleServiceAPI().EstUtilisee(ob.id));
                break;

            case "Theme":
                b = !(new ThemeServiceAPI().EstUtilisee(ob.id));
                break;

            case "Blocage":
                b = !(new BlocageServiceAPI().EstUtilisee(ob.id));
                break;

            case "Nouvelle":
                b = !(new NouvelleServiceAPI().EstUtilisee(ob.id));
                break;

            /*case "Arbre":
             *  b = !(new ArbreServiceAPI().EstUtilisee(ob.id));
             *  break;*/
            default:
                return(new ValidationResult("Kolossale Error :("));

                break;
            }


            if (!b)
            {
                return(new ValidationResult(ErrorMessage));
            }
            return(ValidationResult.Success);

            /*base.IsValid(value, validationContext);*/
        }
Пример #6
0
    IEnumerator Counter()
    {
        yield return(new WaitForSeconds(10f));

        foreach (GameObject Ob in GameObject.FindGameObjectsWithTag("Player"))
        {
            Ob.GetComponent <PlayerScript>().ChangeCharacter;
        }
    }
Пример #7
0
        static void Main(string[] args)
        {
            Ob ob = new Ob {
                id = 1, nom = "le nom"
            };

            explorer(ob, "no");
            explorer(ob, "nom");

            Console.ReadKey();
        }
Пример #8
0
 public void Draw(SpriteBatch spritebatch, Camera Cam, GameTime GT)
 {
     DrawTiles(Cam, spritebatch);
     foreach (Object Ob in Objects)
     {
         Ob.Draw(spritebatch, Cam, GT);
     }
     foreach (Enemy E in Enemies)
     {
         E.Draw(spritebatch);
     }
 }
Пример #9
0
 public static void Dispose()
 {
     foreach (var Ob in Sounds.Values)
     {
         if (Ob != null)
         {
             Ob.Dispose();
         }
     }
     if (Device != null && !Device.Disposed)
     {
         Device.Dispose();
     }
 }
Пример #10
0
 private void OnVmOnSetFocusExecuted(object sender, SetFocusEventArg arg)
 {
     if (arg.ElementName == "DDS")
     {
         ComboBoxDoc.Focus();
     }
     if (arg.ElementName == "Ob")
     {
         if (!Ob.IsFocused)
         {
             Ob.Focus();
         }
     }
 }
Пример #11
0
        //GET /containers/json?filters={"status": ["running"]}
        //GET /containers/json? filters = { "status":["running"]
        //(on OS unix,linux) curl --unix-socket /var/run/docker.sock http://localhost/containers/json?filters=status=(running)
        //(on OS Windows ) curl http://localhost:2375/containers/json?filters={"status":["running"]}
        /// <summary>
        /// List only docker containers with a status : running – Get the Docker container list
        /// </summary>
        /// <param name="url"> name of the server url
        /// examples : host://localhost   or http://192.168.58.1 </param>
        /// <returns> running containers list </returns>
        public static async Task <String[]> DockContRunning(string url)
        {
            // url : adress of the local or remote server hosting the containers
            string url1;

            url1 = url + ":2375" + "/containers/json?filters={\"status\":[\"running\"]}";
            string Response1, Response2;

            Response1 = await Dck.GetHttpRep(url1);

            JArray Ob;

            Ob        = JArray.Parse(Response1); // for this Docker server endpoint  the data are in JArray format
            Response2 = Ob.ToString();
            //Console.WriteLine(Response2);

            String[] Out = new string[2];
            Out[0] = Response1;    // container info in json compact format  Jarray type of data
            Out[1] = Response2;    // container info in json text format  JArray type of data

            return(Out);
        }
    public void NoteCreate(int Num, List <Note> note, bool hold)
    {
        GameObject Ob, Create;
        Transform  File;

        for (int i = 0; i < Num; i++)
        {
            int Line = note[i].line;
            if (hold)
            {
                Hold h = note[i] as Hold;
                Create = Hold;
                File   = HoldFile;
            }
            Ob = Instantiate(Note, NoteFile);
            Ob.SetActive(false);
            Ob.transform.position = new Vector2(Line1Mid + LineAndLine * (Line - 1), Ob.transform.position.y);
            Ob.GetComponent <NoteBehavior>().arrivetime = Stage.BPM / 60 * note[i].Time;

            NoteChker[Line].Add(Ob);
        }
    }
    public void NoteCreate()
    {
        GameObject Ob;

        int[]   NoteLine = { 0, 0 };
        float[] NoteTime = { 0, 0 };
        for (int i = 0; i < 2; i++)
        {
            if (count[i] < maxchk[i])
            {
                if (i == 0)
                {
                    NoteLine[i] = Stage.N[count[i]].line;
                    NoteTime[i] = Stage.N[count[i]].Time;
                }
                else
                {
                    NoteLine[i] = Stage.H[count[i]].line;
                    NoteTime[i] = Stage.H[count[i]].Time;
                }
            }
        }
        //Debug.Log("NextGenerate: Note: Line " + NoteLine[0] + " Time " + NoteTime[0] + " Hold: Line " + NoteLine[1] + " Time " + NoteTime[1]);
        for (int k = 0; k <= 1; k++)
        {
            float NoteReady = (NoteTime[k] * (RealTime) + Stage.offset) - ((NoteTop - NoteBottom) / MoveSpeed);
            if (NoteReady <= StageTime)
            {
                if (count[k] < maxchk[k])
                {
                    Ob = Instantiate(NoteOrigin[k], NoteFile[k]);
                    Ob.transform.localPosition = new Vector2(Line1Mid + LineAndLine * NoteLine[k], Ob.transform.localPosition.y);

                    if (Editor)
                    {
                        EditNoitBeh DataID = Ob.GetComponent <EditNoitBeh>();
                        DataID.NoteIDonLine = NoteChker[NoteLine[k]].Count;
                        if (k == 1)
                        {
                            DataID.NoteData = Stage.H[count[k]];
                        }
                        else
                        {
                            DataID.NoteData = Stage.N[count[k]];
                        }
                        DataID.NoteIDinStageData = count[k];
                    }

                    NoteBehavior Data = Ob.GetComponent <NoteBehavior>();
                    Data.arrivetime = NoteTime[k] * (RealTime) + Stage.offset;

                    if (k == 1)
                    {
                        Data.isHold             = true;
                        Data.EndTime            = (Stage.H[count[k]].EndTime) * (RealTime) + Stage.offset;
                        Ob.transform.localScale = new Vector3(Ob.transform.localScale.x, (Speed * ((Stage.H[count[k]].EndTime - NoteTime[k])) * (RealTime)) / HoldSize, 1);
                    }
                    NoteChker[NoteLine[k]].Add(Data);

                    count[k] += 1;
                }
            }
        }
    }
Пример #14
0
    public void AddPiece(int type, int x, int z)
    {
        Ob ob = new Ob(type, x, z);

        pieceList.Add(ob);
    }
Пример #15
0
        //------------------------------------------------------------------------------------------------------------
        //The routine : GetAllIssuesPj returns a list of  all issues in a project
        /// <summary>
        ///  execute a GET http request on a Jira server with Rest API, to get all issues from a JIRA project.
        ///  Write results to an Excel file
        ///  </summary>

        //---------------------------------------------------------------------------------------------------------------
        public static async Task GetAllIssuesPj(string username, string password, string urlbase, string projectname, int Writeconsole)
        {
            Console.WriteLine("---------------------------------------------------------------------------");
            Console.WriteLine("Execute (Jira Server platform) REST API");
            Console.WriteLine("----------------------------------------------------------------------------");
            Console.WriteLine(" REf : Goto : https://docs.atlassian.com/software/jira/docs/api/REST/8.13.2/");
            Console.WriteLine("----------------------------------------------------------------------------");

            string url;

            url = urlbase + "/rest/api/2/search?jql=project=" + projectname;
            Console.WriteLine(" URIs for Jira's REST API cchoosed to pick issues from project : {0} is : {1} ", projectname, url);
            Console.WriteLine("------------------------------------------------------------------------------------------------");

            //Send the request via Http protocol to the JIRA server & Get the response in a string (the string is Json formated)
            //------------------------------------------------------------------------------------------------------------------
            string result;

            result = await Http.GetHttpResponse(username, password, url);


            //wrtite to Console sous forme groupée
            //---------------------------------------------------------------------------
            if (Writeconsole == 1)
            {
                Console.WriteLine(result);
                Console.WriteLine("----------------------------------------------------------");
            }

            JObject Ob;

            Ob = JObject.Parse(result);

            //wrtite to Console sous forme d'objet
            //---------------------------------------------------------------------------
            if (Writeconsole == 1)
            {
                Console.WriteLine(Ob.ToString());
                Console.WriteLine("----------------------------------------------------------");
            }

            //write the result sous forme groupée in a file
            // write the result in a json formated file
            //----------------------------------------------------------------------------
            //ecriture dans un fichier des données au format Json
            // Get the current directory.

            string dir  = Directory.GetCurrentDirectory();
            string path = dir + "/List-issues-" + projectname + ".json";

            if (File.Exists(path))
            {
                File.Delete(path);
            }
            using (var tw = new StreamWriter(path, true))
            { tw.WriteLine(result.ToString());
              tw.Close(); }
            Console.WriteLine("json formated file : List-issues-{0}.json created ", projectname);
            Console.WriteLine("--------------------------------------------------------------");

            //write the result sous forme groupée in a file
            // write the result in a text formated file
            //----------------------------------------------------------------------------
            //ecriture dans un fichier des données au format string

            string path1 = dir + "/List-issues-" + projectname + ".txt";

            if (File.Exists(path1))
            {
                File.Delete(path1);
            }
            using (var tw1 = new StreamWriter(path1, true))
            { tw1.WriteLine(Ob.ToString());
              tw1.Close(); }
            Console.WriteLine("text formated file :  List-issues-{0}.txt created ", projectname);
            Console.WriteLine("----------------------------------------------------------");


            // Get the number of issues from the project stored in the json JObject Ob
            //----------------------------------------------------------------------
            int NumberOfIssues = 0;

            NumberOfIssues = GetNumberIssue(Ob);

            // Get all issues details of the project, stored in the JObject variable : Ob
            //--------------------------------------------------------------------------
            IssueInfos[] Data2;
            Data2 = GetProjectIssues(projectname, Ob, NumberOfIssues);

            //Write results to a EXcel file
            //------------------------------------------------------------------------
            WrPrIssuesToXL(Data2, projectname, NumberOfIssues);
        }
Пример #16
0
    public void AddEnemy(int type, int x, int z, int dir)
    {
        Ob ob = new Ob(type, x, z, dir);

        enemyList.Add(ob);
    }
Пример #17
0
        protected override ValidationResult IsValid(object value, ValidationContext contexteVal)
        {
            bool b  = true;
            Ob   ob = new Ob();

            ob.lit = (string)ExplorationObjet.Valeur(contexteVal.ObjectInstance, _cherche);


            try
            {
                if (ExplorationObjet.Existe(contexteVal.ObjectInstance, "id"))
                {
                    ob.id = (int?)ExplorationObjet.Valeur(contexteVal.ObjectInstance, "id");
                }
                else
                {
                    ob.id = null;
                }
            }
            catch (Exception)
            {
                return(new ValidationResult("Kolossale Error :("));

                throw;
            }

            if (_action == EnumAction.CREER)
            {
                ob.id = null;
            }

            if (!(_chercheint == ""))
            {
                try
                {
                    if (ExplorationObjet.Existe(contexteVal.ObjectInstance, _chercheint))
                    {
                        ob.litint = (int)ExplorationObjet.Valeur(contexteVal.ObjectInstance, _chercheint);
                    }
                    else
                    {
                        return(new ValidationResult("Kolossale Error :("));
                    }
                }
                catch (Exception)
                {
                    return(new ValidationResult("Kolossale Error :("));

                    throw;
                }
            }

            switch (_modele)
            {
            case "Utilisateur":
                ob.res = new UtilisateurServiceAPI().DonnerParNom(ob.lit);
                break;

            case "Role":
                ob.res = new RoleServiceAPI().DonnerParNom(ob.lit);
                break;

            case "Blocage":
                ob.res = new BlocageServiceAPI().DonnerParNom(ob.lit);
                break;

            case "Theme":
                ob.res = new BlocageServiceAPI().DonnerParNom(ob.lit);
                break;

            case "Abonnement":
                ob.res = new AbonnementServiceAPI().DonnerParNom(ob.lit);
                break;

            case "Arbre":
                ob.res = new ArbreServiceAPI().DonnerParNom(ob.lit, ob.litint);
                break;

            default:
                b = false;
                break;
            }

            if (!b)
            {
                return(new ValidationResult("Kolossale Error :("));
            }

            switch (_action)
            {
            case EnumAction.CREER:
                if (ob.res != null)
                {
                    b = false;
                }
                break;

            case EnumAction.MODIFIER:
                if (!(ob.res == ob.id))
                {
                    b = true;
                }
                break;
            }
            if (!b)
            {
                return(new ValidationResult(ErrorMessage));
            }
            return(ValidationResult.Success);

            /*base.IsValid(value, validationContext);*/
        }
Пример #18
0
    //更新
    protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow row     = GridView1.Rows[e.RowIndex];
        string      keyword = GridView1.DataKeys[e.RowIndex].Values[0].ToString();

        string[] ss  = ((DropDownList)GridView1.Rows[e.RowIndex].FindControl("staffNo")).Text.Split('(');
        string[] sN1 = ss[1].Split(')');
        string   sN  = sN1[0];
        string   Ty  = ((DropDownList)GridView1.Rows[e.RowIndex].FindControl("DropDownList1")).SelectedItem.Text;

        string[] ss2 = ((DropDownList)GridView1.Rows[e.RowIndex].FindControl("DropDownList2")).SelectedItem.Text.Split('(');
        string   Ob;

        if (ss2.Length == 1)
        {
            Ob = ((DropDownList)GridView1.Rows[e.RowIndex].FindControl("DropDownList2")).SelectedItem.Text;
        }
        else
        {
            string[] ss3 = ss2[1].Split(')');
            Ob = ss3[0];
        }
        string Fr = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox4")).Text;
        string To = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox5")).Text;
        string Ex = ((DropDownList)GridView1.Rows[e.RowIndex].FindControl("DropDownList3")).SelectedItem.Text;
        string Re = ((TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox7")).Text;

        if (sN != "" && Ty != "" && Ob != "" && Fr != "" && To != "" && Ex != "" && Re != "")
        {
            bool flag = false;
            if (Ty == "CREW")
            {
                string SQL_Staff = "select Crew_Info.Staff_No from Crew_Info "
                                   + " order by Crew_Info.Staff_No";


                // DataTable dt = new DataTable();

                using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.Conn, CommandType.Text, SQL_Staff))
                {
                    while (rdr.Read())
                    {
                        if (Ob == Convert.ToString(rdr.GetSqlValue(0)))
                        {
                            flag = true;
                        }
                    }
                }
            }
            else if (Ty == "STATION")
            {
                string SQL_Stn = "select * from vStn "
                                 + " order by DEP_APT";



                using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.Conn1, CommandType.Text, SQL_Stn))
                {
                    while (rdr.Read())
                    {
                        if (Ob == Convert.ToString(rdr.GetSqlValue(0)))
                        {
                            flag = true;
                        }
                    }
                }
            }
            else if (Ty == "CARRIER")
            {
                if (Ob == "CA" || Ob == "NX" || Ob == "NXCA")
                {
                    flag = true;
                }
            }



            if (flag)
            {
                //查旧记录


                string SQL_query = " select * from Crew_Check"
                                   + " where Crew_Check.CC_ID='" + keyword + "'";

                SqlParameter[] parmlog = new SqlParameter[] {
                    new SqlParameter("@sN", SqlDbType.VarChar, 10),
                    new SqlParameter("@DO", SqlDbType.VarChar, 200),
                    new SqlParameter("@DA", SqlDbType.VarChar, 200),
                    new SqlParameter("@AC", SqlDbType.VarChar, 50),
                    new SqlParameter("@RB", SqlDbType.VarChar, 50),
                    new SqlParameter("@ET", SqlDbType.VarChar, 10)
                };



                using (SqlDataReader rdr = SqlHelper.ExecuteReader(SqlHelper.Conn, CommandType.Text, SQL_query))
                {
                    if (rdr.Read())
                    {
                        parmlog[0].Value = rdr[1].ToString().Trim();
                        parmlog[1].Value = rdr[1].ToString().Trim() + "/" + rdr[2].ToString().Trim() + "/" + rdr[3].ToString().Trim() + "/" + rdr[4].ToString().Trim() + "/" + rdr[5].ToString().Trim() + "/" + rdr[6].ToString().Trim();
                        parmlog[2].Value = sN.Trim() + "/" + Ty.Trim() + "/" + Ob.Trim() + "/" + Fr.Trim() + "/" + To.Trim() + "/" + Ex.Trim();
                        parmlog[3].Value = "UPDATA";
                        parmlog[4].Value = Session["User_ID"].ToString();
                        parmlog[5].Value = "CC";
                    }
                }


                //写日志
                string SQL_Log = "INSERT INTO Crew_Check_Log"
                                 + " (Staff_No,Details_Origin,Details_After_Action,Actions,Rcd_By,Edit_Table)"
                                 + " VALUES(@sN,@DO,@DA,@AC,@RB,@ET)";
                using (SqlConnection conn = new SqlConnection(SqlHelper.Conn))
                {
                    SqlHelper.ExecuteNonQuery(conn, CommandType.Text, SQL_Log, parmlog);
                }


                //更新

                string SQL_Update = "UPDATE Crew_Check "
                                    + " SET Crew_Check.Staff_No ='" + sN + "' , No_Type ='" + Ty + "'  ,No_Object= '" + Ob + "' ,No_From='" + Fr + "',No_To ='"
                                    + To + "', Except_For = '" + Ex + "' ,Remark='" + Re + "'"
                                    + " where Crew_Check.CC_ID='" + keyword + "'";

                using (SqlConnection conn = new SqlConnection(SqlHelper.Conn))
                {
                    SqlHelper.ExecuteNonQuery(conn, CommandType.Text, SQL_Update);
                }
            }
            else
            {
                //Response.Write("<script>alert('Type and Object do not match')</script>");
                ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('Type and Object do not match');</script>");
            }
        }
        else
        {
            //Response.Write("<script>alert('Please fill in all the information')</script>");
            ClientScript.RegisterStartupScript(GetType(), "message", "<script>alert('Please fill in all the information');</script>");
        }



        GridView1.EditIndex = -1;
        Bind();
    }