示例#1
0
        public RepoBranch GetRepoBranch(string branchName)
        {
            var branchBuffer = Branches.FirstOrDefault(b => b.Name == branchName);

            if (null == branchBuffer)
            {
                var branchNameSections = branchName.Split('-');
                if (branchNameSections[0].ToUpper() == "EPIC")
                {
                    branchBuffer = GetEpicRepoBranch(branchNameSections);
                }
                else if (branchNameSections[0].ToUpper() == "BETA")
                {
                    var branchVersion = new Version(17, 1);
                    branchBuffer = GetRepoBranch(branchVersion);
                }
                else if (branchNameSections[0].ToUpper() == "FEATURE")
                {
                    branchBuffer = Branches.FirstOrDefault(b => b.Name == branchNameSections[1]);
                }
                else
                {
                    var branchVersionSections = branchNameSections[1].Split('.');
                    var branchVersion         = new Version(Convert.ToInt32(branchVersionSections[0]), Convert.ToInt32(branchVersionSections[1]));
                    branchBuffer = GetRepoBranch(branchVersion);
                }
            }
            return(branchBuffer);
        }
 public void updateBranchCommand(object obj)
 {
     if (branchDB.updateBranch(Branches_id, LisenceNum, FileNum, CompanyName, BranchName, ContractNumber,
                               ReferenceNumber, AutomatedNumber, Area, block, street,
                               phone, Governate, BusinessField, CivilNumber))
     {
         var found = Branches.FirstOrDefault(x => x.Branches_id == Branches_id);
         Branches.Remove(found);
         Branches.Add(new Models.BranchesModel
         {
             LisenceNum      = LisenceNum,
             FileNum         = FileNum,
             CompanyName     = CompanyName,
             BranchName      = BranchName,
             ContractNumber  = ContractNumber,
             ReferenceNumber = ReferenceNumber,
             AutomatedNumber = AutomatedNumber,
             Area            = Area,
             block           = block,
             street          = street,
             phone           = phone,
             Governate       = Governate,
             BusinessField   = BusinessField,
             CivilNumber     = CivilNumber,
         });
     }
 }
示例#3
0
        private void HandleBranchDeleted(object sender, BranchInfo info)
        {
            var branch = Branches.FirstOrDefault(b => b.id == info.id);

            if (branch == null)
            {
                return;
            }
            Stream.branches.items.Remove(branch);
            NotifyOfPropertyChange(nameof(BranchContextMenuItems));
        }
示例#4
0
        private void HandleBranchUpdated(object sender, BranchInfo info)
        {
            var branch = Branches.FirstOrDefault(b => b.id == info.id);

            if (branch == null)
            {
                return;
            }
            branch.name        = info.name;
            branch.description = info.description;
            NotifyOfPropertyChange(nameof(BranchContextMenuItems));
        }
示例#5
0
        void RefreshBranches(IObservableRepository repo)
        {
            Branches.Clear();
            foreach (var branch in repo.Inner.Branches
                     .Select(x => new BranchViewModel {
                Name = x.Name, CanonicalName = x.CanonicalName
            }))
            {
                Branches.Add(branch);
            }

            SelectedBranch = Branches.FirstOrDefault(
                b => b.CanonicalName == repo.Inner.Head.CanonicalName);
        }
示例#6
0
        private async void HandleCommitCreated(object sender, CommitInfo info)
        {
            Branches = await Client.StreamGetBranches(Stream.id);

            if (IsSenderCard)
            {
                return;
            }

            var binfo = Branches.FirstOrDefault(b => b.name == info.branchName);
            var cinfo = binfo.commits.items.FirstOrDefault(c => c.id == info.id);

            ServerUpdateSummary = $"{cinfo.authorName} sent new data on branch {info.branchName}: {info.message}";
            ServerUpdates       = true;
        }
        private void ReloadBranches()
        {
            var selectedBranch = SelectedBranch?.Name;

            Branches.Clear();
            var branches = new ShellCommand().ExecuteGit("branch", GitRoot).Select(p => p.Trim());

            foreach (var branch in branches)
            {
                Branches.Add(new Branch {
                    Name = branch
                });
            }
            if (selectedBranch != null)
            {
                SelectedBranch = Branches.SingleOrDefault(p => p.Name == selectedBranch);
            }
            else
            {
                SelectedBranch = Branches.FirstOrDefault(p => p.Name == "master") ?? Branches.FirstOrDefault();
            }
        }
