示例#1
0
        private void CreateRepetableOption(Type optionType, ISyntaxNode parent, string propertyName)
        {
            // TODO: move this code to SyntaxTreeManager
            ISyntaxNode          model = SyntaxTreeManager.CreateRepeatableConcept(optionType, parent, propertyName);
            ConceptNodeViewModel node  = SyntaxTreeController.Current.CreateSyntaxNode(Owner, model);

            Owner.Add(node);
        }
        public override void AddToList()
        {
            IsDeleted = false;

            IsNew = false;

            Owner.Add(this);
        }
示例#3
0
 public WoopsaContainer(WoopsaContainer container, string name)
     : base(container, name)
 {
     Lock   = new object();
     _items = new WoopsaElementList <WoopsaContainer>();
     if (Owner != null)
     {
         Owner.Add(this);
     }
 }
        public void HashDownloadFinished(ChunkHash[] hashes, int fileId, int senderId)
        {
            Owner o = new Owner();

            o.ApplicationId = senderId;
            o.FileId        = fileId;
            o.Add();
            ChunkHashModel.Add(hashes, fileId);
            SendFinishedNotification(fileId, senderId);
        }
        public void HandleFileHashTransferRequest(C2SMessageReader mr)
        {
            if (!ServerCommunicationCenter.commCenter.ClientsEndPoint.ContainsKey(mr.ClientEP()))
            {
                return;
            }
            HashSender.SendAllHashes(mr.ClientEP(), mr.ReadFileId());
            Owner owner = new Owner();

            owner.ApplicationId = mr.ClientEP();
            owner.FileId        = mr.ReadFileId();
            owner.Add();
        }
示例#6
0
        public virtual void AddToList()
        {
            if (IsDeleted)
            {
                Debug.WriteLine("adding deleted");
            }

            if (Owner != null)
            {
                Owner.Add(this);
            }
            IsNew     = false;
            IsDeleted = false;
        }
示例#7
0
 protected void btnSave_Click(object sender, EventArgs e)
 {
     if (Session["UserType"] == null)
     { // New customer
         client = GetCustomer();
         client.Add();
         Session["UserType"] = userType.Customer;
         Session["OWNER"]    = client;
         Response.Redirect("~/Home.aspx");
     }
     else if ((userType)Session["UserType"] == userType.Customer)
     { // Customer editing account
         client        = GetCustomer();
         client.number = (int)Session["OWNER_NUMBER"];
         client.Update();
         Session["OWNER"] = client;
         Response.Redirect("~/Home.aspx");
     }
     else if ((userType)Session["UserType"] == userType.Clerk && Session["OWNER_NUMBER"] == null)
     {
         // Clerk creating new customer
         client = GetCustomer();
         client.Add();
         Session["OWNER_NUMBER"] = client.number;
         if ((bool)Session["ManageClient"])
         {
             Response.Redirect("~/ManageClientHome.aspx");
         }
         else
         {
             Response.Redirect("~/Home.aspx");
         }
     }
     else
     { // Clerk editing existing customer
         client        = GetCustomer();
         client.number = Convert.ToInt32(Session["OWNER_NUMBER"]);
         client.Update();
         if ((bool)Session["ManageClient"])
         {
             Response.Redirect("~/ManageClientHome.aspx");
         }
         else
         {
             Response.Redirect("~/Home.aspx");
         }
     }
 }
示例#8
0
        public override void TakeTurn(Entity target, ProgramData data)
        {
            if (NumberOfTurns > 0)
            {
                var randomX = Owner.X + Rng.Next(3) - 1;
                var randomY = Owner.Y + Rng.Next(3) - 1;

                if (randomX != Owner.X && randomY != Owner.Y)
                {
                    Owner.MoveTowards(randomX, randomY, data.GameData.DungeonLevel.Map, data.GameData.Entities);
                }

                NumberOfTurns -= 1;
            }
            else
            {
                Owner.Add(PreviousAi);
                data.GameData.MessageLog.AddMessage($"The {Owner.Name} is no longer confused!", Color.Red);
            }
        }
