Esempio n. 1
0
 public void DoProjectLaunch(Object sender, Events.ProjectLaunchClickArgs e)
 {
     ProfileHelper.SelectedIdProject = e.IdProject;
     //((BC)Master).UpdateProjectSelector();
     //TODO: Afterwards, take the user to a reports page.
     SiteMapHelper.ReloadSamePage(Page);
 }
        public PluginList()
        {
            InitializeComponent();

            _logger = new Logger();

            _dte = Package.GetGlobalService(typeof(DTE)) as DTE;
            if (_dte == null)
                return;

            _solution = _dte.Solution;
            if (_solution == null)
                return;

            _events = _dte.Events;
            var windowEvents = _events.WindowEvents;
            windowEvents.WindowActivated += WindowEventsOnWindowActivated;
            _solutionEvents = _events.SolutionEvents;
            _solutionEvents.BeforeClosing += BeforeSolutionClosing;
            _solutionEvents.BeforeClosing += SolutionBeforeClosing;
            _solutionEvents.ProjectAdded += SolutionProjectAdded;
            _solutionEvents.ProjectRemoved += SolutionProjectRemoved;
            _solutionEvents.ProjectRenamed += SolutionProjectRenamed;

            SelectedAssemblyItem.PropertyChanged += SelectedAssemblyItem_PropertyChanged;
        }
Esempio n. 3
0
 /// <summary>
 /// Cancel a server event
 /// </summary>
 /// <param name="e">The event that you want to cancel</param>
 /// <param name="p">The Player that event is related to (null if not dealing with player event)</param>
 public static void CancelEvent(Events e, Player p)
 {
     //TODO
     //Add some more events to be canceled
     switch (e)
     {
         case Events.BlockChange:
             p.cancelBlock = true;
             break;
         case Events.PlayerChat:
             p.cancelchat = true;
             break;
         case Events.PlayerCommand:
             p.cancelcommand = true;
             break;
         case Events.PlayerMove:
             p.cancelmove = true;
             break;
         case Events.LevelLoad:
             Level.cancelsave = true;
             break;
         case Events.LevelSave:
             Level.cancelload = true;
             break;
     }
 }
Esempio n. 4
0
 public void removeListener(Events evento, Action<Object> listener)
 {
     if(!listeners.ContainsKey(evento)){
         listeners[evento] = new List<Action<Object>>();
     }
     listeners[evento].Remove(listener);
 }
        public void ShouldListEventsFromThisWeek()
        {
            Events newEvents = new Events
            {
                { new Event ( "2015/01/01", "one", "test") },
                {new Event(DateTime.Today.ToShortDateString(), "two") },
            };

            List<Event> expectedList = new List<Event>
            {{ new Event (DateTime.Today.ToShortDateString(),"two") },
            };

            string[] args = { "/search", "date", "this week" };
            SearchDateArgument searchArgs = new SearchDateArgument(args);
            string field = "";
            string op = "";
            string val1 = "";
            string val2 = "";
            searchArgs.IsValid();
            field = searchArgs.Field;
            op = searchArgs.Criteria;
            val1 = searchArgs.Date;
            val2 = searchArgs.AnotherDate;
            string[] values = { val1, val2 };

            Events filteredList = Dispenser.SearchEvents(newEvents,field, op,  values);
            Utils.AssertAreEqual(filteredList, expectedList);
        }
        protected override void Initialize()
        {
            Debug.WriteLine ("Entering Initialize() of: {0}", this);
            base.Initialize();

            _dte = (DTE)GetService(typeof(DTE));
            _events = _dte.Events;
            _documentEvents = _events.DocumentEvents;
            _documentEvents.DocumentSaved += DocumentEvents_DocumentSaved;

            var window = _dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);

            var outputWindow = (OutputWindow)window.Object;

            _outputPane = outputWindow.OutputWindowPanes
                                      .Cast<OutputWindowPane>()
                                      .FirstOrDefault(p => p.Name == "AutoRunCustomTool")
                          ?? outputWindow.OutputWindowPanes.Add("AutoRunCustomTool");
            _errorListProvider = new ErrorListProvider(this)
                                 {
                                      ProviderName = "AutoRunCustomTool",
                                      ProviderGuid = Guid.NewGuid()
                                 };
            RegisterExtenderProvider();
        }
