public override InstallSetupResult Execute(object model) { //This is synonymous with library.RefreshContent() - but we don't want to use library // for anything anymore so welll use the method that it is wrapping. This will just make sure // the correct xml structure exists in the xml cache file. This is required by some upgrade scripts // that may modify the cmsContentXml table directly. DistributedCache.Instance.RefreshAllPageCache(); // Update configurationStatus GlobalSettings.ConfigurationStatus = UmbracoVersion.GetSemanticVersion().ToSemanticString(); // Update ClientDependency version var clientDependencyConfig = new ClientDependencyConfiguration(_applicationContext.ProfilingLogger.Logger); var clientDependencyUpdated = clientDependencyConfig.IncreaseVersionNumber(); var security = new WebSecurity(_httpContext, _applicationContext); security.PerformLogin(0); //reports the ended install var ih = new InstallHelper(UmbracoContext.Current); ih.InstallStatus(true, ""); return(null); }
public IEnumerable <Package> GetPackages() { var installHelper = new InstallHelper(UmbracoContext); var starterKits = installHelper.GetStarterKits(); return(starterKits); }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (_repo.HasConnection()) { try { //clear progress bar cache InstallHelper.ClearProgress(); var skinsCollection = _repo.Webservice.Skins(StarterKitGuid.ToString()); var numberOfSkins = skinsCollection.Length; this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "skinCounter", "var numberOfSkins = " + numberOfSkins, true); rep_starterKitDesigns.DataSource = skinsCollection; rep_starterKitDesigns.DataBind(); } catch (Exception ex) { LogHelper.Error <LoadStarterKitDesigns>("An error occurred initializing", ex); ShowConnectionError(); } } else { ShowConnectionError(); } }
public StarterKitDownloadStep(IContentService contentService, IPackagingService packageService, InstallHelper installHelper, IUmbracoContextAccessor umbracoContextAccessor) { _installHelper = installHelper; _umbracoContextAccessor = umbracoContextAccessor; _contentService = contentService; _packageService = packageService; }
/// <summary> /// What the instruction should do /// </summary> protected override void _Process() { // Checking parameters string fileName = _GetParameter(PatchInstructionParameter.ParameterName.mappedFileName, false); string cleanFileName = fileName.Replace(@"\", "_"); string lockCode = _GetParameter(PatchInstructionParameter.ParameterName.lockCode, false); // Checks if specified BNK file has already been remapped string modName = InstallHelper.GetAlreadyRemappedModNames(cleanFileName); if (string.Empty.Equals(modName) || modName.Contains(PatchHelper.CurrentPatch.Name) || InstallHelper.IsSameLockCode(cleanFileName, lockCode)) { // Not remapped yet or overwrite allowed, telling installer to create file during finalization InstallHelper.RemappedFiles.Add(cleanFileName, lockCode); } else { // Already remapped string realFileName = _GetParameter(PatchInstructionParameter.ParameterName.mappedFileName, true); string message = string.Format("'{0}' mod(s) already replacing following file:\r\n{1}", modName, realFileName); PatchHelper.AddMessage(string.Concat(message, Environment.NewLine, "Please uninstall this mod first.")); throw new Exception(message); } }
protected override void OnInit(EventArgs e) { base.OnInit(e); //clear progressbar cache InstallHelper.ClearProgress(); if (_repo.HasConnection()) { try { rep_starterKits.DataSource = _repo.Webservice.StarterKits(); rep_starterKits.DataBind(); } catch (Exception ex) { LogHelper.Error <LoadStarterKits>("Cannot connect to package repository", ex); CannotConnect = true; } } else { CannotConnect = true; } }
public override InstallSetupResult Execute(object model) { var ih = new InstallHelper(UmbracoContext.Current); //During a new install we'll log the default user in (which is id = 0). // During an upgrade, the user will already need to be logged in in order to run the installer. var security = new WebSecurity(_httpContext, _applicationContext); //we do this check here because for upgrades the user will already be logged in, for brand new installs, // they will not be logged in, however we cannot check the current installation status because it will tell // us that it is in 'upgrade' because we already have a database conn configured and a database. if (security.IsAuthenticated() == false && GlobalSettings.ConfigurationStatus.IsNullOrWhiteSpace()) { security.PerformLogin(0); } //This is synonymous with library.RefreshContent() - but we don't want to use library // for anything anymore so welll use the method that it is wrapping. This will just make sure // the correct xml structure exists in the xml cache file. This is required by some upgrade scripts // that may modify the cmsContentXml table directly. DistributedCache.Instance.RefreshAllPageCache(); // Update configurationStatus GlobalSettings.ConfigurationStatus = UmbracoVersion.GetSemanticVersion().ToSemanticString(); //reports the ended install ih.InstallStatus(true, ""); return(null); }
private void init() { isInstalled = InstallHelper.IsInstalled(); status = new FirewallStatusWrapper(); if (status.PrivateIsOutBlocked && isInstalled) { status.PrivateIsOutBlockedNotif = true; status.PrivateIsOutBlocked = false; } if (status.PublicIsOutBlocked && isInstalled) { status.PublicIsOutBlockedNotif = true; status.PublicIsOutBlocked = false; } if (status.DomainIsOutBlocked && isInstalled) { status.DomainIsOutBlockedNotif = true; status.DomainIsOutBlocked = false; } stackOptions.DataContext = status; messsageInfoPanel.DataContext = this; }
/// <summary> /// Create an instance of the hosting class /// </summary> /// <param name="target">target instance</param> public SOSHost(ITarget target) { Target = target; ConsoleService = target.Services.GetService <IConsoleService>(); ModuleService = target.Services.GetService <IModuleService>(); ThreadService = target.Services.GetService <IThreadService>(); MemoryService = target.Services.GetService <IMemoryService>(); _ignoreAddressBitsMask = MemoryService.SignExtensionMask(); string rid = InstallHelper.GetRid(); SOSPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), rid); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { var debugClient = new DebugClient(this); _interface = debugClient.IDebugClient; } else { var lldbServices = new LLDBServices(this); _interface = lldbServices.ILLDBServices; } _hostWrapper = new HostWrapper(target.Host); _hostWrapper.AddServiceWrapper(SymbolServiceWrapper.IID_ISymbolService, () => new SymbolServiceWrapper(target.Host)); }
public bool CheckInstall(GlobalSettings s) { try { using (var session = docStore.OpenSession()) { var results = session.Query <WritaPost>().Count(); if (results == 0) { InstallSet set = InstallHelper.GetInstall(); CreatePost(set.homepage); CreatePost(set.firstpost); //db.WritaSettings.Add(set.settings); //db.SaveChanges(); using (var f = docStore.OpenSession()) { f.Store(set.settings); f.SaveChanges(); } //install. } session.SaveChanges(); System.Threading.Thread.Sleep(3000); } return(true); } catch { return(false); } }
public ActionResult Index() { if (ApplicationContext.Current.IsConfigured) { return(Redirect(SystemDirectories.Umbraco.EnsureEndsWith('/'))); } if (ApplicationContext.Current.IsUpgrading) { var result = _umbracoContext.Security.ValidateCurrentUser(false); switch (result) { case ValidateRequestAttempt.FailedNoPrivileges: case ValidateRequestAttempt.FailedNoContextId: return(Redirect(SystemDirectories.Umbraco + "/AuthorizeUpgrade?redir=" + Server.UrlEncode(Request.RawUrl))); } } //gen the install base url ViewBag.InstallApiBaseUrl = Url.GetUmbracoApiService("GetSetup", "InstallApi", "UmbracoInstall").TrimEnd("GetSetup"); //get the base umbraco folder ViewBag.UmbracoBaseFolder = IOHelper.ResolveUrl(SystemDirectories.Umbraco); InstallHelper ih = new InstallHelper(_umbracoContext); ih.InstallStatus(false, ""); //always ensure full path (see NOTE in the class remarks) return(View(GlobalSettings.Path.EnsureEndsWith('/') + "install/views/index.cshtml")); }
int ConfigMongoDB(bool bAdd, out string strError) { strError = ""; string strDataDir = this.textBox_dataDir.Text; string strInstanceName = this.textBox_instanceName.Text; if (string.IsNullOrEmpty(strDataDir)) { strError = "尚未指定数据目录"; return(-1); } string strLibraryXmlFileName = Path.Combine(strDataDir, "library.xml"); if (File.Exists(strLibraryXmlFileName) == false) { strError = "配置文件 '" + strLibraryXmlFileName + "' 不存在,无法进行进一步配置"; return(-1); } return(InstallHelper.SetupMongoDB( strLibraryXmlFileName, strInstanceName, bAdd, out strError)); }
/// <summary> /// Initialize objects before anything during the boot cycle happens /// </summary> /// <returns></returns> public override IBootManager Initialize() { base.Initialize(); _examineStartup = new ExamineStartup(ApplicationContext); _examineStartup.Initialize(); ConfigureClientDependency(); //set master controller factory ControllerBuilder.Current.SetControllerFactory( new MasterControllerFactory(FilteredControllerFactoriesResolver.Current)); //set the render view engine ViewEngines.Engines.Add(new RenderViewEngine()); //set the plugin view engine ViewEngines.Engines.Add(new PluginViewEngine()); //set model binder ModelBinderProviders.BinderProviders.Add(RenderModelBinder.Instance); // is a provider ////add the profiling action filter //GlobalFilters.Filters.Add(new ProfilingActionFilter()); // Disable the X-AspNetMvc-Version HTTP Header MvcHandler.DisableMvcResponseHeader = true; InstallHelper insHelper = new InstallHelper(UmbracoContext.Current); insHelper.DeleteLegacyInstaller(); return(this); }
public int OnExecute(IConsole console, CommandLineApplication app) { if (InstallSOS || UninstallSOS) { try { var sosInstaller = new InstallHelper((message) => console.WriteLine(message)); if (SOSSourcePath != null) { sosInstaller.SOSSourcePath = SOSSourcePath; } if (UninstallSOS) { sosInstaller.Uninstall(); } else { sosInstaller.Install(); } } catch (SOSInstallerException ex) { console.Error.WriteLine(ex.Message); return(1); } } return(0); }
/// <summary> /// Redefines contextual controls /// </summary> private void _UpdateContextualControls() { // Info label (bottom) string info; // Warning if this mod is already installed bool isInstalled = InstallHelper.IsModInstalled(_CurrentInstallPatch.SlotRef, _CurrentInstallPatch.Name); if (isInstalled) { info = _MESSAGE_ALREADY_INSTALLED; } else { info = _MESSAGE_NOT_INSTALLED; } infoLabel.Text = info; // Uninstall button bool isUninstallAvailable = false; if (_CurrentUninstallPatch != null && isInstalled) { isUninstallAvailable = true; } uninstallButton.Enabled = isUninstallAvailable; }
private void btnOK_Click(object sender, RoutedEventArgs e) { Settings.Default.FirstRun = true; // reset the flag to log os info again once Settings.Default.Save(); InstallHelper.SetAuditPolConnection(enableSuccess: Settings.Default.AuditPolEnableSuccessEvent, enableFailure: true); // always turn this on for now so that security log and notifier works Close(); }
public override InstallSetupResult Execute(Guid?starterKitId) { //if there is no value assigned then use the default starter kit if (starterKitId.HasValue == false) { var installHelper = new InstallHelper(UmbracoContext.Current); var starterKits = installHelper.GetStarterKits().FirstOrDefault(); if (starterKits != null) { starterKitId = starterKits.Id; } else { return(null); } } else if (starterKitId.Value == Guid.Empty) { //if the startkit id is an empty GUID then it means the user has decided not to install one // so we'll just exit return(null); } var result = DownloadPackageFiles(starterKitId.Value); _applicationContext.RestartApplicationPool(_httpContext); return(new InstallSetupResult(new Dictionary <string, object> { { "manifestId", result.Item2 }, { "packageFile", result.Item1 } })); }
public static async Task <EventStoreInstance> StartAsync() { var installedSoftware = await InstallHelper.InstallAsync(SoftwareDescription).ConfigureAwait(false); var tcpPort = TcpHelper.GetFreePort(); var httpPort = TcpHelper.GetFreePort(); var connectionStringUri = new Uri($"tcp://*****:*****@{IPAddress.Loopback}:{tcpPort}"); var exePath = Path.Combine(installedSoftware.InstallPath, "EventStore.ClusterNode.exe"); IDisposable processDisposable = null; try { processDisposable = ProcessHelper.StartExe( exePath, "'admin' user added to $users", "--mem-db=True", "--cluster-size=1", $"--ext-tcp-port={tcpPort}", $"--ext-http-port={httpPort}"); var connectionSettings = ConnectionSettings.Create() .EnableVerboseLogging() .KeepReconnecting() .SetDefaultUserCredentials(new UserCredentials("admin", "changeit")) .Build(); using (var eventStoreConnection = EventStoreConnection.Create(connectionSettings, connectionStringUri)) { var start = DateTimeOffset.Now; while (true) { if (start + TimeSpan.FromSeconds(10) < DateTimeOffset.Now) { throw new Exception("Failed to connect to EventStore"); } try { await eventStoreConnection.ConnectAsync().ConfigureAwait(false); break; } catch (Exception) { Console.WriteLine("Failed to connect, retrying"); } } } } catch (Exception) { processDisposable.DisposeSafe("Failed to dispose EventStore process"); throw; } return(new EventStoreInstance( connectionStringUri, processDisposable)); }
public override global::System.Data.DataSet Clone() { InstallHelper cln = ((InstallHelper)(base.Clone())); cln.InitVars(); cln.SchemaSerializationMode = this.SchemaSerializationMode; return(cln); }
public SetUmbracoVersionStep(HttpContextBase httpContext, InstallHelper installHelper, IGlobalSettings globalSettings, IUserService userService, DistributedCache distributedCache) { _httpContext = httpContext; _installHelper = installHelper; _globalSettings = globalSettings; _userService = userService; _distributedCache = distributedCache; }
public InstallController(IUmbracoContextAccessor umbracoContextAccessor, InstallHelper installHelper, IRuntimeState runtime, ILogger logger, IGlobalSettings globalSettings) { _umbracoContextAccessor = umbracoContextAccessor; _installHelper = installHelper; _runtime = runtime; _logger = logger; _globalSettings = globalSettings; }
public InstallApiController(DatabaseBuilder databaseBuilder, IProfilingLogger proflog, InstallHelper installHelper, InstallStepCollection installSteps) { _databaseBuilder = databaseBuilder ?? throw new ArgumentNullException(nameof(databaseBuilder)); _proflog = proflog ?? throw new ArgumentNullException(nameof(proflog)); _installSteps = installSteps; InstallHelper = installHelper; _logger = _proflog; }
protected void ChangePasswordClick(object sender, System.EventArgs e) { Page.Validate(); if (Page.IsValid) { var u = User.GetUser(0); var user = Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].GetUser(0, true); user.ChangePassword(u.GetPassword(), tb_password.Text.Trim()); // Is it using the default membership provider if (Membership.Providers[UmbracoSettings.DefaultBackofficeProvider] is UsersMembershipProvider) { // Save user in membership provider var umbracoUser = user as UsersMembershipUser; umbracoUser.FullName = tb_name.Text.Trim(); Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].UpdateUser(umbracoUser); // Save user details u.Email = tb_email.Text.Trim(); } else { u.Name = tb_name.Text.Trim(); if (!(Membership.Providers[UmbracoSettings.DefaultBackofficeProvider] is ActiveDirectoryMembershipProvider)) { Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].UpdateUser(user); } } // we need to update the login name here as it's set to the old name when saving the user via the membership provider! u.LoginName = tb_login.Text; u.Save(); if (cb_newsletter.Checked) { try { var client = new System.Net.WebClient(); var values = new NameValueCollection { { "name", tb_name.Text }, { "email", tb_email.Text } }; client.UploadValues("http://umbraco.org/base/Ecom/SubmitEmail/installer.aspx", values); } catch { /* fail in silence */ } } if (String.IsNullOrWhiteSpace(GlobalSettings.ConfigurationStatus)) { UmbracoContext.Current.Security.PerformLogin(u.Id); } InstallHelper.RedirectToNextStep(Page, GetCurrentStep()); } }
private void btnSave_Click(object sender, RoutedEventArgs e) { //PrivateIsOutBlockedNotif is also valid for public and domain status.PublicIsOutBlockedNotif = status.PrivateIsOutBlockedNotif; status.DomainIsOutBlockedNotif = status.PrivateIsOutBlockedNotif; if (status.PrivateIsOutBlockedNotif == false) { //if not blocked, allowed must be true if (status.PrivateIsOutBlocked == false) { status.PrivateIsOutAllowed = true; } if (status.PublicIsOutBlocked == false) { status.PublicIsOutAllowed = true; } if (status.DomainIsOutBlocked == false) { status.DomainIsOutAllowed = true; } } status.Save(); bool checkResult(Func <bool> boolFunction, string okMsg, string errorMsg) { try { bool success = boolFunction.Invoke(); LastMessage = success ? okMsg : errorMsg; LogHelper.Debug($"{boolFunction.Method.Name}: {LastMessage}"); return(success); } catch (Exception ex) { LogHelper.Error(ex.Message, ex); LastMessage = $"{errorMsg}: {ex.Message}"; return(false); } } if (!isInstalled) { if (!InstallHelper.Install(checkResult)) { return; } } else if (isInstalled) { if (!InstallHelper.InstallCheck(checkResult)) { return; } } init(); }
private void Fix(string project, string reference) { var moduleName = Helper.GetRootFolder(reference); if (moduleName == rootModuleName && reference.ToLower().Contains("\\packages\\")) { return; } if (!Directory.Exists(Path.Combine(Helper.CurrentWorkspace, moduleName))) { if (!missingModules.Contains(moduleName)) { ConsoleWriter.WriteError($"Can't find module '{moduleName}'"); missingModules.Add(moduleName); } return; } if (!File.Exists(Path.Combine(Helper.CurrentWorkspace, moduleName, Helper.YamlSpecFile))) { fixReferenceResult.NoYamlModules.Add(moduleName); return; } var installFiles = InstallHelper.GetAllInstallFiles(moduleName).ToList(); var withSameName = installFiles.Where(file => Path.GetFileName(file).Equals(Path.GetFileName(reference))).ToList(); if (!withSameName.Any()) { withSameName = InstallHelper.GetAllInstallFiles().Where(file => Path.GetFileName(file).Equals(Path.GetFileName(reference))).ToList(); } if (withSameName.Any(r => Path.GetFullPath(r) == Path.GetFullPath(reference))) { TryAddToDeps(reference, project); return; } if (!withSameName.Any()) { if (Helper.GetRootFolder(reference) != rootModuleName) { fixReferenceResult.NotFound[project].Add(reference); } return; } var newReference = withSameName.Count == 1 && moduleName != rootModuleName ? withSameName.First() : UserChoseReplace(project, reference, withSameName); if (newReference != null) { UpdateReference(newReference, project); TryAddToDeps(newReference, project); hasFixedReferences = true; } }
protected override void Process(ReinstallArgs args) { Assert.ArgumentNotNull(args, "args"); var installRadControls = Directory.Exists(Path.Combine(args.WebRootPath, InstallHelper.RadControls)); var installDictionaries = Directory.Exists(Path.Combine(args.WebRootPath, InstallHelper.Dictionaries)); InstallHelper.ExtractFile(args.PackagePath, args.WebRootPath, args.DatabasesFolderPath, args.DataFolderPath, installRadControls, installDictionaries, this.Controller); }
/// <summary> /// What the instruction should do /// </summary> protected override void _Process() { // No parameters if (!InstallHelper.IsCommunityPatchInstalled()) { PatchHelper.AddMessage("Unable to install current mod as latest Community Patch is required.\r\nGet it at http://www.oahucars-unlimited.com"); throw new Exception("Community Patch is not installed on this system."); } }
public static async Task <ElasticsearchInstance> StartAsync() { if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("JAVA_HOME"))) { throw new InvalidOperationException("The 'JAVA_HOME' environment variable is required"); } var installedSoftware = await InstallHelper.InstallAsync(SoftwareDescription).ConfigureAwait(false); var version = SoftwareDescription.Version; var installPath = Path.Combine(installedSoftware.InstallPath, $"elasticsearch-{version.Major}.{version.Minor}.{version.Build}"); var tcpPort = TcpHelper.GetFreePort(); var exePath = Path.Combine(installPath, "bin", "elasticsearch.bat"); var nodeName = $"node-{Guid.NewGuid().ToString("N")}"; var settings = new Dictionary <string, string> { { "http.port", tcpPort.ToString() }, { "node.name", nodeName }, { "index.number_of_shards", "1" }, { "index.number_of_replicas", "0" }, { "gateway.expected_nodes", "1" }, { "discovery.zen.ping.multicast.enabled", "false" }, { "cluster.routing.allocation.disk.threshold_enabled", "false" } }; var configFilePath = Path.Combine(installPath, "config", "elasticsearch.yml"); if (!File.Exists(configFilePath)) { throw new ApplicationException($"Could not find config file at '{configFilePath}'"); } File.WriteAllLines(configFilePath, settings.Select(kv => $"{kv.Key}: {kv.Value}")); IDisposable processDisposable = null; try { processDisposable = ProcessHelper.StartExe(exePath, $"[${nodeName}] started"); var elasticsearchInstance = new ElasticsearchInstance( new Uri($"http://127.0.0.1:{tcpPort}"), processDisposable); await elasticsearchInstance.WaitForGeenStateAsync().ConfigureAwait(false); await elasticsearchInstance.DeleteEverythingAsync().ConfigureAwait(false); return(elasticsearchInstance); } catch (Exception) { processDisposable.DisposeSafe("Failed to dispose Elasticsearch process"); throw; } }
/// <summary> /// Initialize objects before anything during the boot cycle happens /// </summary> /// <returns></returns> public override IBootManager Initialize() { //This is basically a hack for this item: http://issues.umbraco.org/issue/U4-5976 // when Examine initializes it will try to rebuild if the indexes are empty, however in many cases not all of Examine's // event handlers will be assigned during bootup when the rebuilding starts which is a problem. So with the examine 0.1.58.2941 build // it has an event we can subscribe to in order to cancel this rebuilding process, but what we'll do is cancel it and postpone the rebuilding until the // boot process has completed. It's a hack but it works. ExamineManager.Instance.BuildingEmptyIndexOnStartup += OnInstanceOnBuildingEmptyIndexOnStartup; base.Initialize(); // Backwards compatibility - set the path and URL type for ClientDependency 1.5.1 [LK] ClientDependency.Core.CompositeFiles.Providers.XmlFileMapper.FileMapVirtualFolder = "~/App_Data/TEMP/ClientDependency"; ClientDependency.Core.CompositeFiles.Providers.BaseCompositeFileProcessingProvider.UrlTypeDefault = ClientDependency.Core.CompositeFiles.Providers.CompositeUrlType.Base64QueryStrings; var section = ConfigurationManager.GetSection("system.web/httpRuntime") as HttpRuntimeSection; if (section != null) { //set the max url length for CDF to be the smallest of the max query length, max request length ClientDependency.Core.CompositeFiles.CompositeDependencyHandler.MaxHandlerUrlLength = Math.Min(section.MaxQueryStringLength, section.MaxRequestLength); } //set master controller factory ControllerBuilder.Current.SetControllerFactory( new MasterControllerFactory(FilteredControllerFactoriesResolver.Current)); //set the render view engine ViewEngines.Engines.Add(new RenderViewEngine()); //set the plugin view engine ViewEngines.Engines.Add(new PluginViewEngine()); //set model binder ModelBinderProviders.BinderProviders.Add(new RenderModelBinder()); // is a provider ////add the profiling action filter //GlobalFilters.Filters.Add(new ProfilingActionFilter()); //Register a custom renderer - used to process property editor dependencies var renderer = new DependencyPathRenderer(); renderer.Initialize("Umbraco.DependencyPathRenderer", new NameValueCollection { { "compositeFileHandlerPath", ClientDependencySettings.Instance.CompositeFileHandlerPath } }); ClientDependencySettings.Instance.MvcRendererCollection.Add(renderer); // Disable the X-AspNetMvc-Version HTTP Header MvcHandler.DisableMvcResponseHeader = true; InstallHelper insHelper = new InstallHelper(UmbracoContext.Current); insHelper.DeleteLegacyInstaller(); return(this); }
/// <summary> /// Create an instance of the hosting class /// </summary> /// <param name="target">target instance</param> private SOSLibrary(IHost host) { _contextService = host.Services.GetService <IContextService>(); string rid = InstallHelper.GetRid(); SOSPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), rid); _hostWrapper = new HostWrapper(host, () => GetSOSHost()?.TargetWrapper); }
public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) { InstallHelper ds = new InstallHelper(); global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType(); global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence(); global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny(); any.Namespace = ds.Namespace; sequence.Items.Add(any); type.Particle = sequence; global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable(); if (xs.Contains(dsSchema.TargetNamespace)) { global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream(); global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream(); try { global::System.Xml.Schema.XmlSchema schema = null; dsSchema.Write(s1); for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) { schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current)); s2.SetLength(0); schema.Write(s2); if ((s1.Length == s2.Length)) { s1.Position = 0; s2.Position = 0; for (; ((s1.Position != s1.Length) && (s1.ReadByte() == s2.ReadByte())); ) { ; } if ((s1.Position == s1.Length)) { return type; } } } } finally { if ((s1 != null)) { s1.Close(); } if ((s2 != null)) { s2.Close(); } } } xs.Add(dsSchema); return type; }