private BetterDict <string, YamlObject> GetObjectChangeDict() { return(new BetterDict <string, YamlObject> { { online.GetFieldName(), online.GetValue() }, { local.GetFieldName(), local.GetValue() } }); }
public string buildOutputDirectory(string fileName) { List <string> pathSplit = new List <string> { downloadSettings.GetValue().targetDirectory.GetValue() }; if (downloadSettings.GetValue().appendPlatform.GetValue()) { pathSplit.Add(onlineSourcesConfig.GetValue().platform.GetValue()); } if (downloadSettings.GetValue().appendVersion.GetValue()) { pathSplit.Add(onlineSourcesConfig.GetValue().version.GetValue()); } if (downloadSettings.GetValue().appendDate.GetValue()) { pathSplit.Add(DateTime.Now.ToString("yyyy.MM.dd")); } pathSplit.AddRange(fileName.Split("/")); return(Path.Combine(pathSplit.GetRange(0, pathSplit.Count - 1).ToArray())); }
public void Init(IOnlineAddressDictConfig addressDictSupplier) { sourceFrom.GetValue().Init( lastCreated, new MenuOption(nameof(lastCreated), MenuUtils.GetConfigureString, lastCreated.ToString, OnLastCreatedClicked)); sourceTo.GetValue().Init( lastCreated, new MenuOption(nameof(lastCreated), MenuUtils.GetConfigureString, lastCreated.ToString, OnLastCreatedClicked)); onlineSourcesConfig.GetValue().Init(addressDictSupplier); }
public string GetLocalSourceFile(SourceConfig sourceConfig) { string fileName = localSourcesConfig.GetValue().targetFileName; if (sourceConfig.sourceType.GetValue() == ESourceType.online) { if (localSourcesConfig.GetValue().appendPlatform.GetValue()) { fileName += "_" + sourceConfig.online.GetValue().platform; } if (localSourcesConfig.GetValue().appendVersion.GetValue()) { fileName += "_" + sourceConfig.online.GetValue().version; } if (localSourcesConfig.GetValue().appendDate.GetValue()) { fileName += "_" + DateTime.Now.ToString("yyyy.MM.dd"); } } else if (sourceConfig.sourceType.GetValue() == ESourceType.local) { if (localSourcesConfig.GetValue().appendPlatform.GetValue()) { fileName += "_" + sourceConfig.local.GetValue().platform; } if (localSourcesConfig.GetValue().appendVersion.GetValue()) { fileName += "_" + sourceConfig.local.GetValue().version; } if (localSourcesConfig.GetValue().appendDate.GetValue()) { fileName += "_" + sourceConfig.local.GetValue().date; } } else { //undefined behaviour throw new InvalidOperationException("SourceType " + sourceConfig.sourceType.GetValue() + " not supported!"); } fileName += "." + localSourcesConfig.GetValue().targetFileExtension; return(Path.Combine(localSourcesConfig.GetValue().baseDirectory, fileName)); }
public string GetResultFile(string baseFileName) { if (downloadSettings.GetValue().appendDate.GetValue()) { baseFileName += "_" + DateTime.Now.ToString("yyyy.MM.dd"); } if (downloadSettings.GetValue().appendPlatform.GetValue()) { baseFileName += "_" + onlineSourcesConfig.GetValue().platform.GetValue(); } if (downloadSettings.GetValue().appendVersion.GetValue()) { baseFileName += "_" + onlineSourcesConfig.GetValue().version.GetValue(); } baseFileName += ".txt"; return(Path.Combine(downloadSettings.GetValue().targetDirectory.GetValue(), baseFileName)); }
private BetterDict <string, YamlObject> GetObjectChangeDict() { return(new BetterDict <string, YamlObject> { { nameof(onlineSourcesConfig), onlineSourcesConfig.GetValue() }, { nameof(downloadSettings), downloadSettings.GetValue() }, { nameof(interpreterConfig), interpreterConfig.GetValue() } }); }
private BetterDict <string, YamlObject> GetObjectChangeDict() { return(new BetterDict <string, YamlObject> { { nameof(sourceConfigHolder), sourceConfigHolder.GetValue() }, { nameof(resultConfig), resultConfig.GetValue() }, { nameof(onlineSourceInterpreterConfig), onlineSourceInterpreterConfig.GetValue() } }); }
public string GetShortInfoString() { var result = new StringBuilder(); result.Append("{").Append(platform).Append(", ").Append(version).Append(", ").Append(makeFile); if (makeFile.GetValue()) { result.Append(", ").Append(makeLastCreated); } result.Append("}"); return(result.ToString()); }
private static void OnConsoleColorClicked <EnumType>(MenuUtils menuUtils, IMenuPropertyAccessor <EnumType> colorAccessor, string header, int spacing) where EnumType : struct, Enum { colorAccessor.SetValue( Enum.Parse <EnumType>( menuUtils.OpenEnumConfigEditor( header + "." + colorAccessor.GetFieldName(), colorAccessor.GetValue().ToString(), Enum.GetNames(typeof(EnumType)), spacing ) ) ); }
string IMenuObject.GetInfoString() { var result = new StringBuilder(); result.Append(nameof(sourceType)).Append(" = ").Append(sourceType); if (sourceType.GetValue() == ESourceType.online) { result.Append(" | ").Append(online.GetValue().GetShortInfoString()); } else if (sourceType.GetValue() == ESourceType.local) { result.Append(" | ").Append(local.GetValue().GetShortInfoString()); } else if (sourceType.GetValue() == ESourceType.lastCreated) { result.Append(" | ").Append(Path.GetFileName(lastCreated.GetValue())); } return(result.ToString()); }
void IMenuPropertyOnClickBehavior <T> .OnClick(MenuUtils menuUtils, IMenuPropertyAccessor <T> property, string header, int spacing) { property.SetValue(Enum.Parse <T>(menuUtils.OpenEnumConfigEditor(header + "." + property.GetFieldName(), property.GetValue().ToString(), Enum.GetNames(typeof(T)), spacing))); }
private BetterDict <string, string> GetValueChangeDict() { return(new BetterDict <string, string> { { nameof(sourceType), sourceType.GetValue().ToString() } }); }
private void OnLastCreatedClicked(MenuUtils menuUtils, string header, int spacing) { lastCreated.SetValue(menuUtils.OpenFileSelectionMenu(localSourcesConfig.GetValue().baseDirectory, lastCreated.GetValue(), spacing)); }
string IOnlineUrlHolder.GetBaseUrlSuffix() { return(baseUrlSuffix.GetValue()); }
string IOnlineUrlHolder.GetBaseUrl() { return(baseUrl.GetValue()); }
string IOnlineSourceHolder.GetVersion() { return(version.GetValue()); }
string IOnlineSourceHolder.GetPlatform() { return(platform.GetValue()); }
private static void OnNormalTextColorClicked(MenuUtils menuUtils, IMenuPropertyAccessor <ConsoleColor> colorAccessor, string header, int spacing) { OnConsoleColorClicked(menuUtils, colorAccessor, header, spacing); Console.ForegroundColor = colorAccessor.GetValue(); }
public void Init(IOnlineAddressDictConfig addressDictSupplier) { sourceConfigHolder.GetValue().Init(addressDictSupplier); }
void IMenuPropertyOnClickBehavior <string> .OnClick(MenuUtils menuUtils, IMenuPropertyAccessor <string> property, string header, int spacing) { property.SetValue(MenuUtils.OpenSimpleConfigEditor(header, property.GetFieldName(), property.GetValue())); }
void IMenuPropertyOnClickBehavior <T> .OnClick(MenuUtils menuUtils, IMenuPropertyAccessor <T> property, string header, int spacing) { menuUtils.OpenObjectMenu(header, property.GetFieldName(), property.GetValue(), 0, spacing); }
void IMenuPropertyOnClickBehavior <bool> .OnClick(MenuUtils menuUtils, IMenuPropertyAccessor <bool> property, string header, int spacing) { property.SetValue(!property.GetValue()); }
public void Init(IOnlineAddressDictConfig addressDictSupplier) { this.addressDictSupplier = addressDictSupplier; onlineSourcesConfig.GetValue().Init(addressDictSupplier); }
string IMenuPropertyOnClickBehavior <bool> .GetInfoText(IMenuPropertyAccessor <bool> property) { return(property.GetValue().ToString()); }
private BetterDict <string, YamlObject> GetObjectChangeDict() { return(new BetterDict <string, YamlObject> { { nameof(resultFilter), resultFilter.GetValue() } }); }