예제 #1
0
        public static int GetClassId(this IRealmDbContext dbContext, SystemTypes systemType, string className)
        {
            var obj = dbContext.SystemClasses.Where(x => x.SystemType == systemType)
                      .Where(x => x.Name == className);

            return(obj.Count() != 1 ? 0 : obj.ToList()[0].Id);
        }
예제 #2
0
        public static void Murder(PlayerInfo pi, PlayerInfo pi1, SystemTypes local)
        {
            var murder = new Murder(pi.Name, pi1.Name, (int)local - 1);

            Models.Murder.Murders.Add(murder);
            murder.Log();
        }
예제 #3
0
 /// <summary>
 /// Combine flags for a platform into a single identifier.
 /// </summary>
 /// <param name="sys"></param>
 /// <param name="display"></param>
 /// <param name="ar"></param>
 /// <param name="opt"></param>
 /// <returns></returns>
 public static PlatformType Compose(SystemTypes sys, DisplayTypes display, AugmentedRealityTypes ar, Options opt)
 {
     return((PlatformType)(((int)sys << SYS_OFFSET)
                           | ((int)display << DISPLAY_OFFSET)
                           | ((int)ar << AR_OFFSET)
                           | (int)opt));
 }
예제 #4
0
        public static void AddViewModelProperty(this ClassModel @class, Property property, ITypeModelRegistry registry)
        {
            TypeModel propertyType;

            if (property.Type.SystemType != null)
            {
                propertyType = SystemTypes.Parse(property.Type.SystemType);
            }
            else if (!(property.Type.Type is Enumeration))
            {
                var viewModel = registry.GetAllBaseTypes <ViewModel>("Application").SingleOrDefault(vm => vm.IsCompact && vm.Target == property.Type.Type);
                propertyType = registry.Resolve("Application", viewModel);
            }
            else
            {
                propertyType = property.Type.Resolve(registry);
            }

            if (property.IsCollection)
            {
                propertyType = SystemTypes.List(propertyType);
            }

            @class.AddProperty(property.Name, propertyType)
            .WithDescription(property.Description);
        }
예제 #5
0
        public static bool Prefix(SystemTypes ENHDELNCBNG)
        {
            // Get Task
            PlayerTask playerTask = null;

            for (int i = 0; i < ShipStatus.Instance.SpecialTasks.Length; i++)
            {
                PlayerTask task = ShipStatus.Instance.SpecialTasks[i];
                if (task.StartAt == ENHDELNCBNG)
                {
                    playerTask = task;
                    break;
                }
            }

            // Check
            if (playerTask == null)
            {
                LILogger.LogError("Player has been given invalid System Task: " + ENHDELNCBNG.ToString());
                return(false);
            }

            // Provide
            PlayerControl localPlayer = PlayerControl.LocalPlayer;
            PlayerTask    playerTask2 = GameObject.Instantiate <PlayerTask>(playerTask, localPlayer.transform);

            playerTask2.Id    = 255U;
            playerTask2.Owner = localPlayer;
            playerTask2.Initialize();
            localPlayer.myTasks.Add(playerTask2);
            return(false);
        }
예제 #6
0
        public override void GenerateType(BaseType type, TypeModel model, ITypeModelRegistry registry)
        {
            if (type is DomainEvent domainEvent && model is ClassModel @class)
            {
                @class = @class
                         .WithBaseType(SystemTypes.DomainEvent(@class))
                         .WithAttributes(SystemTypes.Parse("Serializable"));

                // Generate property for aggregate unique id
                if (domainEvent.Aggregate.UniqueIdentifier != null)
                {
                    @class.AddDomainProperty(new Property {
                        Name        = domainEvent.Aggregate.Name,
                        Description = "Unique id of aggregate that throws this event",
                        Type        = new MetaType
                        {
                            Type = domainEvent.Aggregate
                        }
                    }, registry);
                }


                // Generate properties
                foreach (var p in domainEvent.Properties)
                {
                    @class.AddDomainProperty(p, registry);
                }

                // Generate constructor
                @class.AddConstructor()
                .WithPropertyParameters()
                .WithAttributes(SystemTypes.JsonConstructorAttribute())
                .WithBody(builder => { builder.AssignPropertiesFromParameters(); });
            }
        }
예제 #7
0
    public static string replace(string str, string delim, string rep)
    {
        String result = "";
        String s      = str + "";
        int    i      = (s.IndexOf(delim) + 1);

        if (i == 0)
        {
            return(s);
        }

        int sublength = delim.Length;

        if (sublength == 0)
        {
            return(s);
        }

        while (i > 0)
        {
            result = result + SystemTypes.subrange(s, 1, i - 1) + rep;
            s      = SystemTypes.subrange(s, i + delim.Length, s.Length);
            i      = (s.IndexOf(delim) + 1);
        }
        result = result + s;
        return(result);
    }
예제 #8
0
 public override void GenerateType(BaseType type, TypeModel model, ITypeModelRegistry registry)
 {
     if (type is Command command && model is ClassModel @class)
     {
         @class.WithBaseType(SystemTypes.Command());
     }
 }
        /// <summary>
        /// Returns jasonstring result by making web call task processing service url
        /// </summary>
        /// <param name="requestUrl"></param>
        /// <param name="accessToken"></param>
        /// <returns></returns>
        private static string GetJsonString(string requestUrl)
        {
            if (string.IsNullOrEmpty(requestUrl))
            {
                return(string.Empty);
            }

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUrl);

            request.Method = "GET";
            request.Accept = "application/json";
            ISSOProvider       ssoProvider;
            SystemTypes        systemType         = SystemTypes.Gateway;
            AuthenticationType authenticationType = (AuthenticationType)Enum.Parse(typeof(AuthenticationType), authType);

            ssoProvider = SSOProviderFactory.Instance.GetSSOProvider(authenticationType, request.Method, "", "", "", false, requestUrl, systemType);   //requestUrl is string
            switch (authenticationType)
            {
            case AuthenticationType.BASIC:
                request.Credentials = new System.Net.NetworkCredential(Constant.SERVICE_USER, Constant.SERVICE_PSWD);
                break;
            }
            ssoProvider.SAPCredientials(ref request);
            string          text;
            HttpWebResponse response = request.GetResponse() as HttpWebResponse;

            using (var sr = new StreamReader(response.GetResponseStream()))
            {
                text = sr.ReadToEnd();
            }
            return(text);
        }
예제 #10
0
 public static void Add(SystemTypes system, string name)
 {
     if (!renames.ContainsKey(system))
     {
         renames.Add(system, name);
     }
 }
 public PlayerRepairSystemEvent(IGame game, IClientPlayer clientPlayer, IInnerPlayerControl playerControl, SystemTypes systemType, byte amount)
 {
     Game          = game;
     ClientPlayer  = clientPlayer;
     PlayerControl = playerControl;
     SystemType    = systemType;
     Amount        = amount;
 }
예제 #12
0
 private void Init(SystemTypes type, string name, int classId, int id, int subId)
 {
     SystemType = type;
     Name       = name;
     ClassId    = classId;
     Id         = id;
     SubId      = subId;
 }
예제 #13
0
        public static EditorBrowseInfo GetSimpleBrowseInfo(SystemTypes systemType, int id)
        {
            var dbContext = Program.NinjectKernel.Get <IRealmDbContext>();
            var obj       = dbContext.GetPrimitive(systemType, id);

            return(obj != null
                ? new EditorBrowseInfo(systemType, "[" + obj.SystemName + "]", obj.SystemClass.Id, obj.Id)
                : null);
        }
예제 #14
0
 public static bool Prefix(SystemTypes PAECGDHCGJC, ref string __result)
 {
     if (TextHandler.Contains(PAECGDHCGJC))
     {
         __result = TextHandler.Get(PAECGDHCGJC);
         return(false);
     }
     return(true);
 }
예제 #15
0
 public BaseEditorControl(SystemTypes systemType, int classId)
 {
     InitializeComponent();
     ControlName  = $"<New {EditorFactory.Builders[systemType].DisplayName}>";
     ClassId      = classId;
     SystemType   = systemType;
     Id           = 0;
     Dirty        = false;
     Changes      = new List <Control>();
     Initializing = true;
 }
