protected override void ProcessSlideSizeFolder(StorageDirectory sizeFolder, SlideFormatEnum format) { var orderFiles = new[] { Path.Combine(sizeFolder.LocalPath, "thumb_order.txt"), Path.Combine(sizeFolder.LocalPath, "slide_order.txt") }; var orderFile = orderFiles.FirstOrDefault(File.Exists); if (orderFile == null) { return; } var folderNames = File.ReadAllLines(orderFile).Where(line => !String.IsNullOrWhiteSpace(line)).ToList(); foreach (var folderName in folderNames) { var slideContentsFolder = new StorageDirectory(sizeFolder.RelativePathParts.Merge(folderName)); var slideTemplatesFolder = new StorageDirectory(_slideTemplatesDirectory.RelativePathParts.Merge( new[] { sizeFolder.RelativePathParts.Last(), folderName })); if (slideContentsFolder.ExistsLocal()) { var slideMaster = new SlideMaster(slideContentsFolder, slideTemplatesFolder) { Group = "Default", Format = format }; slideMaster.Load(); Slides.Add(slideMaster); } } }
public override void LoadToggleData(StorageDirectory holderAppDataFolder) { base.LoadToggleData(holderAppDataFolder); _resourceManager = new ResourceManager(); _resourceManager.Init(DataFolder); if (_resourceManager.SettingsFile.ExistsLocal()) { var document = new XmlDocument(); document.Load(_resourceManager.SettingsFile.LocalPath); Enabled = !Boolean.Parse(document.SelectSingleNode(@"//Settings/ButtonDisabled")?.InnerText ?? "false"); var useImage = Boolean.Parse(document.SelectSingleNode(@"//Settings/ButtonImage")?.InnerText ?? "false"); if (useImage) { foreach (var extension in new[] { ".svg", ".png" }) { ToggleImagePath = Path.Combine(DataFolder.LocalPath, String.Format("{0}{1}", Id.ToLower(), extension)); if (File.Exists(ToggleImagePath)) { break; } } } ToggleTitle = document.SelectSingleNode(@"//Settings/RightPanelButton")?.InnerText ?? ToggleTitle; } }
public RateCardFolder(StorageDirectory rootFolder) { _rootFolder = rootFolder; RateCards = new List <IRateCardViewer>(); RateCardContainer = new RateFolderControl(); RateCardContainer.xtraTabControlRateCards.SelectedPageChanged += SelectRateCard; }
private async void GrabarLocalizacion() { try { TimeSpan TimeSearch = new TimeSpan(0, 0, 30); var locator = CrossGeolocator.Current; locator.DesiredAccuracy = 50; // Precisión deseada (en metros) var position = await locator.GetPositionAsync(TimeSearch); if (position != null) { Latitud = position.Latitude.ToString(); Longitud = position.Longitude.ToString(); //Almaceno en las variables de Usuario los datos correspondientes a la imagen objUser.Latitude = Latitud; objUser.StorageUbication = StorageDirectory.ToString(); objUser.Longitud = Longitud; } } catch (Exception e) { IsBusy = false; await App.Current.MainPage.DisplayAlert("Error Localizacion", e.Message, "Ok"); } }
public virtual void LoadToggleData(StorageDirectory holderAppDataFolder) { DataFolder = new StorageDirectory(holderAppDataFolder.RelativePathParts.Merge(Id)); if (FileStorageManager.Instance.DataState == DataActualityState.Updated || FileStorageManager.Instance.UseLocalMode) { return; } AsyncHelper.RunSync(async() => { var templateVersionFile = new StorageFile(DataFolder.RelativePathParts.Merge("version.txt")); if (!await templateVersionFile.Exists(true) || await templateVersionFile.IsOutOfDate()) { await DataFolder.Allocate(false); if (await DataFolder.Exists(true)) { var templateFiles = (await DataFolder.GetRemoteFiles()).ToList(); foreach (var templateFile in templateFiles) { if (templateFile.Name.Contains(".rar")) { var archiveFolder = new ArchiveDirectory(DataFolder.RelativePathParts.Merge(templateFile.NameOnly)); await archiveFolder.Download(); } else { await templateFile.Download(); } } } } }); }
public virtual void LoadSlides(StorageDirectory slideContentsDirectory) { if (!slideContentsDirectory.ExistsLocal()) { return; } foreach (var sizeContentsFolder in slideContentsDirectory.GetLocalFolders()) { SlideFormatEnum format; switch (Path.GetFileName(sizeContentsFolder.LocalPath)) { case "4x3": format = SlideFormatEnum.Format4x3; break; case "16x9": format = SlideFormatEnum.Format16x9; break; case "3x4": format = SlideFormatEnum.Format3x4; break; default: continue; } ProcessSlideSizeFolder(sizeContentsFolder, format); } }
public static ImageSource FromFolder(StorageDirectory folder, string imageName) { var bigImageFile = new StorageFile(folder.RelativePathParts.Merge(new[] { BigImageFolderName, String.Format("{0}{1}", imageName, ImageFileExtension) })); var smallImageFile = new StorageFile(folder.RelativePathParts.Merge(new[] { SmallImageFolderName, String.Format("{0}2{1}", imageName, ImageFileExtension) })); var tinyImageFile = new StorageFile(folder.RelativePathParts.Merge(new[] { TinyImageFolderName, String.Format("{0}3{1}", imageName, ImageFileExtension) })); var xtraTinyImageFile = new StorageFile(folder.RelativePathParts.Merge(new[] { XtraTinyImageFolderName, String.Format("{0}4{1}", imageName, ImageFileExtension) })); if (!bigImageFile.ExistsLocal() || !smallImageFile.ExistsLocal() || !tinyImageFile.ExistsLocal() || !xtraTinyImageFile.ExistsLocal()) { return(null); } var imageSource = new ImageSource(); imageSource.Name = imageName.ToLower().StartsWith("!default") ? imageName.Substring(1) : imageName; imageSource.FileName = bigImageFile.LocalPath; imageSource.IsDefault = imageName.ToLower().Contains("default"); imageSource.BigImage = new Bitmap(bigImageFile.LocalPath); imageSource.SmallImage = new Bitmap(smallImageFile.LocalPath); imageSource.TinyImage = new Bitmap(tinyImageFile.LocalPath); imageSource.XtraTinyImage = new Bitmap(xtraTinyImageFile.LocalPath); return(imageSource); }
public static StyleInfo FromXml(XmlNode configNode, StorageDirectory sharedImagesFolder, string productId) { var styleInfo = Empty(); styleInfo.Title = configNode.SelectSingleNode("./Title")?.InnerText ?? styleInfo.Title; foreach (var node in configNode.SelectNodes("./Tabs/Tab")?.OfType <XmlNode>().ToArray() ?? new XmlNode[] { }) { var id = node.Attributes?.OfType <XmlAttribute>() .FirstOrDefault(a => String.Equals(a.Name, "Id", StringComparison.OrdinalIgnoreCase))?.Value?.ToUpper(); switch (id) { case "IMAGE": styleInfo.Tab1 = ImageTabInfo.FromXml(node, new StorageDirectory(sharedImagesFolder.RelativePathParts.Merge(new[] { "product_images", productId }))); break; case "LAYOUT": styleInfo.Tab2 = LayoutTabInfo.FromXml(node, new StorageDirectory(sharedImagesFolder.RelativePathParts.Merge("layout_images"))); break; } } return(styleInfo); }
private void LoadImages() { Images.Clear(); var defaultGroup = new ImageSourceGroup( new StorageDirectory( Asa.Common.Core.Configuration.ResourceManager.Instance.ArtworkFolder.RelativePathParts.Merge(String.Format("{0}", MediaMetaData.Instance.DataTypeString.ToUpper())))) { Name = "Gallery", Order = -1 }; defaultGroup.LoadImages(); if (defaultGroup.Images.Any()) { Images.Add(defaultGroup); } var additionalImageFolder = new StorageDirectory( Asa.Common.Core.Configuration.ResourceManager.Instance.ArtworkFolder.RelativePathParts.Merge(String.Format( "{0}_2", MediaMetaData.Instance.DataTypeString.ToUpper()))); if (additionalImageFolder.ExistsLocal()) { var contentDescriptionFile = new StorageFile(additionalImageFolder.RelativePathParts.Merge("order.txt")); if (contentDescriptionFile.ExistsLocal()) { var groupNames = File.ReadAllLines(contentDescriptionFile.LocalPath); var groupIndex = 0; foreach (var groupName in groupNames) { if (String.IsNullOrEmpty(groupName)) { continue; } var groupFolder = new StorageDirectory(additionalImageFolder.RelativePathParts.Merge(groupName)); if (!groupFolder.ExistsLocal()) { continue; } var imageGroup = new ImageSourceGroup(groupFolder); imageGroup.LoadImages(); imageGroup.Name = groupName; imageGroup.Order = groupIndex; if (!imageGroup.Images.Any()) { continue; } Images.Add(imageGroup); groupIndex++; } } } }
private FormStateHelper(Form targetForm, StorageDirectory storagePath, string filePrefix, bool showMaximized) { _form = targetForm; _stateStorageFile = new StorageFile(storagePath.RelativePathParts.Merge(String.Format("{0}-{1}", filePrefix, StorageName))); _showMaximized = showMaximized; _form.WindowState = FormWindowState.Normal; _form.Load += (o, e) => LoadState(); _form.FormClosed += (o, e) => SaveState(); }
public TargetCustomersState() { SaveFolder = new StorageDirectory(AppProfileManager.Instance.AppSaveFolder.RelativePathParts.Merge(new[] { "target customer" })); TemplatesFolder = new StorageDirectory(AppProfileManager.Instance.AppSaveFolder.RelativePathParts.Merge(new[] { "target customer", "templates" })); SlideHeader = string.Empty; Demo = new List <string>(); Income = new List <string>(); Geographic = new List <string>(); }
private DifferentialStorage GetStorageForType(Type type) { if (type == null) { throw new ArgumentNullException("type"); } StorageDirectory.Create(); return(new DifferentialStorage(Path.Combine(StorageDirectory.FullName, type.FullName + StorageFileExtension))); }
public async Task LoadProfile(bool useRemoteConnection = true) { _appID = Guid.Empty; if (File.Exists(_localAppIdFile.LocalPath)) { var document = new XmlDocument(); document.Load(_localAppIdFile.LocalPath); var node = document.SelectSingleNode(@"//Config/AppID"); if (!string.IsNullOrEmpty(node?.InnerText)) { _appID = new Guid(node.InnerText); } SubStorageName = document.SelectSingleNode(@"//Config/SubStorageName")?.InnerText; } if (_appID.Equals(Guid.Empty)) { SaveProfile(); } ProfilesRootFolder = new StorageDirectory(new[] { FileStorageManager.OutgoingFolderName, AppName }); if (!await ProfilesRootFolder.Exists(useRemoteConnection)) { await StorageDirectory.CreateSubFolder(new[] { FileStorageManager.OutgoingFolderName }, AppName, useRemoteConnection); } ProfileFolder = new StorageDirectory(ProfilesRootFolder.RelativePathParts.Merge(ProfileName)); if (!await ProfileFolder.Exists(useRemoteConnection)) { await StorageDirectory.CreateSubFolder(ProfilesRootFolder.RelativePathParts, ProfileName, useRemoteConnection); } SharedFolder = new StorageDirectory(ProfilesRootFolder.RelativePathParts.Merge(SharedFolderName)); if (!await ProfileFolder.Exists(useRemoteConnection)) { await StorageDirectory.CreateSubFolder(ProfilesRootFolder.RelativePathParts, SharedFolderName, useRemoteConnection); } UserDataFolder = new StorageDirectory(ProfileFolder.RelativePathParts.Merge(new[] { UserDataFolderName })); if (!await UserDataFolder.Exists(useRemoteConnection)) { await StorageDirectory.CreateSubFolder(ProfileFolder.RelativePathParts, UserDataFolderName, useRemoteConnection); } AppSaveFolder = new StorageDirectory(ProfileFolder.RelativePathParts.Merge(SavedFilesFolderName)); if (!await AppSaveFolder.Exists(useRemoteConnection)) { await StorageDirectory.CreateSubFolder(ProfileFolder.RelativePathParts, SavedFilesFolderName, useRemoteConnection); } AppDataFolder = new StorageDirectory(new[] { FileStorageManager.IncomingFolderName, AppName, "Data" }); }
public void FillContractInfo(Slide slide, ContractSettings contractSettings, StorageDirectory folder) { var templateFile = new StorageFile(folder.RelativePathParts.Merge(contractSettings.TemplateName)); var templatePresentation = _powerPointObject.Presentations.Open(templateFile.LocalPath, WithWindow: MsoTriState.msoFalse); foreach (var shape in GetContractInfoShapes(contractSettings, templatePresentation)) { shape.Copy(); slide.Shapes.Paste(); } templatePresentation.Close(); }
public LeadoffStatementState() { SaveFolder = new StorageDirectory(AppProfileManager.Instance.AppSaveFolder.RelativePathParts.Merge(new[] { "intro slide" })); TemplatesFolder = new StorageDirectory(AppProfileManager.Instance.AppSaveFolder.RelativePathParts.Merge(new[] { "intro slide", "templates" })); ShowStatement1 = true; ShowStatement2 = false; ShowStatement3 = false; SlideHeader = string.Empty; Statement1 = string.Empty; Statement2 = string.Empty; Statement3 = string.Empty; }
public void Init(StorageDirectory dataFolder) { _graphicResourcesFile = new StorageFile(dataFolder.RelativePathParts.Merge("Dashboard.Resources.dll")); SettingsFile = new StorageFile(dataFolder.RelativePathParts.Merge("settings.xml")); DataUsersFile = new StorageFile(Asa.Common.Core.Configuration.ResourceManager.Instance.DictionariesFolder.RelativePathParts.Merge("Users.xml")); DataCoverFile = new StorageFile(Asa.Common.Core.Configuration.ResourceManager.Instance.DictionariesFolder.RelativePathParts.Merge("Add Cover.xml")); DataClientGoalsFile = new StorageFile(Asa.Common.Core.Configuration.ResourceManager.Instance.DictionariesFolder.RelativePathParts.Merge("Needs Analysis.xml")); DataLeadoffStatementFile = new StorageFile(Asa.Common.Core.Configuration.ResourceManager.Instance.DictionariesFolder.RelativePathParts.Merge("Intro Slide.xml")); DataTargetCustomersFile = new StorageFile(Asa.Common.Core.Configuration.ResourceManager.Instance.DictionariesFolder.RelativePathParts.Merge("Target Customer.xml")); DataSimpleSummaryFile = new StorageFile(Asa.Common.Core.Configuration.ResourceManager.Instance.DictionariesFolder.RelativePathParts.Merge("Closing Summary.xml")); }
public ClientGoalsState() : base() { SaveFolder = new StorageDirectory(AppProfileManager.Instance.AppSaveFolder.RelativePathParts.Merge(new[] { "needs analysis" })); TemplatesFolder = new StorageDirectory(AppProfileManager.Instance.AppSaveFolder.RelativePathParts.Merge(new[] { "needs analysis", "templates" })); SlideHeader = string.Empty; Goal1 = string.Empty; Goal2 = string.Empty; Goal3 = string.Empty; Goal4 = string.Empty; Goal5 = string.Empty; }
/// <summary> /// BlockMeshes ディレクトリをロードします。 /// </summary> void LoadDirectory() { var rootDirectory = storageService.RootDirectory; if (rootDirectory.DirectoryExists(directoryName)) { directory = rootDirectory.GetDirectory(directoryName); } else { directory = rootDirectory.CreateDirectory(directoryName); } }
private void InitFolderTreeViewData() { treeViewFolders.Nodes.Clear(); StorageDirectory rootDirectory = _storageFileSystem.GetRootDirectory(); foreach (StorageDirectory directory in _storageFileSystem.GetDirectories(rootDirectory.Id)) { var treeNode = new TreeNode(directory.DirectoryName) { Name = directory.Id.ToString() }; treeViewFolders.Nodes.Add(treeNode); } }
public CoverState() { SaveFolder = new StorageDirectory(AppProfileManager.Instance.AppSaveFolder.RelativePathParts.Merge(new[] { "cover" })); TemplatesFolder = new StorageDirectory(AppProfileManager.Instance.AppSaveFolder.RelativePathParts.Merge(new[] { "cover", "templates" })); ShowPresentationDate = false; AddAsPageOne = true; UseGenericCover = false; SlideHeader = string.Empty; Advertiser = string.Empty; DecisionMaker = string.Empty; PresentationDate = DateTime.MinValue; Quote = new Quote(); }
public Task RemoveFile(string filePath) { StorageInfo storageInfo = DeserializeStorageInfoFile(); string fileName = Path.GetFileName(filePath); string parentDirectoryPath = PathHelper.GetParentDirectoryPath(filePath); StorageDirectory parentDirectory = GetDirectoryByPath(parentDirectoryPath, storageInfo.Directories); storageInfo.UsedStorage -= parentDirectory.Files[fileName].Size; parentDirectory.Files.Remove(fileName); parentDirectory.ModificationDate = DateTime.Now; SerializeStorageInfoFile(storageInfo); return(Task.CompletedTask); }
private void CalculateDirectorySize(StorageDirectory directory, ref long directorySize) { foreach (var file in directory.Files) { directorySize += file.Value.Size; } foreach (var dir in directory.Directories) { foreach (var file in dir.Value.Files) { directorySize += file.Value.Size; } CalculateDirectorySize(dir.Value, ref directorySize); } }
protected virtual void ProcessSlideSizeFolder(StorageDirectory sizeFolder, SlideFormatEnum format) { foreach (var groupFolder in sizeFolder.GetLocalFolders()) { foreach (var slideContentsFolder in groupFolder.GetLocalFolders()) { var slideMaster = new SlideMaster(slideContentsFolder, slideContentsFolder) { Group = groupFolder.Name, Format = format }; slideMaster.Load(); Slides.Add(slideMaster); } } Slides.Sort( (x, y) => x.Group.Equals(y.Group) ? x.Order.CompareTo(y.Order) : WinAPIHelper.StrCmpLogicalW(x.Group, y.Group)); }
public static ApproachItemInfo FromXml(XmlNode configNode, StorageDirectory imageFolder) { var itemInfo = new ApproachItemInfo(); itemInfo.Id = configNode.SelectSingleNode("./Button")?.InnerText; itemInfo.Title = configNode.SelectSingleNode("./Name")?.InnerText; var imageFileName = configNode.SelectSingleNode("./StaticImage")?.InnerText; if (!String.IsNullOrEmpty(imageFileName)) { itemInfo.ImagePath = Path.Combine(imageFolder.LocalPath, imageFileName); } itemInfo.SubHeaderDefaultValue = configNode.SelectSingleNode("./DefaultStatement")?.InnerText; return(itemInfo); }
public static SolutionsItemInfo FromXml(XmlNode configNode, StorageDirectory imageFolder) { var itemInfo = new SolutionsItemInfo(); itemInfo.Id = configNode.SelectSingleNode("./ProductButton")?.InnerText; itemInfo.Title = configNode.SelectSingleNode("./Name")?.InnerText; itemInfo.ButtonHeader = configNode.SelectSingleNode("./BenefitHeader")?.InnerText; var imageFileName = configNode.SelectSingleNode("./StaticImage")?.InnerText; if (!String.IsNullOrEmpty(imageFileName)) { itemInfo.ImagePath = Path.Combine(imageFolder.LocalPath, imageFileName); } itemInfo.SubHeaderDefaultValue = configNode.SelectSingleNode("./BenefitDetails")?.InnerText; return(itemInfo); }
public Task RemoveDirectory(string path) { StorageInfo storageInfo = DeserializeStorageInfoFile(); string directoryName = Path.GetFileName(path); string parentDirectoryPath = PathHelper.GetParentDirectoryPath(path); StorageDirectory parentDirectory = GetDirectoryByPath(parentDirectoryPath, storageInfo.Directories); if (!parentDirectory.Directories.ContainsKey(directoryName)) { throw new ArgumentException("The path doesn't exist"); } parentDirectory.Directories.Remove(directoryName); parentDirectory.ModificationDate = DateTime.Now; SerializeStorageInfoFile(storageInfo); return(Task.CompletedTask); }
private ProductInfo(string title, string sourceFile, StorageDirectory imagesFolder) { Title = title; _sourceFilePath = sourceFile; ProductId = Path.GetFileNameWithoutExtension(_sourceFilePath); _imagesFolder = imagesFolder; HeaderItems = new List <ListDataItem>(); HeaderConfiguration = TextEditorConfiguration.Empty(); Combo1Items = new List <ListDataItem>(); Combo1Configuration = TextEditorConfiguration.Empty(); Positioning = PositioningInfo.Empty(); Research = ResearchInfo.Empty(); Style = StyleInfo.Empty(); }
public void LoadImages() { Images.Clear(); var bigImageFolder = new StorageDirectory(_root.RelativePathParts.Merge(ImageSource.BigImageFolderName)); if (!bigImageFolder.ExistsLocal()) { return; } foreach (var file in bigImageFolder.GetLocalFiles().Where(file => file.Extension == ImageSource.ImageFileExtension)) { var imageSource = ImageSource.FromFolder(_root, Path.GetFileNameWithoutExtension(file.LocalPath)); if (imageSource != null) { Images.Add(imageSource); } } }
//method recursively searches for directories and files that match search line, and adds their paths to response model private void FindMatches(StorageDirectory directory, string searchLine, string path, GetDirectorySearchResultResponseModel searchResult) { path += $"/{directory.Name}"; foreach (var dir in directory.Directories) { foreach (var file in dir.Value.Files) { if (file.Key.Contains(searchLine)) { searchResult.MatchedFiles.Add($"{path}/{dir.Key}/{file.Key}"); } } if (dir.Key.Contains(searchLine, StringComparison.InvariantCultureIgnoreCase)) { searchResult.MatchedDirectories.Add($"{path}/{dir.Key}"); } FindMatches(dir.Value, searchLine, path, searchResult); } }
public Task CreateDirectory(string path, string directoryName) { StorageInfo storageInfo = DeserializeStorageInfoFile(); StorageDirectory parentDirectory = GetDirectoryByPath(path, storageInfo.Directories); if (parentDirectory.Directories.ContainsKey(directoryName)) { throw new ArgumentException($"The directory {directoryName} is already exists at the path '{path}'"); } parentDirectory.Directories.Add(directoryName, new StorageDirectory() { Name = directoryName, ParentId = parentDirectory.Name }); parentDirectory.ModificationDate = DateTime.Now; SerializeStorageInfoFile(storageInfo); return(Task.CompletedTask); }