• 大小: 2.52MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-09-29
  • 语言: 其他
  • 标签: Angular  7  .net  core  2  

资源简介

将使用.net core 2.2构建一个Angular 7应用程序---实现全球天气,它允许用户选择他们的位置并显示当前的天气

资源截图

代码片段和文件信息

using System;

namespace GlobalWeather
{
    internal class CurrentDirectoryHelpers
    {
        internal const string AspNetCoreModuleDll = “aspnetcorev2_inprocess.dll“;

        [System.Runtime.InteropServices.DllImport(“kernel32.dll“)]
        private static extern IntPtr GetModuleHandle(string lpModuleName);

        [System.Runtime.InteropServices.DllImport(AspNetCoreModuleDll)]
        private static extern int http_get_application_properties(ref IISConfigurationData iiConfigData);

        [System.Runtime.InteropServices.StructLayout(System.Runtime.InteropServices.LayoutKind.Sequential)]
        private struct IISConfigurationData
        {
            public IntPtr pNativeApplication;
            [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]
            public string pwzFullApplicationPath;
            [System.Runtime.InteropServices.MarshalAs(System.Runtime.InteropServices.UnmanagedType.BStr)]
            public string pwzVirtualApplicationPath;
            public bool fWindowsAuthEnabled;
            public bool fBasicAuthEnabled;
            public bool fAnonymousAuthEnable;
        }

        public static void SetCurrentDirectory()
        {
            try
            {
                // Check if physical path was provided by ANCM
                var sitePhysicalPath = Environment.GetEnvironmentVariable(“ASPNETCORE_IIS_PHYSICAL_PATH“);
                if (string.IsNullOrEmpty(sitePhysicalPath))
                {
                    // Skip if not running ANCM InProcess
                    if (GetModuleHandle(AspNetCoreModuleDll) == IntPtr.Zero)
                    {
                        return;
                    }

                    IISConfigurationData configurationData = default(IISConfigurationData);
                    if (http_get_application_properties(ref configurationData) != 0)
                    {
                        return;
                    }

                    sitePhysicalPath = configurationData.pwzFullApplicationPath;
                }

                Environment.CurrentDirectory = sitePhysicalPath;
            }
            catch
            {
                // ignore
            }
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-01-17 20:15  GlobalWeather\
     目录           0  2019-01-17 20:16  GlobalWeather\GlobalWeather\
     文件        1279  2018-12-20 11:47  GlobalWeather\GlobalWeather.sln
     文件         146  2018-12-20 10:59  GlobalWeather\GlobalWeather\appsettings.Development.json
     文件         105  2018-12-20 10:59  GlobalWeather\GlobalWeather\appsettings.json
     目录           0  2019-01-15 19:27  GlobalWeather\GlobalWeather\Controllers\
     文件        1024  2018-12-20 10:59  GlobalWeather\GlobalWeather\Controllers\ValuesController.cs
     文件        2295  2018-12-20 11:47  GlobalWeather\GlobalWeather\CurrentDirectoryHelpers.cs
     文件         568  2018-12-24 15:22  GlobalWeather\GlobalWeather\GlobalWeather.csproj
     文件         635  2018-12-20 10:59  GlobalWeather\GlobalWeather\Program.cs
     目录           0  2019-01-15 19:27  GlobalWeather\GlobalWeather\Properties\
     文件         752  2018-12-20 11:34  GlobalWeather\GlobalWeather\Properties\launchSettings.json
     文件        1960  2019-01-15 08:20  GlobalWeather\GlobalWeather\Startup.cs
     目录           0  2019-01-17 20:34  GlobalWeather\GlobalWeather\WeatherClient\
     文件         246  2018-12-20 11:01  GlobalWeather\GlobalWeather\WeatherClient\.editorconfig
     文件        3832  2018-12-20 13:48  GlobalWeather\GlobalWeather\WeatherClient\angular.json
     目录           0  2019-01-15 19:28  GlobalWeather\GlobalWeather\WeatherClient\dist\
     目录           0  2019-01-15 19:28  GlobalWeather\GlobalWeather\WeatherClient\dist\out-tsc\
     目录           0  2019-01-15 19:28  GlobalWeather\GlobalWeather\WeatherClient\dist\out-tsc\e2e\
     目录           0  2019-01-15 19:28  GlobalWeather\GlobalWeather\WeatherClient\dist\out-tsc\e2e\src\
     文件         384  2019-01-10 07:56  GlobalWeather\GlobalWeather\WeatherClient\dist\out-tsc\e2e\src\app.e2e-spec.js
     文件         461  2019-01-10 07:56  GlobalWeather\GlobalWeather\WeatherClient\dist\out-tsc\e2e\src\app.e2e-spec.js.map
     文件         422  2019-01-10 07:56  GlobalWeather\GlobalWeather\WeatherClient\dist\out-tsc\e2e\src\app.po.js
     文件         401  2019-01-10 07:56  GlobalWeather\GlobalWeather\WeatherClient\dist\out-tsc\e2e\src\app.po.js.map
     目录           0  2019-01-15 19:28  GlobalWeather\GlobalWeather\WeatherClient\dist\out-tsc\src\
     目录           0  2019-01-15 19:28  GlobalWeather\GlobalWeather\WeatherClient\dist\out-tsc\src\app\
     文件         731  2019-01-10 07:56  GlobalWeather\GlobalWeather\WeatherClient\dist\out-tsc\src\app\app-routing.module.js
     文件         630  2019-01-10 07:56  GlobalWeather\GlobalWeather\WeatherClient\dist\out-tsc\src\app\app-routing.module.js.map
     文件         535  2019-01-10 07:56  GlobalWeather\GlobalWeather\WeatherClient\dist\out-tsc\src\app\app.component.js
     文件         383  2019-01-10 07:56  GlobalWeather\GlobalWeather\WeatherClient\dist\out-tsc\src\app\app.component.js.map
     文件        1311  2019-01-10 07:56  GlobalWeather\GlobalWeather\WeatherClient\dist\out-tsc\src\app\app.component.spec.js
............此处省略150个文件信息

评论

共有 条评论