public async Task <IActionResult> StartSimulation([FromQuery] string fileID, [FromQuery] string userName, [FromBody] SimulationPara para)
        {
            if (string.IsNullOrEmpty(fileID) || fileID == "null")
            {
                return(BadRequest());
            }
            if (string.IsNullOrEmpty(userName) || userName == "null")
            {
                return(BadRequest());
            }

            //设置模型路径
            PathSettings path = new PathSettings(_webRootPath, para.AxisID, userName, fileID);

            Simulator simulator = new Simulator(path);

            //进行模型替换
            await Task.Run(() =>
            {
                simulator.PrepareSimulationModel(para);

                //进行模型编译求解
                simulator.PreprocessCompiler(para.Setting);
                simulator.CreateCompiler();
                simulator.RunCompiler();

                //进行结果转换
                simulator.MsfToTxt();
            });

            return(Ok());
        }
 private void Awake()
 {
     _pathSettings = gameObject.AddComponent <PathSettings>();
     _pathSettings.defaultRootPath = RootPathEnum.Url;
     _pathSettings.defaultRootPath = RootPathEnum.Url;
     _defaultImportOptions.zUp     = false;
 }
Exemplo n.º 3
0
 private void OnValidate()
 {
     if (pathSettings == null)
     {
         pathSettings = PathSettings.FindPathComponent(gameObject);
     }
 }
Exemplo n.º 4
0
        private PathSettings GetSettings()
        {
            var settings = new PathSettings();
            var key = Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\SpcsAdm.exe");
            try
            {
                settings.SystemPath = Convert.ToString(key.GetValue("CommonFiles"));
                settings.CompanyPath = Convert.ToString(key.GetValue("DefaultCompanyPath"));
                settings.DllPath = Convert.ToString(key.GetValue("AdkDll"));

                //settings.SystemPath = "C:\\Program Files (x86)\\SPCS\\SPCS Administration\\";
                //settings.SystemPath = "\\\\VIDILAB-SRV2\\Gemensamma Filer\\";
                //settings.CompanyPath = "\\\\VIDILAB-SRV2\\SPCS_Administration\\Företag\\";
                //settings.CompanyPath += "LIMSTEST";
                settings.CompanyPath += "FTG3";

                Console.WriteLine("SystemPath: {0}", settings.SystemPath);
                Console.WriteLine("CompanyPath: {0}", settings.CompanyPath);
                key.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }
            return settings;
        }
Exemplo n.º 5
0
        private void GetPathSettings()
        {
            oPath = oSettings.GetSettingsFromFile();

            txtName.Text     = oPath.TargetFolder;
            txtFilename.Text = oPath.LogFilename;
            GetTreeView(txtName.Text);
        }
Exemplo n.º 6
0
 public ProcessFilesWorker(IOptions <Settings> settings, IProcessFile processFile)
 {
     _pathSettings = settings.Value.PathSettings;
     _pathDefault  = $"{Environment.GetEnvironmentVariable(_pathSettings.Default)}";
     _fullPathIn   = $"{_pathDefault}{_pathSettings.In}";
     _fullPathOut  = $"{_pathDefault}{_pathSettings.Out}";
     _processFile  = processFile;
 }
Exemplo n.º 7
0
 public void ValidateSettings()
 {
     this.WriteLine(PathSettings.GetDebugPathString());
     AssertDirectoryExists(PathSettings.TempPath);
     AssertDirectoryExists(PathSettings.DebugAdaptersPath);
     AssertDirectoryExists(PathSettings.TestsPath);
     AssertDirectoryExists(PathSettings.DebuggeesPath);
     AssertFileExists(PathSettings.TestConfigurationFilePath);
 }
Exemplo n.º 8
0
            public override TomlObject Apply(
                TomlObject obj, Func <TomlObject> resolveParent, PathSettings settings = PathSettings.None)
            {
                var item = base.TryApply(obj, resolveParent, settings)
                           ?? this.TryCreateTable(obj, settings)
                           ?? throw new InvalidOperationException(this.KeyNotFoundMessage);

                return(item.TomlType != TomlObjectType.Table ? this.TryWrapInConvertProxy(item, resolveParent) : item);
            }
