Exemple #1
0
        /// <summary>
        /// Load the Spell from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode)
        {
            objNode.TryGetField("guid", Guid.TryParse, out _guiID);
            if (objNode.TryGetStringFieldQuickly("name", ref _strName))
            {
                _objCachedMyXmlNode = null;
            }
            objNode.TryGetStringFieldQuickly("descriptors", ref _strDescriptors);
            objNode.TryGetStringFieldQuickly("category", ref _strCategory);
            objNode.TryGetStringFieldQuickly("type", ref _strType);
            objNode.TryGetStringFieldQuickly("range", ref _strRange);
            objNode.TryGetStringFieldQuickly("damage", ref _strDamage);
            objNode.TryGetStringFieldQuickly("duration", ref _strDuration);
            if (objNode["improvementsource"] != null)
            {
                _objImprovementSource = Improvement.ConvertToImprovementSource(objNode["improvementsource"].InnerText);
            }
            objNode.TryGetInt32FieldQuickly("grade", ref _intGrade);
            objNode.TryGetStringFieldQuickly("dv", ref _strDV);
            if (objNode.TryGetBoolFieldQuickly("limited", ref _blnLimited) && _blnLimited && _objCharacter.LastSavedVersion <= new Version("5.197.30"))
            {
                GetNode()?.TryGetStringFieldQuickly("dv", ref _strDV);
            }
            objNode.TryGetBoolFieldQuickly("extended", ref _blnExtended);
            objNode.TryGetBoolFieldQuickly("freebonus", ref _blnFreeBonus);
            objNode.TryGetBoolFieldQuickly("usesunarmed", ref _blnUsesUnarmed);
            objNode.TryGetBoolFieldQuickly("alchemical", ref _blnAlchemical);
            objNode.TryGetStringFieldQuickly("source", ref _strSource);
            objNode.TryGetStringFieldQuickly("page", ref _strPage);

            objNode.TryGetStringFieldQuickly("extra", ref _strExtra);
            objNode.TryGetStringFieldQuickly("notes", ref _strNotes);
        }
Exemple #2
0
        /// <summary>
        /// Load the Enhancement from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode)
        {
            if (objNode == null)
            {
                return;
            }
            if (!objNode.TryGetField("guid", Guid.TryParse, out _guiID))
            {
                _guiID = Guid.NewGuid();
            }
            objNode.TryGetStringFieldQuickly("name", ref _strName);
            _objCachedMyXmlNode   = null;
            _objCachedMyXPathNode = null;
            if (!objNode.TryGetGuidFieldQuickly("sourceid", ref _guiSourceID))
            {
                this.GetNodeXPath()?.TryGetGuidFieldQuickly("id", ref _guiSourceID);
            }

            objNode.TryGetStringFieldQuickly("source", ref _strSource);
            objNode.TryGetStringFieldQuickly("page", ref _strPage);
            _nodBonus = objNode["bonus"];
            if (objNode["improvementsource"] != null)
            {
                _objImprovementSource = Improvement.ConvertToImprovementSource(objNode["improvementsource"].InnerText);
            }

            objNode.TryGetInt32FieldQuickly("grade", ref _intGrade);
            objNode.TryGetMultiLineStringFieldQuickly("notes", ref _strNotes);

            string sNotesColor = ColorTranslator.ToHtml(ColorManager.HasNotesColor);

            objNode.TryGetStringFieldQuickly("notesColor", ref sNotesColor);
            _colNotes = ColorTranslator.FromHtml(sNotesColor);
        }
        public void Process(ImprovementInitiated @event, EventSourceId eventSourceId)
        {
            var recipe      = new DotNetFramework();
            var improvement = new Improvement
            {
                Id          = eventSourceId.Value,
                Improvable  = @event.ForImprovable,
                PullRequest = @event.PullRequest,
                Version     = @event.Version
            };

            var improvable = _improvableManager.GetById(@event.ForImprovable);

            var context = new ImprovementContext(
                _executionContextManager.Current.Tenant,
                improvement,
                improvable);

            var pod = _improvementPodFactory.BuildFrom(context, recipe);

            using (var client = _kubernetesClientFactory())
            {
                client.CreateNamespacedPod(pod, pod.Metadata.NamespaceProperty);
            }
        }
