static void CreateFileList(BuildTarget buildTarget, AssetBundleBuild[] assetBundleBuilds) { string sOutputPath = StringUtils.PathCombine(GetOutputDir(buildTarget), ms_ResourceSetting.FileList); Dictionary <string, string> dicFileList = new Dictionary <string, string>(); string sPlatformDir = CrossPlatform.GetABOutputDir(buildTarget); dicFileList.Add("AssetBundleManifest".ToLower(), sPlatformDir); foreach (var abBuild in assetBundleBuilds) { foreach (var asset in abBuild.addressableNames) { string sAssetName = asset; if (asset.IndexOf(ms_ResourceSetting.ResourcePath.ToLower()) == 0) { sAssetName = asset.Substring(ms_ResourceSetting.ResourcePath.Length + 1); sAssetName = asset; } if (!dicFileList.ContainsKey(sAssetName)) { dicFileList.Add(sAssetName, abBuild.assetBundleName); } } } IOUtils.WriteJson(sOutputPath, dicFileList); }
public ABInfo(string sABName, CacheManage mgr) : base(mgr) { m_ABLoader = ABAssetLoader.Loader; m_AssetBundlePath = StringUtils.PathCombine(Application.streamingAssetsPath, CrossPlatform.GetABDir()); ABName = sABName; Path = StringUtils.PathCombine(m_AssetBundlePath, sABName); }
public Task StartAsync(CancellationToken cancellationToken) { try { var pythonName = "python"; var configPath = Path.GetFullPath(CrossPlatform.PathCombine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "radicale.config")); if (WorkContext.IsMono) { pythonName = "python3"; } StartInfo = new ProcessStartInfo { CreateNoWindow = false, UseShellExecute = false, FileName = pythonName, WindowStyle = ProcessWindowStyle.Hidden, Arguments = $"-m radicale --config \"{configPath}\"", WorkingDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) }; StartRedicale(); } catch (Exception e) { Logger.Error(e); } return(Task.CompletedTask); }
//角色移动函数 public void characterMove(float horizontal) { //切换动画状态 changeStatus(horizontal); //切换角色朝向 changeDirection(horizontal); //GetComponent<Rigidbody2D>().AddForce(new Vector2(horizontal * MoveSpeed, 0)); // --last version float lineSpeed = 0; if (Input.GetButton("Sprint") || (CrossPlatform.getInstance() != null && CrossPlatform.getInstance().btn_A_isPressed)) { lineSpeed = horizontal * MoveSpeed; } else { lineSpeed = horizontal * MoveSpeed / 2; } //直接操控刚体的线性速度 m_Rigidbody2D.velocity = new Vector2(lineSpeed, m_Rigidbody2D.velocity.y); //角色脚步音效 playFootPrintSE(horizontal); //角色下落音效 playFallDownSE(); }
private IFileLocation InvokeCanvasPartition(CanvasCallset callset, IFileLocation cleanedPath, string canvasBedPath) { StringBuilder commandLine = new StringBuilder(); string executablePath = Path.Combine(_canvasFolder, "CanvasPartition.exe"); if (CrossPlatform.IsThisMono()) { commandLine.AppendFormat("{0} ", executablePath); executablePath = Utilities.GetMonoPath(); } commandLine.AppendFormat("-i \"{0}\" ", cleanedPath); commandLine.AppendFormat("-b \"{0}\" ", canvasBedPath); string partitionedPath = Path.Combine(callset.TempFolder, string.Format("{0}.partitioned", callset.Id)); commandLine.AppendFormat("-o \"{0}\" ", partitionedPath); if (!_isSomatic) { commandLine.AppendFormat(" -g"); } UnitOfWork partitionJob = new UnitOfWork() { ExecutablePath = executablePath, LoggingFolder = _workManager.LoggingFolder.FullName, LoggingStub = Path.GetFileName(partitionedPath), CommandLine = commandLine.ToString() }; if (_customParameters.ContainsKey("CanvasPartition")) { partitionJob.CommandLine = Utilities.MergeCommandLineOptions(partitionJob.CommandLine, _customParameters["CanvasPartition"], true); } _workManager.DoWorkSingleThread(partitionJob); return(new FileLocation(partitionedPath)); }
public Task StartAsync(CancellationToken cancellationToken) { try { var settings = Configuration.GetSetting <ThumbnailsSettings>("thumb"); StartInfo = new ProcessStartInfo { CreateNoWindow = false, UseShellExecute = false, FileName = "node", WindowStyle = ProcessWindowStyle.Hidden, Arguments = string.Format("\"{0}\"", Path.GetFullPath(CrossPlatform.PathCombine(HostEnvironment.ContentRootPath, settings.Path, "index.js"))), WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory }; var savePath = settings.SavePath; if (!savePath.EndsWith("/")) { savePath += "/"; } StartInfo.EnvironmentVariables.Add("port", settings.Port); StartInfo.EnvironmentVariables.Add("logPath", CrossPlatform.PathCombine(Logger.LogDirectory, "web.thumbnails.log")); StartInfo.EnvironmentVariables.Add("savePath", Path.GetFullPath(savePath)); StartNode(cancellationToken); } catch (Exception e) { Logger.Error("Start", e); } return(Task.CompletedTask); }
public async Task StartAsync(CancellationToken cancellationToken) { try { var cfg = ConfigurationExtension.GetSetting <SsoAuthSettings>("ssoauth"); startInfo = new ProcessStartInfo { CreateNoWindow = false, UseShellExecute = false, FileName = "node", WindowStyle = ProcessWindowStyle.Hidden, Arguments = string.Format("\"{0}\"", Path.GetFullPath(CrossPlatform.PathCombine(HostEnvironment.ContentRootPath, cfg.Path, "app.js"))), WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory }; startInfo.EnvironmentVariables.Add("core.machinekey", Configuration["core:machinekey"]); startInfo.EnvironmentVariables.Add("port", cfg.Port); LogDir = Logger.LogDirectory; startInfo.EnvironmentVariables.Add("logPath", LogDir); await StartNode(cancellationToken); } catch (Exception e) { Logger.Error("Start", e); } }
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .UseSystemd() .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup <BaseWorkerStartup>()) .ConfigureAppConfiguration((hostContext, config) => { var buided = config.Build(); var path = buided["pathToConf"]; if (!Path.IsPathRooted(path)) { path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path)); } config.SetBasePath(path); var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production"); config .AddInMemoryCollection(new Dictionary <string, string> { { "pathToConf", path } } ) .AddJsonFile("appsettings.json") .AddJsonFile($"appsettings.{env}.json", true) .AddJsonFile($"appsettings.services.json", true) .AddJsonFile("storage.json") .AddJsonFile("notify.json") .AddJsonFile($"notify.{env}.json", true) .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{env}.json", true) .AddJsonFile("elastic.json", true) .AddEnvironmentVariables() .AddCommandLine(args); }) .ConfigureServices((hostContext, services) =>
static IEnumerable <string> GetPackageLookupPaths(string packageId, NuGetVersion version, Uri feedUri) { // Files created by the path resolver. This would take into account the non-side-by-side scenario // and we do not need to match this for id and version. var packageFileName = GetPackageFileName(packageId, version); var filesMatchingFullName = GetPackageFiles(feedUri, packageFileName); if (version != null && version.Version.Revision < 1) { // If the build or revision number is not set, we need to look for combinations of the format // * Foo.1.2.nupkg // * Foo.1.2.3.nupkg // * Foo.1.2.0.nupkg // * Foo.1.2.0.0.nupkg // To achieve this, we would look for files named 1.2*.nupkg if both build and revision are 0 and // 1.2.3*.nupkg if only the revision is set to 0. string partialName = version.Version.Build < 1 ? String.Join(".", packageId, version.Version.Major, version.Version.Minor) : String.Join(".", packageId, version.Version.Major, version.Version.Minor, version.Version.Build); partialName += "*" + CrossPlatform.GetPackageExtension(); // Partial names would result is gathering package with matching major and minor but different build and revision. // Attempt to match the version in the path to the version we're interested in. var partialNameMatches = GetPackageFiles(feedUri, partialName).Where(path => FileNameMatchesPattern(packageId, version, path)); return(Enumerable.Concat(filesMatchingFullName, partialNameMatches)); } return(filesMatchingFullName); }
public CommandLineInvocation Build() { var argLine = new List <string>(); #if NET40 #else if (dotnet && !CrossPlatform.IsWindows()) { argLine.Add(executable); if (action != null) { argLine.Add(action); } argLine.AddRange(arguments); return(new CommandLineInvocation("dotnet", string.Join(" ", argLine))); } #endif if (action != null) { argLine.Add(action); } argLine.AddRange(arguments); return(new CommandLineInvocation(executable, string.Join(" ", argLine))); }
public MappedPath(PathUtils pathUtils, string tenant, bool appendTenant, string ppath, IDictionary <string, string> storageConfig) : this(pathUtils) { tenant = tenant.Trim('/'); ppath = PathUtils.ResolvePhysicalPath(ppath, storageConfig); PhysicalPath = ppath.IndexOf('{') == -1 && appendTenant?CrossPlatform.PathCombine(ppath, tenant) : string.Format(ppath, tenant); }
public Uri[] ListFiles(string domain, string path, string pattern, bool recursive) { var filePaths = ListFilesRelative(domain, path, pattern, recursive); return Array.ConvertAll( filePaths, x => GetUri(domain, CrossPlatform.PathCombine(PathUtils.Normalize(path), x))); }
protected override string GetTargetPath(RunningDeployment deployment, PackageMetadata metadata) { var targetPath = Path.Combine(CrossPlatform.GetCurrentDirectory(), "staging"); fileSystem.EnsureDirectoryExists(targetPath); return(targetPath); }
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .UseSystemd() .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webBuilder => { var builder = webBuilder.UseStartup <Startup>(); builder.ConfigureKestrel((hostingContext, serverOptions) => { serverOptions.Limits.MaxRequestBodySize = 100 * 1024 * 1024; serverOptions.Limits.MaxRequestBufferSize = 100 * 1024 * 1024; serverOptions.Limits.MinRequestBodyDataRate = null; serverOptions.Limits.MinResponseDataRate = null; var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel"); if (!kestrelConfig.Exists()) { return; } var unixSocket = kestrelConfig.GetValue <string>("ListenUnixSocket"); if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { if (!String.IsNullOrWhiteSpace(unixSocket)) { unixSocket = String.Format(unixSocket, hostingContext.HostingEnvironment.ApplicationName.Replace("ASC.", "").Replace(".", "")); serverOptions.ListenUnixSocket(unixSocket); } } }); }) .ConfigureAppConfiguration((hostingContext, config) => { var buided = config.Build(); var path = buided["pathToConf"]; if (!Path.IsPathRooted(path)) { path = Path.GetFullPath(CrossPlatform.PathCombine(hostingContext.HostingEnvironment.ContentRootPath, path)); } config.SetBasePath(path); config .AddJsonFile("appsettings.json") .AddJsonFile($"appsettings.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) .AddJsonFile("storage.json") .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{hostingContext.HostingEnvironment.EnvironmentName}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary <string, string> { { "pathToConf", path } }); }) .ConfigureNLogLogging();
static string GetKeyFileDirectory(string keyFileName) { string folderPath = CrossPlatform.GetCommonApplicationDataFolderPath(); string text = Path.Combine(folderPath, "Microsoft", "Crypto", "RSA", "MachineKeys"); string[] array = Directory.GetFiles(text, keyFileName); string result; if (array.Length <= 0) { string folderPath2 = CrossPlatform.GetApplicationDataFolderPath(); string path = Path.Combine(folderPath2, "Microsoft", "Crypto", "RSA"); array = Directory.GetDirectories(path); if (array.Length > 0) { string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text2 = array2[i]; array = Directory.GetFiles(text2, keyFileName); if (array.Length != 0) { result = text2; return(result); } } } throw new InvalidOperationException("Unable to locate private key file directory"); } result = text; return(result); }
public static string ToRootedPath(string path, string basePath) { if (!Path.IsPathRooted(path)) { path = CrossPlatform.PathCombine(basePath, path); } return(Path.GetFullPath(path)); }
public MappedPath AppendDomain(string domain) { domain = domain.Replace('.', '_'); //Domain prep. Remove dots return(new MappedPath(PathUtils) { PhysicalPath = CrossPlatform.PathCombine(PhysicalPath, PathUtils.Normalize(domain, true)), }); }
public static string ToRootedConfigPath(string path) { if (!Path.HasExtension(path)) { path = CrossPlatform.PathCombine(path, "Web.config"); } return(ToRootedPath(path)); }
public ABAssetLoader(string sFileList) { m_sFileList = sFileList; m_ABLoader = this; m_AssetBundlePath = StringUtils.PathCombine(Application.streamingAssetsPath, CrossPlatform.GetABDir()); LoadFileList(); LoadAssetBundleManifest(); }
private IBedGraphToBigWigConverter GetConverter() { if (CrossPlatform.IsThisLinux()) { return(new FormatConverterFactory(_logger, _workDoer, _commandManager).GetBedGraphToBigWigConverter()); } return(new NullBedGraphToBigWigConverter(_logger, "BedGraph to BigWig conversion unavailable on Windows.")); }
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .UseSystemd() .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureAppConfiguration((hostContext, config) => { var buided = config.Build(); var path = buided["pathToConf"]; if (!Path.IsPathRooted(path)) { path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path)); } config.SetBasePath(path); var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production"); config .AddInMemoryCollection(new Dictionary <string, string> { { "pathToConf", path } } ) .AddJsonFile("appsettings.json") .AddJsonFile($"appsettings.{env}.json", true) .AddJsonFile($"appsettings.services.json", true) .AddJsonFile("storage.json") .AddJsonFile("notify.json") .AddJsonFile($"notify.{env}.json", true) .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{env}.json", true) .AddEnvironmentVariables() .AddCommandLine(args); }) .ConfigureServices((hostContext, services) => { services.AddMemoryCache(); var diHelper = new DIHelper(services); diHelper.TryAdd(typeof(ICacheNotify <>), typeof(KafkaCache <>)); diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); services.AddHostedService <ServiceLauncher>(); diHelper.TryAdd <ServiceLauncher>(); diHelper.TryAdd <FactoryIndexerCase>(); diHelper.TryAdd <FactoryIndexerContact>(); diHelper.TryAdd <FactoryIndexerContactInfo>(); diHelper.TryAdd <FactoryIndexerDeal>(); diHelper.TryAdd <FactoryIndexerEvents>(); diHelper.TryAdd <FactoryIndexerFieldValue>(); diHelper.TryAdd <FactoryIndexerInvoice>(); diHelper.TryAdd <FactoryIndexerTask>(); }) .ConfigureContainer <ContainerBuilder>((context, builder) => { builder.Register(context.Configuration, true, false, "search.json"); }) .ConfigureNLogLogging();
private void Clean() { var filePath = string.Empty; var dirPath = string.Empty; try { if (FileName == null) { return; } filePath = ((NLog.Layouts.SimpleLayout)FileName).Text; if (string.IsNullOrEmpty(filePath)) { return; } dirPath = Path.GetDirectoryName(filePath); if (string.IsNullOrEmpty(dirPath)) { return; } if (!Path.IsPathRooted(dirPath)) { dirPath = CrossPlatform.PathCombine(AppDomain.CurrentDomain.BaseDirectory, dirPath); } var directory = new DirectoryInfo(dirPath); if (!directory.Exists) { return; } var files = directory.GetFiles(); var cleanPeriod = GetCleanPeriod(); foreach (var file in files.Where(file => (DateTime.UtcNow.Date - file.CreationTimeUtc.Date).Days > cleanPeriod)) { file.Delete(); } } catch (Exception err) { base.Write(new LogEventInfo { Exception = err, Level = LogLevel.Error, Message = string.Format("file: {0}, dir: {1}, mess: {2}", filePath, dirPath, err.Message), LoggerName = "SelfCleaningTarget" }); } }
private IFileLocation GetRuntimeExecutable() { #if DotNetCore return(new FileLocation(_executableProcessor.GetEnvironmentExecutablePath("dotnet"))); #else var mono = CrossPlatform.IsThisLinux() ? _executableProcessor.GetMonoPath() : null; return(new FileLocation(mono)); #endif }
private string GetBackupFilePath(string tenantAlias) { if (!Directory.Exists(BackupDirectory ?? DefaultDirectoryName)) { Directory.CreateDirectory(BackupDirectory ?? DefaultDirectoryName); } return(CrossPlatform.PathCombine(BackupDirectory ?? DefaultDirectoryName, tenantAlias + DateTime.UtcNow.ToString("(yyyy-MM-dd HH-mm-ss)") + ".backup")); }
public void ShouldFallBackToDefaultCodePage() { var filePath = GetFixtureResouce("Samples", "ANSI.txt"); Encoding encoding; FileSystem.ReadFile(filePath, out encoding); Assert.AreEqual(CrossPlatform.GetDefaultEncoding(), encoding); }
private string GetTarget(string domain, string path) { var pathMap = GetPath(domain); //Build Dir var target = CrossPlatform.PathCombine(pathMap.PhysicalPath, PathUtils.Normalize(path)); ValidatePath(target); return(target); }
public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .UseSystemd() .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup <BaseWorkerStartup>()) .ConfigureAppConfiguration((hostContext, config) => { var buided = config.Build(); var path = buided["pathToConf"]; if (!Path.IsPathRooted(path)) { path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path)); } config.SetBasePath(path); var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production"); config .AddJsonFile("appsettings.json") .AddJsonFile($"appsettings.{env}.json", true) .AddJsonFile($"appsettings.services.json", true) .AddJsonFile("storage.json") .AddJsonFile("notify.json") .AddJsonFile($"notify.{env}.json", true) .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{env}.json", true) .AddEnvironmentVariables() .AddCommandLine(args) .AddInMemoryCollection(new Dictionary <string, string> { { "pathToConf", path } } ); }) .ConfigureServices((hostContext, services) => { services.AddMemoryCache(); var diHelper = new DIHelper(services); diHelper.TryAdd(typeof(ICacheNotify <>), typeof(KafkaCache <>)); diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath); services.Configure <NotifyServiceCfg>(hostContext.Configuration.GetSection("notify")); diHelper.TryAdd <NotifyServiceLauncher>(); diHelper.TryAdd <JabberSender>(); diHelper.TryAdd <SmtpSender>(); diHelper.TryAdd <AWSSender>(); // fix private services.AddHostedService <NotifyServiceLauncher>(); }) .ConfigureContainer <ContainerBuilder>((context, builder) => { builder.Register(context.Configuration); }) .ConfigureNLogLogging();
public static string GetTempFileName(string tempDir) { string tempPath; do { tempPath = CrossPlatform.PathCombine(tempDir, Path.GetRandomFileName()); } while (File.Exists(tempPath)); return(tempPath); }
static string GetTempBasePath() { var path = CrossPlatform.GetApplicationTempDir(); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } return(path); }
public void TildePrefixReplacedWithHome() { var home = Environment.GetEnvironmentVariable("HOME"); Assert.IsNotNull(home, "Expected $HOME environment variable to be set."); var value = CrossPlatform.ExpandPathEnvironmentVariables("~/blah"); Assert.AreEqual($"{home}/blah", value); }