示例#8
0
 public BranchInfo GetBranchInfo(string channelName)
 => Branches.FirstOrDefault(b => b.Name == channelName);
示例#9
0
 public bool TryGetEdge(INode source, INode target, out IBranch edge)
 {
     edge = Branches.FirstOrDefault(b => b.Source == source && b.Target == target);
     return(edge == null);
 }
示例#10
0
 public RepoBranch GetRepoBranch(BranchTitle branch)
 {
     return(Branches.FirstOrDefault(b => b.Title == branch));
 }
示例#11
0
 public RepoBranch GetRepoBranch(Version version)
 {
     return(Branches.FirstOrDefault(b => b.Version.Major == version.Major && b.Version.Minor == version.Minor));
 }
示例#12
0
        public string GetFluentString()
        {
            var message = (Branches?.FirstOrDefault()?.Inline ?? false) ? "" : $", {Message}";

            switch (Type)
            {
            case EmoteType.AwardNoShareXP:
            case EmoteType.AwardXP:
                return($"{Amount64:N0}");

            case EmoteType.AddCharacterTitle:
                return($"{(CharacterTitle)Amount}");

            case EmoteType.AddContract:
                return($"{(ContractId)Stat}");

            case EmoteType.AwardLevelProportionalXP:
                var suffix = "";
                if ((Max64 ?? 0) != 0)
                {
                    suffix += $", {Max64:N0}";
                }
                if ((Min64 ?? 0) != 0 && Min64 != Max64)
                {
                    suffix = $", {Min64:N0} - {Max64:N0}";
                }
                if (Display ?? false)
                {
                    suffix += $", Share";
                }
                return($"{Math.Round((Percent ?? 0) * 100, 2)}%{suffix}");

            case EmoteType.AwardLevelProportionalSkillXP:
                suffix = "";
                if ((Max ?? 0) != 0)
                {
                    suffix += $", {Max:N0}";
                }
                if ((Min ?? 0) != 0 && Min != Max)
                {
                    suffix = $", {Min:N0} - {Max:N0}";
                }
                return($"{((Skill)Stat).ToSentence()}, {Math.Round((Percent ?? 0) * 100, 2)}%{suffix}");

            case EmoteType.AwardLuminance:
            case EmoteType.SpendLuminance:
                return($"{HeroXP64:N0}");

            case EmoteType.AwardSkillXP:
            case EmoteType.AwardSkillPoints:
                return($"{((Skill)Stat).ToSentence()}, {Amount:N0}");

            case EmoteType.CreateTreasure:
                return($"Type: {TreasureType}, Class: {TreasureClass}, WealthRating: {WealthRating}");

            case EmoteType.SetFloatStat:
                return($"{(PropertyFloat)Stat}, {Percent}");

            case EmoteType.DecrementIntStat:
            case EmoteType.IncrementIntStat:
                suffix = (Amount ?? 1) > 1 ? $", {Amount:N0}" : "";
                return($"{(PropertyInt)Stat}{suffix}");

            case EmoteType.SetIntStat:
                return($"{(PropertyInt)Stat}, {Amount:N0}");

            case EmoteType.SetInt64Stat:
                return($"{(PropertyInt64)Stat}, {Amount64:N0}");

            case EmoteType.SetBoolStat:
                return($"{(PropertyBool)Stat}, {(Amount == 0 ? "False" : "True")}");

            case EmoteType.IncrementMyQuest:
            case EmoteType.IncrementQuest:
            case EmoteType.AwardTrainingCredits:
            case EmoteType.InflictVitaePenalty:
                var amount = (Amount ?? 1) > 1 ? $", {Amount}" : "";
                return($"{Message}{amount}");

            case EmoteType.InqAttributeStat:
            case EmoteType.InqRawAttributeStat:

                amount = $"{Min:N0}";
                if (Max != Min)
                {
                    amount += $" - {Max:N0}";
                }

                return($"{(PropertyAttribute)Stat}, {amount}{message}");

            case EmoteType.InqBoolStat:

                return($"{(PropertyBool)Stat}{message}");

            case EmoteType.InqFloatStat:

                amount = $"{MinFloat}";
                if (MaxFloat != MinFloat)
                {
                    amount += $" - {MaxFloat}";
                }

                return($"{(PropertyFloat)Stat}, {amount}{message}");

            case EmoteType.InqIntStat:

                amount = $"{Min:N0}";
                if (Max != Min)
                {
                    amount += $" - {Max:N0}";
                }

                return($"{(PropertyInt)Stat}, {amount}{message}");

            case EmoteType.InqInt64Stat:

                amount = $"{Min64:N0}";
                if (Max64 != Min64)
                {
                    amount += $" - {Max64:N0}{message}";
                }

                return($"{(PropertyInt64)Stat}, {amount}");

            case EmoteType.InqQuestSolves:
                var numSolves = Min != null ? $", {Min}" : "";
                if (Max != null && Min != Max)
                {
                    numSolves += $" - {Max}";
                }
                return($"{Message}{numSolves}");

            case EmoteType.InqSecondaryAttributeStat:
            case EmoteType.InqRawSecondaryAttributeStat:

                amount = $"{Min:N0}";
                if (Max != Min)
                {
                    amount += $" - {Max:N0}{message}";
                }

                return($"{(PropertyAttribute2nd)Stat}, {amount}");

            case EmoteType.InqSkillStat:
            case EmoteType.InqRawSkillStat:

                amount = $"{Min:N0}";
                if (Max != Min)
                {
                    amount += $" - {Max:N0}{message}";
                }

                return($"{((Skill)Stat).ToSentence()}, {amount}");

            case EmoteType.InqStringStat:
                return($"{(PropertyString)Stat}, \"{TestString}\"{message}");

            case EmoteType.InqSkillTrained:
            case EmoteType.InqSkillSpecialized:
                return($"{((Skill)Stat).ToSentence()}{message}");

            case EmoteType.UntrainSkill:
                return($"{((Skill)Stat).ToSentence()}");

            case EmoteType.InqYesNo:
                return(TestString + message);

            case EmoteType.Give:
            case EmoteType.TakeItems:

                var wcid      = WeenieClassId.Value;
                var stackSize = (StackSize ?? 1) != 1 ? $", {StackSize:N0}" : "";
                return($"{WeenieName}{stackSize}");

            case EmoteType.InqOwnsItems:

                wcid      = WeenieClassId.Value;
                stackSize = (StackSize ?? 1) > 1 ? $", {StackSize:N0}" : "";
                return($"{WeenieName}{stackSize}{message}");

            case EmoteType.Motion:
            case EmoteType.ForceMotion:
                return($"{(MotionCommand)Motion}");

            case EmoteType.Move:
            case EmoteType.MoveToPos:
            case EmoteType.SetSanctuaryPosition:
            case EmoteType.TeleportTarget:
                var moveTo = new Position(ObjCellId ?? 0, new Vector3(OriginX ?? 0, OriginY ?? 0, OriginZ ?? 0),
                                          new Quaternion(AnglesX ?? 0, AnglesY ?? 0, AnglesZ ?? 0, AnglesW ?? 1));
                return(moveTo.ToString());

            case EmoteType.Sound:
                return($"{(Sound)Sound}");

            case EmoteType.CastSpell:
            case EmoteType.CastSpellInstant:
            case EmoteType.TeachSpell:
            case EmoteType.PetCastSpellOnOwner:
                return(SpellName);

            case EmoteType.SetMyQuestCompletions:
            case EmoteType.SetQuestCompletions:
                return($"{Message}, {Amount}");

            case EmoteType.Turn:
                var rotation    = new Quaternion(AnglesX ?? 0, AnglesY ?? 0, AnglesZ ?? 0, AnglesW ?? 1);
                var heading     = Position.get_heading(rotation);
                var heading_dir = Position.get_heading_dir(heading);
                return($"Heading: {heading} ({heading_dir})");
            }

            return(Message);
        }