Esempio n. 7
0
		public override void handleEvent (Events par1, object par2)
		{
			//TODO: implements touch screen
			if (par1 == Scene.Events.Input) {
				switch ((Keys)par2) {
				case Keys.Up:
					player.move (Entity.directions.Up);
					break;
				case Keys.Down:
					player.move (Entity.directions.Down);
					break;
				case Keys.Left:
					player.move (Entity.directions.Left);
					break;
				case Keys.Right:
					player.move (Entity.directions.Right);
					break;
				case Keys.Space:
					player.change ();
					break;
				case Keys.Escape:
					if (pauseTime <= 0) {
						pause = !pause;
						pauseTime = 10;
					}
					break;
				}
			}
		}
        private void BindEvents()
        {
            this.events = _applicationObject.Events;

            this.BindBuildEvents();
            this.BindSolutionEvents();
        }
    void CheckDragOrOnTile()
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        Debug.DrawRay(ray.origin, ray.direction * 100, Color.white);

        if (gameObject.layer != 2) { gameObject.layer = 2; }

        if (_currentEvent == Events.DRAGGING)
        {
            Vector3 rayPoint = new Vector3(ray.GetPoint(_distance).x, transform.position.y, ray.GetPoint(_distance).z);

            _distance = Vector3.Distance(transform.position, Camera.main.transform.position);

            transform.position = rayPoint;
            transform.rotation = _startRotation;
        }

        if (Physics.Raycast(ray, out hit))
        {
            if (hit.transform.name == "Tile" && hit.transform.GetComponent<Gridtile>().type == Gridtile.TileType.FRIENDLY && hit.transform.GetComponent<Gridtile>().occupied == false)
            {
                _currentTile = hit.transform;
                _currentEvent = Events.ON_TILE;
                CheckOnTile();
            }
            else
            {
                _currentEvent = Events.DRAGGING;
            }
        }
    }
Esempio n. 10
0
 private void pwrEvents_PowerLineStatusChanged(object sender, Events.EventArgsValues<PowerLineStatus> e)
 {
     if (e.NewValue == PowerLineStatus.Online)
         this.Log.LogLineDate("The computer was connected to the power network", Trigger.Log.Type.PowerEvent);
     else
         this.Log.LogLineDate("The computer was disconnected from the power network", Trigger.Log.Type.PowerEvent);
 }
Esempio n. 11
0
 private void databaseCreatedEventHandler(Events.DatabaseCreated databaseCreatedEvent)
 {
     Databases.Clear();
       foreach (SqlServerDatabase database in databaseManager.GetAllDatabases()) {
     Databases.Add(database);
       }
 }
Esempio n. 12
0
        public static Events FilterEvents(Events eventsList, string field, string criteria, string[] values)
        {
            Events filteredList = new Events();

            switch (field)
            {
                case "date":
                    {
                        string firstValue = values[0];
                        string secondValue = values[1];
                        filteredList = GetFilteredListByDate(eventsList, criteria, firstValue, secondValue);
                        break;
                    }
                case "description":
                    {
                        string firstValue = values[0];
                        filteredList = GetFilteredListByDescription(eventsList, criteria, firstValue);
                        break;
                    }
                case "tag":
                    {
                        filteredList = GetFilteredListByTag(eventsList, criteria, values);
                        break;
                    }
                default:
                    {
                        Console.WriteLine("Invalid parameter!");
                        break;
                    }
            }

            return filteredList;
        }
Esempio n. 13
0
 private void pwrEvents_BatteryAvailabilityChanged(object sender, Events.EventArgsValue<bool?> e)
 {
     if (e.Value.Value == true)
         this.Log.LogLineDate("A battery was connected", Trigger.Log.Type.PowerEvent);
     else
         this.Log.LogLineDate("A battery was disconnected", Trigger.Log.Type.PowerEvent);
 }
