diff --git a/.gitignore b/.gitignore index 67687b3..dcaa468 100644 --- a/.gitignore +++ b/.gitignore @@ -116,3 +116,5 @@ nsis/* /KattekerCreator/contrib/AppStub.exe /KattekerCreator/contrib/AppStub.exe.config /.idea +/app-stub/target +/nupkg diff --git a/AppStub/App.config b/AppStub/App.config deleted file mode 100644 index 8e15646..0000000 --- a/AppStub/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/AppStub/AppStub.csproj b/AppStub/AppStub.csproj deleted file mode 100644 index 7b80d38..0000000 --- a/AppStub/AppStub.csproj +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - Debug - AnyCPU - {E746AE0F-BEEA-4C18-9ED8-2E708ED00A5B} - WinExe - AppStub - AppStub - v4.5.2 - 512 - - - - - AnyCPU - true - full - false - ..\KattekerCreator\contrib\ - DEBUG;TRACE - prompt - 4 - latest - - - AnyCPU - pdbonly - true - ..\KattekerCreator\contrib\ - TRACE - prompt - 4 - latest - - - - - - - - - - - - - SemVersion.cs - - - - - - - - - - - - Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". - - - - \ No newline at end of file diff --git a/AppStub/Program.cs b/AppStub/Program.cs deleted file mode 100644 index 02b2439..0000000 --- a/AppStub/Program.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Reflection; -using System.Windows.Forms; -using Semver; - -namespace AppStub -{ - internal static class Program - { - [STAThread] - private static void Main(string[] args) - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - - try - { - var commandline = string.Join(" ", args); - var location = new FileInfo(Assembly.GetExecutingAssembly().Location); - var directory = location.Directory; - if (directory == null) return; - var files = directory.EnumerateFiles(location.Name, SearchOption.AllDirectories) - .Where(x => x.Directory?.Name.StartsWith("app-") == true); - - var entries = new SortedList(); - - foreach (var file in files) - { - var version = SemVersion.TryParse(file.Directory?.Name.Replace("app-", ""), out var value) - ? value - : new SemVersion(0); - entries.Add(version, file); - } - - var latestVersion = entries.LastOrDefault().Value; - if (latestVersion == null) throw new FileNotFoundException(); - DeleteOldVersionDirectories(entries.Where(x => x.Value != latestVersion)); - using (var process = new Process()) - { - process.StartInfo = - new ProcessStartInfo(latestVersion.FullName) - { - Arguments = commandline, - WorkingDirectory = latestVersion.DirectoryName ?? Assembly.GetExecutingAssembly().Location, - UseShellExecute = false - }; - process.Start(); - process.WaitForExit(); - } - } - catch (Exception e) - { - MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private static void DeleteOldVersionDirectories(IEnumerable> dirEntries) - { - if (Debugger.IsAttached) return; - foreach (var directoryInfo in dirEntries) - { - try - { - directoryInfo.Value.Directory?.Delete(true); - } - catch - { - // silently ignore - } - } - } - } -} \ No newline at end of file diff --git a/AppStub/Properties/AssemblyInfo.cs b/AppStub/Properties/AssemblyInfo.cs deleted file mode 100644 index 30a0dee..0000000 --- a/AppStub/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// Allgemeine Informationen über eine Assembly werden über die folgenden -// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, -// die einer Assembly zugeordnet sind. -[assembly: AssemblyTitle("AppStub")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("AppStub")] -[assembly: AssemblyCopyright("Copyright © 2018")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly -// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von -// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. -[assembly: ComVisible(false)] - -// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird -[assembly: Guid("e746ae0f-beea-4c18-9ed8-2e708ed00a5b")] - -// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: -// -// Hauptversion -// Nebenversion -// Buildnummer -// Revision -// -// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, -// übernehmen, indem Sie "*" eingeben: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/AppStub/packages.config b/AppStub/packages.config deleted file mode 100644 index 71f1798..0000000 --- a/AppStub/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/AppStubEx/App.config b/AppStubEx/App.config deleted file mode 100644 index e707b32..0000000 --- a/AppStubEx/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/AppStubEx/AppEntry.cs b/AppStubEx/AppEntry.cs deleted file mode 100644 index cb51529..0000000 --- a/AppStubEx/AppEntry.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.IO; - -namespace Katteker.AppStub -{ - public class AppEntry : IComparable - { - public AppEntry(DirectoryInfo info) - { - DirInfo = info; - Version = SemanticVersion.Parse(info.Name.Replace("app-", "")); - } - - public SemanticVersion Version { get; } - public DirectoryInfo DirInfo { get; } - - public int CompareTo(AppEntry other) => Version.CompareTo(other.Version); - } -} \ No newline at end of file diff --git a/AppStubEx/AppStubEx.csproj b/AppStubEx/AppStubEx.csproj deleted file mode 100644 index f947275..0000000 --- a/AppStubEx/AppStubEx.csproj +++ /dev/null @@ -1,70 +0,0 @@ - - - - - Debug - AnyCPU - {AF7579CC-C0B2-4E5A-B052-00D2991DC715} - WinExe - Katteker.AppStubEx - AppStubEx - v4.5 - 512 - - - - AnyCPU - true - full - false - ..\bin\Debug\ - DEBUG;TRACE - prompt - 4 - true - - - AnyCPU - pdbonly - true - ..\bin\Release\ - TRACE - prompt - 4 - true - - - - - - - - - - - - - - - - - Form - - - InstallerUx.cs - - - - - - - - - - - - InstallerUx.cs - - - - \ No newline at end of file diff --git a/AppStubEx/IniFile.cs b/AppStubEx/IniFile.cs deleted file mode 100644 index dc24985..0000000 --- a/AppStubEx/IniFile.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System.IO; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Text; - -namespace Katteker.AppStub -{ - public class IniFile // revision 11 - { - private readonly FileInfo _path; - private readonly string _exe = Assembly.GetExecutingAssembly().GetName().Name; - - [DllImport("kernel32", CharSet = CharSet.Unicode)] - private static extern long WritePrivateProfileString(string section, string key, string value, string filePath); - - [DllImport("kernel32", CharSet = CharSet.Unicode)] - private static extern int GetPrivateProfileString(string section, string key, string Default, StringBuilder retVal, int size, string filePath); - - public IniFile(string iniPath = null) - { - _path = new FileInfo(iniPath ?? _exe + ".ini"); - } - - public string Read(string key, string section = null) - { - var retVal = new StringBuilder(255); - GetPrivateProfileString(section ?? _exe, key, "", retVal, 255, _path.FullName); - return retVal.ToString(); - } - - public void Write(string key, string value, string section = null) - { - WritePrivateProfileString(section ?? _exe, key, value, _path.FullName); - } - - public void DeleteKey(string key, string section = null) - { - Write(key, null, section ?? _exe); - } - - public void DeleteSection(string section = null) - { - Write(null, null, section ?? _exe); - } - - public bool Exists => _path.Exists; - - public bool KeyExists(string key, string section = null) => Read(key, section).Length > 0; - } -} \ No newline at end of file diff --git a/AppStubEx/InstallerUx.cs b/AppStubEx/InstallerUx.cs deleted file mode 100644 index 6bf8986..0000000 --- a/AppStubEx/InstallerUx.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; - -namespace Katteker.AppStub -{ - public sealed partial class InstallerUx : Form - { - private int _autoCloseCountdown = 10; - - public InstallerUx(string appName) - { - Font = SystemFonts.MessageBoxFont; - InitializeComponent(); - SetLocationAndShow(); - this.appName.Text = appName; - } - - private void SetLocationAndShow() - { - var taskBar = new Taskbar(); - switch (taskBar.Position) - { - case TaskbarPosition.Unknown: - break; - case TaskbarPosition.Left: - Location = new Point(taskBar.Bounds.Left + taskBar.Bounds.Width, taskBar.Bounds.Bottom - Size.Height); - break; - case TaskbarPosition.Top: - Location = new Point(taskBar.Bounds.Right - Size.Width, taskBar.Bounds.Bottom); - break; - case TaskbarPosition.Right: - Location = new Point(taskBar.Bounds.Left - Size.Width, taskBar.Bounds.Bottom - Size.Height); - break; - case TaskbarPosition.Bottom: - Location = new Point(taskBar.Bounds.Right - Size.Width, taskBar.Bounds.Top - Size.Height); - break; - default: - break; - } - Show(); - } - - private void closeBtn_Click(object sender, EventArgs e) - { - Close(); - } - - private void installBtn_Click(object sender, EventArgs e) - { - _autoCloseCountdown = 0; - MessageBox.Show("Hallo Welt"); - } - - private void autoCloseTimer_Tick(object sender, EventArgs e) - { - switch (_autoCloseCountdown) - { - case 1: - Close(); - break; - case 0: - countDownLbl.Text = string.Empty; - autoCloseTimer.Enabled = false; - break; - default: - countDownLbl.Tag = --_autoCloseCountdown; - countDownLbl.Text = _autoCloseCountdown.ToString(); - break; - } - } - } -} \ No newline at end of file diff --git a/AppStubEx/InstallerUx.designer.cs b/AppStubEx/InstallerUx.designer.cs deleted file mode 100644 index e47e9a4..0000000 --- a/AppStubEx/InstallerUx.designer.cs +++ /dev/null @@ -1,149 +0,0 @@ -namespace Katteker.AppStub -{ - sealed partial class InstallerUx - { - /// - /// Erforderliche Designervariable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Verwendete Ressourcen bereinigen. - /// - /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Vom Windows Form-Designer generierter Code - - /// - /// Erforderliche Methode für die Designerunterstützung. - /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.closeBtn = new System.Windows.Forms.Button(); - this.installBtn = new System.Windows.Forms.Button(); - this.messageLbl = new System.Windows.Forms.Label(); - this.appName = new System.Windows.Forms.Label(); - this.countDownLbl = new System.Windows.Forms.Label(); - this.autoCloseTimer = new System.Windows.Forms.Timer(this.components); - this.SuspendLayout(); - // - // closeBtn - // - this.closeBtn.AutoSize = true; - this.closeBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.closeBtn.FlatAppearance.BorderSize = 0; - this.closeBtn.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(122)))), ((int)(((byte)(204))))); - this.closeBtn.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(65))))); - this.closeBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.closeBtn.Font = new System.Drawing.Font("Marlett", 10F); - this.closeBtn.Location = new System.Drawing.Point(249, 0); - this.closeBtn.Margin = new System.Windows.Forms.Padding(0); - this.closeBtn.Name = "closeBtn"; - this.closeBtn.Size = new System.Drawing.Size(31, 26); - this.closeBtn.TabIndex = 1; - this.closeBtn.TabStop = false; - this.closeBtn.Text = "r"; - this.closeBtn.UseVisualStyleBackColor = true; - this.closeBtn.Click += new System.EventHandler(this.closeBtn_Click); - // - // installBtn - // - this.installBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.installBtn.FlatAppearance.BorderSize = 0; - this.installBtn.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(122)))), ((int)(((byte)(204))))); - this.installBtn.FlatAppearance.MouseOverBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(63)))), ((int)(((byte)(65))))); - this.installBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.installBtn.Location = new System.Drawing.Point(192, 59); - this.installBtn.Margin = new System.Windows.Forms.Padding(0); - this.installBtn.Name = "installBtn"; - this.installBtn.Size = new System.Drawing.Size(77, 30); - this.installBtn.TabIndex = 2; - this.installBtn.TabStop = false; - this.installBtn.Text = "Install"; - this.installBtn.UseVisualStyleBackColor = true; - this.installBtn.Click += new System.EventHandler(this.installBtn_Click); - // - // messageLbl - // - this.messageLbl.AutoSize = true; - this.messageLbl.Location = new System.Drawing.Point(11, 68); - this.messageLbl.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); - this.messageLbl.Name = "messageLbl"; - this.messageLbl.Size = new System.Drawing.Size(93, 13); - this.messageLbl.TabIndex = 3; - this.messageLbl.Text = "Upgrade available"; - // - // appName - // - this.appName.AutoSize = true; - this.appName.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.appName.Location = new System.Drawing.Point(13, 13); - this.appName.Name = "appName"; - this.appName.Size = new System.Drawing.Size(80, 20); - this.appName.TabIndex = 4; - this.appName.Text = "AppName"; - // - // countDownLbl - // - this.countDownLbl.AutoSize = true; - this.countDownLbl.BackColor = System.Drawing.Color.Transparent; - this.countDownLbl.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.countDownLbl.ForeColor = System.Drawing.SystemColors.ControlDark; - this.countDownLbl.Location = new System.Drawing.Point(229, 5); - this.countDownLbl.Name = "countDownLbl"; - this.countDownLbl.Size = new System.Drawing.Size(24, 17); - this.countDownLbl.TabIndex = 5; - this.countDownLbl.Tag = 10; - this.countDownLbl.Text = "10"; - this.countDownLbl.TextAlign = System.Drawing.ContentAlignment.TopRight; - // - // autoCloseTimer - // - this.autoCloseTimer.Enabled = true; - this.autoCloseTimer.Interval = 1000; - this.autoCloseTimer.Tick += new System.EventHandler(this.autoCloseTimer_Tick); - // - // InstallerUx - // - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(45)))), ((int)(((byte)(45)))), ((int)(((byte)(48))))); - this.ClientSize = new System.Drawing.Size(278, 98); - this.ControlBox = false; - this.Controls.Add(this.countDownLbl); - this.Controls.Add(this.appName); - this.Controls.Add(this.messageLbl); - this.Controls.Add(this.installBtn); - this.Controls.Add(this.closeBtn); - this.ForeColor = System.Drawing.SystemColors.Control; - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; - this.Location = new System.Drawing.Point(30, 0); - this.Name = "InstallerUx"; - this.ShowIcon = false; - this.ShowInTaskbar = false; - this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; - this.TopMost = true; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - private System.Windows.Forms.Button closeBtn; - private System.Windows.Forms.Button installBtn; - private System.Windows.Forms.Label messageLbl; - private System.Windows.Forms.Label appName; - private System.Windows.Forms.Label countDownLbl; - private System.Windows.Forms.Timer autoCloseTimer; - } -} - diff --git a/AppStubEx/InstallerUx.resx b/AppStubEx/InstallerUx.resx deleted file mode 100644 index 22570e0..0000000 --- a/AppStubEx/InstallerUx.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 167, 17 - - - 87 - - \ No newline at end of file diff --git a/AppStubEx/Program.cs b/AppStubEx/Program.cs deleted file mode 100644 index f2c6178..0000000 --- a/AppStubEx/Program.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Katteker.AppStub -{ - internal class Program - { - private Program() - { - CurrentDir = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory); - ConfigFile = new IniFile(Path.Combine(CurrentDir.FullName, "app.ini")); - } - - private DirectoryInfo CurrentDir { get; } - - private IniFile ConfigFile { get; } - - private Process MainProcess { get; set; } - - [STAThread] - private static void Main(string[] args) - { - Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); - var p = new Program(); - p.Run(args); - } - - private void Run(string[] args) - { - StartExecutable(args); - StartUpdateInfo(); - } - - private static void StartUpdateInfo() - { - Application.Run(new InstallerUx("TestProgramm")); - } - - private void StartExecutable(string[] args) - { - var dirEntries = CurrentDir.EnumerateDirectories().Where(x => x.Name.StartsWith("app-")) - .Select(x => new AppEntry(x)).ToList(); - - var latestVersion = dirEntries.OrderByDescending(x => x).FirstOrDefault(); - - if (latestVersion != null && ConfigFile.Exists) - { - try - { - var executable = ConfigFile.Read("Executable", "Main"); - - var a = args.Aggregate(string.Empty, (current, s) => current + s + " ").TrimEnd(' '); - MainProcess = new Process - { - StartInfo = - new ProcessStartInfo($"{latestVersion.DirInfo.FullName}\\{executable}") - { - Arguments = a, - WorkingDirectory = latestVersion.DirInfo.FullName, - UseShellExecute = false - } - }; - MainProcess.Start(); - Task.Run(() => - DeleteOldVersionDirectories(dirEntries.Where(x => - x.DirInfo.Name != latestVersion.DirInfo.Name))); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - else - { - MessageBox.Show("Error, File not found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - - private static void DeleteOldVersionDirectories(IEnumerable dirEntries) - { -#if !DEBUG - foreach (var directoryInfo in dirEntries) - { - try - { - directoryInfo.DirInfo.Delete(true); - } - catch (Exception) - { - // silently ignore - } - } -#endif - } - } -} \ No newline at end of file diff --git a/AppStubEx/Properties/AssemblyInfo.cs b/AppStubEx/Properties/AssemblyInfo.cs deleted file mode 100644 index 4670df4..0000000 --- a/AppStubEx/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// Allgemeine Informationen über eine Assembly werden über die folgenden -// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, -// die einer Assembly zugeordnet sind. -//[assembly: AssemblyTitle("AppStub")] -//[assembly: AssemblyDescription("")] -//[assembly: AssemblyConfiguration("")] -//[assembly: AssemblyCompany("")] -//[assembly: AssemblyProduct("AppStub")] -//[assembly: AssemblyCopyright("Copyright © 2016")] -//[assembly: AssemblyTrademark("")] -//[assembly: AssemblyCulture("")] - -// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly -// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von -// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. -[assembly: ComVisible(false)] - -// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird -[assembly: Guid("af7579cc-c0b2-4e5a-b052-00d2991dc715")] -[assembly: AssemblyTitle("Katteker.AppStubEx")] -[assembly: AssemblyDescription("Katteker.AppStubEx")] -[assembly: AssemblyCompany("Holger Börchers")] -[assembly: AssemblyProduct("Katteker.AppStubEx")] -[assembly: AssemblyCopyright("Holger Börchers")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] - -// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: -// -// Hauptversion -// Nebenversion -// Buildnummer -// Revision -// -// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden. -// übernehmen, indem Sie "*" eingeben: -// [assembly: AssemblyVersion("1.0.*")] -//[assembly: AssemblyVersion("1.0.0.0")] -//[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/AppStubEx/Taskbar.cs b/AppStubEx/Taskbar.cs deleted file mode 100644 index 8696f9c..0000000 --- a/AppStubEx/Taskbar.cs +++ /dev/null @@ -1,117 +0,0 @@ -using System; -using System.Drawing; -using System.Runtime.InteropServices; - -namespace Katteker.AppStub -{ - public enum TaskbarPosition - { - Unknown = -1, - Left, - Top, - Right, - Bottom - } - - public sealed class Taskbar - { - private const string ClassName = "Shell_TrayWnd"; - - public Taskbar() - { - var taskbarHandle = User32.FindWindow(ClassName, null); - - var data = new APPBARDATA - { - cbSize = (uint) Marshal.SizeOf(typeof(APPBARDATA)), - hWnd = taskbarHandle - }; - var result = Shell32.SHAppBarMessage(ABM.GetTaskbarPos, ref data); - if (result == IntPtr.Zero) - throw new InvalidOperationException(); - - Position = (TaskbarPosition) data.uEdge; - Bounds = Rectangle.FromLTRB(data.rc.left, data.rc.top, data.rc.right, data.rc.bottom); - - data.cbSize = (uint) Marshal.SizeOf(typeof(APPBARDATA)); - result = Shell32.SHAppBarMessage(ABM.GetState, ref data); - var state = result.ToInt32(); - AlwaysOnTop = (state & ABS.AlwaysOnTop) == ABS.AlwaysOnTop; - AutoHide = (state & ABS.Autohide) == ABS.Autohide; - } - - public Rectangle Bounds { get; } - - public TaskbarPosition Position { get; private set; } - - public Point Location => Bounds.Location; - - public Size Size => Bounds.Size; - - //Always returns false under Windows 7 - public bool AlwaysOnTop { get; private set; } - - public bool AutoHide { get; private set; } - } - - public enum ABM : uint - { - New = 0x00000000, - Remove = 0x00000001, - QueryPos = 0x00000002, - SetPos = 0x00000003, - GetState = 0x00000004, - GetTaskbarPos = 0x00000005, - Activate = 0x00000006, - GetAutoHideBar = 0x00000007, - SetAutoHideBar = 0x00000008, - WindowPosChanged = 0x00000009, - SetState = 0x0000000A - } - - public enum ABE : uint - { - Left = 0, - Top = 1, - Right = 2, - Bottom = 3 - } - - public static class ABS - { - public const int Autohide = 0x0000001; - public const int AlwaysOnTop = 0x0000002; - } - - public static class Shell32 - { - [DllImport("shell32.dll", SetLastError = true)] - public static extern IntPtr SHAppBarMessage(ABM dwMessage, [In] ref APPBARDATA pData); - } - - public static class User32 - { - [DllImport("user32.dll", SetLastError = true)] - public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); - } - - [StructLayout(LayoutKind.Sequential)] - public struct APPBARDATA - { - public uint cbSize; - public IntPtr hWnd; - public uint uCallbackMessage; - public ABE uEdge; - public RECT rc; - public int lParam; - } - - [StructLayout(LayoutKind.Sequential)] - public struct RECT - { - public int left; - public int top; - public int right; - public int bottom; - } -} \ No newline at end of file diff --git a/Example/Annotations.cs b/Example/Annotations.cs deleted file mode 100644 index 667e482..0000000 --- a/Example/Annotations.cs +++ /dev/null @@ -1,1066 +0,0 @@ -/* MIT License - -Copyright (c) 2016 JetBrains http://www.jetbrains.com - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. */ - -using System; - -#pragma warning disable 1591 -// ReSharper disable UnusedMember.Global -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable UnusedAutoPropertyAccessor.Global -// ReSharper disable IntroduceOptionalParameters.Global -// ReSharper disable MemberCanBeProtected.Global -// ReSharper disable InconsistentNaming -// ReSharper disable once CheckNamespace - -namespace JetBrains.Annotations -{ - /// - /// Indicates that the value of the marked element could be null sometimes, - /// so the check for null is necessary before its usage. - /// - /// - /// [CanBeNull] object Test() => null; - /// - /// void UseTest() { - /// var p = Test(); - /// var s = p.ToString(); // Warning: Possible 'System.NullReferenceException' - /// } - /// - [AttributeUsage( - AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | - AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | - AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] -internal sealed class CanBeNullAttribute : Attribute { } - - /// - /// Indicates that the value of the marked element could never be null. - /// - /// - /// [NotNull] object Foo() { - /// return null; // Warning: Possible 'null' assignment - /// } - /// - [AttributeUsage( - AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | - AttributeTargets.Delegate | AttributeTargets.Field | AttributeTargets.Event | - AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.GenericParameter)] -internal sealed class NotNullAttribute : Attribute { } - - /// - /// Can be appplied to symbols of types derived from IEnumerable as well as to symbols of Task - /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property - /// or of the Lazy.Value property can never be null. - /// - [AttributeUsage( - AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | - AttributeTargets.Delegate | AttributeTargets.Field)] -internal sealed class ItemNotNullAttribute : Attribute { } - - /// - /// Can be appplied to symbols of types derived from IEnumerable as well as to symbols of Task - /// and Lazy classes to indicate that the value of a collection item, of the Task.Result property - /// or of the Lazy.Value property can be null. - /// - [AttributeUsage( - AttributeTargets.Method | AttributeTargets.Parameter | AttributeTargets.Property | - AttributeTargets.Delegate | AttributeTargets.Field)] -internal sealed class ItemCanBeNullAttribute : Attribute { } - - /// - /// Indicates that the marked method builds string by format pattern and (optional) arguments. - /// Parameter, which contains format string, should be given in constructor. The format string - /// should be in -like form. - /// - /// - /// [StringFormatMethod("message")] - /// void ShowError(string message, params object[] args) { /* do something */ } - /// - /// void Foo() { - /// ShowError("Failed: {0}"); // Warning: Non-existing argument in format string - /// } - /// - [AttributeUsage( - AttributeTargets.Constructor | AttributeTargets.Method | - AttributeTargets.Property | AttributeTargets.Delegate)] -internal sealed class StringFormatMethodAttribute : Attribute - { - /// - /// Specifies which parameter of an annotated method should be treated as format-string - /// - public StringFormatMethodAttribute([NotNull] string formatParameterName) - { - FormatParameterName = formatParameterName; - } - - [NotNull] public string FormatParameterName { get; private set; } - } - - /// - /// For a parameter that is expected to be one of the limited set of values. - /// Specify fields of which type should be used as values for this parameter. - /// - [AttributeUsage( - AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field, - AllowMultiple = true)] -internal sealed class ValueProviderAttribute : Attribute - { - public ValueProviderAttribute([NotNull] string name) - { - Name = name; - } - - [NotNull] public string Name { get; private set; } - } - - /// - /// Indicates that the function argument should be string literal and match one - /// of the parameters of the caller function. For example, ReSharper annotates - /// the parameter of . - /// - /// - /// void Foo(string param) { - /// if (param == null) - /// throw new ArgumentNullException("par"); // Warning: Cannot resolve symbol - /// } - /// - [AttributeUsage(AttributeTargets.Parameter)] -internal sealed class InvokerParameterNameAttribute : Attribute { } - - /// - /// Indicates that the method is contained in a type that implements - /// System.ComponentModel.INotifyPropertyChanged interface and this method - /// is used to notify that some property value changed. - /// - /// - /// The method should be non-static and conform to one of the supported signatures: - /// - /// NotifyChanged(string) - /// NotifyChanged(params string[]) - /// NotifyChanged{T}(Expression{Func{T}}) - /// NotifyChanged{T,U}(Expression{Func{T,U}}) - /// SetProperty{T}(ref T, T, string) - /// - /// - /// - /// public class Foo : INotifyPropertyChanged { - /// public event PropertyChangedEventHandler PropertyChanged; - /// - /// [NotifyPropertyChangedInvocator] - /// protected virtual void NotifyChanged(string propertyName) { ... } - /// - /// string _name; - /// - /// public string Name { - /// get { return _name; } - /// set { _name = value; NotifyChanged("LastName"); /* Warning */ } - /// } - /// } - /// - /// Examples of generated notifications: - /// - /// NotifyChanged("Property") - /// NotifyChanged(() => Property) - /// NotifyChanged((VM x) => x.Property) - /// SetProperty(ref myField, value, "Property") - /// - /// - [AttributeUsage(AttributeTargets.Method)] -internal sealed class NotifyPropertyChangedInvocatorAttribute : Attribute - { - public NotifyPropertyChangedInvocatorAttribute() { } - public NotifyPropertyChangedInvocatorAttribute([NotNull] string parameterName) - { - ParameterName = parameterName; - } - - [CanBeNull] public string ParameterName { get; private set; } - } - - /// - /// Describes dependency between method input and output. - /// - /// - ///