示例#13
0
        public void Merge(Modules modules)
        {
            foreach (KeyValuePair <string, Documents> module in modules)
            {
                if (!Modules.Keys.Contains(module.Key))
                {
                    Modules.Add(module.Key, module.Value);
                }
                else
                {
                    foreach (KeyValuePair <string, Classes> document in module.Value)
                    {
                        if (!Modules[module.Key].ContainsKey(document.Key))
                        {
                            Modules[module.Key].Add(document.Key, document.Value);
                        }
                        else
                        {
                            foreach (KeyValuePair <string, Methods> @class in document.Value)
                            {
                                if (!Modules[module.Key][document.Key].ContainsKey(@class.Key))
                                {
                                    Modules[module.Key][document.Key].Add(@class.Key, @class.Value);
                                }
                                else
                                {
                                    foreach (KeyValuePair <string, Method> method in @class.Value)
                                    {
                                        if (!Modules[module.Key][document.Key][@class.Key].ContainsKey(method.Key))
                                        {
                                            Modules[module.Key][document.Key][@class.Key].Add(method.Key, method.Value);
                                        }
                                        else
                                        {
                                            foreach (KeyValuePair <int, int> line in method.Value.Lines)
                                            {
                                                if (!Modules[module.Key][document.Key][@class.Key][method.Key].Lines.ContainsKey(line.Key))
                                                {
                                                    Modules[module.Key][document.Key][@class.Key][method.Key].Lines.Add(line.Key, line.Value);
                                                }
                                                else
                                                {
                                                    Modules[module.Key][document.Key][@class.Key][method.Key].Lines[line.Key] += line.Value;
                                                }
                                            }

                                            foreach (BranchInfo branch in method.Value.Branches)
                                            {
                                                Branches   branches   = Modules[module.Key][document.Key][@class.Key][method.Key].Branches;
                                                BranchInfo branchInfo = branches.FirstOrDefault(b => b.EndOffset == branch.EndOffset && b.Line == branch.Line && b.Offset == branch.Offset && b.Ordinal == branch.Ordinal && b.Path == branch.Path);
                                                if (branchInfo == null)
                                                {
                                                    branches.Add(branch);
                                                }
                                                else
                                                {
                                                    branchInfo.Hits += branch.Hits;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
示例#14
0
        /// <summary>
        /// Writes a polyline shape file with the network
        /// </summary>
        /// <param name="shapefilename"></param>
        public void WriteToShape(string shapefilename)
        {
            using (ShapeWriter swc = new ShapeWriter(shapefilename + "_QHPoints"))
            {
                DataTable dat = new DataTable();
                dat.Columns.Add("BranchName", typeof(string));
                dat.Columns.Add("Chainage", typeof(double));
                dat.Columns.Add("Type", typeof(string));
                foreach (var b in nwkfile.MIKE_11_Network_editor.COMPUTATIONAL_SETUP.branchs)
                {
                    foreach (var p in b.points.points)
                    {
                        GeoRefData gd = new GeoRefData();
                        gd.Data = dat.NewRow();
                        gd.Data["BranchName"] = b.name;
                        gd.Data["Chainage"]   = p.Par1;

                        if (p.Par3 == 0)
                        {
                            gd.Data["Type"] = "h";
                        }
                        else
                        {
                            gd.Data["Type"] = "q";
                        }

                        var bran = Branches.FirstOrDefault(br => br.Name == b.name);
                        if (bran != null)
                        {
                            gd.Geometry = bran.GetPointAtChainage(p.Par1);
                            swc.Write(gd);
                        }
                    }
                }
            }

            ShapeWriter sw = new ShapeWriter(shapefilename);


            ShapeWriter swCsc = new ShapeWriter(shapefilename + "_CrossSections");
            DataTable   dtCsc = new DataTable();

            dtCsc.Columns.Add("Name", typeof(string));
            dtCsc.Columns.Add("TopoID", typeof(string));
            dtCsc.Columns.Add("Chainage", typeof(double));

            DataTable dt = new DataTable();

            dt.Columns.Add("Name", typeof(string));
            dt.Columns.Add("TopoID", typeof(string));
            dt.Columns.Add("ChainageStart", typeof(double));
            dt.Columns.Add("ChainageEnd", typeof(double));

            foreach (var b in branches)
            {
                GeoRefData grf = new GeoRefData();
                grf.Geometry = b.Line;
                grf.Data     = dt.NewRow();
                grf.Data[0]  = b.Name;
                grf.Data[1]  = b.TopoID;
                grf.Data[2]  = b.ChainageStart;
                grf.Data[3]  = b.ChainageEnd;
                sw.Write(grf);

                foreach (var Csc in b.CrossSections)
                {
                    GeoRefData csc_data = new GeoRefData();
                    csc_data.Geometry = Csc.Line;
                    csc_data.Data     = dtCsc.NewRow();
                    csc_data.Data[0]  = Csc.BranchName;
                    csc_data.Data[1]  = Csc.TopoID;
                    csc_data.Data[2]  = Csc.Chainage;

                    swCsc.Write(csc_data);
                }
            }
            sw.Dispose();
            swCsc.Dispose();
        }