Esempio n. 14
0
        public static void DummyFollowing(object sender, Events.PlayerMovingEventArgs e)
        {
            if (e.Player.World.Map.Dummys.Count() > 0)
            {
                foreach (Player d in e.Player.World.Map.Dummys)
                {
                    if (d.Info.IsFollowing)
                    {
                        if (d.Info.ID.ToString() == e.Player.Info.followingID)
                        {
                            Vector3I oldPos = new Vector3I(e.OldPosition.X, e.OldPosition.Y, e.OldPosition.Z);
                            Vector3I newPos = new Vector3I(e.NewPosition.X, e.NewPosition.Y, e.NewPosition.Z);
                            Packet packet = PacketWriter.MakeMoveRotate(d.Info.ID, new Position
                            {
                                X = (short)(newPos.X - oldPos.X),
                                Y = (short)(newPos.Y - oldPos.Y),
                                Z = (short)(newPos.Z - oldPos.Z),
                                R = (byte)Math.Abs(e.Player.Position.R),
                                L = (byte)Math.Abs(e.Player.Position.L)
                            }); ;

                            e.Player.World.Players.Send(packet);
                            d.Info.DummyPos = d.Position;
                        }
                    }
                }
            }
        }
 public override void FeatureActivated(SPFeatureReceiverProperties properties)
 {
     //Adding Project Published Event Handling Code starts here
     try
     {
         MyUtilities.ErrorLog("Feature Event-Activated Started", EventLogEntryType.SuccessAudit);
         var site = (SPSite)properties.Feature.Parent;
         using (var Site = new SPSite(site.Url))
         {
             MyUtilities.EnableSQlServerCLR(Site.ID);
             MyUtilities.InstallStoredProcedure(Site.ID, true);
             var Events_Svc = new Events
                                  {
                                      UseDefaultCredentials = true,
                                      AllowAutoRedirect = true,
                                      Url = (Site.Url + @"/_vti_bin/psi/Events.asmx")
                                  };
             string FilePath = SPUtility.GetGenericSetupPath(string.Empty) + @"\TEMPLATE\FEATURES\ITXTaskBaseLineAudit\ITXTaskBaseLineAudit.dll";
             Utilities.CreatePSEvent(Events_Svc, FilePath, "Project", "Published",
                                     "ITX Task BaseLine Change Monitor",
                                     "This code is to track the task baseline value changes.");
         }
     }
     catch (Exception ex)
     {
         MyUtilities.ErrorLog("Error at activating feature due to : " + ex.Message, EventLogEntryType.Error);
     }
 }
Esempio n. 16
0
 public ProgressBar(Vector2 position, float current, Events callbackEvent)
 {
     Dst.X = (int)position.X;
       Dst.Y = (int)position.Y;
       Current = current;
       CallbackEvent = callbackEvent;
 }
Esempio n. 17
0
			public Map(string name, string description, Events[] events, CSDK.Game.Location[] locations, Handler[] data) {
				this.name = name;
				this.description = description;
				this.events = events;
				this.locations = locations;
				this.data = data;
			}
Esempio n. 18
0
 public static void PrintEvent(Events eventToPrint)
 {
     if (eventToPrint != null)
     {
         Output.Append(eventToPrint + "\n");
     }
 }
        public override void Extract(object sender, Events.ExtractionEventArgs e)
        {
            base.Extract(sender, e);

            IEnumerable<XElement> elements = base.Document.Document.Descendants();
            IEnumerable<XElement> hiddenElements = from el in elements where el.Name.LocalName.Equals("input") && el.Attribute(XName.Get("type")).Value.Equals("hidden") select el;

            foreach (XElement nextElement in hiddenElements)
            {
                string name = String.Empty;
                string value = String.Empty;

                if (nextElement.HasAttributes && nextElement.Attribute(XName.Get("name")) != null)
                {
                    name = nextElement.Attribute(XName.Get("name")).Value;

                    if (nextElement.Attribute(XName.Get("value")) != null)
                    {
                        value = nextElement.Attribute(XName.Get("value")).Value;
                    }

                    base._context[name] = value;
                }
            }
        }
        public override void Validate(object sender, Events.ValidationEventArgs e)
        {
            if (String.IsNullOrEmpty(_name))
            {
                throw new ArgumentNullException("Name may not be null.");
            }

            try
            {
                base.Validate(sender, e);

                IEnumerable<XElement> formElements = base.Document.Document.Descendants(XName.Get("input", "http://www.w3.org/1999/xhtml"));

                foreach (XElement nextElement in formElements)
                {
                    if (nextElement.Attribute(XName.Get("value")) != null && nextElement.Attribute(XName.Get("value")).Value.Equals(_expectedValue))
                    {
                        _context.Outcome = WebTestOutcome.Passed;

                        break;
                    }
                }

                if (_context.Outcome != WebTestOutcome.Passed)
                {
                    _context.Outcome = WebTestOutcome.Failed;
                }
            }
            catch (Exception ex)
            {
                _context.Outcome = WebTestOutcome.Error;
                _message = ex.Message;
            }
        }
