diff --git a/project-clean-temp-files/cleantempfiles.sln b/project-clean-temp-files/cleantempfiles.sln new file mode 100644 index 0000000..7d83bbe --- /dev/null +++ b/project-clean-temp-files/cleantempfiles.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.2.32616.157 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cleantempfiles", "cleantempfiles\cleantempfiles.csproj", "{044FB96A-7D49-4DFC-9318-DDFC76DF223A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {044FB96A-7D49-4DFC-9318-DDFC76DF223A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {044FB96A-7D49-4DFC-9318-DDFC76DF223A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {044FB96A-7D49-4DFC-9318-DDFC76DF223A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {044FB96A-7D49-4DFC-9318-DDFC76DF223A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D044A8EC-C4DC-44CB-BBE5-1B283B4FD72C} + EndGlobalSection +EndGlobal diff --git a/project-clean-temp-files/cleantempfiles/App.config b/project-clean-temp-files/cleantempfiles/App.config new file mode 100644 index 0000000..193aecc --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/project-clean-temp-files/cleantempfiles/FodyWeavers.xml b/project-clean-temp-files/cleantempfiles/FodyWeavers.xml new file mode 100644 index 0000000..c6e1b7c --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/FodyWeavers.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/project-clean-temp-files/cleantempfiles/Form1.Designer.cs b/project-clean-temp-files/cleantempfiles/Form1.Designer.cs new file mode 100644 index 0000000..3706c5f --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/Form1.Designer.cs @@ -0,0 +1,129 @@ +namespace cleantempfiles +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.button1 = new System.Windows.Forms.Button(); + this.progressBar1 = new System.Windows.Forms.ProgressBar(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // button1 + // + this.button1.Location = new System.Drawing.Point(12, 12); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(143, 38); + this.button1.TabIndex = 0; + this.button1.Text = "clean temp files && empty recycle bin"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // progressBar1 + // + this.progressBar1.Location = new System.Drawing.Point(12, 56); + this.progressBar1.Name = "progressBar1"; + this.progressBar1.Size = new System.Drawing.Size(470, 23); + this.progressBar1.TabIndex = 1; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 6F); + this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.label1.Location = new System.Drawing.Point(12, 82); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(0, 9); + this.label1.TabIndex = 2; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(161, 9); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(98, 13); + this.label2.TabIndex = 3; + this.label2.Text = "C:\\Windows\\Temp"; + this.label2.Click += new System.EventHandler(this.label2_Click); + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(161, 22); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(210, 13); + this.label3.TabIndex = 4; + this.label3.Text = "C:\\Users\\username\\AppData\\Local\\Temp"; + this.label3.Click += new System.EventHandler(this.label3_Click); + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(161, 35); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(49, 13); + this.label4.TabIndex = 5; + this.label4.Text = "C:/Temp"; + this.label4.Click += new System.EventHandler(this.label4_Click); + // + // Form1 + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(494, 104); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Controls.Add(this.progressBar1); + this.Controls.Add(this.button1); + this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(510, 143); + this.MinimumSize = new System.Drawing.Size(510, 143); + this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Form1"; + this.Load += new System.EventHandler(this.Form1_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Button button1; + private System.Windows.Forms.ProgressBar progressBar1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + } +} + diff --git a/project-clean-temp-files/cleantempfiles/Form1.cs b/project-clean-temp-files/cleantempfiles/Form1.cs new file mode 100644 index 0000000..02992af --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/Form1.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.IO; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace cleantempfiles +{ + public partial class Form1 : Form + { + public Form1() + { + InitializeComponent(); + } + + enum RecycleFlags : uint + { + SHERB_NOCONFIRMATION = 0x00000001, + SHERB_NOPROGRESSUI = 0x00000002, + SHERB_NOSOUND = 0x00000004 + } + [DllImport("Shell32.dll", CharSet = CharSet.Unicode)] + static extern uint SHEmptyRecycleBin(IntPtr hwnd, string pszRootPath, RecycleFlags dwFlags); + + private bool isProgressing = false; + + private async void button1_Click(object sender, EventArgs e) + { + if (isProgressing) return; + isProgressing = true; + + string path = "C:/Users/" + Environment.UserName + "/AppData/Local/Temp"; + string path2 = "C:/Windows/Temp"; + string path3 = "C:/temp"; + + if (!Directory.Exists(path)) + { + MessageBox.Show("%TEMP% does not exist:: " + path); + return; + } + + List dirs = new List(); + List files = new List(); + + foreach (string dir in Directory.GetDirectories(path, "*.*", SearchOption.AllDirectories)) + { + dirs.Add(dir); + label1.Text = "found dir: " + dir; + foreach (string file in Directory.GetFiles(dir, "*.*", SearchOption.AllDirectories)) + { + label1.Text = "found file: " + file; + files.Add(file); + } + await Task.Delay(1); + } + foreach (string dir in Directory.GetDirectories(path2, "*.*", SearchOption.AllDirectories)) + { + dirs.Add(dir); + label1.Text = "found dir: " + dir; + foreach (string file in Directory.GetFiles(dir, "*.*", SearchOption.AllDirectories)) + { + label1.Text = "found file: " + file; + files.Add(file); + } + await Task.Delay(1); + } + if (Directory.Exists("C:/temp")) + { + foreach (string dir in Directory.GetDirectories(path3, "*.*", SearchOption.AllDirectories)) + { + dirs.Add(dir); + label1.Text = "found dir: " + dir; + foreach (string file in Directory.GetFiles(dir, "*.*", SearchOption.AllDirectories)) + { + label1.Text = "found file: " + file; + files.Add(file); + } + await Task.Delay(1); + } + } + + await Task.Delay(1000); + label1.Text = "starting deletion in 3.."; + await Task.Delay(1000); + label1.Text = "starting deletion in 2.."; + await Task.Delay(1000); + label1.Text = "starting deletion in 1.."; + await Task.Delay(1000); + label1.ForeColor = Color.IndianRed; + progressBar1.Maximum = dirs.Count; + foreach (string dir in dirs) + { + progressBar1.Value++; + label1.Text = "deleting: " + dir; + + try + { + Directory.Delete(dir, true); + } catch (Exception) { } + await Task.Delay(1); + + } + + // arg index 1 = If this value is an empty string or NULL, all Recycle Bins on all drives will be emptied. + // arg index 2 = don't show progress reports/confirmation windows + SHEmptyRecycleBin(Handle, null, RecycleFlags.SHERB_NOCONFIRMATION); + + label1.Text = "deleted dirs: " + dirs.Count + ", files: " + files.Count; + + Application.Restart(); + } + + private void Form1_Load(object sender, EventArgs e) + { + label3.Text = "C:/Users/" + Environment.UserName + "/AppData/Local/Temp"; + } + + private void label4_Click(object sender, EventArgs e) + { + Process.Start("explorer", label4.Text); + } + + private void label3_Click(object sender, EventArgs e) + { + Process.Start("explorer", label3.Text); + } + + private void label2_Click(object sender, EventArgs e) + { + Process.Start("explorer", label2.Text); + } + } +} diff --git a/project-clean-temp-files/cleantempfiles/Form1.resx b/project-clean-temp-files/cleantempfiles/Form1.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + \ No newline at end of file diff --git a/project-clean-temp-files/cleantempfiles/Program.cs b/project-clean-temp-files/cleantempfiles/Program.cs new file mode 100644 index 0000000..27a1427 --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace cleantempfiles +{ + internal static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/project-clean-temp-files/cleantempfiles/Properties/AssemblyInfo.cs b/project-clean-temp-files/cleantempfiles/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..125fa69 --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("cleantempfiles")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("cleantempfiles")] +[assembly: AssemblyCopyright("Copyright © 2022")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("044fb96a-7d49-4dfc-9318-ddfc76df223a")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/project-clean-temp-files/cleantempfiles/Properties/Resources.Designer.cs b/project-clean-temp-files/cleantempfiles/Properties/Resources.Designer.cs new file mode 100644 index 0000000..02d43b5 --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace cleantempfiles.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("cleantempfiles.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/project-clean-temp-files/cleantempfiles/Properties/Resources.resx b/project-clean-temp-files/cleantempfiles/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/project-clean-temp-files/cleantempfiles/Properties/Settings.Designer.cs b/project-clean-temp-files/cleantempfiles/Properties/Settings.Designer.cs new file mode 100644 index 0000000..a911edf --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace cleantempfiles.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/project-clean-temp-files/cleantempfiles/Properties/Settings.settings b/project-clean-temp-files/cleantempfiles/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/project-clean-temp-files/cleantempfiles/Properties/app.manifest b/project-clean-temp-files/cleantempfiles/Properties/app.manifest new file mode 100644 index 0000000..438ee0d --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/Properties/app.manifest @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/project-clean-temp-files/cleantempfiles/bin/Debug/cleantempfiles.exe b/project-clean-temp-files/cleantempfiles/bin/Debug/cleantempfiles.exe new file mode 100644 index 0000000..c5af75a Binary files /dev/null and b/project-clean-temp-files/cleantempfiles/bin/Debug/cleantempfiles.exe differ diff --git a/project-clean-temp-files/cleantempfiles/bin/Debug/cleantempfiles.exe.config b/project-clean-temp-files/cleantempfiles/bin/Debug/cleantempfiles.exe.config new file mode 100644 index 0000000..193aecc --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/bin/Debug/cleantempfiles.exe.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/project-clean-temp-files/cleantempfiles/bin/Debug/cleantempfiles.pdb b/project-clean-temp-files/cleantempfiles/bin/Debug/cleantempfiles.pdb new file mode 100644 index 0000000..01cd9d9 Binary files /dev/null and b/project-clean-temp-files/cleantempfiles/bin/Debug/cleantempfiles.pdb differ diff --git a/project-clean-temp-files/cleantempfiles/cleantempfiles.csproj b/project-clean-temp-files/cleantempfiles/cleantempfiles.csproj new file mode 100644 index 0000000..8a131e3 --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/cleantempfiles.csproj @@ -0,0 +1,107 @@ + + + + + Debug + AnyCPU + {044FB96A-7D49-4DFC-9318-DDFC76DF223A} + WinExe + cleantempfiles + cleantempfiles + v4.8 + 512 + true + true + + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + Properties\app.manifest + + + + ..\packages\Costura.Fody.1.6.0\lib\dotnet\Costura.dll + False + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/.NETFramework,Version=v4.8.AssemblyAttributes.cs b/project-clean-temp-files/cleantempfiles/obj/Debug/.NETFramework,Version=v4.8.AssemblyAttributes.cs new file mode 100644 index 0000000..15efebf --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/obj/Debug/.NETFramework,Version=v4.8.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/Common.cs b/project-clean-temp-files/cleantempfiles/obj/Debug/Common.cs new file mode 100644 index 0000000..72654ac --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/obj/Debug/Common.cs @@ -0,0 +1,297 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.IO; +using System.IO.Compression; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Security.AccessControl; +using System.Security.Cryptography; +using System.Security.Principal; +using System.Text; +using System.Threading; + +static class Common +{ + private const int DelayUntilReboot = 4; + + [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] + static extern bool MoveFileEx(string lpExistingFileName, string lpNewFileName, int dwFlags); + + [DllImport("kernel32", SetLastError = true, CharSet = CharSet.Unicode)] + static extern IntPtr LoadLibrary(string dllToLoad); + + [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)] + [return: MarshalAs(UnmanagedType.Bool)] + static extern bool SetDllDirectory(string lpPathName); + + [Conditional("DEBUG")] + public static void Log(string format, params object[] args) + { + // Should this be trace? + Debug.WriteLine("=== COSTURA === " + string.Format(format, args)); + } + + static void CopyTo(Stream source, Stream destination) + { + var array = new byte[81920]; + int count; + while ((count = source.Read(array, 0, array.Length)) != 0) + { + destination.Write(array, 0, count); + } + } + + static void CreateDirectory(string tempBasePath) + { + if (!Directory.Exists(tempBasePath)) + { + Directory.CreateDirectory(tempBasePath); + } + } + + static byte[] ReadStream(Stream stream) + { + var data = new Byte[stream.Length]; + stream.Read(data, 0, data.Length); + return data; + } + + public static string CalculateChecksum(string filename) + { + using (var fs = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) + using (var bs = new BufferedStream(fs)) + using (var sha1 = new SHA1CryptoServiceProvider()) + { + var hash = sha1.ComputeHash(bs); + var formatted = new StringBuilder(2 * hash.Length); + foreach (var b in hash) + { + formatted.AppendFormat("{0:X2}", b); + } + return formatted.ToString(); + } + } + + public static Assembly ReadExistingAssembly(AssemblyName name) + { + var currentDomain = AppDomain.CurrentDomain; + var assemblies = currentDomain.GetAssemblies(); + foreach (var assembly in assemblies) + { + var currentName = assembly.GetName(); + if (string.Equals(currentName.Name, name.Name, StringComparison.InvariantCultureIgnoreCase) && + string.Equals(CultureToString(currentName.CultureInfo), CultureToString(name.CultureInfo), StringComparison.InvariantCultureIgnoreCase)) + { + Log("Assembly '{0}' already loaded, returning existing assembly", assembly.FullName); + + return assembly; + } + } + return null; + } + + static string CultureToString(CultureInfo culture) + { + if (culture == null) + return ""; + + return culture.Name; + } + + public static Assembly ReadFromDiskCache(string tempBasePath, AssemblyName requestedAssemblyName) + { + var name = requestedAssemblyName.Name.ToLowerInvariant(); + + if (requestedAssemblyName.CultureInfo != null && !String.IsNullOrEmpty(requestedAssemblyName.CultureInfo.Name)) + name = $"{requestedAssemblyName.CultureInfo.Name}.{name}"; + + var bittyness = IntPtr.Size == 8 ? "64" : "32"; + var assemblyTempFilePath = Path.Combine(tempBasePath, String.Concat(name, ".dll")); + if (File.Exists(assemblyTempFilePath)) + { + return Assembly.LoadFile(assemblyTempFilePath); + } + assemblyTempFilePath = Path.ChangeExtension(assemblyTempFilePath, "exe"); + if (File.Exists(assemblyTempFilePath)) + { + return Assembly.LoadFile(assemblyTempFilePath); + } + assemblyTempFilePath = Path.Combine(Path.Combine(tempBasePath, bittyness), String.Concat(name, ".dll")); + if (File.Exists(assemblyTempFilePath)) + { + return Assembly.LoadFile(assemblyTempFilePath); + } + assemblyTempFilePath = Path.ChangeExtension(assemblyTempFilePath, "exe"); + if (File.Exists(assemblyTempFilePath)) + { + return Assembly.LoadFile(assemblyTempFilePath); + } + return null; + } + + public static Assembly ReadFromEmbeddedResources(Dictionary assemblyNames, Dictionary symbolNames, AssemblyName requestedAssemblyName) + { + var name = requestedAssemblyName.Name.ToLowerInvariant(); + + if (requestedAssemblyName.CultureInfo != null && !String.IsNullOrEmpty(requestedAssemblyName.CultureInfo.Name)) + name = $"{requestedAssemblyName.CultureInfo.Name}.{name}"; + + byte[] assemblyData; + using (var assemblyStream = LoadStream(assemblyNames, name)) + { + if (assemblyStream == null) + { + return null; + } + assemblyData = ReadStream(assemblyStream); + } + + using (var pdbStream = LoadStream(symbolNames, name)) + { + if (pdbStream != null) + { + var pdbData = ReadStream(pdbStream); + return Assembly.Load(assemblyData, pdbData); + } + } + + return Assembly.Load(assemblyData); + } + + static Stream LoadStream(Dictionary resourceNames, string name) + { + string value; + if (resourceNames.TryGetValue(name, out value)) + return LoadStream(value); + + return null; + } + + static Stream LoadStream(string fullname) + { + var executingAssembly = Assembly.GetExecutingAssembly(); + + if (fullname.EndsWith(".compressed")) + { + using (var stream = executingAssembly.GetManifestResourceStream(fullname)) + using (var compressStream = new DeflateStream(stream, CompressionMode.Decompress)) + { + var memStream = new MemoryStream(); + CopyTo(compressStream, memStream); + memStream.Position = 0; + return memStream; + } + } + + return executingAssembly.GetManifestResourceStream(fullname); + } + + // Mutex code from http://stackoverflow.com/questions/229565/what-is-a-good-pattern-for-using-a-global-mutex-in-c + public static void PreloadUnmanagedLibraries(string hash, string tempBasePath, IEnumerable libs, Dictionary checksums) + { + var mutexId = $"Global\\Costura{hash}"; + + using (var mutex = new Mutex(false, mutexId)) + { + var allowEveryoneRule = new MutexAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), MutexRights.FullControl, AccessControlType.Allow); + var securitySettings = new MutexSecurity(); + securitySettings.AddAccessRule(allowEveryoneRule); + mutex.SetAccessControl(securitySettings); + + var hasHandle = false; + try + { + try + { + hasHandle = mutex.WaitOne(60000, false); + if (hasHandle == false) + throw new TimeoutException("Timeout waiting for exclusive access"); + } + catch (AbandonedMutexException) + { + hasHandle = true; + } + + var bittyness = IntPtr.Size == 8 ? "64" : "32"; + CreateDirectory(Path.Combine(tempBasePath, bittyness)); + InternalPreloadUnmanagedLibraries(tempBasePath, libs, checksums); + } + finally + { + if (hasHandle) + mutex.ReleaseMutex(); + } + } + } + + static void InternalPreloadUnmanagedLibraries(string tempBasePath, IEnumerable libs, Dictionary checksums) + { + string name; + + foreach (var lib in libs) + { + name = ResourceNameToPath(lib); + + var assemblyTempFilePath = Path.Combine(tempBasePath, name); + + if (File.Exists(assemblyTempFilePath)) + { + var checksum = CalculateChecksum(assemblyTempFilePath); + if (checksum != checksums[lib]) + File.Delete(assemblyTempFilePath); + } + + if (!File.Exists(assemblyTempFilePath)) + { + using (var copyStream = LoadStream(lib)) + using (var assemblyTempFile = File.OpenWrite(assemblyTempFilePath)) + { + CopyTo(copyStream, assemblyTempFile); + } + if (!MoveFileEx(assemblyTempFilePath, null, DelayUntilReboot)) + { + //TODO: for now we ignore the return value. + } + } + } + + SetDllDirectory(tempBasePath); + + foreach (var lib in libs) + { + name = ResourceNameToPath(lib); + + if (name.EndsWith(".dll")) + { + var assemblyTempFilePath = Path.Combine(tempBasePath, name); + + LoadLibrary(assemblyTempFilePath); + } + } + } + + static string ResourceNameToPath(string lib) + { + var bittyness = IntPtr.Size == 8 ? "64" : "32"; + + var name = lib; + + if (lib.StartsWith(String.Concat("costura", bittyness, "."))) + { + name = Path.Combine(bittyness, lib.Substring(10)); + } + else if (lib.StartsWith("costura.")) + { + name = lib.Substring(8); + } + + if (name.EndsWith(".compressed")) + { + name = name.Substring(0, name.Length - 11); + } + + return name; + } +} \ No newline at end of file diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/project-clean-temp-files/cleantempfiles/obj/Debug/DesignTimeResolveAssemblyReferences.cache new file mode 100644 index 0000000..25da147 Binary files /dev/null and b/project-clean-temp-files/cleantempfiles/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/project-clean-temp-files/cleantempfiles/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache new file mode 100644 index 0000000..fce1a40 Binary files /dev/null and b/project-clean-temp-files/cleantempfiles/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/ILTemplate.cs b/project-clean-temp-files/cleantempfiles/obj/Debug/ILTemplate.cs new file mode 100644 index 0000000..119fdf1 --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/obj/Debug/ILTemplate.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using System.Threading; + +static class ILTemplate +{ + static readonly object nullCacheLock = new object(); + static readonly Dictionary nullCache = new Dictionary(); + + static readonly Dictionary assemblyNames = new Dictionary(); + static readonly Dictionary symbolNames = new Dictionary(); + + static int isAttached = 0; + + public static void Attach() + { + if (Interlocked.Exchange(ref isAttached, 1) == 1) + { + return; + } + + var currentDomain = AppDomain.CurrentDomain; + currentDomain.AssemblyResolve += ResolveAssembly; + } + + public static Assembly ResolveAssembly(object sender, ResolveEventArgs e) + { + lock (nullCacheLock) + { + if (nullCache.ContainsKey(e.Name)) + { + return null; + } + } + + var requestedAssemblyName = new AssemblyName(e.Name); + + var assembly = Common.ReadExistingAssembly(requestedAssemblyName); + if (assembly != null) + { + return assembly; + } + + Common.Log("Loading assembly '{0}' into the AppDomain", requestedAssemblyName); + + assembly = Common.ReadFromEmbeddedResources(assemblyNames, symbolNames, requestedAssemblyName); + if (assembly == null) + { + lock (nullCacheLock) + { + nullCache[e.Name] = true; + } + + // Handles retargeted assemblies like PCL + if (requestedAssemblyName.Flags == AssemblyNameFlags.Retargetable) + { + assembly = Assembly.Load(requestedAssemblyName); + } + } + return assembly; + } +} \ No newline at end of file diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.Form1.resources b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.Form1.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.Form1.resources differ diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.Properties.Resources.resources b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.Properties.Resources.resources new file mode 100644 index 0000000..6c05a97 Binary files /dev/null and b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.Properties.Resources.resources differ diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.csproj.AssemblyReference.cache b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.csproj.AssemblyReference.cache new file mode 100644 index 0000000..bb3731a Binary files /dev/null and b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.csproj.AssemblyReference.cache differ diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.csproj.CoreCompileInputs.cache b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..b5d9037 --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +713c31a738d3db32cbf21521ffa94f65d046de7b diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.csproj.FileListAbsolute.txt b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..d0e55d1 --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.csproj.FileListAbsolute.txt @@ -0,0 +1,11 @@ +D:\programming\visual-studio\workspace\cleantempfiles\cleantempfiles\bin\Debug\cleantempfiles.exe.config +D:\programming\visual-studio\workspace\cleantempfiles\cleantempfiles\bin\Debug\cleantempfiles.exe +D:\programming\visual-studio\workspace\cleantempfiles\cleantempfiles\bin\Debug\cleantempfiles.pdb +D:\programming\visual-studio\workspace\cleantempfiles\cleantempfiles\obj\Debug\cleantempfiles.csproj.AssemblyReference.cache +D:\programming\visual-studio\workspace\cleantempfiles\cleantempfiles\obj\Debug\cleantempfiles.csproj.SuggestedBindingRedirects.cache +D:\programming\visual-studio\workspace\cleantempfiles\cleantempfiles\obj\Debug\cleantempfiles.Form1.resources +D:\programming\visual-studio\workspace\cleantempfiles\cleantempfiles\obj\Debug\cleantempfiles.Properties.Resources.resources +D:\programming\visual-studio\workspace\cleantempfiles\cleantempfiles\obj\Debug\cleantempfiles.csproj.GenerateResource.cache +D:\programming\visual-studio\workspace\cleantempfiles\cleantempfiles\obj\Debug\cleantempfiles.csproj.CoreCompileInputs.cache +D:\programming\visual-studio\workspace\cleantempfiles\cleantempfiles\obj\Debug\cleantempfiles.exe +D:\programming\visual-studio\workspace\cleantempfiles\cleantempfiles\obj\Debug\cleantempfiles.pdb diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.csproj.GenerateResource.cache b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.csproj.GenerateResource.cache new file mode 100644 index 0000000..21397bc Binary files /dev/null and b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.csproj.GenerateResource.cache differ diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.csproj.SuggestedBindingRedirects.cache b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.csproj.SuggestedBindingRedirects.cache new file mode 100644 index 0000000..e69de29 diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.exe b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.exe new file mode 100644 index 0000000..c5af75a Binary files /dev/null and b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.exe differ diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.exe.tmp b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.exe.tmp new file mode 100644 index 0000000..0e92b25 Binary files /dev/null and b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.exe.tmp differ diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.pdb b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.pdb new file mode 100644 index 0000000..01cd9d9 Binary files /dev/null and b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.pdb differ diff --git a/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.pdb.tmp b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.pdb.tmp new file mode 100644 index 0000000..378c418 Binary files /dev/null and b/project-clean-temp-files/cleantempfiles/obj/Debug/cleantempfiles.pdb.tmp differ diff --git a/project-clean-temp-files/cleantempfiles/packages.config b/project-clean-temp-files/cleantempfiles/packages.config new file mode 100644 index 0000000..1c05eb5 --- /dev/null +++ b/project-clean-temp-files/cleantempfiles/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/project-clean-temp-files/packages/Costura.Fody.1.6.0/.signature.p7s b/project-clean-temp-files/packages/Costura.Fody.1.6.0/.signature.p7s new file mode 100644 index 0000000..b3f770e Binary files /dev/null and b/project-clean-temp-files/packages/Costura.Fody.1.6.0/.signature.p7s differ diff --git a/project-clean-temp-files/packages/Costura.Fody.1.6.0/Costura.Fody.1.6.0.nupkg b/project-clean-temp-files/packages/Costura.Fody.1.6.0/Costura.Fody.1.6.0.nupkg new file mode 100644 index 0000000..6c30e88 Binary files /dev/null and b/project-clean-temp-files/packages/Costura.Fody.1.6.0/Costura.Fody.1.6.0.nupkg differ diff --git a/project-clean-temp-files/packages/Costura.Fody.1.6.0/Costura.Fody.dll b/project-clean-temp-files/packages/Costura.Fody.1.6.0/Costura.Fody.dll new file mode 100644 index 0000000..801662d Binary files /dev/null and b/project-clean-temp-files/packages/Costura.Fody.1.6.0/Costura.Fody.dll differ diff --git a/project-clean-temp-files/packages/Costura.Fody.1.6.0/Costura.Fody.pdb b/project-clean-temp-files/packages/Costura.Fody.1.6.0/Costura.Fody.pdb new file mode 100644 index 0000000..288674e Binary files /dev/null and b/project-clean-temp-files/packages/Costura.Fody.1.6.0/Costura.Fody.pdb differ diff --git a/project-clean-temp-files/packages/Costura.Fody.1.6.0/Costura.Tasks.dll b/project-clean-temp-files/packages/Costura.Fody.1.6.0/Costura.Tasks.dll new file mode 100644 index 0000000..46763d6 Binary files /dev/null and b/project-clean-temp-files/packages/Costura.Fody.1.6.0/Costura.Tasks.dll differ diff --git a/project-clean-temp-files/packages/Costura.Fody.1.6.0/Costura.Tasks.pdb b/project-clean-temp-files/packages/Costura.Fody.1.6.0/Costura.Tasks.pdb new file mode 100644 index 0000000..3c0a5c7 Binary files /dev/null and b/project-clean-temp-files/packages/Costura.Fody.1.6.0/Costura.Tasks.pdb differ diff --git a/project-clean-temp-files/packages/Costura.Fody.1.6.0/build/dotnet/Costura.Fody.targets b/project-clean-temp-files/packages/Costura.Fody.1.6.0/build/dotnet/Costura.Fody.targets new file mode 100644 index 0000000..4d42573 --- /dev/null +++ b/project-clean-temp-files/packages/Costura.Fody.1.6.0/build/dotnet/Costura.Fody.targets @@ -0,0 +1,29 @@ + + + + + $(MSBuildThisFileDirectory)..\..\ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/project-clean-temp-files/packages/Costura.Fody.1.6.0/build/portable-net+sl+win+wpa+wp/Costura.Fody.targets b/project-clean-temp-files/packages/Costura.Fody.1.6.0/build/portable-net+sl+win+wpa+wp/Costura.Fody.targets new file mode 100644 index 0000000..4d42573 --- /dev/null +++ b/project-clean-temp-files/packages/Costura.Fody.1.6.0/build/portable-net+sl+win+wpa+wp/Costura.Fody.targets @@ -0,0 +1,29 @@ + + + + + $(MSBuildThisFileDirectory)..\..\ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/project-clean-temp-files/packages/Costura.Fody.1.6.0/lib/dotnet/Costura.dll b/project-clean-temp-files/packages/Costura.Fody.1.6.0/lib/dotnet/Costura.dll new file mode 100644 index 0000000..3167a93 Binary files /dev/null and b/project-clean-temp-files/packages/Costura.Fody.1.6.0/lib/dotnet/Costura.dll differ diff --git a/project-clean-temp-files/packages/Costura.Fody.1.6.0/lib/dotnet/Costura.pdb b/project-clean-temp-files/packages/Costura.Fody.1.6.0/lib/dotnet/Costura.pdb new file mode 100644 index 0000000..fb99852 Binary files /dev/null and b/project-clean-temp-files/packages/Costura.Fody.1.6.0/lib/dotnet/Costura.pdb differ diff --git a/project-clean-temp-files/packages/Costura.Fody.1.6.0/lib/portable-net+sl+win+wpa+wp/Costura.dll b/project-clean-temp-files/packages/Costura.Fody.1.6.0/lib/portable-net+sl+win+wpa+wp/Costura.dll new file mode 100644 index 0000000..3167a93 Binary files /dev/null and b/project-clean-temp-files/packages/Costura.Fody.1.6.0/lib/portable-net+sl+win+wpa+wp/Costura.dll differ diff --git a/project-clean-temp-files/packages/Costura.Fody.1.6.0/lib/portable-net+sl+win+wpa+wp/Costura.pdb b/project-clean-temp-files/packages/Costura.Fody.1.6.0/lib/portable-net+sl+win+wpa+wp/Costura.pdb new file mode 100644 index 0000000..fb99852 Binary files /dev/null and b/project-clean-temp-files/packages/Costura.Fody.1.6.0/lib/portable-net+sl+win+wpa+wp/Costura.pdb differ diff --git a/project-clean-temp-files/packages/Costura.Fody.1.6.0/tools/install.ps1 b/project-clean-temp-files/packages/Costura.Fody.1.6.0/tools/install.ps1 new file mode 100644 index 0000000..d41e9b1 --- /dev/null +++ b/project-clean-temp-files/packages/Costura.Fody.1.6.0/tools/install.ps1 @@ -0,0 +1,94 @@ +param($installPath, $toolsPath, $package, $project) + + +function RemoveForceProjectLevelHack($project) +{ + Write-Host "RemoveForceProjectLevelHack" + Foreach ($item in $project.ProjectItems) + { + if ($item.Name -eq "Fody_ToBeDeleted.txt") + { + $item.Delete() + } + } +} + +function FlushVariables() +{ + Write-Host "Flushing environment variables" + $env:FodyLastProjectPath = "" + $env:FodyLastWeaverName = "" + $env:FodyLastXmlContents = "" +} + +function Update-FodyConfig($addinName, $project) +{ + Write-Host "Update-FodyConfig" + $fodyWeaversPath = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($project.FullName), "FodyWeavers.xml") + + $FodyLastProjectPath = $env:FodyLastProjectPath + $FodyLastWeaverName = $env:FodyLastWeaverName + $FodyLastXmlContents = $env:FodyLastXmlContents + + if ( + ($FodyLastProjectPath -eq $project.FullName) -and + ($FodyLastWeaverName -eq $addinName)) + { + Write-Host "Upgrade detected. Restoring content for $addinName" + [System.IO.File]::WriteAllText($fodyWeaversPath, $FodyLastXmlContents) + FlushVariables + return + } + + FlushVariables + + $xml = [xml](get-content $fodyWeaversPath) + + $weavers = $xml["Weavers"] + $node = $weavers.SelectSingleNode($addinName) + + if (-not $node) + { + Write-Host "Appending node" + $newNode = $xml.CreateElement($addinName) + $weavers.AppendChild($newNode) + } + + $xml.Save($fodyWeaversPath) +} + +function Fix-ReferencesCopyLocal($package, $project) +{ + Write-Host "Fix-ReferencesCopyLocal $($package.Id)" + $asms = $package.AssemblyReferences | %{$_.Name} + + foreach ($reference in $project.Object.References) + { + if ($asms -contains $reference.Name + ".dll") + { + if($reference.CopyLocal -eq $true) + { + $reference.CopyLocal = $false; + } + } + } +} + +function UnlockWeaversXml($project) +{ + $fodyWeaversProjectItem = $project.ProjectItems.Item("FodyWeavers.xml"); + if ($fodyWeaversProjectItem) + { + $fodyWeaversProjectItem.Open("{7651A701-06E5-11D1-8EBD-00A0C90F26EA}") + $fodyWeaversProjectItem.Save() + $fodyWeaversProjectItem.Document.Close() + } +} + +UnlockWeaversXml($project) + +RemoveForceProjectLevelHack $project + +Update-FodyConfig $package.Id.Replace(".Fody", "") $project + +Fix-ReferencesCopyLocal $package $project \ No newline at end of file diff --git a/project-clean-temp-files/packages/Costura.Fody.1.6.0/tools/uninstall.ps1 b/project-clean-temp-files/packages/Costura.Fody.1.6.0/tools/uninstall.ps1 new file mode 100644 index 0000000..6fb0d2f --- /dev/null +++ b/project-clean-temp-files/packages/Costura.Fody.1.6.0/tools/uninstall.ps1 @@ -0,0 +1,47 @@ +param($installPath, $toolsPath, $package, $project) + + +function Update-FodyConfig($addinName, $project) +{ + $fodyWeaversPath = [System.IO.Path]::Combine([System.IO.Path]::GetDirectoryName($project.FullName), "FodyWeavers.xml") + + if (!(Test-Path ($fodyWeaversPath))) + { + return + } + + Write-Host "Caching variables for possible update" + $env:FodyLastProjectPath = $project.FullName + $env:FodyLastWeaverName = $addinName + $env:FodyLastXmlContents = [IO.File]::ReadAllText($fodyWeaversPath) + + + $xml = [xml](get-content $fodyWeaversPath) + + $weavers = $xml["Weavers"] + $node = $weavers.SelectSingleNode($addinName) + + if ($node) + { + Write-Host "Removing node from FodyWeavers.xml" + $weavers.RemoveChild($node) + } + + $xml.Save($fodyWeaversPath) +} + + +function UnlockWeaversXml($project) +{ + $fodyWeaversProjectItem = $project.ProjectItems.Item("FodyWeavers.xml"); + if ($fodyWeaversProjectItem) + { + $fodyWeaversProjectItem.Open("{7651A701-06E5-11D1-8EBD-00A0C90F26EA}") + $fodyWeaversProjectItem.Save() + $fodyWeaversProjectItem.Document.Close() + } +} + +UnlockWeaversXml($project) + +Update-FodyConfig $package.Id.Replace(".Fody", "") $project \ No newline at end of file diff --git a/project-clean-temp-files/packages/Fody.2.0.0/.signature.p7s b/project-clean-temp-files/packages/Fody.2.0.0/.signature.p7s new file mode 100644 index 0000000..aa66de3 Binary files /dev/null and b/project-clean-temp-files/packages/Fody.2.0.0/.signature.p7s differ diff --git a/project-clean-temp-files/packages/Fody.2.0.0/Content/FodyWeavers.xml b/project-clean-temp-files/packages/Fody.2.0.0/Content/FodyWeavers.xml new file mode 100644 index 0000000..0227a5d --- /dev/null +++ b/project-clean-temp-files/packages/Fody.2.0.0/Content/FodyWeavers.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/project-clean-temp-files/packages/Fody.2.0.0/Fody.2.0.0.nupkg b/project-clean-temp-files/packages/Fody.2.0.0/Fody.2.0.0.nupkg new file mode 100644 index 0000000..dff65ce Binary files /dev/null and b/project-clean-temp-files/packages/Fody.2.0.0/Fody.2.0.0.nupkg differ diff --git a/project-clean-temp-files/packages/Fody.2.0.0/Fody.dll b/project-clean-temp-files/packages/Fody.2.0.0/Fody.dll new file mode 100644 index 0000000..bce246b Binary files /dev/null and b/project-clean-temp-files/packages/Fody.2.0.0/Fody.dll differ diff --git a/project-clean-temp-files/packages/Fody.2.0.0/Fody.pdb b/project-clean-temp-files/packages/Fody.2.0.0/Fody.pdb new file mode 100644 index 0000000..d6b69f9 Binary files /dev/null and b/project-clean-temp-files/packages/Fody.2.0.0/Fody.pdb differ diff --git a/project-clean-temp-files/packages/Fody.2.0.0/FodyCommon.dll b/project-clean-temp-files/packages/Fody.2.0.0/FodyCommon.dll new file mode 100644 index 0000000..4d3c03b Binary files /dev/null and b/project-clean-temp-files/packages/Fody.2.0.0/FodyCommon.dll differ diff --git a/project-clean-temp-files/packages/Fody.2.0.0/FodyCommon.pdb b/project-clean-temp-files/packages/Fody.2.0.0/FodyCommon.pdb new file mode 100644 index 0000000..5e0761c Binary files /dev/null and b/project-clean-temp-files/packages/Fody.2.0.0/FodyCommon.pdb differ diff --git a/project-clean-temp-files/packages/Fody.2.0.0/FodyIsolated.dll b/project-clean-temp-files/packages/Fody.2.0.0/FodyIsolated.dll new file mode 100644 index 0000000..451f05a Binary files /dev/null and b/project-clean-temp-files/packages/Fody.2.0.0/FodyIsolated.dll differ diff --git a/project-clean-temp-files/packages/Fody.2.0.0/FodyIsolated.pdb b/project-clean-temp-files/packages/Fody.2.0.0/FodyIsolated.pdb new file mode 100644 index 0000000..48f8169 Binary files /dev/null and b/project-clean-temp-files/packages/Fody.2.0.0/FodyIsolated.pdb differ diff --git a/project-clean-temp-files/packages/Fody.2.0.0/Mono.Cecil.Mdb.dll b/project-clean-temp-files/packages/Fody.2.0.0/Mono.Cecil.Mdb.dll new file mode 100644 index 0000000..8f1d085 Binary files /dev/null and b/project-clean-temp-files/packages/Fody.2.0.0/Mono.Cecil.Mdb.dll differ diff --git a/project-clean-temp-files/packages/Fody.2.0.0/Mono.Cecil.Pdb.dll b/project-clean-temp-files/packages/Fody.2.0.0/Mono.Cecil.Pdb.dll new file mode 100644 index 0000000..6b085b9 Binary files /dev/null and b/project-clean-temp-files/packages/Fody.2.0.0/Mono.Cecil.Pdb.dll differ diff --git a/project-clean-temp-files/packages/Fody.2.0.0/Mono.Cecil.Rocks.dll b/project-clean-temp-files/packages/Fody.2.0.0/Mono.Cecil.Rocks.dll new file mode 100644 index 0000000..5514de4 Binary files /dev/null and b/project-clean-temp-files/packages/Fody.2.0.0/Mono.Cecil.Rocks.dll differ diff --git a/project-clean-temp-files/packages/Fody.2.0.0/Mono.Cecil.dll b/project-clean-temp-files/packages/Fody.2.0.0/Mono.Cecil.dll new file mode 100644 index 0000000..70de67f Binary files /dev/null and b/project-clean-temp-files/packages/Fody.2.0.0/Mono.Cecil.dll differ diff --git a/project-clean-temp-files/packages/Fody.2.0.0/Tools/install.ps1 b/project-clean-temp-files/packages/Fody.2.0.0/Tools/install.ps1 new file mode 100644 index 0000000..09c40dd --- /dev/null +++ b/project-clean-temp-files/packages/Fody.2.0.0/Tools/install.ps1 @@ -0,0 +1,3 @@ +param($installPath, $toolsPath, $package, $project) +$item = $project.ProjectItems | where-object {$_.Name -eq "FodyWeavers.xml"} +$item.Properties.Item("BuildAction").Value = [int]0 \ No newline at end of file diff --git a/project-clean-temp-files/packages/Fody.2.0.0/build/dotnet/Fody.targets b/project-clean-temp-files/packages/Fody.2.0.0/build/dotnet/Fody.targets new file mode 100644 index 0000000..f7311e0 --- /dev/null +++ b/project-clean-temp-files/packages/Fody.2.0.0/build/dotnet/Fody.targets @@ -0,0 +1,100 @@ + + + + + + $(NCrunchOriginalSolutionDir) + + + + + $(SolutionDir) + + + + + $(MSBuildProjectDirectory)..\..\..\ + + + + + + + $(KeyOriginatorFile) + + + + + $(AssemblyOriginatorKeyFile) + + + + + + + + + + $(ProjectDir)FodyWeavers.xml + $(SignAssembly) + $(MSBuildThisFileDirectory)..\..\ + + + + + + + + + + + True + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/project-clean-temp-files/packages/Fody.2.0.0/build/netstandard1.4/Fody.targets b/project-clean-temp-files/packages/Fody.2.0.0/build/netstandard1.4/Fody.targets new file mode 100644 index 0000000..f7311e0 --- /dev/null +++ b/project-clean-temp-files/packages/Fody.2.0.0/build/netstandard1.4/Fody.targets @@ -0,0 +1,100 @@ + + + + + + $(NCrunchOriginalSolutionDir) + + + + + $(SolutionDir) + + + + + $(MSBuildProjectDirectory)..\..\..\ + + + + + + + $(KeyOriginatorFile) + + + + + $(AssemblyOriginatorKeyFile) + + + + + + + + + + $(ProjectDir)FodyWeavers.xml + $(SignAssembly) + $(MSBuildThisFileDirectory)..\..\ + + + + + + + + + + + True + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/project-clean-temp-files/packages/Fody.2.0.0/build/portable-net+sl+win+wpa+wp/Fody.targets b/project-clean-temp-files/packages/Fody.2.0.0/build/portable-net+sl+win+wpa+wp/Fody.targets new file mode 100644 index 0000000..f7311e0 --- /dev/null +++ b/project-clean-temp-files/packages/Fody.2.0.0/build/portable-net+sl+win+wpa+wp/Fody.targets @@ -0,0 +1,100 @@ + + + + + + $(NCrunchOriginalSolutionDir) + + + + + $(SolutionDir) + + + + + $(MSBuildProjectDirectory)..\..\..\ + + + + + + + $(KeyOriginatorFile) + + + + + $(AssemblyOriginatorKeyFile) + + + + + + + + + + $(ProjectDir)FodyWeavers.xml + $(SignAssembly) + $(MSBuildThisFileDirectory)..\..\ + + + + + + + + + + + True + + + + + + + + + + + + + + + + + + \ No newline at end of file