/// <inheritdoc/> public Export([NotNull] ICommandHandler handler) : base(handler) { //Options.Remove("xml"); //Options.Remove("show"); Options.Add("no-implementations", () => Resources.OptionExportNoImplementations, _ => _noImplementations = true); Options.Add("include-zero-install", () => Resources.OptionExportIncludeZeroInstall, _ => _includeZeroInstall = true); Options.Add("bootstrap=", () => Resources.OptionExportBootstrap + Environment.NewLine + SupportedValues<BootstrapMode>(), (BootstrapMode x) => _bootstrapType = x); }
private bool BootstrapAnswer(string requestStr, out byte[] answer) { answer = null; if (requestStr == "00") { answer = new byte[] { 0x55 }; serialPort.StopBits = StopBits.Two; bootstrapMode = BootstrapMode.Yes; return(true); } return(false); }
/// <summary> /// Loads the embedded configuration. /// </summary> private EmbeddedConfig() { var lines = typeof(EmbeddedConfig).GetEmbeddedString("EmbeddedConfig.txt").SplitMultilineText(); try { AppUri = new FeedUri(ConfigurationManager.AppSettings["app_uri"] ?? lines[0].TrimEnd()); Log.Info("Embedded config: AppUri: " + AppUri); AppName = ConfigurationManager.AppSettings["app_name"] ?? lines[1].TrimEnd(); Log.Info("Embedded config: AppName: " + AppName); AppMode = GetAppMode(ConfigurationManager.AppSettings["app_mode"] ?? lines[2].TrimEnd()); Log.Info("Embedded config: AppMode: " + AppMode); } catch (UriFormatException) { // No (valid) feed URI set } }
/// <summary> /// Loads the embedded configuration. /// </summary> private EmbeddedConfig() { var lines = typeof(EmbeddedConfig).GetEmbeddedString("EmbeddedConfig.txt").SplitMultilineText(); try { AppUri = new FeedUri(ConfigurationManager.AppSettings["app_uri"] ?? lines[0].TrimEnd()); Log.Info("Embedded config: AppUri: " + AppUri); AppName = ConfigurationManager.AppSettings["app_name"] ?? lines[1].TrimEnd(); Log.Info("Embedded config: AppName: " + AppName); AppMode = GetAppMode(ConfigurationManager.AppSettings["app_mode"] ?? lines[2].TrimEnd()); Log.Info("Embedded config: AppMode: " + AppMode); } catch (UriFormatException) { // No (valid) feed URI set } }
int IVsDeployableProjectCfg.StartDeploy(IVsOutputWindowPane pIVsOutputWindowPane, uint dwOptions) { outputWindow = pIVsOutputWindowPane; if (!NotifyBeginDeploy()) { return(VSConstants.E_ABORT); } IVsAppContainerBootstrapper4 bootstrapper = (IVsAppContainerBootstrapper4)ServiceProvider.GlobalProvider.GetService(typeof(SVsAppContainerProjectDeploy)); VsBootstrapperPackageInfo[] packagesToDeployList = new VsBootstrapperPackageInfo[] { new VsBootstrapperPackageInfo { PackageName = "D8B19935-BDBF-4D5B-9619-A6693AFD4554" }, // ScriptMsVsMon new VsBootstrapperPackageInfo { PackageName = "EB22551A-7F66-465F-B53F-E5ABA0C0574E" }, // NativeMsVsMon new VsBootstrapperPackageInfo { PackageName = "62B807E2-6539-46FB-8D67-A73DC9499940" } // ManagedMsVsMon }; VsBootstrapperPackageInfo[] optionalPackagesToDeploy = new VsBootstrapperPackageInfo[] { new VsBootstrapperPackageInfo { PackageName = "FEC73B34-86DE-4EA8-BFF4-3600A0443E9C" }, // NativeMsVsMonDependency new VsBootstrapperPackageInfo { PackageName = "B968CC6A-D2C8-4197-88E3-11662042C291" }, // XamlUIDebugging new VsBootstrapperPackageInfo { PackageName = "8CDEABEF-33E1-4A23-A13F-94A49FF36E84" } // XamlUIDebuggingDependency }; BootstrapMode bootStrapMode = BootstrapMode.UniversalBootstrapMode; VsDebugTargetInfo2[] targets; int hr = QueryDebugTargets(out targets); if (ErrorHandler.Failed(hr)) { NotifyEndDeploy(0); return(hr); } string projectUniqueName = GetProjectUniqueName(); IVsTask localAppContainerBootstrapperOperation = bootstrapper.BootstrapAsync(projectUniqueName, targets[0].bstrRemoteMachine, bootStrapMode, packagesToDeployList.Length, packagesToDeployList, optionalPackagesToDeploy.Length, optionalPackagesToDeploy, this); lock (syncObject) { this.appContainerBootstrapperOperation = localAppContainerBootstrapperOperation; } ThreadHelper.JoinableTaskFactory.RunAsync(async() => { IVsAppContainerBootstrapperResult result = null; try { object taskResult = await localAppContainerBootstrapperOperation; result = (IVsAppContainerBootstrapperResult)taskResult; } finally { this.OnBootstrapEnd(targets[0].bstrRemoteMachine, projectUniqueName, result); } }); return(VSConstants.S_OK); }
/// <summary> /// Creates a new export command. /// </summary> /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about download and IO tasks.</param> public Export(ICommandHandler handler) : base(handler, outputOptions: false) { Options.Add("no-implementations", () => Resources.OptionExportNoImplementations, _ => _noImplementations = true); Options.Add("include-zero-install", () => Resources.OptionExportIncludeZeroInstall, _ => _includeZeroInstall = true); if (Config.SelfUpdateUri == new FeedUri(Config.DefaultSelfUpdateUri)) { Options.Add("bootstrap=", () => Resources.OptionExportBootstrap + Environment.NewLine + SupportedValues <BootstrapMode>(), (BootstrapMode x) => _bootstrapType = x); } }
/// <inheritdoc/> public Export(ICommandHandler handler) : base(handler) { //Options.Remove("xml"); //Options.Remove("show"); Options.Add("no-implementations", () => Resources.OptionExportNoImplementations, _ => _noImplementations = true); Options.Add("include-zero-install", () => Resources.OptionExportIncludeZeroInstall, _ => _includeZeroInstall = true); Options.Add("bootstrap=", () => Resources.OptionExportBootstrap + Environment.NewLine + SupportedValues <BootstrapMode>(), (BootstrapMode x) => _bootstrapType = x); }
public int StartDeploy(IVsOutputWindowPane pIVsOutputWindowPane, uint dwOptions) { outputWindow = pIVsOutputWindowPane; if (!NotifyBeginDeploy()) { return(VSConstants.E_ABORT); } VsDebugTargetInfo2[] targets; int hr = QueryDebugTargets(out targets); if (ErrorHandler.Failed(hr)) { NotifyEndDeploy(0); return(hr); } string projectUniqueName = this.GetProjectUniqueName(); IVsAppContainerBootstrapper4 bootstrapper = (IVsAppContainerBootstrapper4)ServiceProvider.GlobalProvider.GetService(typeof(SVsAppContainerProjectDeploy)); VsBootstrapperPackageInfo[] packagesToDeployList = new VsBootstrapperPackageInfo[] { #if DEV15 new VsBootstrapperPackageInfo { PackageName = "8B426345-3B98-4111-819A-46533C393CE5" }, // NativeMsVsMon new VsBootstrapperPackageInfo { PackageName = "973CA972-0C5F-4F19-B436-814CF773A102" } // ManagedMsVsMon #elif DEV14 new VsBootstrapperPackageInfo { PackageName = "EB22551A-7F66-465F-B53F-E5ABA0C0574E" }, // NativeMsVsMon new VsBootstrapperPackageInfo { PackageName = "62B807E2-6539-46FB-8D67-A73DC9499940" } // ManagedMsVsMon #else #error Unsupported version of Visual Studio #endif }; VsBootstrapperPackageInfo[] optionalPackagesToDeploy = new VsBootstrapperPackageInfo[] { #if DEV15 new VsBootstrapperPackageInfo { PackageName = "92063DB3-36E3-434E-840C-DEE8DA2AD4B7" }, // NativeMsVsMonDependency #elif DEV14 new VsBootstrapperPackageInfo { PackageName = "FEC73B34-86DE-4EA8-BFF4-3600A0443E9C" }, // NativeMsVsMonDependency #else #error Unsupported version of Visual Studio #endif new VsBootstrapperPackageInfo { PackageName = "B968CC6A-D2C8-4197-88E3-11662042C291" }, // XamlUIDebugging new VsBootstrapperPackageInfo { PackageName = "8CDEABEF-33E1-4A23-A13F-94A49FF36E84" } // XamlUIDebuggingDependency }; BootstrapMode bootStrapMode = BootstrapMode.UniversalBootstrapMode; IVsTask localAppContainerBootstrapperOperation = bootstrapper.BootstrapAsync(projectUniqueName, targets[0].bstrRemoteMachine, bootStrapMode, packagesToDeployList.Length, packagesToDeployList, optionalPackagesToDeploy.Length, optionalPackagesToDeploy, this); lock (syncObject) { this.appContainerBootstrapperOperation = localAppContainerBootstrapperOperation; } ThreadHelper.JoinableTaskFactory.RunAsync(async() => { IVsAppContainerBootstrapperResult result = null; try { object taskResult = await localAppContainerBootstrapperOperation; result = (IVsAppContainerBootstrapperResult)taskResult; } finally { this.OnBootstrapEnd(projectUniqueName, result); } }); return(VSConstants.S_OK); }
private void BootstrapModeExecute() { int length = 0; Array.Clear(buffer, 0, buffer.Length); do { try { buffer[length++] = (byte)serialPort.ReadByte(); serialPort.Write(buffer, length - 1, 1); } catch (TimeoutException) { } } while (length < size); var checkSumm = DataHelper.CalcXorCRC(buffer, 0, length - 1); if (checkSumm == buffer[length - 1]) { buffer[length] = 0x55; } else { buffer[length] = 0xFE; } serialPort.Write(buffer, length, 1); #region string requestStr = DataHelper.ByteArrayToStr(buffer, length); log.Add(String.Format("{0}\t->\t{1}", requestStr, buffer[length].ToString("X2"))); var currentTicks = DateTime.Now.Ticks; if ((currentTicks - ticks) < logUpdateTimeout) { return; } uiContext.Send( delegate { if (currentLogRow > logMaxRows) { SaveLogToFile(protocolTrace.Text); protocolTrace.ResetText(); currentLogRow = 0; } protocolTrace.AppendText(Environment.NewLine); protocolTrace.AppendText(String.Join(Environment.NewLine, log.ToArray())); } , null); currentLogRow += log.Count; log.Clear(); #endregion if (buffer[0] == 00) { bootstrapMode = BootstrapMode.Yes; } switch (bootstrapMode) { case BootstrapMode.Yes: #region switch (buffer[1]) { case 00: bootstrapMode = BootstrapMode.Mode0; startAddress = (buffer[2] << 8) + buffer[3]; size = buffer[6] + 2; loaderIndex = 0; break; case 01: bootstrapMode = BootstrapMode.Mode1; startAddress = (buffer[2] << 8) + buffer[3]; break; case 02: bootstrapMode = BootstrapMode.Mode2; break; case 03: bootstrapMode = BootstrapMode.Mode3; break; } break; #endregion case BootstrapMode.Mode0: #region switch (buffer[0]) { case 01: Buffer.BlockCopy(buffer, 1, loader, loaderIndex, size - 2); loaderIndex += (size - 2); break; case 02: bootstrapMode = BootstrapMode.Yes; size = 8; Buffer.BlockCopy(buffer, 2, loader, loaderIndex, size - 3); loaderIndex += (size - 3); var file = new byte[loaderIndex]; Buffer.BlockCopy(loader, 0, file, 0, loaderIndex); File.WriteAllBytes(@"c:\loader.bin", file); break; } break; #endregion } }