示例#9
0
        protected override void Awake()
        {
            Instance = this;


            GameObject enemiesLeftObj = new GameObject("EnemiesLeft");

            EnemiesLeftText = new UiTextRendererComponent("Arial", false, 1, DefaultFilepaths.DefaultLitShader);
            enemiesLeftObj.AddComponent(EnemiesLeftText);
            EnemiesLeftText.Position = new Vector2(0.2f, -0.45f);
            EnemiesLeftText.Scale    = new Vector2(2f);
            EnemiesLeftText.Text     = "Enemies Left: 0/0";
            Owner.Add(enemiesLeftObj);


            Bitmap bmp = new Bitmap(1, 1);


            GameObject playerHPBarBGObj = new GameObject("PlayerHPBar");

            bmp.SetPixel(0, 0, Color.Black);

            PlayerHPBarBGObj = new UiImageRendererComponent(TextureLoader.BitmapToTexture(bmp, "UI_HPBar_BG"), false, 1,
                                                            DefaultFilepaths.DefaultUiImageShader);
            playerHPBarBGObj.AddComponent(PlayerHPBarBGObj);
            PlayerHPBarBGObj.Position = new Vector2(0.0f, 0.9f);
            PlayerHPBarBGObj.Scale    = new Vector2(0.31f, 0.05f * GameEngine.Instance.AspectRatio * 1.2f);
            Owner.Add(playerHPBarBGObj);

            GameObject playerHPBarObj = new GameObject("PlayerHPBar");

            bmp.SetPixel(0, 0, Color.Red);

            PlayerHPBarObj = new UiImageRendererComponent(TextureLoader.BitmapToTexture(bmp, "UI_HPBar"), false, 1,
                                                          DefaultFilepaths.DefaultUiImageShader);
            playerHPBarObj.AddComponent(PlayerHPBarObj);
            PlayerHPBarObj.Position = new Vector2(0.0f, 0.9f);
            PlayerHPBarObj.Scale    = new Vector2(0.3f, 0.05f * GameEngine.Instance.AspectRatio);
            Owner.Add(playerHPBarObj);
        }
 internal NoteChart(SimFile owner, string id)
 {
   this.Owner = owner;
   this.Id = id;
   Owner.Add(id, this);
 }
示例#11
0
        private bool SplitAndAdd(string s, int annotationSignalNr, bool isFirst, int orderIndex)
        {
            Debug.Assert(annotationSignalNr >= 0, TALConsts.AnnotationSignalNrError);
            double duration = 0;
            double onset;

            if ((s == string.Empty) || ((s.IndexOf(TALConsts.c21) == -1) && s.IndexOf(TALConsts.c20) == -1) ||
                (s[s.Length - 1] != TALConsts.c20))
            {
                AddToLastError(annotationSignalNr, s, TalError.InvalidEntry);
                return(false);
            }
            bool hasDuration = (s.IndexOf(TALConsts.c21) >= 0);

            string[] sValues = s.Split(new[] { TALConsts.c20, TALConsts.c21 });
            Regex    illegalAllowedFloatCharsRegEx = new Regex(TALConsts.AllowedFloatCharsExpr);
            Regex    illegalValidFloatCharsRegEx   = new Regex(TALConsts.ValidFloatCharsExpr);
            Regex    illegalFloatCharsRegEx        = new Regex(TALConsts.ValidFloatExclMinPlusExpr);

            if ((sValues.Length > 0) && !illegalAllowedFloatCharsRegEx.IsMatch(sValues[0]) &&
                ((sValues[0][0] == '+') || (sValues[0][0] == '-')))
            {
                if (illegalValidFloatCharsRegEx.IsMatch(sValues[0]))
                {
                    AddToLastError(annotationSignalNr, sValues[0], TalError.InvalidOnset);
                }
                if (!double.TryParse(sValues[0], NumberStyles.Float, FormatInfo, out onset))
                {
                    AddToLastError(annotationSignalNr, sValues[0], TalError.InvalidOnset);
                    return(false);
                }
            }
            else
            {
                AddToLastError(annotationSignalNr, sValues[0], TalError.InvalidOnset);
                return(false);
            }
            if (hasDuration)
            {
                if ((sValues.Length > 1) && !illegalAllowedFloatCharsRegEx.IsMatch(sValues[1]))
                {
                    if (illegalFloatCharsRegEx.IsMatch(sValues[1]))
                    {
                        AddToLastError(annotationSignalNr, sValues[1], TalError.InvalidDuration);
                    }
                    if (!double.TryParse(sValues[1], NumberStyles.Float, FormatInfo, out duration))
                    {
                        AddToLastError(annotationSignalNr, sValues[1], TalError.InvalidDuration);
                        return(false);
                    }
                }
                else
                {
                    AddToLastError(annotationSignalNr, sValues[1], TalError.InvalidDuration);
                    return(false);
                }
            }
            if ((hasDuration && sValues.Length > 2) || (!hasDuration && sValues.Length > 1))
            {
                int iStart = hasDuration ? 2 : 1;
                for (int i = iStart; i < sValues.Length; i++)
                {
                    int index;
                    if (isFirst)
                    {
                        if (annotationSignalNr == 0)
                        {
                            if ((sValues[i] != string.Empty) || hasDuration)
                            {
                                AddToLastError(annotationSignalNr, string.Empty, TalError.MissingTimeEvent);
                                return(false);
                            }
                            _dataRecOnset = onset;
                        }
                        else
                        {
                            if ((sValues[i] == string.Empty) && !hasDuration)
                            {
                                AddToLastError(annotationSignalNr, string.Empty, TalError.ExtraTimeEvent);
                            }
                            index = Owner.Add(DataRecNr, onset, duration, sValues[i], annotationSignalNr);
                            Owner[index].FileOrder = orderIndex;
                        }
                        isFirst = false;
                    }
                    else
                    {
                        if (sValues[i] != string.Empty)
                        {
                            index = Owner.Add(DataRecNr, onset, duration, sValues[i], annotationSignalNr);
                            Owner[index].FileOrder = index;
                        }
                    }
                }
            }
            return(true);
        }
示例#12
0
 // ReSharper disable once AssignNullToNotNullAttribute
 public override void Add(TK item) => Owner.Add(item, default(TV));