Beispiel #1
0
        public static SimGroup MovingPlatform(string from, string to, string Rot, string Scale, string interior, int index, string name, bool doesReturn = true, string time = "5000", string smoothing = "Linear")
        {
            var platform = new PathedInterior(interior, index, Vector.Zero, new AngAxis(Rot), new Vector(Scale))
            {
                objname = name + "MP"
            };
            var    fromMarker   = new Marker(time, "0", smoothing, new Vector(from), AngAxis.Identity, Vector.One);
            var    toMarker     = new Marker(time, "1", smoothing, new Vector(to), AngAxis.Identity, Vector.One);
            Marker returnMarker = null;

            if (doesReturn)
            {
                returnMarker = new Marker(time, "2", smoothing, new Vector(from), AngAxis.Identity, Vector.One);
            }
            var Path = new Path();

            Path.Add(fromMarker);
            Path.Add(toMarker);
            if (doesReturn)
            {
                Path.Add(returnMarker);
            }
            var sg = new SimGroup()
            {
                objname = name
            };

            sg.Add(Path);
            sg.Add(platform);
            return(sg);
        }
Beispiel #2
0
        private void CreateRadgroupcheck(SimGroup simGroup)
        {
            var radgroupcheck1 = new Radgroupcheck()
            {
                Attribute = "Pool-Name",
                Groupname = simGroup.Id.ToString(),
                Op        = ":=",
                Value     = simGroup.IsolatedNw1IpPool
            };
            var radgroupcheck2 = new Radgroupcheck()
            {
                Attribute = "Called-Station-Id",
                Groupname = simGroup.Id.ToString(),
                Op        = "==",
                Value     = simGroup.Apn
            };
            var radgroupcheck3 = new Radgroupcheck()
            {
                Attribute = "NAS-IP-Address",
                Groupname = simGroup.Id.ToString(),
                Op        = "==",
                Value     = simGroup.NasIp
            };

            _radiusRepository.CreateRadgroupcheck(radgroupcheck1, radgroupcheck2, radgroupcheck3);
        }
Beispiel #3
0
        /// <summary>
        /// Create a server of the given type, load the given level, and then
        /// create a local client connection to the server.
        /// </summary>
        /// <param name="serverType"></param>
        /// <param name="level"></param>
        /// <returns>true if succesful.</returns>
        public static bool createAndConnectToLocalServer(string serverType, string level)
        {
            if (!createServer(serverType, level))
            {
                return(false);
            }

            GameConnectionToServer ServerConnection = new GameConnectionToServer("ServerConnection", true);
            SimGroup RootGroup = Sim.FindObject <SimGroup>("RootGroup");

            RootGroup.add(ServerConnection);

            ServerConnection.setConnectArgs(Globals.GetString("pref::Player::Name"));
            ServerConnection.setJoinPassword(Globals.GetString("Client::Password"));

            string result = ServerConnection.connectLocal();

            if (!string.IsNullOrEmpty(result))
            {
                ServerConnection.delete();
                destroyServer();

                return(false);
            }

            return(true);
        }
Beispiel #4
0
        public static void onEnd()
        {
            // Delete the objects we created.
            SimGroup gameGroup = Sim.FindObject <SimGroup>("GameGroup");

            gameGroup.delete();
        }