Function Definition Table syntax:

- /// - /// FDT ::= FDTRow [;FDTRow]* - /// FDTRow ::= Input => Output | Output <= Input - /// Input ::= ParameterName: Value [, Input]* - /// Output ::= [ParameterName: Value]* {halt|stop|void|nothing|Value} - /// Value ::= true | false | null | notnull | canbenull - /// - /// If method has single input parameter, it's name could be omitted.
- /// Using halt (or void/nothing, which is the same) for method output - /// means that the methos doesn't return normally (throws or terminates the process).
- /// Value canbenull is only applicable for output parameters.
- /// You can use multiple [ContractAnnotation] for each FDT row, or use single attribute - /// with rows separated by semicolon. There is no notion of order rows, all rows are checked - /// for applicability and applied per each program state tracked by R# analysis.
- ///
- /// - /// - /// [ContractAnnotation("=> halt")] - /// public void TerminationMethod() - /// - /// - /// [ContractAnnotation("halt <= condition: false")] - /// public void Assert(bool condition, string text) // regular assertion method - /// - /// - /// [ContractAnnotation("s:null => true")] - /// public bool IsNullOrEmpty(string s) // string.IsNullOrEmpty() - /// - /// - /// // A method that returns null if the parameter is null, - /// // and not null if the parameter is not null - /// [ContractAnnotation("null => null; notnull => notnull")] - /// public object Transform(object data) - /// - /// - /// [ContractAnnotation("=> true, result: notnull; => false, result: null")] - /// public bool TryParse(string s, out Person result) - /// - /// - [AttributeUsage(AttributeTargets.Method, AllowMultiple = true)] -internal sealed class ContractAnnotationAttribute : Attribute - { - public ContractAnnotationAttribute([NotNull] string contract) - : this(contract, false) { } - - public ContractAnnotationAttribute([NotNull] string contract, bool forceFullStates) - { - Contract = contract; - ForceFullStates = forceFullStates; - } - - [NotNull] public string Contract { get; private set; } - - public bool ForceFullStates { get; private set; } - } - - /// - /// Indicates that marked element should be localized or not. - /// - /// - /// [LocalizationRequiredAttribute(true)] - /// class Foo { - /// string str = "my string"; // Warning: Localizable string - /// } - /// - [AttributeUsage(AttributeTargets.All)] -internal sealed class LocalizationRequiredAttribute : Attribute - { - public LocalizationRequiredAttribute() : this(true) { } - - public LocalizationRequiredAttribute(bool required) - { - Required = required; - } - - public bool Required { get; private set; } - } - - /// - /// Indicates that the value of the marked type (or its derivatives) - /// cannot be compared using '==' or '!=' operators and Equals() - /// should be used instead. However, using '==' or '!=' for comparison - /// with null is always permitted. - /// - /// - /// [CannotApplyEqualityOperator] - /// class NoEquality { } - /// - /// class UsesNoEquality { - /// void Test() { - /// var ca1 = new NoEquality(); - /// var ca2 = new NoEquality(); - /// if (ca1 != null) { // OK - /// bool condition = ca1 == ca2; // Warning - /// } - /// } - /// } - /// - [AttributeUsage(AttributeTargets.Interface | AttributeTargets.Class | AttributeTargets.Struct)] -internal sealed class CannotApplyEqualityOperatorAttribute : Attribute { } - - /// - /// When applied to a target attribute, specifies a requirement for any type marked - /// with the target attribute to implement or inherit specific type or types. - /// - /// - /// [BaseTypeRequired(typeof(IComponent)] // Specify requirement - /// class ComponentAttribute : Attribute { } - /// - /// [Component] // ComponentAttribute requires implementing IComponent interface - /// class MyComponent : IComponent { } - /// - [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] - [BaseTypeRequired(typeof(Attribute))] -internal sealed class BaseTypeRequiredAttribute : Attribute - { - public BaseTypeRequiredAttribute([NotNull] Type baseType) - { - BaseType = baseType; - } - - [NotNull] public Type BaseType { get; private set; } - } - - /// - /// Indicates that the marked symbol is used implicitly (e.g. via reflection, in external library), - /// so this symbol will not be marked as unused (as well as by other usage inspections). - /// - [AttributeUsage(AttributeTargets.All)] -internal sealed class UsedImplicitlyAttribute : Attribute - { - public UsedImplicitlyAttribute() - : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { } - - public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags) - : this(useKindFlags, ImplicitUseTargetFlags.Default) { } - - public UsedImplicitlyAttribute(ImplicitUseTargetFlags targetFlags) - : this(ImplicitUseKindFlags.Default, targetFlags) { } - - public UsedImplicitlyAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) - { - UseKindFlags = useKindFlags; - TargetFlags = targetFlags; - } - - public ImplicitUseKindFlags UseKindFlags { get; private set; } - - public ImplicitUseTargetFlags TargetFlags { get; private set; } - } - - /// - /// Should be used on attributes and causes ReSharper to not mark symbols marked with such attributes - /// as unused (as well as by other usage inspections) - /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.GenericParameter)] -internal sealed class MeansImplicitUseAttribute : Attribute - { - public MeansImplicitUseAttribute() - : this(ImplicitUseKindFlags.Default, ImplicitUseTargetFlags.Default) { } - - public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags) - : this(useKindFlags, ImplicitUseTargetFlags.Default) { } - - public MeansImplicitUseAttribute(ImplicitUseTargetFlags targetFlags) - : this(ImplicitUseKindFlags.Default, targetFlags) { } - - public MeansImplicitUseAttribute(ImplicitUseKindFlags useKindFlags, ImplicitUseTargetFlags targetFlags) - { - UseKindFlags = useKindFlags; - TargetFlags = targetFlags; - } - - [UsedImplicitly] public ImplicitUseKindFlags UseKindFlags { get; private set; } - - [UsedImplicitly] public ImplicitUseTargetFlags TargetFlags { get; private set; } - } - - [Flags] -internal enum ImplicitUseKindFlags - { - Default = Access | Assign | InstantiatedWithFixedConstructorSignature, - /// Only entity marked with attribute considered used. - Access = 1, - /// Indicates implicit assignment to a member. - Assign = 2, - /// - /// Indicates implicit instantiation of a type with fixed constructor signature. - /// That means any unused constructor parameters won't be reported as such. - /// - InstantiatedWithFixedConstructorSignature = 4, - /// Indicates implicit instantiation of a type. - InstantiatedNoFixedConstructorSignature = 8, - } - - /// - /// Specify what is considered used implicitly when marked - /// with or . - /// - [Flags] -internal enum ImplicitUseTargetFlags - { - Default = Itself, - Itself = 1, - /// Members of entity marked with attribute are considered used. - Members = 2, - /// Entity marked with attribute and all its members considered used. - WithMembers = Itself | Members - } - - /// - /// This attribute is intended to mark publicly available API - /// which should not be removed and so is treated as used. - /// - [MeansImplicitUse(ImplicitUseTargetFlags.WithMembers)] -internal sealed class PublicAPIAttribute : Attribute - { - public PublicAPIAttribute() { } - - public PublicAPIAttribute([NotNull] string comment) - { - Comment = comment; - } - - [CanBeNull] public string Comment { get; private set; } - } - - /// - /// Tells code analysis engine if the parameter is completely handled when the invoked method is on stack. - /// If the parameter is a delegate, indicates that delegate is executed while the method is executed. - /// If the parameter is an enumerable, indicates that it is enumerated while the method is executed. - /// - [AttributeUsage(AttributeTargets.Parameter)] -internal sealed class InstantHandleAttribute : Attribute { } - - /// - /// Indicates that a method does not make any observable state changes. - /// The same as System.Diagnostics.Contracts.PureAttribute. - /// - /// - /// [Pure] int Multiply(int x, int y) => x * y; - /// - /// void M() { - /// Multiply(123, 42); // Waring: Return value of pure method is not used - /// } - /// - [AttributeUsage(AttributeTargets.Method)] -internal sealed class PureAttribute : Attribute { } - - /// - /// Indicates that the return value of method invocation must be used. - /// - [AttributeUsage(AttributeTargets.Method)] -internal sealed class MustUseReturnValueAttribute : Attribute - { - public MustUseReturnValueAttribute() { } - - public MustUseReturnValueAttribute([NotNull] string justification) - { - Justification = justification; - } - - [CanBeNull] public string Justification { get; private set; } - } - - /// - /// Indicates the type member or parameter of some type, that should be used instead of all other ways - /// to get the value that type. This annotation is useful when you have some "context" value evaluated - /// and stored somewhere, meaning that all other ways to get this value must be consolidated with existing one. - /// - /// - /// class Foo { - /// [ProvidesContext] IBarService _barService = ...; - /// - /// void ProcessNode(INode node) { - /// DoSomething(node, node.GetGlobalServices().Bar); - /// // ^ Warning: use value of '_barService' field - /// } - /// } - /// - [AttributeUsage( - AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.Method | - AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.GenericParameter)] -internal sealed class ProvidesContextAttribute : Attribute { } - - /// - /// Indicates that a parameter is a path to a file or a folder within a web project. - /// Path can be relative or absolute, starting from web root (~). - /// - [AttributeUsage(AttributeTargets.Parameter)] -internal sealed class PathReferenceAttribute : Attribute - { - public PathReferenceAttribute() { } - - public PathReferenceAttribute([NotNull, PathReference] string basePath) - { - BasePath = basePath; - } - - [CanBeNull] public string BasePath { get; private set; } - } - - /// - /// An extension method marked with this attribute is processed by ReSharper code completion - /// as a 'Source Template'. When extension method is completed over some expression, it's source code - /// is automatically expanded like a template at call site. - /// - /// - /// Template method body can contain valid source code and/or special comments starting with '$'. - /// Text inside these comments is added as source code when the template is applied. Template parameters - /// can be used either as additional method parameters or as identifiers wrapped in two '$' signs. - /// Use the attribute to specify macros for parameters. - /// - /// - /// In this example, the 'forEach' method is a source template available over all values - /// of enumerable types, producing ordinary C# 'foreach' statement and placing caret inside block: - /// - /// [SourceTemplate] - /// public static void forEach<T>(this IEnumerable<T> xs) { - /// foreach (var x in xs) { - /// //$ $END$ - /// } - /// } - /// - /// - [AttributeUsage(AttributeTargets.Method)] -internal sealed class SourceTemplateAttribute : Attribute { } - - /// - /// Allows specifying a macro for a parameter of a source template. - /// - /// - /// You can apply the attribute on the whole method or on any of its additional parameters. The macro expression - /// is defined in the property. When applied on a method, the target - /// template parameter is defined in the property. To apply the macro silently - /// for the parameter, set the property value = -1. - /// - /// - /// Applying the attribute on a source template method: - /// - /// [SourceTemplate, Macro(Target = "item", Expression = "suggestVariableName()")] - /// public static void forEach<T>(this IEnumerable<T> collection) { - /// foreach (var item in collection) { - /// //$ $END$ - /// } - /// } - /// - /// Applying the attribute on a template method parameter: - /// - /// [SourceTemplate] - /// public static void something(this Entity x, [Macro(Expression = "guid()", Editable = -1)] string newguid) { - /// /*$ var $x$Id = "$newguid$" + x.ToString(); - /// x.DoSomething($x$Id); */ - /// } - /// - /// - [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method, AllowMultiple = true)] -internal sealed class MacroAttribute : Attribute - { - /// - /// Allows specifying a macro that will be executed for a source template - /// parameter when the template is expanded. - /// - [CanBeNull] public string Expression { get; set; } - - /// - /// Allows specifying which occurrence of the target parameter becomes editable when the template is deployed. - /// - /// - /// If the target parameter is used several times in the template, only one occurrence becomes editable; - /// other occurrences are changed synchronously. To specify the zero-based index of the editable occurrence, - /// use values >= 0. To make the parameter non-editable when the template is expanded, use -1. - /// > - public int Editable { get; set; } - - /// - /// Identifies the target parameter of a source template if the - /// is applied on a template method. - /// - [CanBeNull] public string Target { get; set; } - } - - [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] -internal sealed class AspMvcAreaMasterLocationFormatAttribute : Attribute - { - public AspMvcAreaMasterLocationFormatAttribute([NotNull] string format) - { - Format = format; - } - - [NotNull] public string Format { get; private set; } - } - - [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] -internal sealed class AspMvcAreaPartialViewLocationFormatAttribute : Attribute - { - public AspMvcAreaPartialViewLocationFormatAttribute([NotNull] string format) - { - Format = format; - } - - [NotNull] public string Format { get; private set; } - } - - [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] -internal sealed class AspMvcAreaViewLocationFormatAttribute : Attribute - { - public AspMvcAreaViewLocationFormatAttribute([NotNull] string format) - { - Format = format; - } - - [NotNull] public string Format { get; private set; } - } - - [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] -internal sealed class AspMvcMasterLocationFormatAttribute : Attribute - { - public AspMvcMasterLocationFormatAttribute([NotNull] string format) - { - Format = format; - } - - [NotNull] public string Format { get; private set; } - } - - [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] -internal sealed class AspMvcPartialViewLocationFormatAttribute : Attribute - { - public AspMvcPartialViewLocationFormatAttribute([NotNull] string format) - { - Format = format; - } - - [NotNull] public string Format { get; private set; } - } - - [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = true)] -internal sealed class AspMvcViewLocationFormatAttribute : Attribute - { - public AspMvcViewLocationFormatAttribute([NotNull] string format) - { - Format = format; - } - - [NotNull] public string Format { get; private set; } - } - - /// - /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter - /// is an MVC action. If applied to a method, the MVC action name is calculated - /// implicitly from the context. Use this attribute for custom wrappers similar to - /// System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String). - /// - [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] -internal sealed class AspMvcActionAttribute : Attribute - { - public AspMvcActionAttribute() { } - - public AspMvcActionAttribute([NotNull] string anonymousProperty) - { - AnonymousProperty = anonymousProperty; - } - - [CanBeNull] public string AnonymousProperty { get; private set; } - } - - /// - /// ASP.NET MVC attribute. Indicates that a parameter is an MVC area. - /// Use this attribute for custom wrappers similar to - /// System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String). - /// - [AttributeUsage(AttributeTargets.Parameter)] -internal sealed class AspMvcAreaAttribute : Attribute - { - public AspMvcAreaAttribute() { } - - public AspMvcAreaAttribute([NotNull] string anonymousProperty) - { - AnonymousProperty = anonymousProperty; - } - - [CanBeNull] public string AnonymousProperty { get; private set; } - } - - /// - /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is - /// an MVC controller. If applied to a method, the MVC controller name is calculated - /// implicitly from the context. Use this attribute for custom wrappers similar to - /// System.Web.Mvc.Html.ChildActionExtensions.RenderAction(HtmlHelper, String, String). - /// - [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] -internal sealed class AspMvcControllerAttribute : Attribute - { - public AspMvcControllerAttribute() { } - - public AspMvcControllerAttribute([NotNull] string anonymousProperty) - { - AnonymousProperty = anonymousProperty; - } - - [CanBeNull] public string AnonymousProperty { get; private set; } - } - - /// - /// ASP.NET MVC attribute. Indicates that a parameter is an MVC Master. Use this attribute - /// for custom wrappers similar to System.Web.Mvc.Controller.View(String, String). - /// - [AttributeUsage(AttributeTargets.Parameter)] -internal sealed class AspMvcMasterAttribute : Attribute { } - - /// - /// ASP.NET MVC attribute. Indicates that a parameter is an MVC model type. Use this attribute - /// for custom wrappers similar to System.Web.Mvc.Controller.View(String, Object). - /// - [AttributeUsage(AttributeTargets.Parameter)] -internal sealed class AspMvcModelTypeAttribute : Attribute { } - - /// - /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter is an MVC - /// partial view. If applied to a method, the MVC partial view name is calculated implicitly - /// from the context. Use this attribute for custom wrappers similar to - /// System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial(HtmlHelper, String). - /// - [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] -internal sealed class AspMvcPartialViewAttribute : Attribute { } - - /// - /// ASP.NET MVC attribute. Allows disabling inspections for MVC views within a class or a method. - /// - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] -internal sealed class AspMvcSuppressViewErrorAttribute : Attribute { } - - /// - /// ASP.NET MVC attribute. Indicates that a parameter is an MVC display template. - /// Use this attribute for custom wrappers similar to - /// System.Web.Mvc.Html.DisplayExtensions.DisplayForModel(HtmlHelper, String). - /// - [AttributeUsage(AttributeTargets.Parameter)] -internal sealed class AspMvcDisplayTemplateAttribute : Attribute { } - - /// - /// ASP.NET MVC attribute. Indicates that a parameter is an MVC editor template. - /// Use this attribute for custom wrappers similar to - /// System.Web.Mvc.Html.EditorExtensions.EditorForModel(HtmlHelper, String). - /// - [AttributeUsage(AttributeTargets.Parameter)] -internal sealed class AspMvcEditorTemplateAttribute : Attribute { } - - /// - /// ASP.NET MVC attribute. Indicates that a parameter is an MVC template. - /// Use this attribute for custom wrappers similar to - /// System.ComponentModel.DataAnnotations.UIHintAttribute(System.String). - /// - [AttributeUsage(AttributeTargets.Parameter)] -internal sealed class AspMvcTemplateAttribute : Attribute { } - - /// - /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter - /// is an MVC view component. If applied to a method, the MVC view name is calculated implicitly - /// from the context. Use this attribute for custom wrappers similar to - /// System.Web.Mvc.Controller.View(Object). - /// - [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] -internal sealed class AspMvcViewAttribute : Attribute { } - - /// - /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter - /// is an MVC view component name. - /// - [AttributeUsage(AttributeTargets.Parameter)] -internal sealed class AspMvcViewComponentAttribute : Attribute { } - - /// - /// ASP.NET MVC attribute. If applied to a parameter, indicates that the parameter - /// is an MVC view component view. If applied to a method, the MVC view component view name is default. - /// - [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] -internal sealed class AspMvcViewComponentViewAttribute : Attribute { } - - /// - /// ASP.NET MVC attribute. When applied to a parameter of an attribute, - /// indicates that this parameter is an MVC action name. - /// - /// - /// [ActionName("Foo")] - /// public ActionResult Login(string returnUrl) { - /// ViewBag.ReturnUrl = Url.Action("Foo"); // OK - /// return RedirectToAction("Bar"); // Error: Cannot resolve action - /// } - /// - [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property)] -internal sealed class AspMvcActionSelectorAttribute : Attribute { } - - [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.Field)] -internal sealed class HtmlElementAttributesAttribute : Attribute - { - public HtmlElementAttributesAttribute() { } - - public HtmlElementAttributesAttribute([NotNull] string name) - { - Name = name; - } - - [CanBeNull] public string Name { get; private set; } - } - - [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Field | AttributeTargets.Property)] -internal sealed class HtmlAttributeValueAttribute : Attribute - { - public HtmlAttributeValueAttribute([NotNull] string name) - { - Name = name; - } - - [NotNull] public string Name { get; private set; } - } - - /// - /// Razor attribute. Indicates that a parameter or a method is a Razor section. - /// Use this attribute for custom wrappers similar to - /// System.Web.WebPages.WebPageBase.RenderSection(String). - /// - [AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Method)] -internal sealed class RazorSectionAttribute : Attribute { } - - /// - /// Indicates how method, constructor invocation or property access - /// over collection type affects content of the collection. - /// - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Property)] -internal sealed class CollectionAccessAttribute : Attribute - { - public CollectionAccessAttribute(CollectionAccessType collectionAccessType) - { - CollectionAccessType = collectionAccessType; - } - - public CollectionAccessType CollectionAccessType { get; private set; } - } - - [Flags] -internal enum CollectionAccessType - { - /// Method does not use or modify content of the collection. - None = 0, - /// Method only reads content of the collection but does not modify it. - Read = 1, - /// Method can change content of the collection but does not add new elements. - ModifyExistingContent = 2, - /// Method can add new elements to the collection. - UpdatedContent = ModifyExistingContent | 4 - } - - /// - /// Indicates that the marked method is assertion method, i.e. it halts control flow if - /// one of the conditions is satisfied. To set the condition, mark one of the parameters with - /// attribute. - /// - [AttributeUsage(AttributeTargets.Method)] -internal sealed class AssertionMethodAttribute : Attribute { } - - /// - /// Indicates the condition parameter of the assertion method. The method itself should be - /// marked by attribute. The mandatory argument of - /// the attribute is the assertion type. - /// - [AttributeUsage(AttributeTargets.Parameter)] -internal sealed class AssertionConditionAttribute : Attribute - { - public AssertionConditionAttribute(AssertionConditionType conditionType) - { - ConditionType = conditionType; - } - - public AssertionConditionType ConditionType { get; private set; } - } - - /// - /// Specifies assertion type. If the assertion method argument satisfies the condition, - /// then the execution continues. Otherwise, execution is assumed to be halted. - /// -internal enum AssertionConditionType - { - /// Marked parameter should be evaluated to true. - IS_TRUE = 0, - /// Marked parameter should be evaluated to false. - IS_FALSE = 1, - /// Marked parameter should be evaluated to null value. - IS_NULL = 2, - /// Marked parameter should be evaluated to not null value. - IS_NOT_NULL = 3, - } - - /// - /// Indicates that the marked method unconditionally terminates control flow execution. - /// For example, it could unconditionally throw exception. - /// - [Obsolete("Use [ContractAnnotation('=> halt')] instead")] - [AttributeUsage(AttributeTargets.Method)] -internal sealed class TerminatesProgramAttribute : Attribute { } - - /// - /// Indicates that method is pure LINQ method, with postponed enumeration (like Enumerable.Select, - /// .Where). This annotation allows inference of [InstantHandle] annotation for parameters - /// of delegate type by analyzing LINQ method chains. - /// - [AttributeUsage(AttributeTargets.Method)] -internal sealed class LinqTunnelAttribute : Attribute { } - - /// - /// Indicates that IEnumerable, passed as parameter, is not enumerated. - /// - [AttributeUsage(AttributeTargets.Parameter)] -internal sealed class NoEnumerationAttribute : Attribute { } - - /// - /// Indicates that parameter is regular expression pattern. - /// - [AttributeUsage(AttributeTargets.Parameter)] -internal sealed class RegexPatternAttribute : Attribute { } - - /// - /// Prevents the Member Reordering feature from tossing members of the marked class. - /// - /// - /// The attribute must be mentioned in your member reordering patterns - /// - [AttributeUsage( - AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum)] -internal sealed class NoReorderAttribute : Attribute { } - - /// - /// XAML attribute. Indicates the type that has ItemsSource property and should be treated - /// as ItemsControl-derived type, to enable inner items DataContext type resolve. - /// - [AttributeUsage(AttributeTargets.Class)] -internal sealed class XamlItemsControlAttribute : Attribute { } - - /// - /// XAML attribute. Indicates the property of some BindingBase-derived type, that - /// is used to bind some item of ItemsControl-derived type. This annotation will - /// enable the DataContext type resolve for XAML bindings for such properties. - /// - /// - /// Property should have the tree ancestor of the ItemsControl type or - /// marked with the attribute. - /// - [AttributeUsage(AttributeTargets.Property)] -internal sealed class XamlItemBindingOfItemsControlAttribute : Attribute { } - - [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] -internal sealed class AspChildControlTypeAttribute : Attribute - { - public AspChildControlTypeAttribute([NotNull] string tagName, [NotNull] Type controlType) - { - TagName = tagName; - ControlType = controlType; - } - - [NotNull] public string TagName { get; private set; } - - [NotNull] public Type ControlType { get; private set; } - } - - [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] -internal sealed class AspDataFieldAttribute : Attribute { } - - [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method)] -internal sealed class AspDataFieldsAttribute : Attribute { } - - [AttributeUsage(AttributeTargets.Property)] -internal sealed class AspMethodPropertyAttribute : Attribute { } - - [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] -internal sealed class AspRequiredAttributeAttribute : Attribute - { - public AspRequiredAttributeAttribute([NotNull] string attribute) - { - Attribute = attribute; - } - - [NotNull] public string Attribute { get; private set; } - } - - [AttributeUsage(AttributeTargets.Property)] -internal sealed class AspTypePropertyAttribute : Attribute - { - public bool CreateConstructorReferences { get; private set; } - - public AspTypePropertyAttribute(bool createConstructorReferences) - { - CreateConstructorReferences = createConstructorReferences; - } - } - - [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] -internal sealed class RazorImportNamespaceAttribute : Attribute - { - public RazorImportNamespaceAttribute([NotNull] string name) - { - Name = name; - } - - [NotNull] public string Name { get; private set; } - } - - [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] -internal sealed class RazorInjectionAttribute : Attribute - { - public RazorInjectionAttribute([NotNull] string type, [NotNull] string fieldName) - { - Type = type; - FieldName = fieldName; - } - - [NotNull] public string Type { get; private set; } - - [NotNull] public string FieldName { get; private set; } - } - - [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] -internal sealed class RazorDirectiveAttribute : Attribute - { - public RazorDirectiveAttribute([NotNull] string directive) - { - Directive = directive; - } - - [NotNull] public string Directive { get; private set; } - } - - [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] -internal sealed class RazorPageBaseTypeAttribute : Attribute - { - public RazorPageBaseTypeAttribute([NotNull] string baseType) - { - BaseType = baseType; - } - public RazorPageBaseTypeAttribute([NotNull] string baseType, string pageName) - { - BaseType = baseType; - PageName = pageName; - } - - [NotNull] public string BaseType { get; private set; } - [CanBeNull] public string PageName { get; private set; } - } - - [AttributeUsage(AttributeTargets.Method)] -internal sealed class RazorHelperCommonAttribute : Attribute { } - - [AttributeUsage(AttributeTargets.Property)] -internal sealed class RazorLayoutAttribute : Attribute { } - - [AttributeUsage(AttributeTargets.Method)] -internal sealed class RazorWriteLiteralMethodAttribute : Attribute { } - - [AttributeUsage(AttributeTargets.Method)] -internal sealed class RazorWriteMethodAttribute : Attribute { } - - [AttributeUsage(AttributeTargets.Parameter)] -internal sealed class RazorWriteMethodParameterAttribute : Attribute { } -} \ No newline at end of file diff --git a/Example/App.config b/Example/App.config deleted file mode 100644 index 2ab126c..0000000 --- a/Example/App.config +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - diff --git a/Example/App.xaml b/Example/App.xaml deleted file mode 100644 index 21f0938..0000000 --- a/Example/App.xaml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/Example/App.xaml.cs b/Example/App.xaml.cs deleted file mode 100644 index 7d783f2..0000000 --- a/Example/App.xaml.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.Windows; -using Prism.Ioc; - -namespace Example -{ - /// - /// Interaction logic for App.xaml - /// - public partial class App - { - protected override void RegisterTypes(IContainerRegistry containerRegistry) - { - //nothing - } - - protected override Window CreateShell() => Container.Resolve(); - } -} diff --git a/Example/Example.csproj b/Example/Example.csproj deleted file mode 100644 index 84f9026..0000000 --- a/Example/Example.csproj +++ /dev/null @@ -1,165 +0,0 @@ - - - - - - Debug - AnyCPU - {DE9CFDEB-40B8-447D-9959-31BA78512CED} - WinExe - Example - Example - v4.5 - 512 - {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 4 - - - - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - latest - - - x64 - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - latest - - - nsis3-install.ico - - - Example.App - - - - ..\packages\CommonServiceLocator.2.0.5\lib\net45\CommonServiceLocator.dll - True - - - ..\packages\DryIoc.dll.4.0.7\lib\net45\DryIoc.dll - True - - - ..\packages\MaterialDesignColors.1.2.1\lib\net45\MaterialDesignColors.dll - True - - - ..\packages\MaterialDesignThemes.3.0.0\lib\net45\MaterialDesignThemes.Wpf.dll - - - - ..\packages\Prism.Core.7.2.0.1422\lib\net45\Prism.dll - - - ..\packages\Prism.DryIoc.7.2.0.1422\lib\net45\Prism.DryIoc.Wpf.dll - True - - - ..\packages\Prism.Wpf.7.2.0.1422\lib\net45\Prism.Wpf.dll - - - - - ..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll - - - - ..\packages\Prism.Wpf.7.2.0.1422\lib\net45\System.Windows.Interactivity.dll - - - - - 4.0 - - - - - - - - MSBuild:Compile - Designer - - - MSBuild:Compile - Designer - - - - App.xaml - Code - - - MainWindow.xaml - Code - - - - - - Code - - - True - True - Resources.resx - - - True - Settings.settings - True - - - ResXFileCodeGenerator - Resources.Designer.cs - - - PreserveNewest - - - - SettingsSingleFileGenerator - Settings.Designer.cs - - - - - - - - {07e2de31-80a0-43da-b307-1ca47cd930a1} - Katteker.UserInterface - - - {4cd50166-c3ab-4cc4-9694-951a3f33addb} - Katteker - - - - - - - - - Dieses Projekt verweist auf mindestens ein NuGet-Paket, das auf diesem Computer fehlt. Verwenden Sie die Wiederherstellung von NuGet-Paketen, um die fehlenden Dateien herunterzuladen. Weitere Informationen finden Sie unter "http://go.microsoft.com/fwlink/?LinkID=322105". Die fehlende Datei ist "{0}". - - - - - - \ No newline at end of file diff --git a/Example/MainWindow.xaml b/Example/MainWindow.xaml deleted file mode 100644 index da1d518..0000000 --- a/Example/MainWindow.xaml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - -