public Property(Controller controller, string name, DotNet.DataType dataType, string modifier) : base(controller) { Name = name; DataType = dataType; Modifiers.Add(modifier); }
public Operator(Controller controller, string name, DotNet.DataType type, string modifier) : base(controller) { Name = name; DataType = type; Modifiers.Add(modifier); }
protected Property(Controller controller, BaseConstruct parentObject, string name, DotNet.DataType dataType, List<string> modifiers, PropertyAccessor getAccessor, PropertyAccessor setAccessor, CodeLanguage language, int nodeIndex) : base(controller) { ParentObject = parentObject; Name = name; DataType = dataType; Modifiers = modifiers; GetAccessor = getAccessor; SetAccessor = setAccessor; Language = language; Index = nodeIndex; }
public string WriteToFileSystem(Solution solution, string outputPath) { if (solution is null) { throw new ArgumentNullException(nameof(solution)); } var createSolutionCommand = DotNet.New(_outputWriter).Solution().InFolder(outputPath).WithName(solution.Name).Build(); createSolutionCommand.Execute((innerException) => new ProjectCreationNotPossibleException("Could not create solution.", innerException)); string solutionFilePath = Path.Combine(outputPath, $"{solution.Name}.sln"); WriteProjects(solution, outputPath, solutionFilePath); if (solution.NugetConfig != null) { _projectFileWriter.Write(solution.NugetConfig, outputPath); } //_projectFileWriter.Write(new ProjectFile("global.json", "None", "{ \"sdk\": { \"version\": \"2.1.105\" }}"), outputPath); return(solutionFilePath); }
protected override void OnKeyUp(string text, char key, int caret, KeyEventArgs e) { Items?.Clear(); var word = GetCaretWord(text, caret).ToLower(); var snipetKeys = GetSnipetKeys(word); bool isCursor = e.Key == Key.Left || e.Key == Key.Right; bool isBlock = ScriptIndentAnalyze(text, caret).isScriptBlock; if (isBlock && !isCursor) { var blocks = CsTxt.Block.BlockFactory.Parse(text); var usings = blocks.OfType <UsingBlock>().Select(x => x.GetNamespace()).ToArray(); foreach (var name in DotNet.GetTypes(usings, word)) { Items?.Add(name); } } foreach (var snipetKey in snipetKeys) { if (!string.IsNullOrWhiteSpace(snipetKey)) { Items?.Add(snipetKey); } } if (e.Key == Key.Down || e.Key == Key.Up || e.Key == Key.Left || e.Key == Key.Right) { if (0 < (Items?.Count ?? 0)) { FocusCommand?.Execute(null); } } }
public ExecutionResult Dotnet(string command, string project, Dictionary <string, string> properties, bool assert_success = true) { return(DotNet.Execute(command, project, properties, assert_success: assert_success)); }
private void btnMerge_Click(object sender, EventArgs e) { //! Locate ILMerge.exe on disk or registry. //! Load ILMerge.exe dynamically. //! c:\Program Files (x86)\Microsoft\ILMerge\ILMerge.exe //! HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-21-822211721-2317658140-2171821640-1000\Components\F995DC6782BCD301ECDB40AF0BEFB501 //! FB8E12458022DA64AB4CCF9364EE3B15=C:\Program Files (x86)\Microsoft\ILMerge\ILMerge.exe //! or //! HKEY_CURRENT_USER\Software\Microsoft\Installer\Assemblies\C:|Program Files (x86)|Microsoft|ILMerge|ILMerge.exe //! just enumerate //! HKEY_CURRENT_USER\Software\Microsoft\Installer\Assemblies until a key ends in |ILMerge.exe //Debug.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFilesX86)); //Debug.WriteLine(Environment.GetFolderPath(Environment.SpecialFolder.CommonProgramFiles)); if (Engine == Merger.None) { return; } //! TODO Nicely find ILMerge. if (!DynaInvoke.PreLoadAssembly(iLMergePath, ilMerge)) { return; } arrAssemblies = new List<String>(); PreMerge(); if (!String.IsNullOrWhiteSpace(TxtOutputAssembly.Text) && !Directory.Exists(Path.GetDirectoryName(TxtOutputAssembly.Text.Trim()))) { Directory.CreateDirectory(Path.GetDirectoryName(TxtOutputAssembly.Text.Trim())); } //! [workitem:8741] if (String.IsNullOrWhiteSpace(TxtOutputAssembly.Text) || !Directory.Exists(Path.GetDirectoryName(TxtOutputAssembly.Text.Trim()))) { MessageBox.Show(Resources.Error_NoOutputPath, Resources.Error_Term, MessageBoxButtons.OK, MessageBoxIcon.Error); TxtOutputAssembly.Focus(); return; } else { TxtOutputAssembly.Text = TxtOutputAssembly.Text.Trim(); } if (File.Exists(TxtKeyFile.Text) && !File.Exists(TxtKeyFile.Text)) { MessageBox.Show(Resources.Error_KeyFileNotExists, Resources.Error_Term, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } for (Int32 i = 0; i < ListAssembly.Items.Count; i++) { if (((String)ListAssembly.Items[i].Tag).ToLower().Equals(TxtOutputAssembly.Text.ToLower())) { MessageBox.Show(Resources.Error_OutputConflict, Resources.Error_Term, MessageBoxButtons.OK, MessageBoxIcon.Error); TxtOutputAssembly.Focus(); return; } } if (File.Exists(TxtOutputAssembly.Text)) { try { FileInfo objFile = new FileInfo(TxtOutputAssembly.Text); objFile.Attributes = FileAttributes.Normal; objFile.Delete(); objFile = null; } catch (Exception) { MessageBox.Show(Resources.Error_OutputPathInUse, Resources.Error_Term, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (ListAssembly.SelectedItems.Count == 0) { for (Int32 i = 0; i < ListAssembly.Items.Count; i++) { if (Path.GetExtension((String)ListAssembly.Items[i].Tag).ToLower() == ".exe") { ListAssembly.Items[i].Selected = true; break; } } } if (ListAssembly.SelectedItems.Count == 0) { ListAssembly.Items[0].Selected = true; } arrAssemblies.Add(Primary); for (Int32 i = 0; i < ListAssembly.Items.Count; i++) { if (!arrAssemblies.Contains((String)ListAssembly.Items[i].Tag)) { arrAssemblies.Add((String)ListAssembly.Items[i].Tag); } } Console.WriteLine("{0}.{1}={1}", ilMerge, "CopyAttributes", DynaInvoke.SetProperty<Boolean>(iLMergePath, ilMerge, "CopyAttributes", ChkCopyAttributes.Checked)); Console.WriteLine("{0}.{1}={1}", ilMerge, "UnionMerge", DynaInvoke.SetProperty<Boolean>(iLMergePath, ilMerge, "UnionMerge", ChkUnionDuplicates.Checked)); Console.WriteLine("{0}.{1}={1}", ilMerge, "Internalize", DynaInvoke.SetProperty<Boolean>(iLMergePath, ilMerge, "Internalize", ChkInternalize.Checked)); Console.WriteLine("{0}.{1}={1}", ilMerge, "XmlDocumentation", DynaInvoke.SetProperty<Boolean>(iLMergePath, ilMerge, "XmlDocumentation", ChkMergeXml.Checked)); if (ChkSignKeyFile.Checked) { Console.WriteLine("{0}.{1}={2}", ilMerge, "KeyFile", DynaInvoke.SetProperty<String>(iLMergePath, ilMerge, "KeyFile", TxtKeyFile.Text)); Console.WriteLine("{0}.{1}={2}", ilMerge, "DelaySign", DynaInvoke.SetProperty<Boolean>(iLMergePath, ilMerge, "DelaySign", ChkDelayedSign.Checked)); } if (ChkGenerateLog.Checked) { Console.WriteLine("{0}.{1}={2}", ilMerge, "Log", DynaInvoke.SetProperty<Boolean>(iLMergePath, ilMerge, "Log", ChkGenerateLog.Checked).ToString()); Console.WriteLine("{0}.{1}={2}", ilMerge, "LogFile", DynaInvoke.SetProperty(iLMergePath, ilMerge, "LogFile", TxtLogFile.Text)); } Console.WriteLine("{0}.{1}={2}", ilMerge, "DebugInfo", DynaInvoke.SetProperty<Boolean>(iLMergePath, ilMerge, "DebugInfo", CboDebug.SelectedIndex == 0 ? true : false)); //! This must be done better!! //! TODO Enumerate Frameworks and find correct directories under Program Files. framework = (DotNet)CboTargetFramework.SelectedItem; frameversion = String.Format("{0}.{1}", framework.version.Major, framework.version.Minor); //! .Net v4.5 fixup. 4.5 is an inplace upgrade of 4.0 which does not alter the version number. //! [workitem:8745] if (Engine == Merger.ILMerge && framework.version.Major == 4 && framework.version.Minor == 5) { frameversion = "4.0"; } if (Engine == Merger.ILMerge && framework.version.Major == 4 && framework.version.Minor == 6) { frameversion = "4.0"; } String ff = frameversion; //! Fixups for ILRepack (does not support .NET 3/3.5 or 4.5 it seems), //! It uses the registry keys and does not support v2.0, v3.0, v3.5 or v4.5. // // case "v1": runtime = TargetRuntime.Net_1_0; break; // case "v1.1": runtime = TargetRuntime.Net_1_1; break; // case "v2": runtime = TargetRuntime.Net_2_0; break; // case "v4": runtime = TargetRuntime.Net_4_0; break; // if (Engine == Merger.ILRepack) { //! 16-11-2013 - veg - Workaround for Stack Overflow in ILRepack! frameversion = null; //! String.Format("v{0}", framework.version.Major); } try { if (Environment.Is64BitOperatingSystem) { Console.WriteLine("{0}.{1}('{2}', '{3}')", ilMerge, "SetTargetPlatform", frameversion, framework.x64WindowsPath); DynaInvoke.CallMethod<Object>(iLMergePath, ilMerge, "SetTargetPlatform", new String[] { frameversion, framework.x64WindowsPath }); } else { Console.WriteLine("{0}.{1}('{2}', '{3}')", ilMerge, "SetTargetPlatform", frameversion, framework.x86WindowsPath); DynaInvoke.CallMethod<Object>(iLMergePath, ilMerge, "SetTargetPlatform", new String[] { frameversion, framework.x86WindowsPath }); } } catch (TargetInvocationException) { MessageBox.Show(String.Format(Resources.Error_Framework, ff, ilMerge), Resources.Error_Term, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //Console.WriteLine("{0}.{1}={2}",ilMerge, "Version", DynaInvoke.GetProperty<Version>(iLMergePath, ilMerge, "Version")); //0=Dll //1=Exe //2=WinExe //3=ILMerge.Kind.SameAsPrimaryAssembly //public enum Kind //{ // Dll, //0 // Exe, //1 // WinExe, //2 // SameAsPrimaryAssembly //3 //} //fix for issue: 8737 switch (Engine) { case Merger.ILMerge: Console.WriteLine("{0}.{1}={2}", ilMerge, "TargetKind", DynaInvoke.SetProperty<Int32>(iLMergePath, ilMerge, "TargetKind", 3)); break; case Merger.ILRepack: //! Fix for ILRepack which uses a Nullable Enum. Console.WriteLine("{0}.{1}={2}", ilMerge, "TargetKind", DynaInvoke.SetProperty<Int32?>(iLMergePath, ilMerge, "TargetKind", (Int32?)3)); break; } Console.WriteLine("{0}.{1}={2}", ilMerge, "OutputFile", DynaInvoke.SetProperty<String>(iLMergePath, ilMerge, "OutputFile", TxtOutputAssembly.Text)); // Clear input assemblies. Console.WriteLine("{0}.{1}(", ilMerge, "SetInputAssemblies"); foreach (String asm in arrAssemblies) { Console.WriteLine(" '{0}'", asm); } Console.WriteLine(" )"); DynaInvoke.CallMethod<Object>(iLMergePath, ilMerge, "SetInputAssemblies", new Object[] { arrAssemblies.ToArray() }); if (ChkGenCmdLine.Checked) { String cmdFile = Path.Combine( Path.GetDirectoryName(TxtOutputAssembly.Text.Trim()), Path.ChangeExtension(Path.GetFileName(TxtOutputAssembly.Text.Trim()), ".txt")); File.WriteAllText(cmdFile, DoGenerateCmdLine()); Process.Start(new ProcessStartInfo(cmdFile)); } //Cursor = Cursors.WaitCursor EnableForm(false); WorkerILMerge.RunWorkerAsync(); }
public override async Task <Diagonosis> Examine(PatientHistory history) { var dn = new DotNet(); var missingDiagnosis = new Diagonosis(Status.Error, this, new Prescription(".NET SDK not installed")); if (!dn.Exists) { return(missingDiagnosis); } var sdks = await dn.GetSdks(); var missingSdks = new List <Manifest.DotNetSdk>(); var sentinelFiles = new List <string>(); if (RequiredSdks?.Any() ?? false) { foreach (var rs in RequiredSdks) { if (!sdks.Any(s => s.Version.Equals(NuGetVersion.Parse(rs.Version)))) { missingSdks.Add(rs); } } } DotNetSdkInfo bestSdk = null; foreach (var sdk in sdks) { var requiredSdk = RequiredSdks.FirstOrDefault(rs => sdk.Version == NuGetVersion.Parse(rs.Version)); if (requiredSdk != null) { if (bestSdk == null || sdk.Version > bestSdk.Version) { bestSdk = sdk; } if (requiredSdk.EnableWorkloadResolver) { var sentinelPath = Path.Combine(sdk.Directory.FullName, "EnableWorkloadResolver.sentinel"); sentinelFiles.Add(sentinelPath); } ReportStatus($"{sdk.Version} - {sdk.Directory}", Status.Ok); } else { ReportStatus($"{sdk.Version} - {sdk.Directory}", null); } } // Find newest compatible sdk if (bestSdk != null) { Util.SetDoctorEnvironmentVariable("DOTNET_SDK", bestSdk.Directory.FullName); } // Add sentinel files that should be considered if (sentinelFiles.Any()) { history.AddNotes(this, "sentinel_files", sentinelFiles.ToArray()); } if (missingSdks.Any()) { var str = SdkListToString(); return(new Diagonosis(Status.Error, this, $".NET SDK {str} not installed.", new Prescription($"Download .NET SDK {str}", new BootsRemedy(missingSdks.Select(ms => (ms.Urls.For(Util.Platform)?.ToString(), ".NET SDK " + ms.Version)).ToArray()) { AdminRequirements = new [] { (Platform.Windows, true) }
public void GetLatestSdkVersion() { var sdkVersion = new DotNet().LatestSdkVersion; Assert.NotNull(sdkVersion); }
public void GetLatestRuntimeVersion() { var runtimeVersion = new DotNet().LatestRuntimeVersion; Assert.NotNull(runtimeVersion); }