コード例 #1
0
ファイル: AnimClock.cs プロジェクト: pocdev/solar-sail
	// Use this for initialization
	void Start () {
		_scrubber = GameObject.FindGameObjectWithTag("Scrubber").GetComponent<Scrubber>();
		_scrubber.OnScrubValueChanged += OnScrubberChanged;		
		
		_clockHand = GetComponentInChildren<LineRenderer>();
		_clockHand.SetVertexCount(2);
		_clockHand.SetPosition(1,new Vector3(0f,10f,0f));
	}	
コード例 #2
0
        public void DeleteFilesDeletesSymlinkButNotTarget(bool useRelativeTargetForSymlink)
        {
            string rootDir = Path.Combine(TemporaryDirectory, nameof(DeleteFilesDeletesSymlinkButNotTarget));

            string fileBasename = "out.txt";
            string fullFilePath = WriteFile(Path.Combine(rootDir, fileBasename));

            XAssert.IsTrue(File.Exists(fullFilePath));

            string fullSymlinkPath = WriteSymlink(
                Path.Combine(rootDir, $"sym-{fileBasename}"),
                useRelativeTargetForSymlink ? fileBasename : fullFilePath,
                isTargetFile: true);

            XAssert.IsTrue(FileUtilities.FileExistsNoFollow(fullSymlinkPath));

            var numDeleted = Scrubber.DeleteFiles(new[] { fullSymlinkPath });

            XAssert.AreEqual(1, numDeleted);
            XAssert.IsFalse(File.Exists(fullSymlinkPath));
            XAssert.IsTrue(File.Exists(fullFilePath));
        }
コード例 #3
0
ファイル: SJScrubListener.cs プロジェクト: pocdev/ar
	// Use this for initialization
	void Start () 
	{
		_scrubber = GameObject.FindGameObjectWithTag("Scrubber").GetComponent<Scrubber>();
		_scrubber.OnScrubValueChanged += OnScrubValueChanged;
		
		_sail = GameObject.FindGameObjectWithTag("Sail");
		_animState = _sail.animation[_sail.animation.clip.name];
		_animState.speed = 0.0f;
		_sail.animation.Play();
		
		_playButton = GameObject.Find("PlayButton").GetComponent<PlayButton>();
		
		OnScrubValueChanged(0f);
		
		foreach(MegaPointCache MPC in _sail.GetComponentsInChildren<MegaPointCache>())
		{
			if(MPC.maxtime >= _animLoopTime)
				_animLoopTime = MPC.maxtime;
		}
		
		if(_animState.length > _animLoopTime)
			_animLoopTime = _animState.length;
	}
コード例 #4
0
        protected override void ExecutionImpl(IEsbChannel esbChannel, IDSFDataObject dataObject, string inputs, string outputs, out ErrorResultTO tmpErrors, int update)
        {
            tmpErrors = new ErrorResultTO();
            if (Headers == null)
            {
                tmpErrors.AddError(ErrorResource.HeadersAreNull);
                return;
            }
            if (QueryString == null)
            {
                tmpErrors.AddError(ErrorResource.QueryIsNull);
                return;
            }

            var(head, query, _) = ConfigureHttp(dataObject, update);

            var url = ResourceCatalog.GetResource <WebSource>(Guid.Empty, SourceId);

            if (dataObject.IsDebugMode())
            {
                AddDebugInputItem(new DebugEvalResult(query, "URL", dataObject.Environment, update));
                AddDebugInputItem(new DebugEvalResult(url.Address, "Query String", dataObject.Environment, update));
            }
            var webRequestResult = PerformWebRequest(head, query, url);

            tmpErrors.MergeErrors(_errorsTo);

            ResponseManager = new ResponseManager
            {
                OutputDescription = OutputDescription,
                Outputs           = Outputs,
                IsObject          = IsObject,
                ObjectName        = ObjectName
            };
            webRequestResult = Scrubber.Scrub(webRequestResult);
            ResponseManager.PushResponseIntoEnvironment(webRequestResult, update, dataObject);
        }