Esempio n. 21
0
        public void ShouldDisplayEventsFromCertainDate()
        {
            Events newEvents = new Events();
            IOConsole toDisplay = new IOConsole();

            string expectedConsole;
            var consoleOut = new StringWriter();

            string date = "2019/12/25";
            string title = "Christmas Day!";
            string description = "Santa Claus is comming in our house....";

            string date1 = "2015/10/25";
            string title1 = "Johana's Birtday!";
            string description1 = "Don't forget to call her...";

            SetExpectedResultToConsole(date1, title1,out expectedConsole, out consoleOut, description1);

            newEvents.EventsList.ShouldBeEmpty();
            newEvents.Add(date, title, description);
            newEvents.Add(date1, title1, description1);

            DateFilter eventsToDisplay = new DateFilter("=", "2015/10/25");
            Events filteredList = eventsToDisplay.ApplyFilter(newEvents);

            IOConsole newObj = new IOConsole(filteredList);
            newObj.DisplayEventsToConsole();
            consoleOut.ToString().ShouldContain(expectedConsole);
        }
Esempio n. 22
0
        public void ShouldDisplayEventsBeetwenTwoDate()
        {
            IOConsole toDisplay = new IOConsole();

            string expectedConsole;
            var consoleOut = new StringWriter();

            Events newEvents = new Events {
                { new Event ( "2015/01/01", "one", "test") },
                {new Event("2015/11/15", "two") },
                { new Event("2015/07/01", "three") },
                { new Event("2015/12/03", "four", "test1") },
                { new Event("2015/03/04", "five", "test2") },
                { new Event("2015/09/08", "six") }
            };

               SetExpectedResultToConsole("2015/09/08", "six", out expectedConsole, out consoleOut);

            DateFilter firstFilter = new DateFilter( "<", "2015/10/25");
            Events firstFilteredList = firstFilter.ApplyFilter((newEvents));
            DateFilter eventsToDisplay = new DateFilter( ">", "2015/02/25");
            Events filteredList = eventsToDisplay.ApplyFilter(firstFilteredList);

            IOConsole newObj = new IOConsole(filteredList);
            newObj.DisplayEventsToConsole();
            consoleOut.ToString().ShouldContain(expectedConsole);
        }
Esempio n. 23
0
        public void ShouldExportTOHTMLFromStream()
        {
            string expectedFile = @"<!DOCTYPE html>
            <html>
            <head>
            <title>Events List</title>
            </head>
            <body><p><b>Date:</b> 2015.12.25</p>
            <p><b>Subject:</b> Christmas!</p><p><b>Title:</b> Christmas</p><p><b>Description:</b> Santa Claus</p><hr>
            </body>
            </html>";

            expectedFile = expectedFile.Replace("\r", "");
            Events newEvent = new Events();

            string date = "2015/12/25";
            string title = "Christams";
            string description = "Santa Claus";
            newEvent.Add(date, title,description);

            using (MemoryStream ms = new MemoryStream())
            {
                using (IOStream streamObj = new IOStream(ms))
                {
                    streamObj.ExportEventsInHTMLStream(newEvent);
                    var htmlContent = Encoding.UTF8.GetString(ms.ToArray());
                    htmlContent.ShouldContain(expectedFile);
                }
            }
        }
Esempio n. 24
0
        public void ShouldDisplayAllEvents()
        {
            Events newEvent = new Events();

            string expectedConsole;
            var consoleOut = new StringWriter();

            string date = "2015/12/25";
            string title = "Christmas Day!";
            string description = "Santa Claus is comming in our house....";

            newEvent.EventsList.ShouldBeEmpty();
            newEvent.Add(date, title, description);

            string date1 = "2015/10/25";
            string title1 = "Johana's Birtday!";
            string description1 = "Don't forget to call her...";
            newEvent.Add(date1, title1, description1);

            expectedConsole = " \nDate:" + Convert.ToDateTime(date1).ToString("yyyy/MM/dd") + " \nTitle:" + title1 + " \nDescription:" + description1 + "\n" +
                " \nDate:" + Convert.ToDateTime(date).ToString("yyyy/MM/dd") + " \nTitle:" + title + " \nDescription:" + description;

            Console.SetOut(consoleOut);
            IOConsole newObj = new IOConsole(newEvent);
            newObj.DisplayEventsToConsole();

            consoleOut.ToString().ShouldContain(expectedConsole);
        }