예제 #16
0
        public virtual void Awake()
        {
            cam = GetComponent <Camera>();

            Install(false);

            lastSystem = Sys.m_System;
            lastOption = Sys.m_Option;

            StartXRDisplay();
        }
예제 #17
0
 public static TypeModel Resolve(this MetaType type, ITypeModelRegistry registry, string layer = "Domain")
 {
     if (type.SystemType != null)
     {
         return(SystemTypes.Parse(type.SystemType));
     }
     else
     {
         return(registry.Resolve(layer, type.Type) ?? SystemTypes.Parse(type.Name));
     }
 }
예제 #18
0
 public static void Report(PlayerInfo pi, PlayerInfo pi2, SystemTypes local)
 {
     if (pi2.IsNull)
     {
         new Meeting(pi.Name, null, (int)local - 1).Log();
     }
     else
     {
         new Meeting(pi.Name, pi2.Name, (int)local - 1).Log();
     }
 }
예제 #19
0
 protected EditorBuilder(SystemTypes aSystemType, string aDisplayName, string aDisplayPlural,
                         IRealmDbContext realmDbContext, IRealmAdminDbContext realmAdminContext)
 {
     DisplayName       = aDisplayName;
     DisplayPlural     = aDisplayPlural;
     SystemType        = aSystemType;
     Icon              = null;
     IsVisible         = true;
     RealmContext      = realmDbContext;
     RealmAdminContext = realmAdminContext;
 }
예제 #20
0
 public override void GenerateType(BaseType type, TypeModel model, ITypeModelRegistry registry)
 {
     if (type is Query query && model is ClassModel @class && query.Result is ViewModel viewModel)
     {
         @class = @class.WithBaseType(SystemTypes.Query(registry.Resolve(Layer, viewModel)));
         foreach (var property in query.Properties)
         {
             @class.AddDomainProperty(property, registry);
         }
     }
 }
예제 #21
0
        public void TrapSuccessful(SystemTypes room)
        {
            if (AmongUsClient.Instance.AmClient && DestroyableSingleton <HudManager> .Instance && !player.Data.IsDead)
            {
                string roomName = DestroyableSingleton <TranslationController> .Instance.GetString(room);

                DestroyableSingleton <HudManager> .Instance.Chat.AddChat(player, $"The last known position of the saboteur was in {roomName}!");
            }

            markTrapUsed = false;
            markedSystem = null;
        }
예제 #22
0
        public override void GenerateType(BaseType type, TypeModel model, ITypeModelRegistry registry)
        {
            if (type is Service service && model is InterfaceModel @interface)
            {
                foreach (var method in service.Methods)
                {
                    var serviceMethod = @interface.AddMethod(method.Name)
                                        .WithParameters(method.Parameters.Select(p => GenerateMethodParameter(registry, p)).ToArray());

                    serviceMethod = serviceMethod.WithReturnType(SystemTypes.Task(GenerateReturnType(registry, method)));
                }
            }
        }
    private static bool HasOneFlag(SystemTypes flags)
    {
        int numFlags = 0;

        foreach (SystemTypes flag in Enum.GetValues(typeof(SystemTypes)))
        {
            if (flag != SystemTypes.None && flags.HasFlag(flag))
            {
                ++numFlags;
            }
        }

        return(numFlags == 0);
    }
예제 #24
0
        public override void GenerateModule(Module module, NamespaceModel @namespace, ITypeModelRegistry registry)
        {
            if (GetTypes(module).Any())
            {
                var @class = @namespace.AddClass($"{module.Name}DbContext");

                foreach (var aggregate in module.GetTypes <Aggregate>())
                {
                    @class.AddProperty($"{aggregate.Name}Set", SystemTypes.DbSet(registry.Resolve(Layer, aggregate)));
                }

                registry.Register(Layer, module, @class);
            }
        }