Exemplo n.º 9
0
    public MapperSettings()
    {
        Paths = new PathSettings();
        UI = new UISettings();
        View = new ViewSettings();
        Performance = new PerformanceSettings();

        Paths.DataDirs = new List<string>();
        Paths.DataFiles = new List<string>();
    }
Exemplo n.º 10
0
            private TomlTable TryCreateTable(TomlObject obj, PathSettings settings)
            {
                if (settings.HasFlag(PathSettings.CreateTables) && obj is TomlTable tbl)
                {
                    var table = tbl.AddTable(this.key, tbl.CreateAttachedTable());
                    return(table);
                }

                return(null);
            }
Exemplo n.º 11
0
    public MapperSettings()
    {
        Paths       = new PathSettings();
        UI          = new UISettings();
        View        = new ViewSettings();
        Performance = new PerformanceSettings();

        Paths.DataDirs  = new List <string>();
        Paths.DataFiles = new List <string>();
    }
Exemplo n.º 12
0
Arquivo: TPath.cs Projeto: zanedp/Nett
        public TomlObject Apply(TomlObject obj, PathSettings settings = PathSettings.None)
        {
            if (this.IsRootPrefixPath)
            {
                return(obj);
            }

            var po = this.prefixPath.Apply(obj, settings);

            return(this.segment.Apply(po, () => this.prefixPath?.prefixPath?.Apply(obj) ?? po, settings));
        }
Exemplo n.º 13
0
 public override void SetValue(TomlObject target, TomlObject value, PathSettings settings)
 {
     if (target is TomlTable tbl)
     {
         tbl[this.key] = value;
     }
     else
     {
         throw new InvalidOperationException(
                   $"Cannot set key '{this.key}' value for path segment '{this.ToString()}' because target " +
                   $"object is of type '{target.ReadableTypeName}' instead of 'table'.");
     }
 }
Exemplo n.º 14
0
 public override TomlObject TryApply(
     TomlObject obj, Func <TomlObject> resolveParent, PathSettings settings = PathSettings.None)
 {
     try
     {
         return(base.TryApply(obj, resolveParent, settings) ?? this.TryCreateTable(obj, settings));
     }
     catch
     {
         Debug.Assert(false, "This should never happen if the stuff in the try block is implemented correctly.");
         return(null);
     }
 }
Exemplo n.º 15
0
 public void SetValue(TomlObject target, TomlObject value, PathSettings settings)
 {
     if (value is TomlArray a)
     {
         a.Items[this.index] = (TomlValue)value;
     }
     else if (value is TomlTableArray ta)
     {
         ta.Items[this.index] = (TomlTable)value;
     }
     else
     {
         throw new InvalidOperationException(
                   $"Cannot apply index '[{this.index}]' onto TOML object of type '{target.ReadableTypeName}'.");
     }
 }
Exemplo n.º 16
0
Arquivo: TPath.cs Projeto: zanedp/Nett
        public TomlObject TryApply(TomlObject obj, PathSettings settings = PathSettings.None)
        {
            try
            {
                if (this.IsRootPrefixPath)
                {
                    return(obj);
                }

                var po = this.prefixPath.TryApply(obj, settings);
                return(this.segment.TryApply(po, () => this.prefixPath?.prefixPath?.Apply(obj) ?? po, settings));
            }
            catch
            {
                Debug.Assert(false, "Should never happen if the try methods above are implemented correctly.");
                return(null);
            }
        }
Exemplo n.º 17
0
            protected TomlObject ApplyKey(
                TomlObject obj,
                Func <TomlTable, TomlObject> onDoesNotExist,
                Func <string, TomlObject> onError,
                PathSettings settings)
            {
                switch (obj)
                {
                case TomlTable tbl:
                    return(tbl.TryGetValue(this.key, out var val)
                            ? this.VerifyType(val, onError, settings)
                            : onDoesNotExist(tbl));

                default:
                    return(onError($"Key '{this.key}' cannot be applied. " +
                                   $"Keys can only be applied on TOML tables but object has type " +
                                   $"'{obj?.ReadableTypeName ?? "object was null"}'."));
                }
            }
