Inheritance: MonoBehaviour
 public CouchApi( string urlHostPart, string urlDbPart, System.Net.WebHeaderCollection headers, bool isSelfChecking=true)
 {
     this.urlHostPart=urlHostPart;
     this.urlDbPart=urlDbPart;
     this.IsSelfChecking=IsSelfChecking;
     rest = new Rest("application/json", "application/json", headers);
 }
Ejemplo n.º 2
0
 public BlowJobType()
 {
     Time= new Duration();
     Sucks = new Duration();
     Speed = new Duration();
     Punish =  new PunishMulti();
     Rest= new Rest();
 }
Ejemplo n.º 3
0
        public DonPedroJob()
        {
            RalphURL = Properties.app.Default.ralph_url;
            ReportURL = RalphURL + Properties.app.Default.api_path;
            MaxTries = Properties.app.Default.max_tries;
            SecondsInterval = Properties.app.Default.tries_interval;
            ApiUser = Properties.app.Default.api_user;
            ApiKey = Properties.app.Default.api_key;

            ServicePointManager.ServerCertificateValidationCallback += delegate { return true; };

            apiClient = new Rest();
        }
Ejemplo n.º 4
0
 /// <summary>
 ///   Deserializes workflow markup into an rest object
 /// </summary>
 /// <param name = "xml">string workflow markup to deserialize</param>
 /// <param name = "obj">Output rest object</param>
 /// <param name = "exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out Rest obj, out Exception exception)
 {
     exception = null;
     obj = default(Rest);
     try
     {
         obj = Deserialize(xml);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            var rest = new Rest();

            var restCategotries = rest.getRestaurantCategories();
            var restList = rest.GetResturants(5);

            var client = new MongoClient("mongodb://localhost:27017");
            var server = client.GetServer();
            var database = server.GetDatabase("Lucky");
            var collection = database.GetCollection("restaurants");

            collection.InsertBatch(restList);

            /*foreach (var document in collection.FindAll())
            {
                Console.WriteLine(document["name"]);
            }*/

            Console.Read();
        }
Ejemplo n.º 6
0
 internal static List<Rest> Insert(List<api.inner.Rest> value)
 {
     var ret = new List<Rest>();
     try
     {
         value.ForEach(x =>
         {
             var add = new Rest();
             add.no = x.no;
             add.charid = x.charid;
             add.reststarttime = x.reststarttime;
             add.restendtime = x.restendtime;
             add.cardinfo = x.cardinfo;
             ret.Add(add);
         });
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return ret;
 }
Ejemplo n.º 7
0
        public void Start()
        {
            this.draw = true;
            this.influenceMapDebugMode = 0;

            this.navMesh = NavigationManager.Instance.NavMeshGraphs[0];
            this.Character = new DynamicCharacter(this.gameObject);

            //initialization of the movement algorithms
            this.aStarPathFinding = new NodeArrayAStarPathFinding(this.navMesh, new EuclideanDistanceHeuristic(), this);
            this.aStarPathFinding.NodesPerSearch = 500;

            var steeringPipeline = new SteeringPipeline
            {
                MaxAcceleration = 40.0f,
                MaxConstraintSteps = 2,
                Character = this.Character.KinematicData,
            };

            this.decomposer = new PathFindingDecomposer(steeringPipeline, this.aStarPathFinding);
            this.Targeter = new FixedTargeter(steeringPipeline);
            steeringPipeline.Targeters.Add(this.Targeter);
            steeringPipeline.Decomposers.Add(this.decomposer);
            steeringPipeline.Actuator = new FollowPathActuator(steeringPipeline);

            this.Character.Movement = steeringPipeline;

            //initialization of the Influence Maps
            this.RedInfluenceMap = new InfluenceMap(this.navMesh,new SimpleUnorderedList(), new ClosedLocationRecordDictionary(), new LinearInfluenceFunction(), 0.1f);
            this.GreenInfluenceMap = new InfluenceMap(this.navMesh, new SimpleUnorderedList(), new ClosedLocationRecordDictionary(), new LinearInfluenceFunction(), 0.1f);
            this.ResourceInfluenceMap = new InfluenceMap(this.navMesh, new SimpleUnorderedList(), new ClosedLocationRecordDictionary(), new LinearInfluenceFunction(), 0.1f);
            this.CombinedInfluence = new Dictionary<LocationRecord, float>();
            this.SecurityMap = new Dictionary<LocationRecord, float>();

            //initialization of the GOB decision making
            //let's start by creating 5 main goals
            //the eat goal is the only goal that increases at a fixed rate per second, it increases at a rate of 0.1 per second
            this.SurviveGoal = new Goal(SURVIVE_GOAL, 2.0f);
            this.EatGoal = new Goal(EAT_GOAL, 1.0f)
            {
                ChangeRate = 0.1f
            };
            this.GetRichGoal = new Goal(GET_RICH_GOAL, 1.0f)
            {
                InsistenceValue = 5.0f,
                ChangeRate = 0.2f
            };
            this.RestGoal = new Goal(REST_GOAL, 1.0f);
            this.ConquerGoal = new Goal(CONQUER_GOAL, 1.5f)
            {
                InsistenceValue = 5.0f
            };

            this.Goals = new List<Goal>();
            this.Goals.Add(this.SurviveGoal);
            this.Goals.Add(this.EatGoal);
            this.Goals.Add(this.GetRichGoal);
            this.Goals.Add(this.RestGoal);
            this.Goals.Add(this.ConquerGoal);

            //initialize the available actions

            var restAction = new Rest(this);
            this.Actions = new List<Action>();
            this.Actions.Add(restAction);
            this.Actions.Add(new PlaceFlag(this));

            this.ActiveResources = new Dictionary<NavigationGraphNode, IInfluenceUnit>();
            int boars = 0;
            int chests = 0;
            int trees = 0;
            int beds = 0;

            foreach (var chest in GameObject.FindGameObjectsWithTag("Chest"))
            {
                chests++;
                this.Actions.Add(new PickUpChest(this, chest));
                this.AddResource(new Resource(this.navMesh.QuantizeToNode(chest.transform.position, 1.0f)));
            }

            foreach (var tree in GameObject.FindGameObjectsWithTag("Tree"))
            {
                trees++;
                this.Actions.Add(new GetArrows(this, tree));
                this.AddResource(new Resource(this.navMesh.QuantizeToNode(tree.transform.position, 1.0f)));
            }

            foreach (var bed in GameObject.FindGameObjectsWithTag("Bed"))
            {
                beds++;
                this.Actions.Add(new Sleep(this, bed));
                this.AddResource(new Resource(this.navMesh.QuantizeToNode(bed.transform.position, 1.0f)));
            }

            foreach (var boar in GameObject.FindGameObjectsWithTag("Boar"))
            {
                boars++;
                this.AddResource(new Resource(this.navMesh.QuantizeToNode(boar.transform.position, 1.0f)));
                this.Actions.Add(new MeleeAttack(this, boar));
                this.Actions.Add(new Shoot(this, boar));
            }

            this.ResourceInfluenceMap.Initialize(this.ActiveResources.Values.ToList());

            //flags used for the influence map
            this.RedFlags = new List<IInfluenceUnit>();
            foreach (var redFlag in GameObject.FindGameObjectsWithTag("RedFlag"))
            {
                this.RedFlags.Add(new Flag(this.navMesh.QuantizeToNode(redFlag.transform.position, 1.0f), FlagColor.Red));
            }

            this.GreenFlags = new List<IInfluenceUnit>();
            foreach (var greenFlag in GameObject.FindGameObjectsWithTag("GreenFlag"))
            {
                this.GreenFlags.Add(new Flag(this.navMesh.QuantizeToNode(greenFlag.transform.position, 1.0f), FlagColor.Green));
            }

            this.RedInfluenceMap.Initialize(this.RedFlags);
            this.GreenInfluenceMap.Initialize(this.GreenFlags);

            var worldModel = new CurrentStateWorldModelFEAR(this.GameManager, this.Actions, this.Goals);
            worldModel.InitArrays( boars, trees,  beds,  chests);

            this.GOAPDecisionMaking = new DepthLimitedGOAPDecisionMaking(worldModel,this.Actions,this.Goals);
        }
Ejemplo n.º 8
0
 private void MapTo(Rest.User user)
 {
     user.Email = Email;
     user.FullName = FullName;
 }
Ejemplo n.º 9
0
 public static bool Deserialize(string xml, out Rest obj)
 {
     Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
Ejemplo n.º 10
0
 public static bool LoadFromFile(string fileName, out Rest obj)
 {
     Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
Ejemplo n.º 11
0
 /// <summary>
 ///   Deserializes xml markup from file into an rest object
 /// </summary>
 /// <param name = "fileName">string xml file to load and deserialize</param>
 /// <param name = "obj">Output rest object</param>
 /// <param name = "exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out Rest obj, out Exception exception)
 {
     exception = null;
     obj = default(Rest);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 public NetworkStorage()
 {
     rest = new Rest();
 }
Ejemplo n.º 13
0
 //构造函数
 public Entity()
 {
     eat=new Eat();
     drink=new Drink();
     rest=new Rest();
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AccountStore"/> class.
 /// </summary>
 public AccountStore()
 {
     this.rest = new Rest();
 }
Ejemplo n.º 15
0
        protected static string GetErrorMessageWithRequestIdInfo(Rest.Azure.CloudException cloudException)
        {
            if (cloudException == null)
            {
                return "No information in the cloud exception.";
            }

            var sb = new StringBuilder();

            if (!string.IsNullOrEmpty(cloudException.Message))
            {
                sb.Append(cloudException.Message);
            }

            if (cloudException.Response == null)
            {
                return sb.ToString();
            }

            if (cloudException.Response.Content != null)
            {
                var errorReturned = JsonConvert.DeserializeObject<PSComputeLongRunningOperation>(
                    cloudException.Response.Content);

                if (errorReturned.Error != null)
                {
                    sb.AppendLine().AppendFormat("ErrorCode: {0}", errorReturned.Error.Code);
                    sb.AppendLine().AppendFormat("ErrorMessage: {0}", errorReturned.Error.Message);
                }

                if (errorReturned.StartTime != null)
                {
                    sb.AppendLine().AppendFormat("StartTime: {0}", errorReturned.StartTime);
                }

                if (errorReturned.EndTime != null)
                {
                    sb.AppendLine().AppendFormat("EndTime: {0}", errorReturned.EndTime);
                }

                if (string.IsNullOrWhiteSpace(errorReturned.OperationId) &&
                    !string.IsNullOrWhiteSpace(errorReturned.Name))
                {
                    sb.AppendLine().AppendFormat("OperationID: {0}", errorReturned.Name);
                }
                else if (!string.IsNullOrWhiteSpace(errorReturned.OperationId))
                {
                    sb.AppendLine().AppendFormat("OperationID: {0}", errorReturned.OperationId);
                }

                if (!string.IsNullOrWhiteSpace(errorReturned.Status))
                {
                    sb.AppendLine().AppendFormat("Status: {0}", errorReturned.Status);
                }
            }

            if (!cloudException.Response.StatusCode.Equals(HttpStatusCode.OK))
            {
                sb.AppendLine().AppendFormat("StatusCode: {0}", cloudException.Response.StatusCode.GetHashCode());
                sb.AppendLine().AppendFormat("ReasonPhrase: {0}", cloudException.Response.ReasonPhrase);
                if (cloudException.Response.Headers == null
                    || !cloudException.Response.Headers.ContainsKey(RequestIdHeaderInResponse))
                {
                    return sb.ToString();
                }

                string operationId = cloudException.RequestId;

                sb.AppendLine().AppendFormat(
                    "OperationID : {0}",
                    operationId);
            }
            return sb.ToString();
        }
Ejemplo n.º 16
0
 public ComputeCloudException(Rest.Azure.CloudException ex)
     : base(GetErrorMessageWithRequestIdInfo(ex), ex)
 {
 }
Ejemplo n.º 17
0
 public RestManager(Rest rest, TPulse tPulse)
 {
     Rest = rest;
     TPulse = tPulse;
 }
Ejemplo n.º 18
0
 /* Constructor
  * */
 public SPluginApi(Rest Rest, Database DB)
 {
     this.Rest = Rest;
     this.DB = DB;
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StreamStore"/> class.
 /// </summary>
 public StreamStore()
 {
     this.rest = new Rest();
 }
Ejemplo n.º 20
0
 public RestManager(Rest rest)
 {
     Rest = rest;
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GifStore"/> class.
 /// </summary>
 public GifStore()
 {
     this.rest = new Rest("http://api.gifme.io");
 }