Esempio n. 25
0
 public void LoadGrid()
 {
     evnts = new  Events();
     evnts.GetAll();
     gvwEvents.DataSource = evnts;
     gvwEvents.DataBind();
 }
Esempio n. 26
0
 private static void OnChatMessage(object sender, Events.ChatMessageEventArgs e)
 {
     var message = e.ClanName == null ?
                   string.Format("<{0}>: {1}", e.Username, e.Message) :
                   string.Format("<[{0}]{1}>: {2}", e.ClanName, e.Username, e.Message);
     Console.WriteLine(message);
 }
    void LoadLists()
    {
        //repeat interval
        for (int i = 1; i <= 30; i++)
        {
            ddlRepeatInterval.Items.Add(new ListItem(i.ToString(), i.ToString()));
        }

        //assigned consultants and the user load in to the calendar
        //IEnumerable<User> list = new Users().GetConsultantsAndPa(LoginUser.GetLoggedInUserId(), true);
        //ddlAllocatedTo.Items.Clear();
        //foreach (User item in list)
        //{
        //    ddlAllocatedTo.Items.Add(new ListItem(item.Forename + " " + item.Surname, item.UserId.ToString()));
        //}
        ddlAllocatedTo.FillData(Bindings.Type.USER, true, false);

        //event types
        var eventTypes = new Events().GetEventTypes();
        ddlEventType.Items.Clear();
        foreach (var type in eventTypes)
        {
            ddlEventType.Items.Add(new ListItem(type.EventTypeText, type.EventTypeId.ToString()));
        }
    }
Esempio n. 28
0
    public static EventBase LookupEvent(Events evt)
    {
        EventBase returnEvent;

        switch(evt)
        {
            case Events.TriggerEventEnter:

                returnEvent = new TriggerEventEnter();

            break;

            case Events.TriggerEventExit:

                returnEvent = new TriggerEventExit();

            break;

            case Events.TriggerEventStay:

                returnEvent = new TriggerEventStay();

            break;

            default:

                returnEvent = null;

            break;
        }

        return returnEvent;
    }
        private List<Events> GetEvents()
        {
            List<Events> eventList = new List<Events>();

            Events newEvent = new Events{
                id = "1",
                title = "Event 1",
                start = DateTime.Now.AddDays(1).ToString("s"),
                end = DateTime.Now.AddDays(1).ToString("s"),
                allDay = false
            };


            eventList.Add(newEvent);

            newEvent = new Events
            {
                id = "1",
                title = "Event 3",
                start = DateTime.Now.AddDays(2).ToString("s"),
                end = DateTime.Now.AddDays(3).ToString("s"),
                allDay = false
            };

            eventList.Add(newEvent);

            return eventList;
        }
Esempio n. 30
0
    public void KeysPressed(Events.Notification notification)
    {
        string key = (string)notification.data;
        if (key == "Back") LoadNewLevel("MainMenu", 1);

        OpenInfoBox("Returning to Menu...", 3, 0.25f);
    }