Exemplo n.º 18
0
        private static void ConfigureServiceSettings(IServiceCollection services, AppSettings appSettings)
        {
            AuthSettings    auth    = appSettings.Auth;
            MembersSettings members = appSettings.Members;
            PathSettings    paths   = appSettings.Paths;
            UrlSettings     urls    = appSettings.Urls;

            services.AddSingleton(new AuthenticationServiceSettings
            {
                AccessTokenLifetimeMinutes = auth.AccessTokenLifetimeMinutes,
                EventsUrl = $"{urls.AppBase}{urls.Events}",
                PasswordResetTokenLifetimeMinutes = auth.PasswordResetTokenLifetimeMinutes,
                PasswordResetUrl         = $"{urls.AppBase}{urls.PasswordReset}",
                RefreshTokenLifetimeDays = auth.RefreshTokenLifetimeDays
            });

            services.AddSingleton(new AuthenticationTokenFactorySettings
            {
                Key = auth.Key
            });

            services.AddSingleton(new EventAdminServiceSettings
            {
                BaseUrl              = urls.AppBase,
                EventRsvpUrlFormat   = urls.EventRsvp,
                EventUrlFormat       = urls.Event,
                UnsubscribeUrlFormat = urls.Unsubscribe
            });

            services.AddSingleton(new MemberServiceSettings
            {
                ActivateAccountUrl           = $"{urls.AppBase}{urls.ActivateAccount}",
                ConfirmEmailAddressUpdateUrl = $"{urls.AppBase}{urls.ConfirmEmailAddressUpdate}",
                MaxImageSize = members.MaxImageSize
            });

            services.AddSingleton(new MediaFileProviderSettings
            {
                RootMediaPath = paths.MediaRoot,
                RootMediaUrl  = $"{urls.ApiBase}{urls.Media}"
            });
        }
Exemplo n.º 19
0
        public PathFinder(Movable _mov, PathSettings p, Point Start, Point End, ManualResetEvent _m)
        {
            mov        = _mov;
            _doneEvent = _m;


            formula        = p.formula;
            maxSearch      = p.maxSearch;
            useDiagonals   = p.useDiagonals;
            heavyDiagonals = p.heavyDiagonals;
            tieBreaker     = p.tieBreaker;
            mHEstimate     = p.mHEstimate;

            diagonalNeighbors = p.diagonalNeighbors;


            startX = Start.x;
            startY = Start.y;

            endX = End.x;
            endY = End.y;
        }
Exemplo n.º 20
0
        //private static String rootNetPath = "\\\\10.1.1.2\\Change\\Archive\\";
        //private static String rootPath = "C:\\Archive\\";
        //private static String baseReportPath = rootPath + "EDO\\Reports\\";
        //private static String baseOrderPath = rootPath + "Order\\";
        //private static String baseReportTemplatePath = baseReportPath + "Templates\\";
        //private static String baseJournalPath = rootNetPath + "JournalC01\\";
        //private static String baseFormC01TemplatePath = baseJournalPath + "Templates\\";
        //private static String baseEntryOrderPath = "EntryOrder\\";
        //private static String baseEntryOrderTemplatePath = baseEntryOrderPath + "Templates\\";


        /*public static void SaveConfiguration(PathSettings savedPathSettings)
         * {
         *  try {
         *      using (Stream stream = File.Open("pathSettings.ini", FileMode.Create)) {
         *          var binaryFormatter = new BinaryFormatter();
         *          binaryFormatter.Serialize(stream, savedPathSettings);
         *      }
         *  }
         *  catch {
         *      AppJournal.Write(System.Reflection.MethodBase.GetCurrentMethod().Name,"Problems with loading settings from file.");
         *  }
         * }*/


        public static PathSettings LoadConfiguration()
        {
            /*if (File.Exists("pathSettings.ini"))
             *  using (Stream stream = File.Open("pathSettings.ini", FileMode.Open)) {
             *      var binaryFormatter = new BinaryFormatter();
             *      return (PathSettings) binaryFormatter.Deserialize(stream);
             *  }*/

            pathSettings = new PathSettings {
                EDOPath         = @"\\10.1.1.2\Change\Archive\EDO\In\",
                EDOReportsPath  = @"\\10.1.1.2\Change\Archive\EDO\",
                EntryOrdersPath = "",
                JournalC01Path  = @"\\10.1.1.2\Change\Munira\",
                OrdersPath      = "",
                RootPath        = @"\\10.1.1.2\Change\Archive",
                TemplatesPath   = @"\\10.1.1.2\Change\Archive\Templates\"
            };

            //SaveConfiguration(pathSettings);
            //pathSettings = LoadConfiguration();

            return(pathSettings);
        }