Exemple #4
0
        public static void Initialize(BugsContext context)
        {
            if (!context.Improvements.Any() || !context.Statuses.Any())
            {
                Status st = new Status {
                    Name = "New"
                };
                Status st2 = new Status {
                    Name = "Process"
                };
                Status st3 = new Status {
                    Name = "Solved"
                };

                context.Statuses.AddRange(st, st2, st3);
                context.SaveChanges();

                Improvement imp = new Improvement {
                    Name = "TestSolveTask", Description = "testing"
                };
                imp.Statuses.Add(st);
                imp.Statuses.Add(st3);
                imp.CurrentStatus = st.Name;
                Improvement imp2 = new Improvement {
                    Name = "SecondTestSolveTask", Description = "testing2"
                };
                imp2.Statuses.Add(st);
                imp2.Statuses.Add(st2);
                imp2.Statuses.Add(st3);
                imp2.CurrentStatus = st.Name;
                context.Improvements.AddRange(imp, imp2);
                context.SaveChanges();
            }
        }
Exemple #5
0
 public void getFired()
 {
     livingIn.unemployedCitizens.Add(this);
     timeAtCurrentJob   = 0;
     currentJob         = null;
     currentBuildingJob = null;
 }
Exemple #6
0
        public object GetImprovementDetails(ImprovementDetail impr)
        {
            dynamic       TBImprovementListResult;
            List <object> ImprListResult = new List <object>();

            try
            {
                List <ImprovementList> Result = Improvement.GetImprovementDetails(impr);

                for (int i = 0; i < Result.Count; i++)
                {
                    ImprListResult.Add(new { ImprovementList = Result[i] });
                }

                if (Result != null && Result.Count != 0)
                {
                    TBImprovementListResult = new { status = "0", message = "success", ImprovementListResult = ImprListResult };
                }
                else
                {
                    TBImprovementListResult = new { status = "1", message = "Record not found", ImprovementListResult = ImprListResult };
                }
            }
            catch
            {
                TBImprovementListResult = new { status = "1", message = "failed" };
            }

            return(new { TBImprovementListResult = TBImprovementListResult });
        }
Exemple #7
0
        public void Add(Improvement input, ContextMenuStrip strip)
        {
            TreeNode newNode = new TreeNode();
            string   strName = input.UniqueName;

            if (input.Value > 0)
            {
                strName += " [+" + input.Value.ToString() + "]";
            }
            else
            {
                strName += " [" + input.Value.ToString() + "]";
            }
            if (input.Exclude != "")
            {
                strName += " (" + input.Exclude + ")";
            }
            newNode.Text = newNode.Name = strName;
            newNode.Tag  = input.SourceName;
            if (input.Notes != string.Empty)
            {
                newNode.ForeColor = Color.SaddleBrown;
            }
            newNode.ToolTipText      = CommonFunctions.WordWrap(input.Notes, 100);
            newNode.ContextMenuStrip = strip;

            TreeNode nodeToAddTo = this.Nodes[(int)Enum.Parse(typeof(LimitType), input.ImprovedName)];

            if (!nodeToAddTo.Nodes.ContainsKey(newNode.Text))
            {
                nodeToAddTo.Nodes.Add(newNode);
                nodeToAddTo.Expand();
            }
        }