コード例 #5
0
        private IEnumerator SpillAtScrubber(Scrubber scrubber, ReagentContainer container)
        {
            yield return(WaitFor.Seconds(Random.Range(spawnDelayRange.x, spawnDelayRange.y)));

            // Check that the scrubber is still fine to reference after this delay.
            if (scrubber == null || scrubber.registerTile == null)
            {
                yield break;
            }

            var reagentMix = new ReagentMix();

            lock (reagentMix.reagents)
            {
                reagentMix.reagents.m_dict.Add(allReagents.PickRandom(), 75f);
                reagentMix.reagents.m_dict.Add(dispersionAgents.PickRandom(), 25f);
            }


            container.Add(reagentMix);
            container.Spill(scrubber.registerTile.WorldPositionServer, 50f);

            // TODO: Play noise.
        }
コード例 #6
0
ファイル: WebServices.cs プロジェクト: Warewolf-ESB/Warewolf
        public static void ExecuteRequest(WebService service, bool throwError, out ErrorResultTO errors, WebExecuteString webExecute)
        {
            var headers          = new List <string>();
            var evaluatedHeaders = new List <INameValue>();

            if (service.Headers != null)
            {
                evaluatedHeaders = service.Headers.Select(o => new NameValue(SetParameters(service.Method.Parameters, o.Name), SetParameters(service.Method.Parameters, o.Value)) as INameValue).ToList();
                headers.AddRange(ToHeaderStringList(evaluatedHeaders));
            }

            var requestUrl = SetParameters(service.Method.Parameters, service.RequestUrl);

            var requestBody          = string.Empty;
            var IsClassicRequestBody = !service.IsManualChecked && !service.IsFormDataChecked && !service.IsUrlEncodedChecked;

            if (service.IsManualChecked || IsClassicRequestBody)
            {
                requestBody = SetParameters(service.Method.Parameters, service.RequestBody);
            }

            var formDataParameters = new List <IFormDataParameters>();

            if ((service.IsFormDataChecked || service.IsUrlEncodedChecked) && service.FormDataParameters != null)
            {
                var headersHelper = new WebRequestHeadersHelper(service.Headers, evaluatedHeaders);
                var evaluated     = headersHelper.CalculateFormDataContentType();
                headers = ToHeaderStringList(evaluated.ToList());

                formDataParameters.AddRange(service.FormDataParameters.Select(o =>
                {
                    if (o is TextParameter textParam)
                    {
                        textParam.Key   = SetParameters(service.Method.Parameters, textParam.Key);
                        textParam.Value = SetParameters(service.Method.Parameters, textParam.Value);
                        return(textParam);
                    }
                    else if (o is FileParameter fileParam)
                    {
                        fileParam.Key        = SetParameters(service.Method.Parameters, fileParam.Key);
                        fileParam.FileName   = SetParameters(service.Method.Parameters, fileParam.FileName);
                        fileParam.FileBase64 = SetParameters(service.Method.Parameters, fileParam.FileBase64);
                        return(fileParam);
                    }
                    return(o);
                }).ToList());
            }
            var webExecuteStringArgs = new WebExecuteStringArgs
            {
                IsManualChecked     = service.IsManualChecked,
                IsFormDataChecked   = service.IsFormDataChecked,
                IsUrlEncodedChecked = service.IsUrlEncodedChecked,
                FormDataParameters  = service.FormDataParameters,
                WebRequestFactory   = null
            };
            var webResponse = webExecute?.Invoke(service.Source as WebSource, service.RequestMethod, requestUrl, requestBody, throwError, out errors, headers.ToArray(), webExecuteStringArgs);

            service.RequestResponse = Scrubber.Scrub(webResponse);

            if (!String.IsNullOrEmpty(service.JsonPath))
            {
                service.ApplyPath();
            }
            errors = new ErrorResultTO();
        }
コード例 #7
0
 public void SetValues(GUI_Acu acuUi, Scrubber scrubber)
 {
     this.acuUi    = acuUi;
     this.scrubber = scrubber;
     UpdateText();
 }
