private void MarkSelectedUsage()
 {
     var item = usagesListView.SelectedItems[0];
     var index = usagesListView.Items.IndexOf( item );
     SelectedUsage = _usages[index];
     DialogResult = DialogResult.OK;
     Dispose();
 }
Beispiel #2
0
        internal static void Init(IUsage <ModulePermission> permission)
        {
            Permission = permission;
            Instance   = permission.Instance;

            DefaultGroup = Instance.Groups.FirstOrDefault(p => p.Id == Instance.DefaultGroupId);
            AdminGroup   = Instance.Groups.FirstOrDefault(p => p.Id == Instance.AdminGroup);
        }
Beispiel #3
0
        private void MarkSelectedUsage()
        {
            var item  = usagesListView.SelectedItems[0];
            var index = usagesListView.Items.IndexOf(item);

            SelectedUsage = _usages[index];
            DialogResult  = DialogResult.OK;
            Dispose();
        }
Beispiel #4
0
 public PostBehaviour(IPostRepository postRepository, IUserRepository userRepository, ICommentRepository commentRepository, IUsage usage, IWebHostEnvironment hostEnvironment, ILogger <PostBehaviour> logger)
 {
     _postRepository      = postRepository;
     _userRepository      = userRepository;
     _commentRepository   = commentRepository;
     this.usage           = usage;
     this.hostEnvironment = hostEnvironment;
     this.logger          = logger;
 }
        public static void FillTranslation(this Translation defaultTranslations, IUsage <Translation> deserializedTranslation)
        {
            foreach (var defaultTranslation in defaultTranslations.Where(defaultTranslation => deserializedTranslation.Instance[defaultTranslation.Key] == null))
            {
                deserializedTranslation.Instance.Add(defaultTranslation);
            }

            deserializedTranslation.Save();
        }
Beispiel #6
0
 public void AddUsage(IUsage usage)
 {
     #region Precondizioni
     if (usage == null)
     {
         throw new ArgumentNullException("usage null");
     }
     #endregion
     if (!_usages.Contains(usage))
     {
         _usages.Add(usage);
     }
 }
Beispiel #7
0
        public static void Init()
        {
            Translations = new JsonFileAsset <Translation>(ModuleEnvironment.TranslationFile);
            ModuleTranslation.FillTranslation(Translations);

            Permissions = new JsonFileAsset <ModulePermission>(ModuleEnvironment.PermissionFile);
            Commands    = new JsonFileAsset <ModuleCommand>(ModuleEnvironment.CommandsFile);
            Settings    = new JsonFileAsset <ModuleSettings>(ModuleEnvironment.SettingsFile);

            PermissionManager.Init(Permissions);
            CommandManager.Init(Commands);
            SettingsManager.Init(Settings);

            UnturnedEvents.Init();
            UnturnedChatManager.Init();
        }
Beispiel #8
0
            /// <summary>
            /// Removes the given item from the collection
            /// </summary>
            /// <returns>True, if the item was removed, otherwise False</returns>
            /// <param name="item">The item that should be removed</param>
            public override bool Remove(IModelElement item)
            {
                if ((this._parent.Crew == item))
                {
                    this._parent.Crew = null;
                    return(true);
                }
                IUsage usageItem = item.As <IUsage>();

                if (((usageItem != null) &&
                     this._parent.Usages.Remove(usageItem)))
                {
                    return(true);
                }
                return(false);
            }
Beispiel #9
0
            /// <summary>
            /// Adds the given element to the collection
            /// </summary>
            /// <param name="item">The item to add</param>
            public override void Add(IModelElement item)
            {
                if ((this._parent.Crew == null))
                {
                    ICrew crewCasted = item.As <ICrew>();
                    if ((crewCasted != null))
                    {
                        this._parent.Crew = crewCasted;
                        return;
                    }
                }
                IUsage usagesCasted = item.As <IUsage>();

                if ((usagesCasted != null))
                {
                    this._parent.Usages.Add(usagesCasted);
                }
            }
Beispiel #10
0
 /// <summary>
 /// Compare this usage to another usage
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public int CompareTo(IUsage other)
 {
     return(this.ID.CompareTo(other.ID));
 }
 internal static void Init(IUsage <ModuleSettings> settings)
 {
     ModuleSettings = settings;
 }
Beispiel #12
0
 internal static void Init(IUsage <ModuleCommand> commands)
 {
     Commands          = commands;
     Instance.Commands = Instance.Commands.Distinct(CommandComparer.Instance).ToList();
 }
Beispiel #13
0
 /// <summary>
 /// This private Constructor creates instances of StoredDataValue, that carray a array_entry
 /// </summary>        
 public StoredDataValue(UInt32 index, IUsage value, Boolean exists) {
     array_entry = new ArrayEntry();
     array_entry.value = createDataValue(value, exists);
     array_entry.index = index;
 }
Beispiel #14
0
        /// <summary>
        /// This private Constructor creates instances of StoredDataValue, that carray a single_value_entry
        /// </summary>        
        public StoredDataValue(IUsage value, Boolean exists) {

            single_value_entry = createDataValue(value, exists);
        }
Beispiel #15
0
 /// <summary>
 /// This Constructor creates instances of StoredDataValue, that carray a dictionary_entry
 /// </summary>        
 public StoredDataValue(string key, IUsage value, Boolean exists) {
     dictionary_entry = new DictionaryEntry();
     DataValue dataValue = createDataValue(value, exists);
     dictionary_entry.value = dataValue;
     dictionary_entry.key = key;
 }
Beispiel #16
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="usage"></param>
 public void RegisterUsage(IUsage usage) {
   if (usage == null)
     throw new ArgumentNullException("Usage reference is null");
   usages.Add(usage.CodePoint, usage);
 }
Beispiel #17
0
        private DataValue createDataValue(IUsage value, Boolean exists) {

            DataValue dataValue = new DataValue();
            if (value != null && value.Length != 0 && exists) {
                dataValue.value = value;
                dataValue.exists = true;
                return dataValue;
            }
            else {
                dataValue.value = null;
                dataValue.exists = false;
                return dataValue;
            }
        }
Beispiel #18
0
 /// <summary>
 /// Compare this usage to another usage
 /// </summary>
 /// <param name="other"></param>
 /// <returns></returns>
 public int CompareTo(IUsage other)
 {
     return(string.Compare(ID, other.ID, StringComparison.InvariantCultureIgnoreCase));
 }