Exemplo n.º 21
0
 private void addPath(string path, PathSettings settings)
 {
     if (settings.imux_max < 0)
     {
         settings.imux_max = imux_max;
     }
     if (settings.network != null)
     {
         settings.networks = settings.networks ?? new Dictionary <string, AdapterRef>();
         settings.networks.Add("default", settings.network);
     }
     settings.realKey = NaiveProtocol.GetRealKeyFromString(settings.key ?? this.key, 32);
     httpServer.Router.AddAsyncRoute(path, (p) => {
         var m = Regex.Match(p.Url_qstr, settings.format);
         if (m.Success == false)
         {
             return(NaiveUtils.CompletedTask);
         }
         var token = m.Groups["token"].Value;
         token     = HttpUtil.UrlDecode(token);
         return(this.HandleRequestAsync(p, settings, token));
     });
 }
Exemplo n.º 22
0
        private void LoadAndValidateSettings(IServiceCollection services)
        {
            _logger.LogInformation("Validating settings");
            services.AddTransient <IStartupFilter, SettingValidationFilter>();
            var mailSettings = Configuration.GetSection("MailingSettings");

            if (mailSettings.Get <MailingSettings>() == null)
            {
                throw new SettingException("appsettings.json", $"Unable to load {nameof(MailingSettings)} configuration section.");
            }
            var identitySettings = Configuration.GetSection("IdentitySettings");

            _identitySettings = identitySettings.Get <IdentitySettings>();
            if (_identitySettings == null)
            {
                throw new SettingException("appsettings.json", $"Unable to load {nameof(IdentitySettings)} configuration section.");
            }
            var pathSettings = Configuration.GetSection("PathSettings");

            _pathSettings = pathSettings.Get <PathSettings>();
            if (_pathSettings == null)
            {
                throw new SettingException("appsettings.json", $"Unable to load {nameof(PathSettings)} configuration section.");
            }
            var swapifyDbSettings = Configuration.GetSection(nameof(SwapifyDatabaseSettings));

            _swapifyDbSettings = swapifyDbSettings.Get <SwapifyDatabaseSettings>();
            if (_swapifyDbSettings == null)
            {
                throw new SettingException("appsettings.json", $"Unable to load {nameof(SwapifyDatabaseSettings)} configuration section.");
            }
            var recaptchaSettings = Configuration.GetSection("RecaptchaSettings");

            if (recaptchaSettings.Get <RecaptchaSettings>() == null)
            {
                throw new SettingException("appsettings.json", $"Unable to load {nameof(RecaptchaSettings)} configuration section.");
            }
            var ldapSettings = Configuration.GetSection("LdapSettings");

            if (ldapSettings.Get <LdapSettings>() == null)
            {
                throw new SettingException("appsettings.json", $"Unable to load {nameof(LdapSettings)} configuration section.");
            }
            var proxySettings = Configuration.GetSection(nameof(ProxySettings));

            if (proxySettings.Get <ProxySettings>() == null)
            {
                throw new SettingException("appsettings.json", $"Unable to load {nameof(ProxySettings)} configuration section.");
            }
            var calendarSettings = Configuration.GetSection("CalendarSettings");

            if (calendarSettings.Get <CalendarSettings>() == null)
            {
                throw new SettingException("appsettings.json", $"Unable to load {nameof(CalendarSettings)} configuration section.");
            }
            services.Configure <MailingSettings>(mailSettings);
            services.Configure <IdentitySettings>(identitySettings);
            services.Configure <PathSettings>(pathSettings);
            services.Configure <EnvironmentSettings>(Configuration);
            services.Configure <RecaptchaSettings>(recaptchaSettings);
            services.Configure <LdapSettings>(ldapSettings);
            services.Configure <ProxySettings>(proxySettings);
            services.Configure <CalendarSettings>(calendarSettings);
            services.AddSingleton <IValidatable>(resolver =>
                                                 resolver.GetRequiredService <IOptions <MailingSettings> >().Value);
            services.AddSingleton <IValidatable>(resolver =>
                                                 resolver.GetRequiredService <IOptions <IdentitySettings> >().Value);
            services.AddSingleton <IValidatable>(resolver =>
                                                 resolver.GetRequiredService <IOptions <EnvironmentSettings> >().Value);
            services.AddSingleton <IValidatable>(resolver =>
                                                 resolver.GetRequiredService <IOptions <PathSettings> >().Value);
            services.AddSingleton <IValidatable>(resolver =>
                                                 resolver.GetRequiredService <IOptions <RecaptchaSettings> >().Value);
            services.AddSingleton <IValidatable>(resolver =>
                                                 resolver.GetRequiredService <IOptions <LdapSettings> >().Value);
            services.AddSingleton <IValidatable>(resolver =>
                                                 resolver.GetRequiredService <IOptions <CalendarSettings> >().Value);
            services.AddControllers().AddNewtonsoftJson(options => options.SerializerSettings.Converters.Add(new Newtonsoft.Json.Converters.StringEnumConverter()));
        }