예제 #25
0
        public override void GenerateType(BaseType type, TypeModel model, ITypeModelRegistry registry)
        {
            if (type is Query query && model is ClassModel @class && query.Result is ViewModel viewModel)
            {
                var queryType       = registry.Resolve(Layer, query);
                var queryResultType = registry.Resolve(Layer, viewModel);

                @class = @class.WithImplementedInterfaces(SystemTypes.QueryHandler(queryType, queryResultType));

                var handler = @class.AddMethod("Handle")
                              .WithParameters(new MethodParameter("query", queryType))
                              .WithReturnType(queryResultType)
                              .WithBody(builder => { builder.ThrowNotImplemented(); });
            }
        }
예제 #26
0
    public static ArrayList intersectAll(ArrayList se)
    {
        ArrayList res = new ArrayList();

        if (se.Count == 0)
        {
            return(res);
        }
        res.AddRange((ArrayList)se[0]);
        for (int i = 1; i < se.Count; i++)
        {
            res = SystemTypes.intersection(res, (ArrayList)se[i]);
        }
        return(res);
    }
 /*
  *	system: must be a type that extends ComponentSystemBase
  */
 private static void SetSystemType(Type system, SystemTypes flag)
 {
     if (!system.IsSubclassOf(typeof(ComponentSystemBase)))
     {
         Debug.LogError(system + " is not a component system.");
     }
     else if (HasOneFlag(flag))
     {
         Debug.LogError(flag + " on " + system + " is not a single flag.");
     }
     else
     {
         systemTypes.Add(system, flag);
     }
 }
예제 #28
0
        public void OnSabotageHappened(SystemTypes system)
        {
            if (system != markedSystem)
            {
                return;
            }

            markTrapUsed = false;
            markedSystem = null;

            TrapSuccessful(SystemTypes.Admin);
            MessageWriter writer = GetWriter(RPC.TrapSuccessful);

            writer.Write((byte)currentRoomId);
            CloseWriter(writer);
        }
예제 #29
0
            public static bool Prefix(ShipStatus __instance, [HarmonyArgument(0)] SystemTypes type, [HarmonyArgument(1)] int someEnumProbably)
            {
                if (AmongUsClient.Instance.AmHost || type != SystemTypes.Sabotage ||
                    PlayerControl.LocalPlayer.Data.IsImpostor ||
                    !(PlayerControl.LocalPlayer.GetRole()?.CanSabotage(null) ?? false))
                {
                    return(true);
                }

                Rpc <CustomSabotage> .Instance.SendTo(__instance, AmongUsClient.Instance.HostId, new CustomSabotage.Data
                {
                    amount = (byte)someEnumProbably
                });

                return(false);
            }
예제 #30
0
        public static void Setup(this LinkLabel value, SystemTypes systemType, int key)
        {
            Validation.IsNotNull(value, "value");

            if (key > 0)
            {
                var browseInfo = EditorFactory.GetBrowseInfo(systemType, key);
                value.Tag  = browseInfo;
                value.Text = browseInfo.Name;
            }
            else
            {
                value.Tag  = new EditorBrowseInfo(systemType, string.Empty, 0, 0);
                value.Text = string.Empty;
            }
        }
 public UnitOfMeasurement CreateNewUnitOfMeasurement(string name, string shortName, SystemTypes systemValueType)
 {
     UnitOfMeasurementRepository.Add(new UnitOfMeasurement{Name = name, ShortName = shortName, ValueType = systemValueType});
     UnitOfWork.Commit();
     return UnitOfMeasurementRepository.Find(name);
 }
예제 #32
0
 public BPExcelWorker(UpdateTypes updateType, SystemTypes systemType)
     : base(updateType, systemType)
 {
     ColorKeep = keep;
     ColorUpdate = update;
 }
예제 #33
0
 public ExcelWorker(UpdateTypes updateType, SystemTypes systemType)
 {
     _updateType = updateType;
     _systemType = systemType;
 }
예제 #34
0
 public static ExcelWorker Factory(UpdateTypes type, SystemTypes systemType)
 {
     ExcelWorker worker = null;
     switch (type)
     {
         case UpdateTypes.BP:
             worker = new BPExcelWorker(type, systemType);
             break;
         case UpdateTypes.CP:
             worker = new CPExcelWorker(type, systemType);
             break;
         case UpdateTypes.R3:
             worker = new R3ExcelWorker(type, systemType);
             break;
         default:
             break;
     }
     return worker;
 }