Esempio n. 31
0
 public void Damaged()
 {
     // Play sound
     Events.PlayFX(explosionSound);
 }
 internal new void OnDeserializingMethod(StreamingContext context)
 {
     Events.Add("OnDeserializing_Derived_Derived");
 }
        private void ReadTraceData(SqlConnection conn, ReadIteration currentIteration)
        {
            string sqlReadTrace = @"
                SELECT EventSequence
	                ,Error
	                ,TextData
	                ,BinaryData
	                ,DatabaseID
	                ,HostName
	                ,ApplicationName
	                ,LoginName
	                ,SPID
	                ,Duration
	                ,StartTime
	                ,EndTime
	                ,Reads
	                ,Writes
	                ,CPU
	                ,EventClass
	                ,DatabaseName
                FROM fn_trace_gettable(@path, @number_files)
            ";

            if (currentIteration.StartSequence > 0)
            {
                sqlReadTrace += "WHERE EventSequence > @event_offset";
            }

            logger.Debug("Reading Trace data...");

            TraceEventParser parser = new TraceEventParser();

            using (SqlCommand cmd = conn.CreateCommand())
            {
                cmd.CommandText = sqlReadTrace;

                var paramPath = cmd.Parameters.Add("@path", System.Data.SqlDbType.NVarChar, 260);
                paramPath.Value = currentIteration.StartFileName;

                var paramNumberFiles = cmd.Parameters.Add("@number_files", System.Data.SqlDbType.Int);
                paramNumberFiles.Value = currentIteration.Files;

                var paramInitialSequence = cmd.Parameters.Add("@event_offset", System.Data.SqlDbType.BigInt);
                paramInitialSequence.Value = currentIteration.StartOffset;

                // don't pass initial file name and offset
                // read directly from the initial file
                // until we have some rows read already
                if (
                    EventCount == 0 ||
                    currentIteration.StartOffset <= 0 ||
                    currentIteration.StartOffset == currentIteration.MinOffset
                    )
                {
                    paramPath.Value            = currentIteration.StartFileName;
                    paramNumberFiles.Value     = 0;
                    paramInitialSequence.Value = 0;
                }

                logger.Debug($"paramPath           : {paramPath.Value}");
                logger.Debug($"paramNumberFiles    : {paramNumberFiles.Value}");
                logger.Debug($"paramInitialSequence: {paramInitialSequence.Value}");


                SqlTransformer transformer = new SqlTransformer();

                try
                {
                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        int skippedRows = 0;
                        while (reader.Read())
                        {
                            if (reader["EventSequence"] != DBNull.Value)
                            {
                                currentIteration.EndSequence = (long)reader["EventSequence"];
                            }

                            // read the event from the sqldatareader
                            var evt = parser.ParseEvent(reader);

                            // skip invalid events
                            if (evt.Type == WorkloadEvent.EventType.Unknown)
                            {
                                continue;
                            }

                            // skip to the correct event in case we're reading again
                            // from the same file and we have a reference sequence
                            if ((currentIteration.RowsRead == 0) && (currentIteration.StartSequence > 0))
                            {
                                // skip rows until we encounter the reference event_sequence
                                if (evt.EventSequence != currentIteration.StartSequence)
                                {
                                    skippedRows++;
                                    continue;
                                }
                                else
                                {
                                    // skip one more row...
                                    skippedRows++;
                                    currentIteration.RowsRead++;
                                    continue;
                                }
                            }


                            // this is only to print out a message, so consider
                            // getting rid of it
                            if (skippedRows > 0)
                            {
                                logger.Debug($"Skipped rows: {skippedRows}");
                                skippedRows = 0;
                            }

                            // now we have an event, no matter if good or bad => increment rows read
                            currentIteration.RowsRead++;
                            if (evt.EventSequence != null)
                            {
                                currentIteration.EndSequence = (long)evt.EventSequence;
                            }


                            if (evt.Type <= WorkloadEvent.EventType.BatchCompleted)
                            {
                                if (transformer.Skip(evt.Text))
                                {
                                    continue;
                                }

                                if (!Filter.Evaluate(evt))
                                {
                                    continue;
                                }

                                evt.Text = transformer.Transform(evt.Text);
                            }

                            // it's a "good" event: add it to the queue
                            Events.Enqueue(evt);

                            EventCount++;
                        }
                        logger.Debug($"currentIteration.EndSequence : {currentIteration.EndSequence}");
                    }
                }
                catch (Exception)
                {
                    throw;
                }

                // Wait before querying the events file again
                if (currentIteration.RowsRead < ReadIteration.DEFAULT_TRACE_ROWS_SLEEP_THRESHOLD &&
                    currentIteration.StartFileName == currentIteration.EndFileName)
                {
                    Thread.Sleep(ReadIteration.DEFAULT_TRACE_INTERVAL_SECONDS * 1000);
                }
            }
        }
 internal new void OnSerializedMethod(StreamingContext context)
 {
     Events.Add("OnSerialized_Derived_Derived");
 }
Esempio n. 35
0
 public static void RegisterFunc(Events eventname, Action funky)
 {
     EventFuncs[eventname].Add(funky);
 }
Esempio n. 36
0
 private static void AddEvent(string aEvent)
 {
     Events.Add(aEvent);
 }
Esempio n. 37
0
    public void FireEvent(Events myEvent)
    {
        MyCanvas canvasScript = DialogueBox.GetComponent <MyCanvas>();

        canvasScript.StartEvent(myEvent);
    }
Esempio n. 38
0
 public static void DeleteFunc(Events eventname, Action funky)
 {
     EventFuncs[eventname].Remove(funky);
 }
Esempio n. 39
0
 public void SkipEventSequence(long eventSequence)
 {
     var events = Events.ToList();
     events.RemoveAll(e => e.Sequence == eventSequence);
     Events = events;
 }