Exemplo n.º 23
0
 public TomlObject Apply(TomlObject obj, Func <TomlObject> _, PathSettings settings = PathSettings.None)
 => this.ApplyIndex(obj, (err) => throw new InvalidOperationException(err));
 public PathRazorViewEngine(PathSettings settings)
     : this(null, settings)
 {
 }
Exemplo n.º 25
0
 public TomlObject TryApply(TomlObject obj, Func <TomlObject> __, PathSettings settings = PathSettings.None)
 => this.ApplyIndex(obj, _ => null);
 public PathResolver(PathSettings settings)
 {
     this.settings = settings;
 }
 public PathRazorViewEngine(IViewPageActivator viewPageActivator, PathSettings settings)
     : base(viewPageActivator)
 {
     controllerPathResolver = new PathResolver(settings);
 }
Exemplo n.º 28
0
 public override TomlObject Apply(TomlObject obj, Func <TomlObject> _, PathSettings settings)
 => this.ApplyKey(obj, this.ThrowWhenKeyNotFound, ThrowOnError, settings);
Exemplo n.º 29
0
 public override TomlObject TryApply(TomlObject obj, Func <TomlObject> __, PathSettings settings)
 => this.ApplyKey(obj, _ => null, ReturnDefaultOnError, settings);
 public SettingsData()
 {
     Paths   = new PathSettings();
     Options = new OptionsSettings();
     Info    = new InfoSettings();
 }
Exemplo n.º 31
0
 public static void ReloadConfig(PathSettings pSettings)
 {
     pathSettings = pSettings;
 }
Exemplo n.º 32
0
Arquivo: TPath.cs Projeto: zanedp/Nett
        public void SetValue(TomlObject applyTo, TomlObject value, PathSettings settings = PathSettings.CreateTables)
        {
            var target = this.prefixPath.Apply(applyTo, settings);

            this.segment.SetValue(target, value, settings);
        }