Replace external deps w/ conan pkgs

This commit is contained in:
John Colvin committed 2022-07-01 18:06:22 -05:00
1 parent 8301fdccf4
commit 99451eb3e7
71 files changed
+339 -169

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
[settings]
os=Windows
compiler='Visual Studio'
build_type=Debug
arch=x86_64
compiler.version=17
compiler.runtime=MTd
[options]
boost:without_graph=True
boost:without_iostreams=True
boost:without_json=True
boost:without_log=True
boost:without_math=True
boost:without_nowide=True
boost:without_program_options=True
boost:without_python=True
boost:without_random=True
boost:without_serialization=True
boost:without_test=True
boost:without_timer=True
boost:without_wave=True
boost:layout=system
boost:multithreading=True
[build_requires]
[env]
+28
View File
@@ -0,0 +1,28 @@
[settings]
os=Windows
compiler='Visual Studio'
build_type=Release
arch=x86_64
compiler.version=17
compiler.runtime=MT
[options]
boost:without_graph=True
boost:without_iostreams=True
boost:without_json=True
boost:without_log=True
boost:without_math=True
boost:without_nowide=True
boost:without_program_options=True
boost:without_python=True
boost:without_random=True
boost:without_serialization=True
boost:without_test=True
boost:without_timer=True
boost:without_wave=True
boost:layout=system
boost:multithreading=True
[build_requires]
[env]
+6
View File
@@ -7,6 +7,12 @@
"commands": [
"dotnet-format"
]
},
"protobuf-net.protogen": {
"version": "3.1.17",
"commands": [
"protogen"
]
}
}
}
+1
View File
@@ -51,3 +51,4 @@ trace_data/
/.venv*/*
.cache/
src/web/api/tsconfig.*.g.json
.conan/windows/install/*
+5
View File
@@ -20,6 +20,10 @@ set(TOOLS "${CMAKE_SOURCE_DIR}/tools")
set(BUILD_SDK OFF CACHE BOOL "Build the sdk")
set(BUILD_WEB ON CACHE BOOL "Build the web server")
include(${CMAKE_SOURCE_DIR}/.conan/${platform}/install/debug/conanbuildinfo.cmake)
set(CONAN_SYSTEM_INCLUDES ON)
conan_basic_setup()
include_directories(BEFORE SYSTEM ${SPARK_INCLUDE} ${EXTERNALS_ROOT}/include/zlib)
link_directories(${SPARK_LIB})
@@ -31,6 +35,7 @@ if(WIN32)
COMMAND cp ARGS ${TOOLS}/cpp.build.props ${CMAKE_BINARY_DIR}/Directory.Build.Props
DEPENDS ${TOOLS}/cpp.build.props
COMMENT "Copy cpp.build.props -> Directory.Build.Props")
add_custom_target(client_layout ALL DEPENDS ${CMAKE_BINARY_DIR}/Directory.Build.Props)
else()
add_compile_definitions(SPARK_ENABLE_CCAPI)
add_compile_definitions(CCAPI_ENABLE_SERVICE_MARKET_DATA)
+2
View File
@@ -21,6 +21,8 @@
"CMAKE_CXX_FLAGS_DEBUG": "/MTd",
"CMAKE_CXX_FLAGS_RELEASE": "/MT",
"CMAKE_SHARED_LINKER_FLAGS_RELEASE": "/DEBUG /OPT:REF /OPT:ICF /LTCG",
"CONAN_COMPILER": "Visual Studio",
"CONAN_COMPILER_VERSION": "17",
"EXTERNALS_ROOT": "${sourceDir}/externals/windows"
}
},
-2
View File
@@ -1,6 +1,4 @@
set(Protobuf_PROTOC_EXECUTABLE "${SPARK_BIN}/protoc")
set(PROTOBUF_INCLUDE_DIRS "${SPARK_INCLUDE}")
set(PROTOBUF_STATIC_LIB "libprotobuf")
function(Protobuf_Generate_Cpp SRCS HDRS)
set(${SRCS})
+16
View File
@@ -0,0 +1,16 @@
from conans import ConanFile
class SparkCryptoConan(ConanFile):
name = "spark_crypto"
version = "0.1"
author = "Blue Trading Solutions"
topics = (
"crypto", "trading", "options", "futures", "derivatives", "api",
"risk", "volatility", "finance")
requires = [
"boost/1.79.0", "catch2/3.0.1", "cmake/3.23.2", "fmt/8.1.1",
"libcurl/7.83.1", "nlohmann_json/3.10.5", "openssl/1.1.1o",
"protobuf/3.21.1", "onetbb/2021.3.0", "zlib/1.2.12"
]
generators = ("cmake", "virtualenv")
+22
View File
@@ -1,17 +1,39 @@
astroid==2.7.3
autopep8==1.5.7
bottle==0.12.21
certifi==2022.6.15
cffi==1.14.6
charset-normalizer==2.1.0
colorama==0.4.4
conan==1.50.0
fasteners==0.17.3
gitdb==4.0.9
idna==3.3
isort==5.9.3
Jinja2==3.1.2
lazy-object-proxy==1.6.0
MarkupSafe==2.1.1
mccabe==0.6.1
node-semver==0.6.1
patch-ng==1.17.4
platformdirs==2.3.0
pluginbase==1.0.1
protobuf==3.19.1
pybars3==0.9.7
pycodestyle==2.7.0
pycparser==2.20
Pygments==2.12.0
PyJWT==2.4.0
pylint==2.10.2
PyMeta3==0.5.1
python-dateutil==2.8.2
PyYAML==6.0
requests==2.28.1
six==1.16.0
smmap==5.0.0
termcolor==1.1.0
toml==0.10.2
tqdm==4.64.0
urllib3==1.26.9
wrapt==1.12.1
yapf==0.31.0
+2 -2
View File
@@ -29,8 +29,8 @@
<PropertyGroup Label="ProtoBuf">
<ProtocPluginBase>$(SparkRoot)\src\lib\api\service_compiler</ProtocPluginBase>
<protoc>$(Externals)\bin\protoc.exe</protoc>
<protogen>$(Externals)\bin\protogen.exe</protogen>
<protoc>protoc</protoc>
<protogen>dotnet protogen</protogen>
</PropertyGroup>
<ItemDefinitionGroup>
+3 -6
View File
@@ -3,7 +3,7 @@
<Target
Name="CompileProto2"
Condition="'@(Proto2)'!=''"
Inputs="$(MSBuildProjectFile);$(protogen);%(Proto2.FullPath)"
Inputs="$(MSBuildProjectFile);%(Proto2.FullPath)"
Outputs="$(GenDir)\proto2\%(Proto2.filename).cs"
AfterTargets="PreBuildEvent">
<PropertyGroup>
@@ -17,9 +17,6 @@
DestinationFolder="$(WorkingDirectory)"
SkipUnchangedFiles="True"
UseHardLinksIfPossible="True" />
<Error
Text="protogen.exe does not exist. If you forgot to clone with externals try: git submodule update --init --recursive"
Condition="!Exists($(protogen))" />
<Exec
Command="$(Protogen) %(Proto2.filename)%(proto2.extension) --csharp_out=. -I. -I$(SourceRoot) -I$(Externals)\include"
WorkingDirectory="$(WorkingDirectory)" />
@@ -37,7 +34,7 @@
Name="CompileProto3"
AfterTargets="GetAssemblyVersion"
Condition="'@(Proto3)'!=''"
Inputs="$(protoc);
Inputs="
%(Proto3.Identity);$(ProtocPluginBase)\plugin.py;
$(ProtocPluginBase)\templates\c#\client.pb.cs;
$(ProtocPluginBase)\templates\c#\server.pb.cs;
@@ -52,7 +49,7 @@
<Exec Command="set PYTHONPATH=$(SparkRoot)\.venv\Scripts\python" />
<Exec
Command="
$(SparkRoot)\tools\build_protos.cmd ^
$(protoc) ^
%(Proto3.FullPath) ^
--error_format=msvs ^
--proto_path=$(SourceRoot) ^
@@ -117,10 +117,10 @@ namespace mbts.spark {
}
Log.Ui.info($"VolSurfaceUsageList name_to_ids count: {name_to_ids.Count}");
var vs_usage = mbts.config.Configuration.get<bts.config.toggles.VolSurfaceUsage>();
Log.Ui.info($"VolSurfaceUsageList vs_usage acount: {vs_usage.vol_surface_usage.Count}");
foreach (var u in vs_usage.vol_surface_usage) {
string option_name = u.option_name;
string vs_name = u.vs_name;
Log.Ui.info($"VolSurfaceUsageList vs_usage acount: {vs_usage.VolSurfaceUsages.Count}");
foreach (var u in vs_usage.VolSurfaceUsages) {
string option_name = u.OptionName;
string vs_name = u.VsName;
int vs_key;
if (name_to_ids.TryGetValue(vs_name, out vs_key)) {
ulist.UsageList.Add(new VolSurfaceUsageEntry() {
@@ -20,7 +20,7 @@ namespace mbts.spark {
[ImportingConstructor]
public AlgoProviderFactory(IAlgoStudioModel studio_model, DynamicOrderHelper dynamic_helper, ISecurityAuxiliaryDataModel security_auxiliary_model) {
var from_conf = config.Configuration.get<bts.config.AlgoTypeRuleSet>();
if (from_conf.rules.Count == 0) {
if (from_conf.Rules.Count == 0) {
// There seems to be a config race bug, where the returned config values are empty, despite having entries in spark.conf.
// [John]I've only noticed it happen when attached to the debugger,
// but best to have a contingency plan in place anyways, to prevent any chance of regression.
@@ -108,7 +108,7 @@ namespace mbts.spark {
.Select(t => _get_type_data(t))
.Concat(dynamic_helper.dynamic_types.Select(dt => _get_type_data(AlgoType.Dynamic, dt)))
.ToListLazy();
var conf_sets = from_conf.rules.Select(r => _to_security_algo_set(r, dynamic_helper, algo_type_data)).ToList();
var conf_sets = from_conf.Rules.Select(r => _to_security_algo_set(r, dynamic_helper, algo_type_data)).ToList();
security_algo_provider = new AlgoProvider(conf_sets.Select(tup => tup.standard).ToList(), studio_model, dynamic_helper, security_auxiliary_model);
attachable_algo_provider = new AttachableAlgoProvider(conf_sets.Select(tup => tup.attachable).ToList(), studio_model, dynamic_helper, security_auxiliary_model);
}
@@ -128,9 +128,9 @@ namespace mbts.spark {
context == null ?
new SecurityCriteriaClause() :
new SecurityCriteriaClause(
exchanges: context.exchanges?.Select(EnumHelper.parse<Venue>)?.ToArray(),
security_types: context.security_types?.Select(EnumHelper.parse<Security.ContractOneofCase>)?.Select(t => t.security_type())?.ToArray(),
symbols: context.symbols?.ToArray());
exchanges: context.Exchanges?.Select(EnumHelper.parse<Venue>)?.ToArray(),
security_types: context.SecurityTypes?.Select(EnumHelper.parse<Security.ContractOneofCase>)?.Select(t => t.security_type())?.ToArray(),
symbols: context.Symbols?.ToArray());
static (SecurityAlgoTypeSetImmutable standard, SecurityAlgoTypeSetImmutable attachable) _to_security_algo_set(
bts.config.AlgoTypeRule rule,
@@ -141,24 +141,24 @@ namespace mbts.spark {
var dynamic_types = ImmutableHashSet<string>.Empty.ToBuilder();
var attachable_factory_types = ImmutableHashSet<AlgoType>.Empty.ToBuilder();
var attachable_dynamic_types = ImmutableHashSet<string>.Empty.ToBuilder();
foreach (var a in rule.algos) {
if (Enum.TryParse(a.name, out AlgoType sys_algo) && sys_algo != AlgoType.Composite && sys_algo != AlgoType.Dynamic) {
on_sys_match(sys_algo, a.is_attachable);
} else if (dynamic_helper.try_parse(a.name, out var dyn_type)) {
on_dyn_match(dyn_type, a.is_attachable);
foreach (var a in rule.Algos) {
if (Enum.TryParse(a.Name, out AlgoType sys_algo) && sys_algo != AlgoType.Composite && sys_algo != AlgoType.Dynamic) {
on_sys_match(sys_algo, a.IsAttachable);
} else if (dynamic_helper.try_parse(a.Name, out var dyn_type)) {
on_dyn_match(dyn_type, a.IsAttachable);
} else {
foreach (var (name, factory, dynamic) in algo_type_data) {
if (Regex.Match(name, a.name).Success) {
if (Regex.Match(name, a.Name).Success) {
switch (factory) {
case AlgoType.None:
case AlgoType.Composite:
// unexpected, but no need to crash
continue;
case AlgoType.Dynamic:
on_dyn_match(dynamic, a.is_attachable);
on_dyn_match(dynamic, a.IsAttachable);
break;
default:
on_sys_match(factory, a.is_attachable);
on_sys_match(factory, a.IsAttachable);
break;
}
}
@@ -168,13 +168,13 @@ namespace mbts.spark {
return (
// standard
new SecurityAlgoTypeSetImmutable(
_to_clause(rule.context),
_to_clause(rule.Context),
new AlgoTypeSetImmutable(
factory_types.ToImmutable(),
dynamic_types.ToImmutable())),
// attachable
new SecurityAlgoTypeSetImmutable(
_to_clause(rule.context),
_to_clause(rule.Context),
new AlgoTypeSetImmutable(
attachable_factory_types.ToImmutable(),
attachable_dynamic_types.ToImmutable())));
+1 -1
View File
@@ -37,7 +37,7 @@ namespace bts.ui {
Window about = Application.LoadComponent(new Uri("/view/Shell/About.xaml", UriKind.Relative)) as Window;
enable_crash_on_dblclick(about);
if (about != null) {
about.DataContext = new { Version = Configuration.get<bts.config.System>().version, User = _user };
about.DataContext = new { Version = Configuration.get<bts.config.System>().Version, User = _user };
about.Topmost = true;
about.CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, (a, b) => about.Close()));
about.CommandBindings.Add(new CommandBinding(ApplicationCommands.Open, (arg, e) => {
+1 -1
View File
@@ -49,7 +49,7 @@ namespace bts {
ss,
user,
security_metadata,
TimeSpan.FromMilliseconds(Configuration.get<RelayOptions>().naggle_ms),
TimeSpan.FromMilliseconds(Configuration.get<RelayOptions>().NaggleMs),
TimeSpan.FromSeconds(1)) { }
public MDDaemon(
@@ -33,7 +33,7 @@ namespace bts.shell {
[ImportingConstructor]
public OrderTicketDaemon(IBus bus, OrdersModel model, UserSettingsHub settings_hub, ErrorReporter error_reporter)
: this(bus, model, settings_hub, error_reporter, Configuration.get<bts.config.OrderTicketOptions>().close_on_send) { }
: this(bus, model, settings_hub, error_reporter, Configuration.get<bts.config.OrderTicketOptions>().CloseOnSend) { }
public OrderTicketDaemon(IBus bus, OrdersModel model, UserSettingsHub settings_hub, ErrorReporter error_reporter, bool close_on_send) {
_bus = bus;
+1 -1
View File
@@ -21,7 +21,7 @@ namespace mbts.ui {
[ImportingConstructor]
public RecenterDaemon(IBus bus) {
_bus = bus;
_time_to_center = TimeSpan.FromSeconds(config.Configuration.get<bts.config.LadderKnobs>().seconds_to_recenter);
_time_to_center = TimeSpan.FromSeconds(config.Configuration.get<bts.config.LadderKnobs>().SecondsToRecenter);
_last_recenter = DateTime.UtcNow;
_dispose = _bus.subscribe(SparkTags.RequestRecenterLadder).Subscribe(_ => trigger_recenter(SparkTags.RecenterLadderNow));
@@ -24,7 +24,7 @@ namespace bts.perf {
[ImportingConstructor]
public ShellLatencyDaemon(ShellLatencyService service, Lazy<UserTuple> user) {
_service = service;
_version = Configuration.get<bts.config.System>().version;
_version = Configuration.get<bts.config.System>().Version;
_username = user.Value.name;
_hostname = Environment.MachineName;
@@ -49,32 +49,32 @@ namespace bts.perf {
async void _forever_ping_host(Ping pinger) {
var config = Configuration.get<bts.config.ShellPingOptions>();
string server_ip = Configuration.get<bts.config.System>().config_ip;
int delay = config.workloop_milliseconds_interval;
string server_ip = Configuration.get<bts.config.System>().ConfigIp;
int delay = config.WorkloopMillisecondsInterval;
int _current_missed_ping_count = 0;
if (config.shell_ping_is_enabled && pinger != null) {
if (config.ShellPingIsEnabled && pinger != null) {
while (true) {
try {
await Task.Delay(delay);
var response = await pinger.SendPingAsync(server_ip, config.timeout_milliseconds_threshold);
var response = await pinger.SendPingAsync(server_ip, config.TimeoutMillisecondsThreshold);
if (response.Status == IPStatus.Success) {
_current_missed_ping_count = 0;
if (response.RoundtripTime > config.logging_milliseconds_threshold) {
if (response.RoundtripTime > config.LoggingMillisecondsThreshold) {
Log.Ui.warn($"Ping response not received in a timely manner:\n" +
$"\tAddress:\t{response.Address}\n" +
$"\tRoundTrip:\t{response.RoundtripTime} ms");
}
// potentially reset delay to initial work period (no-op otherwise)
delay = config.workloop_milliseconds_interval;
delay = config.WorkloopMillisecondsInterval;
} else {
_current_missed_ping_count++;
delay = _get_exp_delay(_current_missed_ping_count, config.workloop_milliseconds_interval, config.maximum_backoff_milliseconds);
delay = _get_exp_delay(_current_missed_ping_count, config.WorkloopMillisecondsInterval, config.MaximumBackoffMilliseconds);
Log.Ui.warn($"Ping was not successful. Ping response: {response.Status}. Missed ping count: {_current_missed_ping_count}. Backing off for {delay} milliseconds.");
}
} catch (PingException e) {
_current_missed_ping_count++;
delay = _get_exp_delay(_current_missed_ping_count, config.workloop_milliseconds_interval, config.maximum_backoff_milliseconds);
delay = _get_exp_delay(_current_missed_ping_count, config.WorkloopMillisecondsInterval, config.MaximumBackoffMilliseconds);
Log.Ui.error($"Ping exception. {e}\nBacking off for {delay} milliseconds.");
}
} // end while
+1 -1
View File
@@ -28,7 +28,7 @@ namespace bts.shell {
}
}
bool check_version() {
string current = Configuration.get<bts.config.System>().version;
string current = Configuration.get<bts.config.System>().Version;
if (!string.IsNullOrWhiteSpace(current) && current != "private") {
using (var key = Registry.CurrentUser.CreateSubKey(@"Software\BTS")) {
var value = key.GetValue("version");
@@ -31,7 +31,7 @@
public override string window_type => WINDOW_TYPE;
string ISharedWindow.thread_id =>
config.Configuration.get<bts.config.MultiThreadedWindows>().vol_surface ? "VolSurface" : null;
config.Configuration.get<bts.config.MultiThreadedWindows>().VolSurface ? "VolSurface" : null;
public int vs_id => _startup_data.id;
public string vs_name { get; }
@@ -65,7 +65,7 @@ namespace mbts.spark {
_settings_hub = settings_hub;
_settings_manager = settings_hub.create_mview_settings_manager(state.grid);
Icon.Freeze();
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().market_view ? "MarketView" : null;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().MarketView ? "MarketView" : null;
_dispose = Disposable.Create(() => {
Disposable.dispose(ref _subscriptions);
_vm.Dispose();
@@ -42,7 +42,7 @@
public override Task<IShellWindow> load(TimeAndSalesSettings state) {
var conf = Configuration.get<bts.config.TimeAndSalesOptions>();
var thread_id = Configuration.get<bts.config.MultiThreadedWindows>().time_and_sales ?
var thread_id = Configuration.get<bts.config.MultiThreadedWindows>().TimeAndSales ?
TimeAndSalesWindow.WINDOW_TYPE_NAME : null;
var settings_man = new WindowSettingsManager<GridSettings>(
_settings_hub, state.grid, s => s.time_and_sales_grid, (s, g) => s.with(time_and_sales: g));
@@ -52,7 +52,7 @@
_consumer,
state,
settings_man,
conf.can_pause_updates,
conf.CanPauseUpdates,
_security_auxiliary_model.get_display_quantity_divisor,
thread_id);
return Task.FromResult<IShellWindow>(win);
@@ -32,7 +32,7 @@ namespace bts.ui {
SparkCommands.ShowGlobalAlerts,
SparkCommands.ShowWorkspaces
};
if (Configuration.get<bts.config.toggles.ToastNotifications>().enabled) {
if (Configuration.get<bts.config.toggles.ToastNotifications>().Enabled) {
actions_list.Add(SparkCommands.ShowSettings);
}
actions = actions_list;
@@ -26,9 +26,9 @@ namespace bts {
static bool _is_hidden(IShellModule module) {
var props = Configuration.get<IShellModuleProps>();
string name = module.GetType().Name;
foreach (var p in props.module) {
if (p.name.ToLower() == name.ToLower()) {
return !p.visible;
foreach (var p in props.Modules) {
if (p.Name.ToLower() == name.ToLower()) {
return !p.Visible;
}
}
return false;
@@ -42,7 +42,7 @@ namespace mbts.spark {
_state = state;
_settings_manager = settings_manager;
Icon.Freeze();
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().synthetic_management ?
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().SyntheticManagement ?
"SyntheticManagement" : null;
_dispose = Disposable.Create(() => {
Disposable.dispose(ref _vm);
@@ -44,8 +44,8 @@ namespace bts.shell {
string uristr = uri.ToString();
string http_base =
"http://{0}:{1}/".fmt(
Configuration.get<bts.config.System>().config_host,
Configuration.get<bts.config.System>().config_port);
Configuration.get<bts.config.System>().ConfigHost,
Configuration.get<bts.config.System>().ConfigPort);
string temp = uristr;
if (uristr.StartsWith("bts://m/")) {
temp = uristr.Replace("bts://m/", http_base + "docs/");
@@ -94,7 +94,7 @@ namespace bts.shell {
emulation_key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(ke_name);
}
var process_name = Configuration.get<bts.config.System>().process_name;
var process_name = Configuration.get<bts.config.System>().ProcessName;
emulation_key.SetValue(process_name, 11001); // IE11
}
#endregion
@@ -43,7 +43,7 @@ namespace mbts.spark {
: base(NAME, bus, factory, SparkCommands.ShowAlgoStudio.icon) {
_model = model;
_state = state;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().algo_studio ? "AlgoStudio" : null;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().AlgoStudio ? "AlgoStudio" : null;
_dispose = Disposable.Create(_dispose_core);
}
@@ -74,12 +74,12 @@ namespace mbts.spark {
_commands.Add(new SparkCommandCommand("Add Algo", Icons.AddBoxes, _vm.add_definition_cmd));
_commands.Add(new SparkCommandCommand("Clone Algo", Icons.CopyBoxes, _vm.clone_selected_definition_cmd));
_commands.Add(new SparkCommandCommand("Save Algo", Icons.DiskFile, _vm.save_cmd) {
show_in_toolbar = _ui_configuration.can_save_specific
show_in_toolbar = _ui_configuration.CanSaveSpecific
});
_commands.Add(new SparkCommandCommand("Save All", Icons.Disk, ObservantAsyncCommand.create(_vm.save_all, out var save_all_observer)));
_resources.Add(_vm.subscribe_dirty().OnDispatcher().Subscribe(save_all_observer));
// undo/redo
if (_ui_configuration.can_undo_redo) {
if (_ui_configuration.CanUndoRedo) {
// undo
var undo_cmd = new ObservantCommand(() => _vm.selected_definition?.try_undo());
var undo_spark_cmd = new SparkCommandCommand("Undo", Icons.UndoCircular, undo_cmd);
@@ -17,10 +17,10 @@ namespace mbts.spark {
static class AlgoStudioModelUtils {
public static IReadOnlyDictionary<object, object> get_dynamic_resources(bts.config.AlgoStudioOptions ui_configuration) =>
new Dictionary<object, object> {
{ AlgoStudioWindow.ShowAlgoToolBarRenameDefinitionKey, ui_configuration.can_modify_definition_name && ui_configuration.show_algo_toolbar_rename },
{ AlgoStudioWindow.ShowAlgoToolBarSaveDefinitionKey, ui_configuration.can_modify_definition_values && ui_configuration.show_algo_toolbar_save },
{ AlgoStudioWindow.ShowAlgoToolBarRevertDefinitionKey, ui_configuration.show_algo_toolbar_revert },
{ AlgoStudioWindow.ShowAlgoToolBarUndoRedoDefinitionKey, ui_configuration.show_algo_toolbar_undo_redo }
{ AlgoStudioWindow.ShowAlgoToolBarRenameDefinitionKey, ui_configuration.CanModifyDefinitionName && ui_configuration.ShowAlgoToolbarRename },
{ AlgoStudioWindow.ShowAlgoToolBarSaveDefinitionKey, ui_configuration.CanModifyDefinitionValues && ui_configuration.ShowAlgoToolbarSave },
{ AlgoStudioWindow.ShowAlgoToolBarRevertDefinitionKey, ui_configuration.ShowAlgoToolbarRevert },
{ AlgoStudioWindow.ShowAlgoToolBarUndoRedoDefinitionKey, ui_configuration.ShowAlgoToolbarUndoRedo }
};
}
}
@@ -65,9 +65,9 @@ namespace mbts.spark {
_permissions_mask.mask = init_permissions;
_permissions_mask.raw = init_permissions;
var resources = new CompositeDisposable();
if (!model.algo_model.ui_configuration.can_modify_definition_values)
if (!model.algo_model.ui_configuration.CanModifyDefinitionValues)
editing_permissions_mask ^= (AlgoEditingPermissions.AllowEditValues | AlgoEditingPermissions.AllowSaveValues);
if (!model.algo_model.ui_configuration.can_modify_definition_structure)
if (!model.algo_model.ui_configuration.CanModifyDefinitionStructure)
editing_permissions_mask ^= (AlgoEditingPermissions.AllowEditStructure | AlgoEditingPermissions.AllowSaveStructure);
key = def_data.key;
algos_view = ObservableAutoWrapper.create_sorted_wrapper(_algo_roots, AlgoCollectionHelper.algo_vm_comparer);
@@ -128,7 +128,7 @@ namespace mbts.spark {
case AlgoKey.Mode.Persisted:
_metadata = new AlgoDefinitionMetadata(key);
resources.Add(model.algo_model.metadata_service.subscribe_metadata(key).OnDispatcher().Subscribe(_on_metadata));
_edit_pane_vs_model.set_state(VisualStateNames.Name.GroupName, conf.can_modify_definition_name ? VisualStateNames.Name.Active : VisualStateNames.Name.CannotRenameDefinition);
_edit_pane_vs_model.set_state(VisualStateNames.Name.GroupName, conf.CanModifyDefinitionName ? VisualStateNames.Name.Active : VisualStateNames.Name.CannotRenameDefinition);
break;
case AlgoKey.Mode.Factory:
_edit_pane_vs_model.set_state(VisualStateNames.Name.GroupName, VisualStateNames.Name.Inactive);
@@ -37,7 +37,7 @@ namespace mbts.spark {
_orders_model = orders_model;
_state = state;
_settings_manager = settings_manager;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().fills ? "Fills" : null;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().Fills ? "Fills" : null;
_dispose = Disposable.Create(() => {
Disposable.dispose(ref _vm);
if (_commands != null) {
@@ -515,7 +515,7 @@ namespace mbts.spark {
static LadderSettings() {
var knobs = config.Configuration.get<bts.config.LadderKnobs>();
mimic_tt = knobs.mimic_tt;
mimic_tt = knobs.MimicTt;
}
// Default proto constructor
@@ -58,7 +58,7 @@
_sec_meta_store = sec_meta_store;
_ladder_conf = new LadderConfig(
Configuration.get<bts.config.LadderKnobs>(),
Configuration.get<bts.config.MultiThreadedWindows>().ladder);
Configuration.get<bts.config.MultiThreadedWindows>().Ladder);
_thread_id_provider = ShellWindowThreadIDFactory.create(_window_type, _ladder_conf.ladders_on_threads);
_mbo = mbo;
_dispose = Disposable.Create(
@@ -117,10 +117,10 @@
public readonly TimeSpan security_timeout;
public LadderConfig(bts.config.LadderKnobs knobs, bool ladders_on_threads) {
max_open_ladders = knobs.max_open_ladders;
open_algo_popup_on_select = knobs.open_algo_popup_on_select;
use_algo_param_grid = knobs.use_algo_param_grid;
security_timeout = TimeSpan.FromSeconds(Math.Max(15, knobs.security_timeout_secs));
max_open_ladders = knobs.MaxOpenLadders;
open_algo_popup_on_select = knobs.OpenAlgoPopupOnSelect;
use_algo_param_grid = knobs.UseAlgoParamGrid;
security_timeout = TimeSpan.FromSeconds(Math.Max(15, knobs.SecurityTimeoutSecs));
this.ladders_on_threads = ladders_on_threads;
}
}
@@ -101,16 +101,16 @@ namespace mbts.spark {
static LadderGridHost() {
var knobs = config.Configuration.get<bts.config.LadderKnobs>();
_show_scrollbar = knobs.show_scrollbar;
_lighten_market_cells = knobs.lighten_market_cells;
_initial_row_count = (int)knobs.scrollable_tick_window_size;
_show_scrollbar = knobs.ShowScrollbar;
_lighten_market_cells = knobs.LightenMarketCells;
_initial_row_count = (int)knobs.ScrollableTickWindowSize;
// For market cell backgrounds, 0 means null. Note that the full
// range of colors can still be expressed, as zero is merely one of
// 2^24 possible representations of 'transparent.'
if (knobs.bid_market_cell_background != 0)
_bid_market_cell_background = knobs.bid_market_cell_background.argb_color();
if (knobs.ask_market_cell_background != 0)
_ask_market_cell_background = knobs.ask_market_cell_background.argb_color();
if (knobs.BidMarketCellBackground != 0)
_bid_market_cell_background = knobs.BidMarketCellBackground.argb_color();
if (knobs.AskMarketCellBackground != 0)
_ask_market_cell_background = knobs.AskMarketCellBackground.argb_color();
}
public LadderGridHost() {
@@ -27,7 +27,7 @@ namespace mbts.spark {
static LadderView() {
var knobs = config.Configuration.get<bts.config.LadderKnobs>();
MimicTT = knobs.mimic_tt;
MimicTT = knobs.MimicTt;
}
public static bool MimicTT { get; }
@@ -130,8 +130,8 @@ namespace bts.shell {
}
public static ManualFillsConfig read() => new ManualFillsConfig(
mbts.config.Configuration.get<bts.config.MultiThreadedWindows>().manual_fills ? window_type : null,
mbts.config.Configuration.get<bts.config.ManualFillsOptions>().modal_transactions);
mbts.config.Configuration.get<bts.config.MultiThreadedWindows>().ManualFills ? window_type : null,
mbts.config.Configuration.get<bts.config.ManualFillsOptions>().ModalTransactions);
}
static class CommandGroups {
@@ -1260,7 +1260,7 @@ namespace mbts.spark {
_background_converter = new AnonymousMultiValueConverter<bool, OrderStatus, Brush>(
(selected, status) => selected || status != OrderStatus.Working ? Brushes.Transparent : BTSColors.Orders.working_order_background_brush);
static readonly bool _animate_child_order_rows = mbts.config.Configuration.get<bts.config.OrderBookOptions>().animate_child_order_rows;
static readonly bool _animate_child_order_rows = mbts.config.Configuration.get<bts.config.OrderBookOptions>().AnimateChildOrderRows;
public static BindingBase _get_background_binding() {
var mb = new MultiBinding { Converter = _background_converter };
@@ -1014,11 +1014,11 @@ namespace mbts.spark {
var top = config.Configuration.get<bts.config.TopAttachUIOptions>();
var offset = config.Configuration.get<bts.config.OffsetAttachUIOptions>();
_algo_type_conf = new Dictionary<CustomOrderDefinition.CustomOneofCase, (bool, bool)> {
{ CustomOrderDefinition.CustomOneofCase.Cover, (cover.show_price, cover.show_quantity) },
{ CustomOrderDefinition.CustomOneofCase.Join, (join.show_price, join.show_quantity) },
{ CustomOrderDefinition.CustomOneofCase.Lean, (lean.show_price, lean.show_quantity) },
{ CustomOrderDefinition.CustomOneofCase.Top, (top.show_price, top.show_quantity) },
{ CustomOrderDefinition.CustomOneofCase.Offset, (offset.show_price, offset.show_quantity) }
{ CustomOrderDefinition.CustomOneofCase.Cover, (cover.ShowPrice, cover.ShowQuantity) },
{ CustomOrderDefinition.CustomOneofCase.Join, (join.ShowPrice, join.ShowQuantity) },
{ CustomOrderDefinition.CustomOneofCase.Lean, (lean.ShowPrice, lean.ShowQuantity) },
{ CustomOrderDefinition.CustomOneofCase.Top, (top.ShowPrice, top.ShowQuantity) },
{ CustomOrderDefinition.CustomOneofCase.Offset, (offset.ShowPrice, offset.ShowQuantity) }
};
}
@@ -67,7 +67,7 @@ namespace mbts.spark {
_state = state;
_settings_manager = settings_manager;
_can_edit_specific_algo_params = can_edit_specific_algo_params;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().order_book ? "OrderBook" : null;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().OrderBook ? "OrderBook" : null;
_dispose = Disposable.Create(() => {
Disposable.dispose(_thread_init_resources);
Disposable.dispose(ref _attachment_exit_sub);
@@ -35,7 +35,7 @@ namespace bts.shell {
ISecurityMetadataStore sec_meta_store,
UserSettingsHub settings_hub) : base(owner, "SparkOrderBookWindow") {
var raw_config = Configuration.get<bts.config.OrderBookOptions>();
_config = new OrderBookConfig(raw_config.can_edit_specific_algo_params);
_config = new OrderBookConfig(raw_config.CanEditSpecificAlgoParams);
_bus = bus;
_notification_service = notification_service;
_notification_service_data_cache = notification_service_data_cache;
@@ -70,7 +70,7 @@ namespace mbts.spark {
var bg_binding = new MultiBinding();
bg_binding.Bindings.Add(new Binding(nameof(OrderBookRowVM.status)));
bg_binding.Bindings.Add(new Binding(nameof(ListBoxItem.IsSelected)) { RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(ListBoxItem), 1) });
double overlay_opacity = config.Configuration.get<bts.config.OrderBookOptions>().status_color_opacity_when_selected;
double overlay_opacity = config.Configuration.get<bts.config.OrderBookOptions>().StatusColorOpacityWhenSelected;
if (overlay_opacity > 0.1 && overlay_opacity < 0.9) {
bg_binding.Converter = ValueConverter.create<OrderStatus, bool, Brush>((status, is_selected) => {
var color = _status_color(status);
@@ -61,7 +61,7 @@ namespace bts.shell {
_position_model = position_model;
_sec_meta_store = sec_meta_store;
_pnl_conf = new PNLConfig(Configuration.get<bts.config.PNLOptions>());
_thread_id_provider = ShellWindowThreadIDFactory.create(_window_type, Configuration.get<bts.config.MultiThreadedWindows>().pnl);
_thread_id_provider = ShellWindowThreadIDFactory.create(_window_type, Configuration.get<bts.config.MultiThreadedWindows>().Pnl);
_dispose = bus.subscribe(SparkTags.ShowPNLTag).OnDispatcher().Subscribe(_show);
}
@@ -308,8 +308,8 @@ namespace bts.shell {
show_pause_resume;
public PNLConfig(bts.config.PNLOptions options) {
enable_animations = options.enable_animations;
show_pause_resume = options.show_pause_resume;
enable_animations = options.EnableAnimations;
show_pause_resume = options.ShowPauseResume;
}
}
@@ -51,7 +51,7 @@ namespace Spark.Trading {
IWindowSettingsManager<GridSettings> settings_manager,
UserTuple user)
: base("Reconcile Report", bus, save, Icons.Reports) {
thread_id = Configuration.get<bts.config.MultiThreadedWindows>().reconcile_report ?
thread_id = Configuration.get<bts.config.MultiThreadedWindows>().ReconcileReport ?
WINDOW_TYPE_NAME : null;
_position_model = position_model;
_security_metadata = security_metadata;
@@ -26,7 +26,7 @@ namespace BCG
Right
}
private readonly bool _is_remoted = mbts.config.Configuration.get<bts.config.System>().is_remote_app;
private readonly bool _is_remoted = mbts.config.Configuration.get<bts.config.System>().IsRemoteApp;
[Category("Grid Lines")]
[DisplayName("Row Seperator Line Color")]
@@ -21,7 +21,7 @@ namespace BCG {
Down
}
private readonly bool _is_remoted = mbts.config.Configuration.get<bts.config.System>().is_remote_app;
private readonly bool _is_remoted = mbts.config.Configuration.get<bts.config.System>().IsRemoteApp;
private readonly PerfStatsLogger _recorder = new PerfStatsLogger();
private readonly HighPerformanceTimer _timer = new HighPerformanceTimer();
private System.ComponentModel.Container components = null;
@@ -350,4 +350,4 @@ namespace BCG {
}
#endregion
}
}
}
+3 -3
View File
@@ -56,8 +56,8 @@ namespace mbts.ui {
SoundNotificationPlayer _sound_player;
Dispatcher _dispatcher;
bool
_sound_notifications_enabled = Configuration.get<bts.config.toggles.SoundNotifications>().enabled,
_toast_notifications_enabled = Configuration.get<bts.config.toggles.ToastNotifications>().enabled;
_sound_notifications_enabled = Configuration.get<bts.config.toggles.SoundNotifications>().Enabled,
_toast_notifications_enabled = Configuration.get<bts.config.toggles.ToastNotifications>().Enabled;
[ImportingConstructor]
public Notifier(IBus bus, UserSettingsHub settings_hub) {
@@ -77,7 +77,7 @@ namespace mbts.ui {
if (_disposer.has_dispose_started)
return;
_sound_player = SoundNotificationPlayer.create();
if (Configuration.get<bts.config.toggles.ToastNotifications>().enabled) {
if (Configuration.get<bts.config.toggles.ToastNotifications>().Enabled) {
_toast_controller = new ToastNotificationController(bus);
_settings_sub = settings_hub.subscribe_default_settings().StartWith(settings_hub.current).OnDispatcher().Subscribe(s => {
if (s == null || _disposer.has_dispose_started)
+1 -1
View File
@@ -36,7 +36,7 @@
[Export]
class OrdersModel : IDisposable {
public static readonly bool piq_enabled = Configuration.get<bts.config.toggles.PlacementInQueue>().enabled;
public static readonly bool piq_enabled = Configuration.get<bts.config.toggles.PlacementInQueue>().Enabled;
public readonly MarketDataAuxiliaryModel md_auxiliary_model;
public readonly ISecurityAuxiliaryDataModel security_auxiliary_model;
@@ -32,7 +32,7 @@
class OrderSentEventPredicate : IEquatable<OrderSentEventPredicate> {
static readonly int _type_hash = typeof(OrderSentEventPredicate).GetHashCode();
// arbitrary short time period (can override in config)
static readonly TimeSpan _stale_order_threshold = TimeSpan.FromSeconds(config.Configuration.get<bts.config.OrderAlerts>().stale_order_threshold_seconds);
static readonly TimeSpan _stale_order_threshold = TimeSpan.FromSeconds(config.Configuration.get<bts.config.OrderAlerts>().StaleOrderThresholdSeconds);
public enum PredicateTypeOneofCase {
[Description("(any order)")]
+1 -1
View File
@@ -30,7 +30,7 @@ namespace mbts.ui.settings {
}
static class PredicateVMWrapper {
static readonly bool _toast_notifications_enabled_global = Configuration.get<bts.config.toggles.ToastNotifications>().enabled;
static readonly bool _toast_notifications_enabled_global = Configuration.get<bts.config.toggles.ToastNotifications>().Enabled;
public static ITemplatedPropertyWrapperVM<TSource> wrap_child_oneof<TSource, TChild, TChildOneof>(
Func<TSource, TChild> get, Action<TSource, TChild> set, Func<TChild, TChildOneof> get_child_oneof, Dictionary<TChildOneof, ITemplatedPropertyWrapperVM<TChild>> oneof_vms)
@@ -29,7 +29,7 @@ namespace mbts.analytics {
IBus bus, ISaveWindow<ComboReportSettings> save,
ComboReportSettings settings)
: base(settings.id.ToString(), bus, save, Icons.Reports) {
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().combo_report ?
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().ComboReport ?
"Combo" : null;
_settings = settings;
_dispose = Disposable.Create(() => (_vm, _model));
@@ -34,7 +34,7 @@ namespace mbts.analytics {
ISaveWindow<SlideReportSettings> save,
SlideReportSettings settings)
: base(settings.id.ToString(), bus, save, Icons.Reports) {
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().slide_report ? "Slide" : null;
thread_id = config.Configuration.get<bts.config.MultiThreadedWindows>().SlideReport ? "Slide" : null;
_settings = settings;
_dispose = Disposable.Create(() => Disposable.dispose(ref _vm));
}
@@ -28,9 +28,9 @@ namespace mbts.spark {
public SecurityAuxiliaryDataModel() {
var sym_config = Configuration.get<bts.config.SymbolUIConfiguration>();
var sym_config_items = Configuration.get<bts.config.SymbolUIConfiguration>().items;
var sym_config_items = Configuration.get<bts.config.SymbolUIConfiguration>().Items;
foreach (var item in sym_config_items)
_auxiliary_data[item.symbol] = new SecurityAuxiliaryData(item.display_quantity_divisor);
_auxiliary_data[item.Symbol] = new SecurityAuxiliaryData(item.DisplayQuantityDivisor);
}
public SecurityAuxiliaryData? get_auxiliary_data(SecurityImmutable security) =>
+1 -1
View File
@@ -88,7 +88,7 @@
}
public override void CreateShell(ShellModel model) {
if (Configuration.get<bts.config.ShellRenderMode>().software_only) {
if (Configuration.get<bts.config.ShellRenderMode>().SoftwareOnly) {
System.Windows.Media.RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;
}
@@ -202,7 +202,7 @@ namespace mbts.ui.native {
private static extern bool SetWorkArea_SystemParametersInfo(SPI action, uint zero, Win32Rect param, uint winini);
public static void SetWorkArea(Rect workarea) {
var dpi_ratio = config.Configuration.get<bts.config.System>().dpi_ratio;
var dpi_ratio = config.Configuration.get<bts.config.System>().DpiRatio;
workarea = new Rect(workarea.Left * dpi_ratio, workarea.Top * dpi_ratio, (workarea.Right - workarea.Left) * dpi_ratio, (workarea.Bottom - workarea.Top) * dpi_ratio);
//const uint SPIF_SENDWININICHANGE = 2;
const uint SPIF_UPDATEINIFILE = 1;
@@ -220,7 +220,7 @@ namespace mbts.ui.native {
// Get the work area for monitor where the specified window is currently.
// The work area is the area of the window not covered by the task bar or a docked shell
public static Rect GetWorkArea(IntPtr window) {
var dpi_ratio = config.Configuration.get<bts.config.System>().dpi_ratio;
var dpi_ratio = config.Configuration.get<bts.config.System>().DpiRatio;
IntPtr monitor = MonitorFromWindow(window, MONITOR_DEFAULTONNEAREST);
MONITORINFO info = new MONITORINFO();
info.cbSize = Marshal.SizeOf(info);
@@ -28,13 +28,13 @@ namespace mbts.spark {
// i.e. 21:30 UTC corresponds to 16:30 Central (4:30 PM), but only during *CDT*
// CDT it UTC -5
// CST is UTC -6
static readonly int sod_hh = (int)config.Configuration.get<bts.config.SODTime>().sod_hh;
static readonly int sod_mm = (int)config.Configuration.get<bts.config.SODTime>().sod_mm;
static readonly int sod_hh = (int)config.Configuration.get<bts.config.SODTime>().SodHh;
static readonly int sod_mm = (int)config.Configuration.get<bts.config.SODTime>().SodMm;
static readonly TimeZoneInfo central_tzi = TimeZoneInfo.FindSystemTimeZoneById(cst_id);
static MarketSchedule() {
var cme_schedule = config.Configuration.get<bts.md.CMETradingSchedule>();
_cme_gen_open_hrs = cme_schedule?.gen_open_hour ?? 8.5;
_cme_gen_open_hrs = cme_schedule?.GenOpenHour ?? 8.5;
}
// for object initializers
public MarketSchedule() { }
@@ -24,7 +24,7 @@ namespace mbts.ui.dpi {
public static readonly float fdpi_ratio;
static HighDpiExtensions() {
dpi_ratio = Configuration.get<bts.config.System>().dpi_ratio;
dpi_ratio = Configuration.get<bts.config.System>().DpiRatio;
pixel_unit = 1.0 / dpi_ratio;
fdpi_ratio = (float)dpi_ratio;
}
@@ -8,7 +8,7 @@ using System.Windows.Input;
namespace mbts.ui {
class ScrollViewerCorrector {
static readonly bool _fix_nested_scrolling_enabled = mbts.config.Configuration.get<bts.config.toggles.FixNestedScrolling>().enabled;
static readonly bool _fix_nested_scrolling_enabled = mbts.config.Configuration.get<bts.config.toggles.FixNestedScrolling>().Enabled;
static List<MouseWheelEventArgs> _reentrancy_list => ThreadStaticActivator<ReentrancyList>.instance;
public static readonly DependencyProperty FixNestedScrollingProperty =
@@ -9,7 +9,7 @@ using System.Windows.Media;
namespace mbts.ui {
static class WindowExtensions {
static readonly bool _ensure_onscreen_with_work_area_rect = config.Configuration.get<bts.config.toggles.EnsureOnScreenWithWorkAreaRect>().enabled;
static readonly bool _ensure_onscreen_with_work_area_rect = config.Configuration.get<bts.config.toggles.EnsureOnScreenWithWorkAreaRect>().Enabled;
public static Rect bounds(this Window window) {
return new Rect(window.Left, window.Top, window.ActualWidth, window.ActualHeight);
+1 -1
View File
@@ -77,7 +77,7 @@
.WithParts(types)
.WithDefaultConventions(rules);
string plugin_path = Configuration.get<bts.config.System>().data_path + "/plugins/";
string plugin_path = Configuration.get<bts.config.System>().DataPath + "/plugins/";
if (Directory.Exists(plugin_path)) {
var assemblies = Directory.GetFiles(plugin_path, "*.dll")
.Select(AssemblyLoadContext.Default.LoadFromAssemblyPath);
@@ -127,7 +127,7 @@ namespace mbts.ui.shell {
}
public async void save_workspace_periodically() {
TimeSpan interval = TimeSpan.FromSeconds(Configuration.get<bts.config.ShellSettingsConfig>().save_timer);
TimeSpan interval = TimeSpan.FromSeconds(Configuration.get<bts.config.ShellSettingsConfig>().SaveTimer);
await Task.Delay(interval);
while (!_closing) {
var workspace = await get_workspace_async();
@@ -153,7 +153,7 @@ namespace mbts.ui.shell {
private static string local_workspace_path() {
var system = Configuration.get<bts.config.System>();
return @"{0}/{1}/{2}".fmt(system.data_path, WORKSPACE_NAMESPACE, "recover_workspace");
return @"{0}/{1}/{2}".fmt(system.DataPath, WORKSPACE_NAMESPACE, "recover_workspace");
}
private static void save_workspace_locally(WorkspaceDefinition workspace) {
string path = local_workspace_path();
@@ -129,7 +129,7 @@ namespace mbts.spark {
#region static
public static readonly MBOSecurityQueryImmutable default_query = (MBOSecurityQueryImmutable)
new MBOSecurityQuery {
Limit = Configuration.get<bts.config.LadderKnobs>().max_mbo_orders
Limit = Configuration.get<bts.config.LadderKnobs>().MaxMboOrders
};
#endregion
}
@@ -14,8 +14,8 @@ namespace mbts.spark {
static WorkLoop() {
var timer_params = config.Configuration.get<bts.config.LadderKnobs>();
default_priority = Enum.TryParse(timer_params.priority, true, out DispatcherPriority p) ? p : DispatcherPriority.ApplicationIdle;
default_interval = TimeSpan.FromMilliseconds(timer_params.interval_ms);
default_priority = Enum.TryParse(timer_params.Priority, true, out DispatcherPriority p) ? p : DispatcherPriority.ApplicationIdle;
default_interval = TimeSpan.FromMilliseconds(timer_params.IntervalMs);
}
/// <summary>
@@ -47,7 +47,7 @@ namespace mbts.ui.utility {
static Int32Rect screen_size() {
var config = Configuration.get<bts.config.System>();
var dpi = config.dpi_ratio;
var dpi = config.DpiRatio;
return new Int32Rect(
(int)(SystemParameters.VirtualScreenLeft * dpi),
(int)(SystemParameters.VirtualScreenTop * dpi),
@@ -106,7 +106,7 @@ namespace bts.test {
port = (uint)((IPEndPoint)listener.LocalEndpoint).Port;
listener.Stop();
}
var cfg = new config.QuickbusNodeCfg() { my_port = port };
var cfg = new config.QuickbusNodeCfg() { MyPort = port };
var stream = new MemoryStream();
ProtoBuf.Serializer.Serialize(stream, cfg);
IntPtr qbus = ApiNativeMethods.api_create_quickbus(stream.ToArray(), stream.Length);
@@ -115,4 +115,4 @@ namespace bts.test {
#endregion
}
}
}
+1 -1
View File
@@ -11,7 +11,7 @@ using bts.support;
namespace mbts
{
public static class LogUtil {
private static string log_path = Path.Combine(Configuration.get<bts.config.System>().data_path, "logging", "log");
private static string log_path = Path.Combine(Configuration.get<bts.config.System>().DataPath, "logging", "log");
+4 -4
View File
@@ -135,9 +135,9 @@ namespace bts.tests.utils {
var prts = mbts.config.Configuration.get<bts.config.Ports>();
Console.WriteLine("\n\n\n\n\n\n\n\n\n\n");
Console.WriteLine("config_port: " + prts.config_port);
Console.WriteLine("qbus_port: " + prts.qbus_port);
Console.WriteLine("glbx_sim_fix_port: " + prts.glbx_sim_fix_port);
Console.WriteLine("config_port: " + prts.ConfigPort);
Console.WriteLine("qbus_port: " + prts.QbusPort);
Console.WriteLine("glbx_sim_fix_port: " + prts.GlbxSimFixPort);
Console.WriteLine("\n\n\n\n\n\n\n\n\n\n");
var ctx = new ServiceContext();
@@ -258,4 +258,4 @@ namespace bts.tests.utils {
return md_result != null;
}
}
}
}
+2 -2
View File
@@ -124,7 +124,7 @@ namespace bts {
ConsoleEx.WriteLine("Invalid Credentials", ConsoleColor.Red);
}
if (Configuration.get<config.DeploymentType>().type.ToUpper() == "PROD") {
if (Configuration.get<config.DeploymentType>().Type.ToUpper() == "PROD") {
ConsoleEx.WriteLine("Refusing to run on production system", ConsoleColor.Red);
return -1;
}
@@ -165,4 +165,4 @@ namespace bts {
}
}
}
}
+4 -10
View File
@@ -100,11 +100,7 @@ if(WIN32)
target_link_libraries(
libspark
libcurl
debug
fmtd
optimized
fmt
libtbb
debug tbb_debug
libboost_system
libboost_thread
libboost_filesystem
@@ -112,11 +108,9 @@ if(WIN32)
libboost_chrono
libboost_date_time
libboost_atomic
libprotobuf
libprotoc
libssl
libcrypto
crypt32)
debug libprotobufd optimized libprotobuf
debug libprotocd optimized libprotoc
${CONAN_LIBS})
else()
add_library(libspark SHARED ${SparkLib_Sources} ${PROTO_SRCS} ${SERVICE_COMPILER_SRCS})
target_link_libraries(
+7 -7
View File
@@ -95,7 +95,7 @@ bool ConfigValueQueue::can_process(const std::string &source) {
for (size_t x = 0; x < len; ++x) {
// If there is a destination assignment underneath the source path
// Then we cannot copy the value yet
const string &dest = _vals[x].dest_key;
const std::string &dest = _vals[x].dest_key;
if (dest.compare(0, source.size(), source) == 0) {
if (dest.size() <= source.size() || dest[source.size()] == '.') {
return false;
@@ -156,7 +156,7 @@ void ConfigValueQueue::assign(
} else if (field->type() == proto::FieldDescriptor::Type::TYPE_BOOL) {
reflection->SetBool(message, field, value_to_bool(value));
} else {
string error = "Invalid type conversion in assignment to " +
std::string error = "Invalid type conversion in assignment to " +
message->GetTypeName() + "." + field->name();
throw ConfigurationException(error.c_str());
}
@@ -227,7 +227,7 @@ void ConfigValueQueue::assign_value_to_field(
case FieldDescriptor::TYPE_FIXED32:
case FieldDescriptor::TYPE_INT32:
if (value.which() == ValueType::string) {
lexical_assign<int, string>(MY_ARGS);
lexical_assign<int, std::string>(MY_ARGS);
} else {
assign<int, double>(MY_ARGS);
}
@@ -241,9 +241,9 @@ void ConfigValueQueue::assign_value_to_field(
case FieldDescriptor::TYPE_STRING:
if (value.which() == ValueType::integer ||
value.which() == ValueType::real) {
lexical_assign<string, double>(MY_ARGS);
lexical_assign<std::string, double>(MY_ARGS);
} else {
assign<string>(MY_ARGS);
assign<std::string>(MY_ARGS);
}
break;
case FieldDescriptor::TYPE_MESSAGE:
@@ -257,7 +257,7 @@ void ConfigValueQueue::assign_value_to_field(
int size = reflection->FieldSize(*message, field);
const EnumDescriptor *enum_type = field->enum_type();
const EnumValueDescriptor *enum_value =
enum_type->FindValueByName(boost::get<string>(value));
enum_type->FindValueByName(boost::get<std::string>(value));
reflection->AddEnum(message, field, enum_value);
if (index != size) {
for (int i = index; i < size; ++i) {
@@ -270,7 +270,7 @@ void ConfigValueQueue::assign_value_to_field(
} else {
const EnumDescriptor *enum_type = field->enum_type();
const EnumValueDescriptor *enum_value =
enum_type->FindValueByName(boost::get<string>(value));
enum_type->FindValueByName(boost::get<std::string>(value));
set_field(message, reflection, field, enum_value, index);
if (field->is_repeated()) {
bump_indexes(message, field, 1);
+13 -13
View File
@@ -99,11 +99,11 @@ class TextFormat {
const UnknownFieldSet &unknown_fields, io::ZeroCopyOutputStream *output);
// Like Print(), but outputs directly to a string.
static bool PrintToString(const Message &message, string *output);
static bool PrintToString(const Message &message, std::string *output);
// Like PrintUnknownFields(), but outputs directly to a string.
static bool PrintUnknownFieldsToString(
const UnknownFieldSet &unknown_fields, string *output);
const UnknownFieldSet &unknown_fields, std::string *output);
// Outputs a textual representation of the value of the field supplied on
// the message supplied. For non-repeated fields, an index of -1 must
@@ -113,7 +113,7 @@ class TextFormat {
const Message &message,
const FieldDescriptor *field,
int index,
string *output);
std::string *output);
// Class for those users which require more fine-grained control over how
// a protobuffer message is printed out.
@@ -130,16 +130,16 @@ class TextFormat {
const UnknownFieldSet &unknown_fields,
io::ZeroCopyOutputStream *output) const;
// Like TextFormat::PrintToString
bool PrintToString(const Message &message, string *output) const;
bool PrintToString(const Message &message, std::string *output) const;
// Like TextFormat::PrintUnknownFieldsToString
bool PrintUnknownFieldsToString(
const UnknownFieldSet &unknown_fields, string *output) const;
const UnknownFieldSet &unknown_fields, std::string *output) const;
// Like TextFormat::PrintFieldValueToString
void PrintFieldValueToString(
const Message &message,
const FieldDescriptor *field,
int index,
string *output) const;
std::string *output) const;
// Adjust the initial indent level of all output. Each indent level is
// equal to two spaces.
@@ -231,19 +231,19 @@ class TextFormat {
// by Print().
static bool Parse(io::ZeroCopyInputStream *input, Message *output);
// Like Parse(), but reads directly from a string.
static bool ParseFromString(const string &input, Message *output);
static bool ParseFromString(const std::string &input, Message *output);
// Like Parse(), but the data is merged into the given message, as if
// using Message::MergeFrom().
static bool Merge(io::ZeroCopyInputStream *input, Message *output);
// Like Merge(), but reads directly from a string.
static bool MergeFromString(const string &input, Message *output);
static bool MergeFromString(const std::string &input, Message *output);
// Parse the given text as a single field value and store it into the
// given field of the given message. If the field is a repeated field,
// the new value will be added to the end
static bool ParseFieldValueFromString(
const string &input, const FieldDescriptor *field, Message *message);
const std::string &input, const FieldDescriptor *field, Message *message);
// Interface that TextFormat::Parser can use to find extensions.
// This class may be extended in the future to find more information
@@ -255,7 +255,7 @@ class TextFormat {
// Try to find an extension of *message by fully-qualified field
// name. Returns NULL if no extension is known for this name or number.
virtual const FieldDescriptor *
FindExtension(Message *message, const string &name) const = 0;
FindExtension(Message *message, const std::string &name) const = 0;
};
// For more control over parsing, use this class.
@@ -267,11 +267,11 @@ class TextFormat {
// Like TextFormat::Parse().
bool Parse(io::ZeroCopyInputStream *input, Message *output);
// Like TextFormat::ParseFromString().
bool ParseFromString(const string &input, Message *output);
bool ParseFromString(const std::string &input, Message *output);
// Like TextFormat::Merge().
bool Merge(io::ZeroCopyInputStream *input, Message *output);
// Like TextFormat::MergeFromString().
bool MergeFromString(const string &input, Message *output);
bool MergeFromString(const std::string &input, Message *output);
void SetValueLookup(IDeferValueLookup *lookup) { lookup_ = lookup; }
@@ -292,7 +292,7 @@ class TextFormat {
// Like TextFormat::ParseFieldValueFromString
bool ParseFieldValueFromString(
const string &input, const FieldDescriptor *field, Message *output);
const std::string &input, const FieldDescriptor *field, Message *output);
private:
// Forward declaration of an internal class used to parse text
-6
View File
@@ -1,6 +0,0 @@
@echo off
@call %~dp0\..\.venv\Scripts\activate.bat
set PYTHONPATH=%~dp0\..\.venv\Scripts\python
@call %~dp0\..\externals\windows\bin\protoc.exe %*
+79
View File
@@ -0,0 +1,79 @@
import os
from pathlib import Path
import platform
import subprocess
import argparse
import termcolor
def _exit(code=0, msg=None):
if msg is not None:
print(msg)
exit(code)
def _get_arg_parser():
parser = argparse.ArgumentParser(description='Install conan deps')
parser.add_argument(
'--profile', metavar='debug|release', help='The conan profile')
parser.set_defaults(profile='debug')
return parser
class BuildStep:
def __init__(
self, header, body=None, begin_color='green', end_color='cyan'):
self.header = header
self.body = body
self.begin_color = begin_color
self.end_color = end_color
def _desc_parts(self):
parts = [self.header]
if self.body is not None:
parts.append(self.body)
return parts
def __str__(self):
return ': '.join(self._desc_parts())
def __enter__(self):
termcolor.cprint(
f'\n* BEGIN {self.header}', color=self.begin_color, flush=True)
if self.body is not None:
print(f'{self.body}', flush=True)
def __exit__(self, exc_type, exc_val, exc_tb):
termcolor.cprint(
f'* END {self.header}', color=self.end_color, flush=True)
def _platform_name():
return platform.system().lower()
def _repo_root():
return Path(os.path.realpath(__file__)).parent.parent.absolute()
def _main():
parser = _get_arg_parser()
args = parser.parse_args()
repo_root_path = _repo_root()
os.chdir(repo_root_path)
conan_cfg_path = repo_root_path.joinpath('.conan', _platform_name())
profile_path = conan_cfg_path.joinpath('profiles', args.profile)
install_path = conan_cfg_path.joinpath('install', args.profile)
conan_install_cmd = f'conan install --profile {profile_path} --install-folder {install_path} --build missing .'
with BuildStep(conan_install_cmd):
subprocess.run(conan_install_cmd, shell=True)
if __name__ == '__main__':
try:
_main()
except Exception as e:
_exit(1, str(e))