Beispiel #5
0
        /// <summary>
        /// A function used in order to easily parse the MissionGroup for classes . I'm pretty
        /// sure at this point the function can be easily modified to search the any group as well.
        /// </summary>
        /// <param name="className"></param>
        /// <param name="childGroup"></param>
        public static bool parseMissionGroup(string className, SimGroup childGroup = null)
        {
            if (childGroup == null)
            {
                childGroup = Sim.FindObject <SimGroup>("MissionGroup");
            }

            for (uint i = 0; i < childGroup.getCount(); i++)
            {
                if (childGroup.getObject(i).getClassName().Equals(className))
                {
                    return(true);
                }

                if (childGroup.getObject(i).getClassName().Equals("SimGroup"))
                {
                    if (parseMissionGroup(className, childGroup.getObject(i).As <SimGroup>()))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Beispiel #6
0
        public override void Groups_OnGroupRolesMembers(object sender, GroupRolesMembersReplyEventArgs e)
        {
            var      groupID = e.GroupID;
            SimGroup g       = DeclareGroup(groupID);

            if (MaintainGroupMetaData)
            {
                MetaDataQueue.Enqueue(() =>
                {
                    foreach (var list in e.RolesMembers)
                    {
                        SimGeneric declareGeneric = DeclareGroupRole(groupID, list.Key);
                        if (list.Value != UUID.Zero)
                        {
                            SimAvatarImpl a = DeclareAvatarProfile(list.Value);
                            a.AddGroupRole(groupID, list.Key);
                            a.AddInfoMapItem(new NamedParam("simMemberRole",
                                                            declareGeneric));
                            SendOnUpdateDataAspect(a, "MemberRole", null, null);
                        }
                    }
                    if (g != null)
                    {
                        SendOnUpdateDataAspect(g, "Members", null, null);
                    }
                });
            }
            // base.Groups_OnGroupRolesMembers(requestID, groupID, rolesMembers);
        }
Beispiel #7
0
        public RegisterTests(CustomWebApplicationFactoryWithMariaDb <Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();
            Utils.RemoveAllEntities(_context);

            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain01", Organization = _org1
            });
            _context.Add(_user1 = new SuperAdmin {
                AccountName = "user0", Name = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                                      // スーパー管理者
            _context.Add(_user2 = new UserAdmin {
                AccountName = "user1", Name = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                                        // ユーザー管理者
            _context.Add(_simGroup1 = new SimGroup()
            {
                Id                      = Guid.NewGuid(),
                Name                    = "simGroup1",
                Organization            = _org1,
                Apn                     = "apn",
                AuthenticationServerIp  = "AuthenticationServerIp",
                IsolatedNw1IpPool       = "IsolatedNw1IpPool",
                IsolatedNw1SecondaryDns = "IsolatedNw1SecondaryDns",
                IsolatedNw1IpRange      = "IsolatedNw1IpRange",
                IsolatedNw1PrimaryDns   = "IsolatedNw1PrimaryDns",
                NasIp                   = "NasIp",
                PrimaryDns              = "PrimaryDns",
                SecondaryDns            = "SecondaryDns",
                UserNameSuffix          = "UserNameSuffix",
            });
            _context.SaveChanges();
        }
Beispiel #8
0
        public override void Groups_OnGroupMembers(object sender, GroupMembersReplyEventArgs e)
        {
            var      groupID = e.GroupID;
            SimGroup g       = DeclareGroup(groupID);

            if (MaintainGroupMetaData)
            {
                MetaDataQueue.Enqueue(() =>
                {
                    foreach (var member in e.Members)
                    {
                        var v = member.Value;
                        if (member.Key == UUID.Zero)
                        {
                            continue;
                        }
                        SimAvatarImpl A = DeclareAvatarProfile(member.Key);
                        //A.AddInfoMap(new NamedParam("GroupMember",groupID));
                    }
                    if (g != null)
                    {
                        SendOnUpdateDataAspect(g, "Members", null, null);
                    }
                });
            }
            // base.Groups_OnGroupMembers(requestID, totalCount, members);
        }
Beispiel #9
0
            public string createObject(string cmd)
            {
                SimGroup MissionGroup = "MissionGroup";

                if (!bGlobal["$missionRunning"])
                {
                    return("");
                }


                if (!this.objectGroup.isObject())
                {
                    this.setNewObjectGroup(MissionGroup);
                }

                Util.pushInstantGroup();
                SimObject objId = Util.eval(cmd);

                Util.popInstantGroup();

                if (objId.isObject())
                {
                    this.onFinishCreateObject(objId);
                }

                return(objId);
            }
Beispiel #10
0
        public void init(SimGroup qualityGroup)
        {
            // Clear the existing content first.
            this.clear();
            // Fill it.
            int select = -1;

            for (uint i = 0; i < qualityGroup.getCount(); i++)
            {
                GraphicsQualityLevel level = qualityGroup.getObject(i);
                if (level.isCurrent())
                {
                    select = (int)i;
                }

                this.add(level.getInternalName(), (int)i);
            }
            // Setup a default selection.
            if (select == -1)
            {
                this.setText("Custom");
            }
            else
            {
                this.setSelected(select);
            }

            //this.setText(select.AsString());
        }
Beispiel #11
0
        public void Case06()
        {
            var organization = Utils.CreateOrganization(code: 5, name: "org5");
            var simGroup     = new SimGroup
            {
                Id                      = Guid.NewGuid(),
                Name                    = "simGroup1",
                Organization            = organization,
                Apn                     = "apn",
                AuthenticationServerIp  = "AuthenticationServerIp",
                IsolatedNw1IpPool       = "IsolatedNw1IpPool",
                IsolatedNw1SecondaryDns = "IsolatedNw1SecondaryDns",
                IsolatedNw1IpRange      = "IsolatedNw1IpRange",
                IsolatedNw1PrimaryDns   = "IsolatedNw1PrimaryDns",
                NasIp                   = "NasIp",
                PrimaryDns              = "PrimaryDns",
                SecondaryDns            = "SecondaryDns",
                UserNameSuffix          = "",
            };

            _context.AddRange(organization, simGroup);
            _context.SaveChanges();

            var(response, _, json) = Utils.Delete(_client, $"{Url}/5", "user0", "user0");  // スーパー管理者
            Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
            Assert.NotNull(json["traceId"]);
            Assert.NotNull(json["errors"][nameof(SimGroup)]); // 存在
            Assert.Null(json["errors"][nameof(Domain)]);
            Assert.Null(json["errors"][nameof(OrganizationClientApp)]);
        }
        public virtual void initGroupList()
        {
            GuiPopUpMenuCtrl groupList = findObjectByInternalName("groupList", true);

            int selected = 0;

            if (groupList.size() > 0)
            {
                selected = groupList.getSelected();
            }

            groupList.clear();

            SimGroup root = getRootGroup();

            if (!root.isObject())
            {
                return;
            }
            // Add all non-empty groups.
            scanGroup(root, groupList, 0);

            // Select initial group.
            if (selected != 0 && selected.AsString().isObject())
            {
                groupList.setSelected(selected);
            }
            else
            {
                groupList.setSelected(root.getId());
            }
        }
Beispiel #13
0
        public void deleteMat()
        {
            SimSet        TerrainMaterialSet            = "TerrainMaterialSet";
            SimGroup      TerrainMaterialDlgDeleteGroup = "TerrainMaterialDlgDeleteGroup";
            TerrainEditor ETerrainEditor = "ETerrainEditor";

            if (!this["activeMat"].isObject())
            {
                return;
            }

            // Cannot delete this material if it is the only one left on the Terrain
            if ((ETerrainEditor.getMaterialCount() == 1) && ETerrainEditor.getMaterialIndex(((SimObject)this["activeMat"]).internalName) != -1)
            {
                messageBox.MessageBoxOK("Error", "Cannot delete this Material, it is the only Material still in use by the active Terrain.");
                return;
            }
            TerrainMaterialSet.remove(this["activeMat"]);
            TerrainMaterialDlgDeleteGroup.add(this["activeMat"]);
            GuiTreeViewCtrl matLibTree = this.findObjectByInternalName("matLibTree", true);

            buildTree();
            //matLibTree.open("TerrainMaterialSet", false);
            //matLibTree.selectItem(1);
        }
Beispiel #14
0
        public static bool parseMissionGroup(string className, string childGroup = "")
        {
            SimGroup currentGroup = "";

            if (omni.Util.getWordCount(childGroup) == 0)
            {
                currentGroup = "MissionGroup";
            }
            else
            {
                currentGroup = childGroup;
            }

            for (uint i = 0; i < currentGroup.getCount(); i++)
            {
                if (((SimObject)currentGroup.getObject(i)).getClassName() == className)
                {
                    return(true);
                }

                if (((SimObject)currentGroup.getObject(i)).getClassName() == "SimGroup")
                {
                    if (parseMissionGroup(className, currentGroup.getObject(i).getID().AsString()))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
        public static void onActivateBasicLM()
        {
            Torque3D.PostEffect HDRPostFx = Sim.FindObjectByName <Torque3D.PostEffect>("HDRPostFx");
            // If HDR is enabled... enable the special format token.
            if (!Globals.GetString("platform").Equals("macos") && HDRPostFx.isEnabled())
            {
                Core.RenderManager.AL_FormatToken.enable();
            }

            // Create render pass for projected shadow.
            BL_ProjectedShadowRPM = new RenderPassManager("BL_ProjectedShadowRPM");
            BL_ProjectedShadowRPM.registerObject();

            // Create the mesh bin and add it to the manager.
            RenderMeshMgr meshBin = new RenderMeshMgr();

            meshBin.registerObject();
            BL_ProjectedShadowRPM.addManager(meshBin);

            SimGroup RootGroup = Sim.FindObjectByName <SimGroup>("RootGroup");

            // Add both to the root group so that it doesn't
            // end up in the MissionCleanup instant group.
            RootGroup.add(BL_ProjectedShadowRPM);
            RootGroup.add(meshBin);
        }
Beispiel #16
0
        public void restoreMaterials()
        {
            if (!"TerrainMaterialDlgSnapshot".isObject())
            {
                Util._error("TerrainMaterial::restoreMaterials - no snapshot present");
                return;
            }

            SimGroup TerrainMaterialDlgSnapshot = "TerrainMaterialDlgSnapshot";

            int count = TerrainMaterialDlgSnapshot.getCount();

            for (uint i = 0; i < count; i++)
            {
                ScriptObject obj = TerrainMaterialDlgSnapshot.getObject(i);

                TerrainMaterial mat = obj["material"];
                mat.setInternalName(obj.internalName);
                mat.diffuseMap           = obj["diffuseMap"];
                mat.normalMap            = obj["normalMap"];
                mat.detailMap            = obj["detailMap"];
                mat.macroMap             = obj["macroMap"];
                mat["detailSize"]        = obj["detailSize"];
                mat["diffuseSize"]       = obj["diffuseSize"];
                mat["detailStrength"]    = obj["detailStrength"];
                mat["detailDistance"]    = obj["detailDistance"];
                mat["macroSize"]         = obj["macroSize"];
                mat["macroStrength"]     = obj["macroStrength"];
                mat["macroDistance"]     = obj["macroDistance"];
                mat["useSideProjection"] = obj["useSideProjection"];
                mat["parallaxScale"]     = obj["parallaxScale"];
            }
        }
Beispiel #17
0
        public UpdateMineTests(CustomWebApplicationFactoryWithMariaDb <JinCreek.Server.Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();

            Utils.RemoveAllEntities(_context);

            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_org2    = Utils.CreateOrganization(code: 2, name: "org2"));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain01", Organization = _org1
            });
            _context.Add(_domain2 = new Domain {
                Id = Guid.NewGuid(), Name = "domain02", Organization = _org2
            });
            _context.Add(_userGroup1 = new UserGroup {
                Id = Guid.NewGuid(), Name = "userGroup1", Domain = _domain1
            });
            _context.Add(_userGroup2 = new UserGroup {
                Id = Guid.NewGuid(), Name = "userGroup2", Domain = _domain2
            });
            _context.Add(new SuperAdmin {
                AccountName = "user0", Name = "", Password = Utils.HashPassword("user0")
            });                                                                                                        // スーパー管理者
            _context.Add(new UserAdmin {
                AccountName = "user1", Name = "", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                          // ユーザー管理者
            _context.Add(_simGroup1 = Utils.CreateSimGroup(organization: _org1, name: "simGroup1", isolatedNw1IpPool: "isolatedNw1IpPool"));
            _context.Add(_simGroup2 = Utils.CreateSimGroup(organization: _org2, name: "simGroup2", isolatedNw1IpPool: "isolatedNw1IpPool"));
            _context.SaveChanges();
        }
        public ListingTests(CustomWebApplicationFactory <JinCreek.Server.Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();
            _context.Database.EnsureDeleted();
            _context.Database.EnsureCreated();

            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_org2    = Utils.CreateOrganization(code: 2, name: "org2"));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain01", Organization = _org1
            });
            _context.Add(_domain2 = new Domain {
                Id = Guid.NewGuid(), Name = "domain02", Organization = _org2
            });
            _context.Add(_user1 = new SuperAdmin {
                AccountName = "user0", Password = Utils.HashPassword("user0")
            });                                                                                                      // スーパー管理者
            _context.Add(_user2 = new UserAdmin {
                AccountName = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                        // ユーザー管理者
            _context.Add(_simGroup1 = new SimGroup()
            {
                Id = Guid.NewGuid(), Name = "simGroup1", Organization = _org1
            });
            _context.Add(_simGroup2 = new SimGroup
            {
                Id = Guid.NewGuid(), Name = "simGroup2", Organization = _org2, IsolatedNw1IpPool = ""
            });
            _context.Add(_simGroup1a = new SimGroup
            {
                Id = Guid.NewGuid(), Name = "simGroup1a", Organization = _org1
            });
            _context.SaveChanges();
        }
Beispiel #19
0
            public string createPrefab(string file)
            {
                SimGroup MissionGroup = "MissionGroup";

                if (!bGlobal["$missionRunning"])
                {
                    return("");
                }


                if (!this.objectGroup.isObject())
                {
                    this.setNewObjectGroup(MissionGroup);
                }

                ObjectCreator objectCreator = new ObjectCreator("Prefab");

                objectCreator["filename"]    = file;
                objectCreator["position"]    = this.getCreateObjectPosition();
                objectCreator["parentGroup"] = this.objectGroup;

                Prefab objId = objectCreator.Create();

                this.onObjectCreated(objId);
                return(objId);
            }
Beispiel #20
0
        public override void onActivated()
        {
            EditorGui    EditorGui    = "EditorGui";
            EWorldEditor EWorldEditor = "EWorldEditor";
            EditorTree   EditorTree   = "EditorTree";

            Creator.EWCreatorWindow      EWCreatorWindow     = "EWCreatorWindow";
            EditorGui.EditorGuiStatusBar EditorGuiStatusBar  = "EditorGuiStatusBar";
            ETransformSelection          ETransformSelection = "ETransformSelection";
            SimGroup MissionGroup = "MissionGroup";

            EditorGui.bringToFront("EWorldEditor");
            EWorldEditor.setVisible(true);

            EditorGui.menuBar.insert(EditorGui.worldMenu, EditorGui.menuBar["dynamicItemInsertPos"].AsInt());

            EWorldEditor.makeFirstResponder(true);
            EditorTree.open(MissionGroup, true);
            EWCreatorWindow.setNewObjectGroup(MissionGroup);

            EWorldEditor.syncGui();

            EditorGuiStatusBar.setSelectionObjectsByCount(EWorldEditor.getSelectionSize().AsString());

            // Should the Transform Selection window open?
            if (EWorldEditor["ETransformSelectionDisplayed"].AsBool())
            {
                ETransformSelection.setVisible(true);
            }

            base.onActivated();
        }
        //-----------------------------------------------------------------------------
        // Called when all datablocks have been transmitted.
        public void onEnterGame()
        {
            //TODO should this be pClient
            //GameConnection client = Sim.FindObject<GameConnection>(pClient);

            // Create a camera for the client.
            Camera theCamera = new Camera("TheCamera")
            {
                DataBlock = Sim.FindObjectByName <CameraData>("Observer")
            };

            theCamera.registerObject();
            theCamera.setTransform(new TransformF(new Point3F(0, 0, 2), new AngAxisF(1, 0, 0, 0)));

            // Cameras are not ghosted (sent across the network) by default; we need to
            // do it manually for the client that owns the camera or things will go south
            // quickly.
            theCamera.scopeToClient(this);
            // And let the client control the camera.
            setControlObject(theCamera);
            // Add the camera to the group of game objects so that it's cleaned up when
            // we close the game.
            SimGroup gameGroup = Sim.FindObject <SimGroup>("GameGroup");

            gameGroup.add(theCamera);
            // Activate HUD which allows us to see the game. This should technically be
            // a commandToClient, but since the client and server are on the same
            // machine...
            GuiCanvas canvas = Sim.FindObject <GuiCanvas>("Canvas");

            canvas.setContent(Sim.FindObject <GuiTSCtrl>("PlayGui"));
            Global.activateDirectInput();
        }
Beispiel #22
0
        public void dialogCancel()
        {
            PersistenceManager ETerrainMaterialPersistMan    = "ETerrainMaterialPersistMan";
            SimGroup           TerrainMaterialDlgNewGroup    = "TerrainMaterialDlgNewGroup";
            SimGroup           TerrainMaterialDlgDeleteGroup = "TerrainMaterialDlgDeleteGroup";

            // Restore material properties we have changed.
            this.restoreMaterials();

            // Clear the persistence manager state.

            ETerrainMaterialPersistMan.clearAll();

            // Delete all new object we have created.

            TerrainMaterialDlgNewGroup.clear();

            // Restore materials we have marked for deletion.

            int deletedCount = TerrainMaterialDlgDeleteGroup.getCount();

            for (uint i = 0; i < deletedCount; i++)
            {
                SimObject mat = TerrainMaterialDlgDeleteGroup.getObject(i);
                mat.parentGroup = "RootGroup";

                ((SimSet)"TerrainMaterialSet").add(mat);
            }
            ((GuiCanvas)"Canvas").popDialog(this);
        }
Beispiel #23
0
        public override void Groups_OnGroupAccountSummary(object sender, GroupAccountSummaryReplyEventArgs e)
        {
            var      groupID = e.GroupID;
            SimGroup g       = DeclareGroup(groupID);

            g.Summary = e.Summary;
            base.Groups_OnGroupAccountSummary(sender, e);
        }
Beispiel #24
0
        //SimGroupに対応のRadippool同期
        private void RadippoolSync(SimGroup simGroup)
        {
            using (var transaction = _radiusRepository._dbContext.Database.BeginTransaction())
            {
                var radippools = _radiusRepository.GetRadippool(simGroup.IsolatedNw1IpPool);
                var network    = IPNetwork.Parse(simGroup.IsolatedNw1IpRange);
                // ReSharper disable once RedundantCast
                if ((int)network.Cidr == 32)                        //32の場合
                {
                    if (radippools != null && radippools.Count > 0) //更新
                    {
                        radippools[0].Framedipaddress = network.Network.ToString();
                        _radiusRepository.UpdateRadippool(radippools[0]);
                    }
                    else //登録
                    {
                        CreateRadippool(network.Network, simGroup);
                    }
                }
                // 32以外の場合
                var ipAddresses = network.ListIPAddress(FilterEnum.Usable);
                if (radippools != null && radippools.Count > 0) //更新
                {
                    if (ipAddresses.Count >= radippools.Count)  // 更新後のIpAddressは増えた
                    {
                        for (int i = 0; i < radippools.Count; i++)
                        {
                            radippools[i].Framedipaddress = ipAddresses[i].ToString();
                            _radiusRepository.UpdateRadippool(radippools[i]);
                        }

                        for (int i = radippools.Count; i < ipAddresses.Count; i++) //増えたIPAddress追加
                        {
                            CreateRadippool(ipAddresses[i], simGroup);
                        }
                    }
                    else //更新後のIpAddressは減った
                    {
                        for (int i = 0; i < ipAddresses.Count; i++)
                        {
                            radippools[i].Framedipaddress = ipAddresses[i].ToString();
                            _radiusRepository.UpdateRadippool(radippools[i]);
                        }
                        //減ったの削除
                        _radiusRepository.DeleteRadippool(radippools.GetRange((int)ipAddresses.Count, radippools.Count - (int)ipAddresses.Count));
                    }
                }
                else//登録
                {
                    foreach (var ip in ipAddresses)
                    {
                        CreateRadippool(ip, simGroup);
                    }
                }
                transaction.Commit();
            }
        }
Beispiel #25
0
        public ListingMineTests(CustomWebApplicationFactoryWithMariaDb <JinCreek.Server.Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();

            Utils.RemoveAllEntities(_context);

            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_org2    = Utils.CreateOrganization(code: 2, name: "org2"));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain1", OrganizationCode = _org1.Code
            });
            _context.Add(_domain2 = new Domain {
                Id = Guid.NewGuid(), Name = "domain2", OrganizationCode = _org2.Code
            });
            _context.Add(_user0 = new SuperAdmin {
                AccountName = "user0", Name = "", Password = Utils.HashPassword("user0")
            });                                                                                                                 // スーパー管理者
            _context.Add(_user1 = new UserAdmin {
                AccountName = "user1", Name = "", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                                                   // ユーザー管理者
            _context.Add(_user2 = new GeneralUser {
                AccountName = "xuser2a", Name = "", Domain = _domain1
            });
            _context.Add(_simGroup1 = Utils.CreateSimGroup(organization: _org1, name: "simGroup1", isolatedNw1IpPool: "isolatedNw1IpPool"));
            _context.Add(_simGroup2 = Utils.CreateSimGroup(organization: _org2, name: "simGroup2", isolatedNw1IpPool: "isolatedNw1IpPool"));
            _context.Add(_sim1A     = new Sim {
                SimGroup = _simGroup1, Msisdn = "1", Imsi = "1a", IccId = "1a", UserName = "******", Password = "******"
            });
            _context.Add(_sim1B = new Sim {
                SimGroup = _simGroup1, Msisdn = "0123456789", Imsi = "1b", IccId = "1b", UserName = "******", Password = "******"
            });
            _context.Add(_sim2 = new Sim {
                SimGroup = _simGroup2, Msisdn = "2", Imsi = "2", IccId = "2", UserName = "******", Password = "******"
            });
            _context.Add(_device1    = Utils.CreateDevice(domain: _domain1, name: "device1"));
            _context.Add(_device2    = Utils.CreateDevice(domain: _domain1, name: "xdevice2a"));
            _context.Add(_simDevice1 = new SimAndDevice {
                Id = Guid.NewGuid(), SimId = _sim1A.Id, Device = _device1, IsolatedNw2Ip = ""
            });
            _context.Add(_simDevice2 = new SimAndDevice {
                Id = Guid.NewGuid(), SimId = _sim1A.Id, Device = _device2, IsolatedNw2Ip = ""
            });
            _context.Add(_multiFactor1 = new MultiFactor {
                Id = Guid.NewGuid(), SimAndDevice = _simDevice1, EndUserId = _user1.Id, ClosedNwIp = ""
            });
            _context.Add(_multiFactor2 = new MultiFactor {
                Id = Guid.NewGuid(), SimAndDevice = _simDevice2, EndUserId = _user2.Id, ClosedNwIp = ""
            });

            //_context.Add(new SimAndDeviceAuthenticationSuccessLog { Id = Guid.NewGuid(), SimAndDevice = _simDevice1 });
            //_context.Add(new SimAndDeviceAuthenticationFailureLog { Id = Guid.NewGuid(), Sim = _sim1 });
            //_context.Add(new MultiFactorAuthenticationSuccessLog { Id = Guid.NewGuid(), MultiFactor = _factorCombination1 });
            //_context.Add(new MultiFactorAuthenticationFailureLog { Id = Guid.NewGuid(), SimAndDevice = _simDevice1 });
            //_context.Add(new DeauthenticationLog { Id = Guid.NewGuid(), MultiFactor = _factorCombination1 });
            _context.SaveChanges();
        }
Beispiel #26
0
        public InquiryMineTests(CustomWebApplicationFactory <JinCreek.Server.Admin.Startup> factory)
        {
            _client  = factory.CreateClient();
            _context = factory.Services.GetService <IServiceScopeFactory>().CreateScope().ServiceProvider.GetService <MainDbContext>();

            _context.Database.EnsureDeleted();
            _context.Database.EnsureCreated();

            _context.Add(_org1    = Utils.CreateOrganization(code: 1, name: "org1"));
            _context.Add(_org2    = Utils.CreateOrganization(code: 2, name: "org2"));
            _context.Add(_domain1 = new Domain {
                Id = Guid.NewGuid(), Name = "domain01", Organization = _org1
            });
            _context.Add(_domain2 = new Domain {
                Id = Guid.NewGuid(), Name = "domain02", Organization = _org2
            });
            _context.Add(_userGroup1 = new UserGroup {
                Id = Guid.NewGuid(), Name = "userGroup1", Domain = _domain1
            });
            _context.Add(_userGroup2 = new UserGroup {
                Id = Guid.NewGuid(), Name = "userGroup2", Domain = _domain2
            });
            _context.Add(new SuperAdmin {
                AccountName = "user0", Password = Utils.HashPassword("user0")
            });                                                                                             // スーパー管理者
            _context.Add(new UserAdmin {
                AccountName = "user1", Password = Utils.HashPassword("user1"), Domain = _domain1
            });                                                                                                               // ユーザー管理者
            _context.Add(_simGroup1 = new SimGroup()
            {
                Id = Guid.NewGuid(), Name = "simGroup1", Organization = _org1
            });
            _context.Add(_simGroup2 = new SimGroup
            {
                Id = Guid.NewGuid(), Name = "simGroup2", Organization = _org2, IsolatedNw1IpPool = ""
            });
            _context.Add(_sim1 = new Sim() // 組織 : '自組織
            {
                Msisdn   = "msisdn01",
                Imsi     = "imsi01",
                IccId    = "iccid01",
                UserName = "******",
                Password = "******",
                SimGroup = _simGroup1
            });
            _context.Add(_sim2 = new Sim() // 組織 : '他組織
            {
                Msisdn   = "msisdn02",
                Imsi     = "imsi02",
                IccId    = "iccid02",
                UserName = "******",
                Password = "******",
                SimGroup = _simGroup2
            });
            _context.SaveChanges();
        }
Beispiel #27
0
        //----------------------------------------------------------------------------
        // Helper functions
        //----------------------------------------------------------------------------

        public static void connect(string server)
        {
            GameConnectionToServer conn = new GameConnectionToServer("ServerConnection", true);
            SimGroup RootGroup          = Sim.FindObject <SimGroup>("RootGroup");

            RootGroup.add(conn);
            conn.setConnectArgs(Globals.GetString("pref::Player::Name"));
            conn.setJoinPassword(Globals.GetString("Client::Password"));
            conn.connect(server);
        }
        public void Case05()
        {
            var simGroup1 = new SimGroup()
            {
                Id                     = Guid.NewGuid(),
                Name                   = "simGroup01",
                Organization           = _org1,
                Apn                    = "apn01",
                AuthenticationServerIp = "AuthServerIpAddress01",
                NasIp                  = "NasIpAddress01",
            };
            var simGroup2 = new SimGroup()
            {
                Id                     = Guid.NewGuid(),
                Name                   = "simGroup02",
                Organization           = _org1,
                Apn                    = "apn02",
                AuthenticationServerIp = "AuthServerIpAddress02",
                NasIp                  = "NasIpAddress02",
            };
            var simGroup3 = new SimGroup()
            {
                Id                     = Guid.NewGuid(),
                Name                   = "simGroup03",
                Organization           = _org1,
                Apn                    = "apn03",
                AuthenticationServerIp = "AuthServerIpAddress03",
                NasIp                  = "NasIpAddress03",
            };
            var simGroup4 = new SimGroup()
            {
                Id                     = Guid.NewGuid(),
                Name                   = "simGroup04",
                Organization           = _org2,
                Apn                    = "apn04",
                AuthenticationServerIp = "AuthServerIpAddress04",
                NasIp                  = "NasIpAddress04",
            };

            _context.AddRange(simGroup1, simGroup2, simGroup3, simGroup4);
            _context.SaveChanges();

            var(response, body, json) = Utils.Get(_client, $"{Url}/?OrganizationCode={_org1.Code}", "user0", "user0"); // スーパー管理者
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            Assert.Equal(3, (int)json["count"]);                                                                       // トータル件数
            Assert.NotEmpty(body);
            var list = (JArray)json["results"];

            Assert.Equal(3, list.Count);
            Assert.Equal("simGroup01", list[0]["name"]);   //SIMグループ名ソート:'昇順
            Assert.Equal("simGroup02", list[1]["name"]);   //SIMグループ名ソート:'昇順
            Assert.Equal("apn02", list[1]["apn"]);         //APNソート:'昇順
            Assert.Equal("apn03", list[2]["apn"]);         //APNソート:'昇順
            Assert.Null(list[0]["traceId"]);
        }
Beispiel #29
0
        public override void onWorldEditorStartup()
        {
            ForestEditorGui.ForestEditBrushTree ForestEditBrushTree = "ForestEditBrushTree";
            SimSet ForestItemDataSet = "ForestItemDataSet";

            ForestEditorGui.ForestEditMeshTree ForestEditMeshTree = "ForestEditMeshTree";
            EditorGui EditorGui = "EditorGui";

            ForestEditorGui.ForestEditTabBook            ForestEditTabBook            = "ForestEditTabBook";
            ForestEditorGui.ForestEditorPropertiesWindow ForestEditorPropertiesWindow = "ForestEditorPropertiesWindow";
            ForestEditorGui.ForestEditorPalleteWindow    ForestEditorPalleteWindow    = "ForestEditorPalleteWindow";

            new ObjectCreator("PersistenceManager", "ForestDataManager").Create();

            const string brushPath = "art/forest/brushes.cs";

            if (!Util.isFile(brushPath))
            {
                Util.createPath(brushPath);
            }

            // This creates the ForestBrushGroup, all brushes, and elements.
            Util.exec(brushPath, false, false);

            SimGroup ForestBrushGroup = "ForestBrushGroup";

            if (!ForestBrushGroup.isObject())
            {
                ForestBrushGroup  = new ObjectCreator("SimGroup", "ForestBrushGroup").Create();
                this["showError"] = true.AsString();
            }

            ForestEditBrushTree.open(ForestBrushGroup);

            if (!ForestItemDataSet.isObject())
            {
                ForestItemDataSet = new ObjectCreator("SimSet", "ForestItemDataSet").Create();
            }

            ForestEditMeshTree.open(ForestItemDataSet);

            // Add ourselves to the window menu.
            string accel = EditorGui.addToEditorsMenu("Forest Editor", "", this);

            // Add ourselves to the tools menu.
            string tooltip = "Forest Editor (" + accel + ")";

            EditorGui.addToToolsToolbar("ForestEditorPlugin", "ForestEditorPalette",
                                        Util._expandFilename("tools/forestEditor/images/forest-editor-btn"), tooltip);

            //connect editor windows
            ForestEditorPalleteWindow.attachTo(ForestEditorPropertiesWindow);
            ForestEditTabBook.selectPage(0);
        }
Beispiel #30
0
        public override void onSaveMission(string missionFile)
        {
            NavEditorGui NavEditorGui = "NavEditorGui";

            if (NavEditorGui.isDirty)
            {
                SimGroup MissionGroup = "MissionGroup";
                MissionGroup.save(missionFile);
                NavEditorGui.isDirty = false;
            }
        }