コード例 #8
0
        public HomeModule()
        {
            Get["/"] = _ => {
                Console.WriteLine("Return View");
                return(View["index.cshtml"]);
            };
            Get["/roadTrip/{id}"] = x => {
                Console.WriteLine("View Road Trip");
                return(View["viewRoadTrip.cshtml", RoadTrip.Find(int.Parse(x.id))]);
            };
            Get["/getStop/{id}"] = x => {
                Console.WriteLine("View Stop");
                return(View["destination.cshtml", Destination.Find(int.Parse(x.id))]);
            };
            Get["/getAllRoadTrips"] = _ => {
                return(View["viewAllRoadTrips.cshtml", RoadTrip.GetAll()]);
            };
            Get["/deleteDestination/{id}"] = parameters => {
                Console.WriteLine("Deleteing: " + parameters.id);
                Destination selectedDestination = Destination.Find(parameters.id);
                selectedDestination.Delete();
                return(View["empty.cshtml"]);
            };

            Get["/moveUp/{id}"] = parameters => {
                Console.WriteLine("Move Up: " + parameters.id);
                Destination selectedDestination = Destination.Find(parameters.id);
                selectedDestination.MoveUp();
                return(View["empty.cshtml"]);
            };

            Get["/moveDown/{id}"] = parameters => {
                Console.WriteLine("Move Down: " + parameters.id);
                Destination selectedDestination = Destination.Find(parameters.id);
                Console.WriteLine("Destination Found, RoadTripId: " + selectedDestination.GetRoadTripId());
                selectedDestination.MoveDown();
                return(View["empty.cshtml"]);
            };

            Post["/nameTrip"] = _ => {
                RoadTrip newTrip = RoadTrip.Find(int.Parse(Request.Form["id"]));
                newTrip.SetName(Request.Form["name"]);
                newTrip.Update();
                return(View["empty.cshtml"]);
            };

            // AJAX ROUTE ONLY RETURNS A PARTIAL HTML VIEW

            Post["/addStop"] = _ => {
                Dictionary <string, object> model = new Dictionary <string, object>()
                {
                };                                                           // instantiate model
                int roadTripId = 0;
                try {
                    roadTripId = int.Parse(Request.Form["roadTripId"]);                         // get roadtrip id
                } catch (Exception e) {}
                string   destinationName = Request.Form["command"];                             // get new destination name
                RoadTrip rtrip;
                if (roadTripId == 0)                                                            // there is no road trip yet
                {
                    rtrip = new RoadTrip("The awesome " + destinationName + " Road Trip!", ""); // so make a road trip
                    rtrip.Save();                                                               // save road trip to db
                    roadTripId = rtrip.GetId();
                }
                else
                {
                    rtrip = RoadTrip.Find(roadTripId);
                }
                Destination newStop = new Destination(destinationName, roadTripId); // make a new destination
                newStop.Save();                                                     // save the new stop to the database
                if (newStop.GetStop() == 1)                                         // if theres only one stop in the road trip so far
                {
                    Console.WriteLine("First Stop");
                    model.Add("map", Scrubber.GetMapOnLocation(newStop.GetName())); // show the map with only one location
                }
                else // there are already multiple stops in the trip
                {
                    Console.WriteLine("Not First Stop");
                    model.Add("map", Scrubber.GetMapDirections(rtrip.GetDestinations()[rtrip.GetDestinations().Count - 2].GetName(), newStop.GetName())); // show direciton map
                }
                model.Add("images", Scrubber.Search(newStop.GetName(), 6));
                model.Add("roadTripId", roadTripId);
                model.Add("destination", newStop);
                Console.WriteLine(model);
                Console.WriteLine("Return View");
                return(View["stop.cshtml", model]);
            };
        }
コード例 #9
0
 public void SetUp()
 {
     _scrubber = new Scrubber();
 }
コード例 #10
0
        protected override object ExecuteService(out ErrorResultTO errors, IOutputFormatter formater = null)
        {
            Service.Source = Source;
            ExecuteWebRequest(Service, out errors);
            string result = String.IsNullOrEmpty(Service.JsonPath) || String.IsNullOrEmpty(Service.JsonPathResult) ? Scrubber.Scrub(Service.RequestResponse) : Scrubber.Scrub(Service.JsonPathResult);

            Service.RequestResponse = null;
            return(result);
        }
コード例 #11
0
 public void Dispose()
 {
     Destination.DeleteAll();
     RoadTrip.DeleteAll();
     Scrubber.DeleteAll();
 }
コード例 #12
0
ファイル: Error.cs プロジェクト: Warewolf-ESB/Warewolf
        public string ToXML(bool scrub = true)
        {
            var xml = this.SerializeToXml();

            return(scrub ? Scrubber.Scrub(xml, ScrubType.Xml) : xml);
        }
コード例 #13
0
 public StringScrubbingConverter(Scrubber <Guid>?guidScrubber, Scrubber <DateTime>?dateTimeScrubber, Scrubber <DateTimeOffset>?dateTimeOffsetScrubber)
 {
     this.guidScrubber           = guidScrubber;
     this.dateTimeScrubber       = dateTimeScrubber;
     this.dateTimeOffsetScrubber = dateTimeOffsetScrubber;
 }