コード例 #1
0
ファイル: RegGroup.cs プロジェクト: ABCo-Src/AppCore
 public unsafe void RemoveItem(string path)
 {
     if (!TryRemoveItem(path))
     {
         ABSLog.ThrowError($"ABSoftware Core: Failed to remove item at path: '{path}'");
     }
 }
コード例 #2
0
ファイル: ABSRegistry.cs プロジェクト: ABCo-Src/AppCore
 public static unsafe void RemoveItem(string path)
 {
     if (!TryRemoveItem(path))
     {
         ABSLog.ThrowError("T");
     }
 }
コード例 #3
0
ファイル: RegGroup.cs プロジェクト: ABCo-Src/AppCore
 public unsafe void AddItem(string path, IRegItem item)
 {
     if (TryAddItem(path, item) != AddItemResult.Success)
     {
         ABSLog.ThrowError($"ABSoftware Core: Failed to add item at path: '{path}'");
     }
 }
コード例 #4
0
ファイル: ABSRegistry.cs プロジェクト: ABCo-Src/AppCore
 public static unsafe void AddItem(string path, IRegItem item)
 {
     if (TryAddItem(path, item) != AddItemResult.Success)
     {
         ABSLog.ThrowError("T");
     }
 }
コード例 #5
0
        public BaseViewModel()
        {
            var allProperties = typeof(T).GetProperties();

            PropertyChanged += (s, e) => UpdateRegistry(e.PropertyName);

            for (int i = 0; i < allProperties.Length; i++)
            {
                var attribute = allProperties[i].GetCustomAttribute <RegistrySyncAttribute>();
                if (attribute != null)
                {
                    var regItem = ABSRegistry.GetItem(attribute.RegistryPath);
                    if (regItem is RegGroup)
                    {
                        ABSLog.ThrowError("Cannot registry sync to a group.");
                    }

                    var syncInfo = new RegistrySyncInfo(allProperties[i], regItem, attribute.BooleanGroupPos);
                    _registrySyncProperties.Add(allProperties[i].Name, syncInfo);
                    AddEventHandlerToItem(syncInfo, regItem);

                    UpdateProperty(syncInfo);
                }
            }
        }
コード例 #6
0
ファイル: RegGroup.cs プロジェクト: ABCo-Src/AppCore
        public unsafe IRegItem GetItem(string path)
        {
            if (!TryGetItem(path, out IRegItem item))
            {
                ABSLog.ThrowError($"ABSoftware Core: Failed to get the item at path: '{path}'");
            }

            return(item);
        }
コード例 #7
0
ファイル: ABSRegistry.cs プロジェクト: ABCo-Src/AppCore
        public static unsafe RegGroup CreateGroup(string path)
        {
            if (TryCreateGroup(path, out RegGroup newGroup) != AddItemResult.Success)
            {
                ABSLog.ThrowError("T");
            }

            return(newGroup);
        }
コード例 #8
0
ファイル: ABSRegistry.cs プロジェクト: ABCo-Src/AppCore
        public static unsafe IRegItem GetItem(string path)
        {
            if (!TryGetItem(path, out IRegItem item))
            {
                ABSLog.ThrowError("T");
            }

            return(item);
        }
コード例 #9
0
ファイル: ComponentManager.cs プロジェクト: ABCo-Src/AppCore
        public static ComponentCategory GetCategory(string categoryName)
        {
            if (Components.TryGetValue(categoryName, out ComponentCategory res))
            {
                return(res);
            }

            ABSLog.ThrowError("An attempt was made to access a non-existant component category. Always use 'CategoryExists' or 'TryGetCategory' if the category is not guaranteed to exist.");
            return(null);
        }
コード例 #10
0
ファイル: ProcessManager.cs プロジェクト: ABCo-Src/AppCore
        internal static void StartMessageLoop()
        {
            if (MessageLoopRunning)
            {
                ABSLog.ThrowError("An attempt to made to start a message loop while one was already running!");
            }
            MessageLoopRunning = true;

            Task.Run(async() =>
            {
                while (true)
                {
                    // Run immediate processes.
                    while (ImmediateProcesses.TryPeek(out Process immediateProcess))
                    {
                        immediateProcess.ProcessIsRunning = true;
                        await immediateProcess.ExecuteAsync();
                        ImmediateProcesses.TryDequeue(out _);
                    }

                    // Run background processes.
                    if (BackgroundProcesses.TryPeek(out Process backgroundProcess))
                    {
                        backgroundProcess.ProcessIsRunning = true;
                        await backgroundProcess.ExecuteAsync();
                        BackgroundProcesses.TryDequeue(out _);
                    }
                    else
                    {
                        StopProcessing?.Invoke(null, null);

                        waitForNext.Wait();

                        if (!MessageLoopRunning)
                        {
                            return;
                        }

                        waitForNext.Reset();

                        StartProcessing?.Invoke(null, null);
                    }
                }
            });
        }