Esempio n. 40
0
        public Lexer(string compiledCode)
        {
            Func          currentFunc  = null;
            Block         currentBlock = null;
            int           blockNumber  = 0;
            Stack <Block> blockstack   = new Stack <Block>();

            foreach (string line in compiledCode.Replace(((char)13).ToString(), "").Split('\n'))
            {
                if (line.StartsWith(":"))
                {
                    string op = line.Substring(1);

                    if (currentFunc == null)
                    {
                        currentFunc = new Func(op, Code.buffer.Count);
                    }
                    else
                    {
                        Code.Write(Opcodes.ret);
                        Funcs.Add(currentFunc);
                        currentFunc = new Func(op, Code.buffer.Count);
                    }
                }
                else if (line.StartsWith("e:"))
                {
                    string op = line.Substring(2);

                    if (currentFunc == null)
                    {
                        currentFunc = new Func(op, Code.buffer.Count);
                    }
                    else
                    {
                        Code.Write(Opcodes.ret);
                        Funcs.Add(currentFunc);
                        currentFunc = new Func(op, Code.buffer.Count);
                    }

                    Events.Add(currentFunc);
                }
                else if (line.StartsWith("."))
                {
                    string name = line.Substring(1);
                    Label  l    = new Label(name, Code.buffer.Count());
                    currentFunc.labels.Add(l);
                }
                else if (line.StartsWith($"{nameof(Opcodes.pushInt)} "))
                {
                    int value = Convert.ToInt32(line.Substring(8));
                    Code.Write(Opcodes.pushInt);
                    Code.Write(value);

                    _pushVarValue = value.ToString();
                }
                else if (line.StartsWith($"{nameof(Opcodes.pushString)} "))
                {
                    string temp  = line.Substring(11);
                    string value = temp.Substring(temp.IndexOf("\"") + 1, temp.LastIndexOf("\"") - 1);
                    Code.Write(Opcodes.pushString);
                    Code.Write(value);

                    _pushVarValue = value;
                }
                else if (line.StartsWith($"{nameof(Opcodes.pushVar)} "))
                {
                    string name = line.Substring(8);
                    Code.Write(Opcodes.pushVar);
                    Code.Write(name);
                }
                else if (line.Equals(nameof(Opcodes.pop)))
                {
                    Code.Write(Opcodes.pop);
                }
                else if (line.Equals(nameof(Opcodes.popa)))
                {
                    Code.Write(Opcodes.popa);
                }
                else if (line.StartsWith($"{nameof(Opcodes.decVar)} "))
                {
                    string name = line.Substring(7);
                    Code.Write(Opcodes.decVar);
                    Code.Write(name);
                }
                else if (line.StartsWith($"{nameof(Opcodes.setGlobalVar)} "))
                {
                    string name = line.Substring(13);
                    Code.Write(Opcodes.setGlobalVar);
                    Code.Write(name);

                    if (_pushVarValue != null)
                    {
                        GlobalVars.Add(new Var(name, _pushVarValue));
                    }
                }
                else if (line.StartsWith($"{nameof(Opcodes.setVar)} "))
                {
                    string name = line.Substring(7);
                    Code.Write(Opcodes.setVar);
                    Code.Write(name);
                }
                else if (line.Equals(nameof(Opcodes.add)))
                {
                    Code.Write(Opcodes.add);
                }
                else if (line.Equals(nameof(Opcodes.sub)))
                {
                    Code.Write(Opcodes.sub);
                }
                else if (line.Equals(nameof(Opcodes.mul)))
                {
                    Code.Write(Opcodes.mul);
                }
                else if (line.Equals(nameof(Opcodes.div)))
                {
                    Code.Write(Opcodes.div);
                }
                else if (line.Equals(nameof(Opcodes.clear)))
                {
                    Code.Write(Opcodes.clear);
                }
                else if (line.StartsWith("if"))
                {
                    string op = line.Substring(2);

                    if (currentBlock != null)
                    {
                        blockstack.Push(currentBlock);
                    }

                    currentBlock = new IfBlock(blockNumber);

                    if (op.Equals("e"))
                    {
                        Code.Write(Opcodes.ife);
                    }
                    else if (op.Equals("n"))
                    {
                        Code.Write(Opcodes.ifn);
                    }
                    else if (op.Equals("gt"))
                    {
                        Code.Write(Opcodes.ifgt);
                    }
                    else if (op.Equals("gte"))
                    {
                        Code.Write(Opcodes.ifgte);
                    }
                    else if (op.Equals("lt"))
                    {
                        Code.Write(Opcodes.iflt);
                    }
                    else if (op.Equals("lte"))
                    {
                        Code.Write(Opcodes.iflte);
                    }

                    Code.Write(blockNumber);
                    blockNumber++;
                }
                else if (line.StartsWith("elseif"))
                {
                    string op = line.Substring(6);

                    if (currentBlock != null)
                    {
                        blockstack.Push(currentBlock);
                    }

                    currentBlock = new ElseIfBlock(blockNumber);

                    if (op.Equals("e"))
                    {
                        Code.Write(Opcodes.elseife);
                    }
                    else if (op.Equals("n"))
                    {
                        Code.Write(Opcodes.elseifn);
                    }
                    else if (op.Equals("gt"))
                    {
                        Code.Write(Opcodes.elseifgt);
                    }
                    else if (op.Equals("gte"))
                    {
                        Code.Write(Opcodes.elseifgte);
                    }
                    else if (op.Equals("lt"))
                    {
                        Code.Write(Opcodes.elseiflt);
                    }
                    else if (op.Equals("lte"))
                    {
                        Code.Write(Opcodes.elseiflte);
                    }

                    Code.Write(blockNumber);
                    blockNumber++;
                }
                else if (line.Equals("else"))
                {
                    if (currentBlock != null)
                    {
                        blockstack.Push(currentBlock);
                    }

                    currentBlock = new ElseBlock(blockNumber);
                    Code.Write(Opcodes.els);
                    Code.Write(blockNumber);
                    blockNumber++;
                }
                else if (line.Equals(nameof(Opcodes.endif)))
                {
                    Code.Write(Opcodes.endif);
                    currentBlock.endBlock = Code.buffer.Count();
                    Blocks.Add(currentBlock);

                    if (blockstack.Count > 0)
                    {
                        currentBlock = blockstack.Pop();
                    }
                    else
                    {
                        currentBlock = null;
                    }
                }
                else if (line.StartsWith($"{nameof(Opcodes.call)} "))
                {
                    string name = line.Substring(5);
                    Code.Write(Opcodes.call);
                    Code.Write(name);
                }
                else if (line.StartsWith("goto "))
                {
                    string name = line.Substring(6);
                    Code.Write(Opcodes.got);
                    Code.Write(name);
                }
                else if (line.Equals(nameof(Opcodes.print)))
                {
                    Code.Write(Opcodes.print);
                }
                else if (line.Equals(nameof(Opcodes.printLine)))
                {
                    Code.Write(Opcodes.printLine);
                }
                else if (line.Equals(nameof(Opcodes.read)))
                {
                    Code.Write(Opcodes.read);
                }
                else if (line.Equals(nameof(Opcodes.readLine)))
                {
                    Code.Write(Opcodes.readLine);
                }
                else if (line.Equals(nameof(Opcodes.delay)))
                {
                    Code.Write(Opcodes.delay);
                }
                else if (line.Equals(nameof(Opcodes.captureScreen)))
                {
                    Code.Write(Opcodes.captureScreen);
                }
                else if (line.Equals(nameof(Opcodes.getClipboard)))
                {
                    Code.Write(Opcodes.getClipboard);
                }
                else if (line.Equals(nameof(Opcodes.setClipboard)))
                {
                    Code.Write(Opcodes.setClipboard);
                }
                else if (line.Equals(nameof(Opcodes.write)))
                {
                    Code.Write(Opcodes.write);
                }
                else if (line.Equals(nameof(Opcodes.exit)))
                {
                    Code.Write(Opcodes.exit);
                }
                else if (line.StartsWith(nameof(Opcodes.msg)))
                {
                    Code.Write(Opcodes.msg);
                }
                else if (line.Equals(nameof(Opcodes.inputInt32)))
                {
                    Code.Write(Opcodes.inputInt32);
                }
                else if (line.Equals(nameof(Opcodes.inputString)))
                {
                    Code.Write(Opcodes.inputString);
                }
                else if (line.Equals(nameof(Opcodes.ret)))
                {
                    Code.Write(Opcodes.ret);
                }
            }

            Code.Write(Opcodes.ret);
            Funcs.Add(currentFunc);
        }