Exemple #8
0
        private dynamic CreateFeedbackRequest(SegmentId?segmentId, dynamic rating, string originalText, string improvement)
        {
            var activeDocument = MtCloudApplicationInitializer.EditorController.ActiveDocument;

            var segmentSource = segmentId != null
                                ? activeDocument.SegmentPairs.ToList().FirstOrDefault(sp => sp.Properties.Id.Equals(segmentId))?.Source.ToString()
                                : activeDocument.ActiveSegmentPair.Source.ToString();

            var model = GetCorrespondingLanguageMappingModel();
            var translationFeedbackRequest = new TranslationFeedbackRequest
            {
                Model            = model?.SelectedModel.Model,
                SourceLanguageId = model?.SelectedSource.CodeName,
                SourceText       = segmentSource,
                TargetLanguageId = model?.SelectedTarget.CodeName,
                TargetMtText     = originalText
            };

            dynamic feedbackRequest = new ExpandoObject();

            if (!string.IsNullOrWhiteSpace(improvement))
            {
                var improvementObject = new Improvement {
                    Text = improvement
                };
                feedbackRequest.Improvement = improvementObject;
            }
            if (rating != null)
            {
                feedbackRequest.Rating = rating;
            }
            feedbackRequest.Translation = translationFeedbackRequest;

            return(feedbackRequest);
        }
        /// <summary>
        /// Load the Mentor Spirit from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode)
        {
            objNode.TryGetField("guid", Guid.TryParse, out _guiID);
            if (objNode.TryGetStringFieldQuickly("name", ref _strName))
            {
                _objCachedMyXmlNode = null;
            }
            if (objNode["mentortype"] != null)
            {
                _eMentorType        = Improvement.ConvertToImprovementType(objNode["mentortype"].InnerText);
                _objCachedMyXmlNode = null;
            }
            objNode.TryGetStringFieldQuickly("extra", ref _strExtra);
            objNode.TryGetStringFieldQuickly("source", ref _strSource);
            objNode.TryGetStringFieldQuickly("page", ref _strPage);
            objNode.TryGetStringFieldQuickly("advantage", ref _strAdvantage);
            objNode.TryGetStringFieldQuickly("disadvantage", ref _strDisadvantage);
            objNode.TryGetBoolFieldQuickly("mentormask", ref _blnMentorMask);
            _nodBonus   = objNode["bonus"];
            _nodChoice1 = objNode["choice1"];
            _nodChoice2 = objNode["choice2"];
            objNode.TryGetStringFieldQuickly("notes", ref _strNotes);

            if (!objNode.TryGetField("id", Guid.TryParse, out _sourceID))
            {
                XmlNode objNewNode = XmlManager.Load("qualities.xml").SelectSingleNode("/chummer/mentors/mentor[name = \"" + Name + "\"]");
                objNewNode?.TryGetField("id", Guid.TryParse, out _sourceID);
            }
        }
Exemple #10
0
        /// <summary>
        /// Load the Metamagic from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode)
        {
            if (!objNode.TryGetField("guid", Guid.TryParse, out _guiID))
            {
                _guiID = Guid.NewGuid();
            }
            if (objNode.TryGetStringFieldQuickly("name", ref _strName))
            {
                _objCachedMyXmlNode = null;
            }
            if (!objNode.TryGetGuidFieldQuickly("sourceid", ref _guiSourceID))
            {
                XmlNode node = GetNode(GlobalOptions.Language);
                node?.TryGetGuidFieldQuickly("id", ref _guiSourceID);
            }
            objNode.TryGetStringFieldQuickly("source", ref _strSource);
            objNode.TryGetStringFieldQuickly("page", ref _strPage);
            _nodBonus = objNode["bonus"];
            if (objNode["improvementsource"] != null)
            {
                _objImprovementSource = Improvement.ConvertToImprovementSource(objNode["improvementsource"].InnerText);
            }

            objNode.TryGetInt32FieldQuickly("grade", ref _intGrade);
            objNode.TryGetStringFieldQuickly("notes", ref _strNotes);
        }
