private void RemoveSN() { SN sn = new SN(Options); sn.ShowStartTextInfo(); string[] rows = Options.Rows; for (int i = 0; i < rows.Length; i++) { string file = rows[i]; RemoveSN(file); } foreach (string file in _allAssemblies.Keys) { AssemblyDefinition ad = _allAssemblies[file]; FixAssemblyNameReference(ad, null); } _changedAssemblies.Clear(); string[] keys = new string[_allAssemblies.Count]; int count = 0; foreach (object key in _allAssemblies.Keys) { keys[count] = key as string; count++; } for (int i = 0; i < keys.Length; i++) { string file = keys[i]; AssemblyDefinition ad = _allAssemblies[file]; #region get output file string outputFile; if (Options.chkOverwriteOriginalFileChecked) outputFile = file; else if (Options.SourceDir == Options.OutputDir) outputFile = Path.ChangeExtension(file, ".NoSN" + Path.GetExtension(file)); else outputFile = Path.Combine(Options.OutputDir, Path.GetFileName(file)); #endregion get output file Options.AppendTextInfo(String.Format("Saving assembly: {0}\r\n", ad.Name.Name)); ad.Write(outputFile); _allAssemblies.Remove(file); ad = null; } sn.ShowCompleteTextInfo(); }
private void RemoveSN() { SN sn = new SN(Options); sn.ShowStartTextInfo(); string[] rows = Options.Rows; for (int i = 0; i < rows.Length; i++) { string file = rows[i]; RemoveSN(file); } foreach (string file in _allAssemblies.Keys) { AssemblyDefinition ad = _allAssemblies[file]; FixAssemblyNameReference(ad, null); } _changedAssemblies.Clear(); string[] keys = new string[_allAssemblies.Count]; int count = 0; foreach (object key in _allAssemblies.Keys) { keys[count] = key as string; count++; } for (int i = 0; i < keys.Length; i++) { string file = keys[i]; AssemblyDefinition ad = _allAssemblies[file]; #region get output file string outputFile; if (Options.chkOverwriteOriginalFileChecked) { outputFile = file; } else if (Options.SourceDir == Options.OutputDir) { outputFile = Path.ChangeExtension(file, ".NoSN" + Path.GetExtension(file)); } else { outputFile = Path.Combine(Options.OutputDir, Path.GetFileName(file)); } #endregion get output file Options.AppendTextInfo(String.Format("Saving assembly: {0}\r\n", ad.Name.Name)); ad.Write(outputFile); _allAssemblies.Remove(file); ad = null; } sn.ShowCompleteTextInfo(); }
private void Sign() { SN sn = new SN(Options); sn.ShowStartTextInfo(); string keyFile = Options.KeyFile; StrongNameKeyPair snkp = null; try { using (FileStream fs = new FileStream(keyFile, FileMode.Open, FileAccess.Read)) { snkp = new StrongNameKeyPair(fs); } } catch { throw; } string[] rows = Options.Rows; for (int i = 0; i < rows.Length; i++) { string file = PathUtils.GetFullFileName(rows, i, Options.SourceDir); Sign(file, snkp); } foreach (string file in _allAssemblies.Keys) { AssemblyDefinition ad = _allAssemblies[file]; FixAssemblyNameReference(ad, snkp); ad = null; } //we free something to release memory, use lots of memory... _changedAssemblies.Clear(); string[] keys = new string[_allAssemblies.Count]; int count = 0; foreach (object key in _allAssemblies.Keys) { keys[count] = key as string; count++; } for (int i = 0; i < keys.Length; i++) { string file = keys[i]; AssemblyDefinition ad = _allAssemblies[file]; #region get output file string outputFile; if (Options.chkOverwriteOriginalFileChecked) outputFile = file; else if (Options.SourceDir == Options.OutputDir) outputFile = Path.ChangeExtension(file, ".SN" + Path.GetExtension(file)); else outputFile = Path.Combine(Options.OutputDir, Path.GetFileName(file)); #endregion get output file Options.AppendTextInfo(String.Format("Saving assembly: {0}\r\n", ad.Name.Name)); ad.Write(outputFile); Resign(outputFile, keyFile); _allAssemblies.Remove(file); ad = null; } sn.ShowCompleteTextInfo(); }
private void Sign() { SN sn = new SN(Options); sn.ShowStartTextInfo(); string keyFile = Options.KeyFile; StrongNameKeyPair snkp = null; try { using (FileStream fs = new FileStream(keyFile, FileMode.Open, FileAccess.Read)) { snkp = new StrongNameKeyPair(fs); } } catch { throw; } string[] rows = Options.Rows; for (int i = 0; i < rows.Length; i++) { string file = PathUtils.GetFullFileName(rows, i, Options.SourceDir); Sign(file, snkp); } foreach (string file in _allAssemblies.Keys) { AssemblyDefinition ad = _allAssemblies[file]; FixAssemblyNameReference(ad, snkp); ad = null; } //we free something to release memory, use lots of memory... _changedAssemblies.Clear(); string[] keys = new string[_allAssemblies.Count]; int count = 0; foreach (object key in _allAssemblies.Keys) { keys[count] = key as string; count++; } for (int i = 0; i < keys.Length; i++) { string file = keys[i]; AssemblyDefinition ad = _allAssemblies[file]; #region get output file string outputFile; if (Options.chkOverwriteOriginalFileChecked) { outputFile = file; } else if (Options.SourceDir == Options.OutputDir) { outputFile = Path.ChangeExtension(file, ".SN" + Path.GetExtension(file)); } else { outputFile = Path.Combine(Options.OutputDir, Path.GetFileName(file)); } #endregion get output file Options.AppendTextInfo(String.Format("Saving assembly: {0}\r\n", ad.Name.Name)); ad.Write(outputFile); Resign(outputFile, keyFile); _allAssemblies.Remove(file); ad = null; } sn.ShowCompleteTextInfo(); }