Exemple #11
0
        public void Add(Improvement input, ContextMenuStrip strip)
        {
            TreeNode newNode = new TreeNode();
            string strName = input.UniqueName;
            if (input.Value > 0)
                strName += " [+" + input.Value.ToString() + "]";
            else
                strName += " [" + input.Value.ToString() + "]";
            if (input.Exclude != "")
                strName += " (" + input.Exclude + ")";
            newNode.Text = newNode.Name = strName;
            newNode.Tag = input.SourceName;
            if (input.Notes != string.Empty)
                newNode.ForeColor = Color.SaddleBrown;
            newNode.ToolTipText = CommonFunctions.WordWrap(input.Notes, 100);
            newNode.ContextMenuStrip = strip;
            if (input.ImprovedName == "")
            {
                if (input.ImproveType == Improvement.ImprovementType.SocialLimit)
                    input.ImprovedName = "Social";
                else if (input.ImproveType == Improvement.ImprovementType.MentalLimit)
                    input.ImprovedName = "Mental";
                else
                    input.ImprovedName = "Physical";
            }

            TreeNode nodeToAddTo = this.Nodes[(int)Enum.Parse(typeof(LimitType), input.ImprovedName)];
            if (!nodeToAddTo.Nodes.ContainsKey(newNode.Text))
            {
                nodeToAddTo.Nodes.Add(newNode);
                nodeToAddTo.Expand();
            }
        }
Exemple #12
0
    public static ImprovementObject PlaceImprovement(string name, TileObject tile, UnitObject source)
    {
        if (name == "City")
        {
            //capital doesnt exist yet, but its building a city
            if (!source.Nation.Capital)
            {
                name = "Capital";
            }
        }
        else if (name == "Capital")
        {
            //building a capital, but we already have one
            if (source.Nation.Capital)
            {
                name = "City";
            }
        }

        Debug.Log("Placed " + name);
        Improvement improvement = name;

        ImprovementObject improvementObject = Instantiate(improvement.prefab).GetComponent <ImprovementObject>();

        improvementObject.Improvement = improvement;
        improvementObject.Tile        = tile;
        improvementObject.Initialize(source);

        return(improvementObject);
    }
 public void DisplayCard(Improvement category, string title, string content, ProgressCardDelegate functionality)
 {
     displayTitleBar.sprite = titleBarSprites [(int)category];
     displayTitle.text      = title;
     displayContent.text    = content;
     cardsDelegate          = functionality;
     panelCardDisplay.SetActive(true);
 }
Exemple #14
0
        public object GetImprovementList(ImprovementSearch impr)
        {
            dynamic       ImprovementListResult;
            List <object> ImprListResult = new List <object>();
            DataSet       Result         = new DataSet();

            try
            {
                string search = "";

                if (impr.searchText == null)
                {
                    search = "";
                }
                else
                {
                    search = impr.searchText;
                }

                Result = Improvement.GetImprovementList(impr, search);
                DataTable dt  = Result.Tables[0];
                DataTable dt1 = Result.Tables[1];

                List <ImprovementList> res = new List <ImprovementList>();

                if (dt.Rows.Count > 0)
                {
                    res = GlobalFuns.DataTableToList <ImprovementList>(dt);

                    if (!string.IsNullOrEmpty(res[0].improvementImg))
                    {
                        string announ_Image = res[0].improvementImg.ToString();
                        string path         = ConfigurationManager.AppSettings["imgPath"] + "Documents/Improvement/Group" + impr.groupId + "/thumb/";
                        res[0].improvementImg = path + announ_Image;
                    }
                }

                for (int i = 0; i < res.Count; i++)
                {
                    ImprListResult.Add(new { ImprovementList = res[i] });
                }

                if (res != null && res.Count != 0)
                {
                    ImprovementListResult = new { status = "0", message = "success", smscount = dt1.Rows[0]["SMSCount"].ToString(), ImprListResult = ImprListResult };
                }
                else
                {
                    ImprovementListResult = new { status = "1", message = "Record not found", smscount = dt1.Rows[0]["SMSCount"].ToString(), ImprListResult = ImprListResult };
                }
            }
            catch
            {
                ImprovementListResult = new { status = "1", message = "failed", smscount = 0 };
            }

            return(new { TBImprovementListResult = ImprovementListResult });
        }
Exemple #15
0
 /// <summary>
 /// Initializes a new instance of <see cref="ImprovementContext"/>
 /// </summary>
 /// <param name="improvement">The <see cref="Improvement">improvement</see></param>
 /// <param name="tenant">The <see cref="Tenant">tenant</see></param>
 /// <param name="improvableConfiguration">The <see cref="Read.Improvables.Improvable">Improvable</see></param>
 public ImprovementContext(
     TenantId tenant,
     Improvement improvement,
     Improvable improvable)
 {
     Improvement = improvement;
     Tenant      = tenant;
     Improvable  = improvable;
 }
Exemple #16
0
 public IEnumerable <ContextInfoContent> GetContextInfoContent()
 {
     return(EnumerableExtensions.Stream(
                units?.SelectMany(u => u.GetContextInfoContent()),
                Improvement?.GetContextInfoContent(),
                Terrain?.GetContextInfoContent(),
                Deposit?.GetContextInfoContent()
                ));
 }
        public Field(AxialCoordinates position, Map world)
        {
            Position = position;
            World    = world;

            Deposit     = new Deposit(this, DepositMetadata.Empty);
            Improvement = new Improvement(this, ImprovementMetadata.Empty);
            Terrain     = new Terrain(this, TerrainMetadata.Empty);
            Unit        = new Unit(this, UnitMetadata.Empty);
        }
Exemple #18
0
 public Corporation(Improvement improvement)
 {
     improvements      = new List <Improvement>();
     producers         = new List <Producer>();
     producersWithNeed = new List <Producer>();
     storesWithNeed    = new List <Store>();
     stores            = new List <Store>();
     improvements.Add(improvement);
     resources = City.initializeResources();
 }
        public async Task AddImprovement(Improvement improvement)
        {
            if (!improvement.IsValid())
            {
                throw new FormatException();
            }

            context.Improvements.Add(improvement);
            await context.SaveChangesAsync();
        }
Exemple #20
0
        public IHttpActionResult GetImprovement(int id)
        {
            Improvement improvement = db.Improvements.Include("Status").First(i => i.ID == id);

            if (improvement == null)
            {
                return(NotFound());
            }

            return(Ok(improvement));
        }
        /// <summary>
        /// Load the Sustained Object from the XmlNode.
        /// </summary>
        /// <param name="objNode">XmlNode to load.</param>
        public void Load(XmlNode objNode)
        {
            if (objNode == null)
            {
                return;
            }
            string strLinkedId = string.Empty;

            if (!objNode.TryGetStringFieldQuickly("linkedobject", ref strLinkedId))
            {
                _guiID = Guid.Empty;
                return;
            }
            if (objNode["linkedobjecttype"] != null)
            {
                _eLinkedObjectType = Improvement.ConvertToImprovementSource(objNode["linkedobjecttype"].InnerText);
            }
            else
            {
                _guiID = Guid.Empty;
                return;
            }
            IEnumerable <IHasInternalId> lstToSearch;

            // ReSharper disable once SwitchStatementHandlesSomeKnownEnumValuesWithDefault
            switch (_eLinkedObjectType)
            {
            case Improvement.ImprovementSource.Spell:
                lstToSearch = _objCharacter.Spells;
                break;

            case Improvement.ImprovementSource.ComplexForm:
                lstToSearch = _objCharacter.ComplexForms;
                break;

            case Improvement.ImprovementSource.CritterPower:
                lstToSearch = _objCharacter.CritterPowers;
                break;

            default:
                _guiID = Guid.Empty;
                return;
            }
            _objLinkedObject = lstToSearch.FirstOrDefault(x => x.InternalId == strLinkedId);
            if (_objLinkedObject == null)
            {
                Utils.BreakIfDebug();
                _guiID = Guid.Empty;
                return;
            }
            objNode.TryGetInt32FieldQuickly("force", ref _intForce);
            objNode.TryGetInt32FieldQuickly("nethits", ref _intNetHits);
            objNode.TryGetBoolFieldQuickly("self", ref _blnSelfSustained);
        }
Exemple #22
0
 public ActionResult Edit([Bind(Include = "Id,Description,StatusID")] Improvement improvement)
 {
     if (ModelState.IsValid)
     {
         repos.Update(improvement);
         repos.Save();
         return(RedirectToAction("Index"));
     }
     ViewBag.StatusList = new SelectList(repos.AllStati(), "ID", "Description");
     return(View(improvement));
 }
Exemple #23
0
        public async Task <Improvement> Delete(int id)
        {
            Improvement improvement = _context.Improvements.Find(id);

            if (improvement != null)
            {
                _context.Improvements.Remove(improvement);
                await _context.SaveChangesAsync();
            }
            return(improvement);
        }
Exemple #24
0
        public IHttpActionResult PostImprovement(Improvement improvement)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Improvements.Add(improvement);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = improvement.ID }, improvement));
        }
Exemple #25
0
        // POST: odata/ImprovementsOdata
        public IHttpActionResult Post(Improvement improvement)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Improvements.Add(improvement);
            db.SaveChanges();

            return(Created(improvement));
        }
        public static void Add(this TreeView treView, Improvement input, ContextMenuStrip strip)
        {
            if (treView == null)
            {
                return;
            }
            TreeNode nodeToAddTo = treView.Nodes[(int)Enum.Parse(typeof(LimitType), input.ImprovedName)];
            string   strName     = input.UniqueName + ": ";

            if (input.Value > 0)
            {
                strName += "+";
            }
            strName += input.Value.ToString();
            if (!string.IsNullOrEmpty(input.Condition))
            {
                strName += ", " + input.Condition;
            }
            if (!nodeToAddTo.Nodes.ContainsKey(strName))
            {
                TreeNode newNode = new TreeNode
                {
                    Name             = strName,
                    Text             = strName,
                    Tag              = input.SourceName,
                    ContextMenuStrip = strip
                };
                if (!string.IsNullOrEmpty(input.Notes))
                {
                    newNode.ForeColor = Color.SaddleBrown;
                }
                newNode.ToolTipText = input.Notes.WordWrap(100);
                if (string.IsNullOrEmpty(input.ImprovedName))
                {
                    if (input.ImproveType == Improvement.ImprovementType.SocialLimit)
                    {
                        input.ImprovedName = "Social";
                    }
                    else if (input.ImproveType == Improvement.ImprovementType.MentalLimit)
                    {
                        input.ImprovedName = "Mental";
                    }
                    else
                    {
                        input.ImprovedName = "Physical";
                    }
                }

                nodeToAddTo.Nodes.Add(newNode);
                nodeToAddTo.Expand();
            }
        }
Exemple #27
0
        ///<summary>
        ///Database yeni bir Improvement ekler.
        ///</summary>
        public bool AddImprovement(Improvement improvement)
        {
            var result = _improvementDal.Add(improvement);

            if (result != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #28
0
 private void GetAllImprovement()
 {
     one   = _improvementService.GetImprovement("one");
     two   = _improvementService.GetImprovement("two");
     three = _improvementService.GetImprovement("three");
     four  = _improvementService.GetImprovement("four");
     five  = _improvementService.GetImprovement("five");
     six   = _improvementService.GetImprovement("six");
     seven = _improvementService.GetImprovement("seven");
     eight = _improvementService.GetImprovement("eight");
     nine  = _improvementService.GetImprovement("nine");
     ten   = _improvementService.GetImprovement("ten");
 }
    public void improveAttribute(int improvementIndex)
    {
        Improvement imp = improvements[improvementIndex];

        if (imp.pointsAllocated < imp.maxPoints)
        {
            string fieldName = imp.fieldName;
            float  amount    = imp.pointValue;
            improveField(fieldName, amount);

            imp.pointsAllocated++;
        }
    }
        public async Task <IHttpActionResult> Post(Improvement improvement)
        {
            try
            {
                await crudOnImprovements.AddImprovement(improvement);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(throwExceptionToUser.Throw(ex));
            }
        }
Exemple #31
0
        public async Task <Improvement> Read(int id)
        {
            Improvement improvement = await _context.Improvements.FindAsync(id);

            if (improvement != null)
            {
                return(improvement);
            }
            else
            {
                return(null);
            }
        }