Esempio n. 1
0
        //TODO Search Query Help
        //TODO Tags Parsing
        //TODO Search and Favorites Selection
        //TODO Search and Favorites Paging
        //TODO Search and Paging Saving (Separate and auromate)

        public MainWindowConnector(IListManager listManager, IEventSystem eventSystem, IAppStates appStatem,
                                   OperationManager manager, FilesManager filesManager, ImageManager imageManager) : base(listManager, eventSystem)
        {
            _appStatem = appStatem;

            ReactOn <PrepareLoadEvent>(_ => FileListIndex = 0);
            ReactOn <PostLoadingEvent>(e => _appStatem.Set <GlobalAppState>(s => s.LastLocation = e.Path));
            DisposeThis(filesManager.FilterObservable.Subscribe(_ => FileListIndex = 1));

            OperationManager   = manager;
            FilesManager       = filesManager;
            ImageManager       = imageManager;
            WindowState        = new UIWindowState(_appStatem);
            _fullScreenManager = new FullScreenManager(WindowState);

            OpenLocationCommand = BindToEvent(OpenLocation);
            NextImage           = BindToEvent(_ => new NextPageEvnt(false));
            BackImage           = BindToEvent(_ => new NextPageEvnt(true));
            DeleteCommand       = BindToEvent(
                _ => MessageBox.Show("WΓ­rklich LΓΆschen?", "LΓΆschen", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes
                    ? new DeleteEvent(ImageManager.CurrentIndex)
                    : null);
            ToogleFavoriteCommand = BindToEvent(_ => new ToogleFavoritesEvent(ImageManager.CurrentIndex));

            FullScreen = new DelegateCommand(_ => _fullScreenManager.EnableFullScreen(), _ => true);
        }
Esempio n. 2
0
        private FileIntegrity GetRelaxedFileIntegrity(BuildDefinitionEntry entry)
        {
            foreach (var existingFile in _context.ExistingFiles)
            {
                var existingFilePath = FilesManager.SanitizePath(PathsManager.Combine(_context.Settings.RootPath, existingFile.RelativePath));
                var entryFilePath    = FilesManager.SanitizePath(PathsManager.Combine(_context.Settings.GetGamePath(), entry.RelativePath));

                if (existingFilePath == entryFilePath)
                {
                    var integrity = FileIntegrity.None;

                    if (existingFile.Size != entry.Size)
                    {
                        integrity |= FileIntegrity.InvalidSize;
                    }

                    if (integrity == FileIntegrity.None)
                    {
                        return(FileIntegrity.Valid);
                    }
                    return(integrity);
                }
            }

            return(FileIntegrity.NotExisting);
        }
Esempio n. 3
0
        [Test] public void TestDownloadAndStart()
        {
            DelFile(TestSetUp.sturtupExecTest);
            DelFile(TestSetUp.sturtupTxtTest);

            FilesManager FM = new FilesManager(TestSetUp.ConnectionString);


            String startUpFile = System.IO.Path.GetFullPath(@"..\..\bin\Debug\Updater.exe");

            try
            {
                System.Diagnostics.Process.Start(startUpFile, "-u");
            }
            catch (ArgumentException ex)
            {
                Console.WriteLine("ArgumentException - ВСстированиС : " + ex.Message + System.Environment.NewLine + startUpFile);
            }
            catch (System.ComponentModel.Win32Exception ex)
            {
                Console.WriteLine("Win32Exception - ВСстированиС : " + ex.Message + System.Environment.NewLine + startUpFile);
            }
            catch (ObjectDisposedException ex)
            {
                Console.WriteLine("ObjectDisposedException - ВСстированиС : " + ex.Message + System.Environment.NewLine + startUpFile);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception  - ВСстированиС : " + ex.Message + System.Environment.NewLine + startUpFile);
            }

            System.Threading.Thread.Sleep(2000);
            Assert.IsTrue(File.Exists(TestSetUp.sturtupTxtTest), "НуТногС ΠΏΡ€ΠΈΠ»ΠΎΠΆΠ΅Π½ΠΈΠ΅ Π½Π΅ Π·Π°ΠΏΡƒΡΡ‚ΠΈΠ»ΠΎΡΡŒ! Или Ρ€Π°Π½ΠΎ смотрим Ρ„Π°ΠΉΠ».");
        }
        private void SaveDelivery2DB()
        {
            try
            {
                string command;

                command         = "SP_AddUpdateDelivery(@DeliveryID:int,@Description:nvarchar(50),@DeliveryState:int,@CreatedByServiceInstanceID:int,@Parameters:text,@DateCreated:datetime,@DateModified:datetime,@RETVAL:int)";
                this.DeliveryID = mappper.SaveOrRemoveSimpleObject <Delivery>(command, this);

                foreach (DeliveryFile dfile in Files)
                {
                    dfile.DeliveryID = this.DeliveryID;
                    dfile.FilePath   = FilesManager.GetDeliveryFilePath(dfile.FileRootPath, DateTime.Now, dfile.DeliveryID, dfile.FileName, this.AccountID);
                    command          = "SP_AddUpdateDeliveryFile(@FileID:Int,@DeliveryID:Int,@FilePath:text,@DownloadUrl:text,@TargetDateTime:datetime,@ReaderType:nvarchar(50),@Parameters:text,@DateCreated:datetime,@DateModified:datetime,@RETVAL:int)";
                    dfile.FileID     = mappper.SaveOrRemoveSimpleObject <DeliveryFile>(command, dfile);

                    foreach (DeliveryFileStatus Status in dfile.HandledStatus)
                    {
                        Status.DeliveryID = this.DeliveryID;
                        command           = "SP_AddUpdateDeliveryStatus(@DeliveryID:Int,@ServiceInstanceID:Int,@State:smallint,@RETVAL:int)";
                        mappper.SaveOrRemoveSimpleObject <DeliveryFileStatus>(command, Status);
                    }
                }
            }
            catch
            {
                throw;
            }
        }
Esempio n. 5
0
        private async void PlaySuaraSound()
        {
            try
            {
                if (bUseSound)
                {
                    MicRecord.StopAudio();
                    await Task.Delay(1000);

                    MicRecord.SetAudioFilePath(KataIndo.Text);

                    string sPath = string.Format("{0}/{1}.mp4", MicRecord.AudioFilePath, KataIndo.Text);//string sPath = string.Format("{0}/{1}.wav", MicRecord.AudioFilePath, KataIndo.Text);
                    if (!FilesManager.FileExists(sPath))
                    {
                        return;
                    }
                    if (IsSoundPlaying)
                    {
                        return;
                    }

                    IsSoundPlaying = true;
                    MicRecord.PlayAudio();
                    UpdatePlayState();
                }
            }
            catch { }
        }
Esempio n. 6
0
        private void DownloadPatch(PatchDefinition definition)
        {
            DirectoriesManager.Create(_context.Settings.GetTempPath());

            var archivePath  = _context.Settings.GetDownloadedPatchArchivePath(definition.From, definition.To);
            var leftAttempts = _context.Settings.PatchDownloadAttempts;
            var success      = false;

            do
            {
                try
                {
                    Downloader.Download(_context.Settings.GetRemotePatchArchiveUrl(definition.From, definition.To), _context.Settings.GetTempPath());
                    var downloadedArchiveHash = Hashing.GetFileHash(archivePath);
                    if (downloadedArchiveHash == definition.Hash)
                    {
                        success = true;
                        break;
                    }
                }
                catch
                {
                    // ignored
                }

                FilesManager.Delete(archivePath);
                leftAttempts--;
            } while (leftAttempts > 0);

            if (!success)
            {
                throw new PatchCannotBeDownloadedException();
            }
        }
         public async void TestCopying()
         {
            File.Delete(@"C:\PLIKI\p.txt");
            Directory.Delete(@"C:\PLIKI\Test", true);
            var m = new FilesManager(null);
            Directory.CreateDirectory(@"C:\PLIKI\Test");
            //File.Exists(@"C:\PLIKI\p.txt").ShouldBeTrue();

            List<Task> l = new List<Task>();
            for (int i = 0; i < 100; i++)
            {
                int i1 = i;
                var task = m.CopyOverwriteAsync(@"C:\PLIKI\t.txt".ToFilePathAbs(),
                    (@"C:\PLIKI\Test\p.txt" + i1).ToFilePathAbs());
              //  var task = Task.Run(
              //      () =>
              //         .Wait());
                l.Add(task);
            }
            Task.WaitAll(l.ToArray());



           
        }
Esempio n. 8
0
        private async void analyze()
        {
            StatusWindow win2 = new StatusWindow();

            win2.Show();

            InputParams i = new InputParams();

            i.numOfStocks = Int32.Parse(this.numOfStocks.Text);
            i.daysAgo     = Int32.Parse(this.daysAgo.Text);
            i.clusters    = Int32.Parse(this.clusters.Text);
            i.open        = (bool)open.IsChecked;
            i.close       = (bool)close.IsChecked;
            i.high        = (bool)high.IsChecked;
            i.low         = (bool)low.IsChecked;

            var im = new Managers.InputManager(i);
            await Task.Run(() => im.GetInputReady());

            var fm = new FilesManager(i.clusters);
            //await Task.Run(() => fm.TestRun());
            await Task.Run(() => fm.Start());

            win2.Close();

            var           om     = new OutputManager(im.allStocksData);
            ResultsWindow graphs = new ResultsWindow(om.clusters);

            graphs.Show();
        }
Esempio n. 9
0
        public void Build()
        {
            if (DirectoriesManager.IsEmpty(_context.Settings.GetUpdaterFolderPath()))
            {
                throw new UpdaterFolderIsEmptyException();
            }

            _context.LogProgress(string.Format(_context.LocalizedMessages.UpdaterCollectingOldDefinition));
            var oldDefinition = GetCurrentDefinition();

            _context.LogProgress(string.Format(_context.LocalizedMessages.UpdaterCollectingFiles));
            var files = GetFiles();

            var definition = BuildDefinition(files, oldDefinition);

            FilesManager.Delete(_context.Settings.GetUpdaterIndexPath());

            FilesManager.Delete(_context.Settings.GetUpdaterDeployPath(_context.LauncherArchiveName));

            _context.LogProgress(string.Format(_context.LocalizedMessages.UpdaterCompressingArchive));
            Compressor.Compress(_context.Settings.GetUpdaterFolderPath(), _context.Settings.GetUpdaterDeployPath(_context.LauncherArchiveName), null, _context.CompressionLevel);
            _context.ReportProgress(string.Format(_context.LocalizedMessages.UpdaterCompressedArchive));

            File.WriteAllText(_context.Settings.GetUpdaterIndexPath(), _context.Serializer.Serialize(definition));
            _context.ReportProgress(string.Format(_context.LocalizedMessages.UpdaterSavedDefinition));
        }
Esempio n. 10
0
        public void ThenCheckDownloadedSuccessfuly(string _filename)
        {
            Thread.Sleep(3000);
            var checker = FilesManager.FileDownloaded(_filename);

            SoftAssertions.AddTrue("The file should be deleted", checker);
        }
Esempio n. 11
0
        public static void ActionStateSelected(UserState userState,
                                               TelegramContext db,
                                               Telegram.Bot.TelegramBotClient botClient,
                                               Update update)
        {
            switch (userState.State)
            {
            case (int)UserStatesEnum.Empty:    //Empty
                break;

            case (int)UserStatesEnum.AddBuildingName:    //AddCourse
                BuildingsManager.AddBuildingName(botClient, db, update.Message);
                break;

            case (int)UserStatesEnum.AddBuildingAddress:    //CoursesList
                BuildingsManager.AddBuildingAddress(botClient, db, update.Message, userState);
                break;

            case (int)UserStatesEnum.AddBuildingComment:    //AddCourseName
                BuildingsManager.AddBuildingComment(botClient, db, update.Message, userState);
                break;

            case (int)UserStatesEnum.AddBuildingPhoto:    //AddCourseName
                FilesManager.SaveFile(botClient, update.Message, userState.BuildingId);
                break;
            }
        }
Esempio n. 12
0
        }//OnStartCommand

        void CheckClientChanges(Object state)
        {
            lock (mLockerClient)
            {
                string sLogTime = "SyncService - Client";
                Log.Debug(sLogTime, "Start sync - Client");
                TimerState s = (TimerState)state;

                List <ShoppingListDTO> lsts = ListsManager.Instance.Lists.Where(x => x.IsDirty).ToList();
                if (lsts.Count == 0)// There are no dirty lists we return
                {
                    return;
                }

                ConnectivityManager connectivityManager = (ConnectivityManager)GetSystemService(ConnectivityService);
                if (connectivityManager.ActiveNetworkInfo != null && connectivityManager.ActiveNetworkInfo.IsConnected)
                {
                    SyncRequestResponseStorage(sLogTime, UpdatedUI, true);
                }
                else
                {
                    string sJson   = ListsManager.Instance.GetSerializedDataForLocalStorage();
                    string newhash = Tools.GetMd5Hash(sJson);
                    if (ListsManager.Instance.CurrentJsonHash != newhash)
                    {
                        FilesManager.WriteShListsState(sJson);
                        Log.Debug(sLogTime, "Save in file the changes");
                        ListsManager.Instance.UpdateStorageHash(newhash);
                    }
                }
            }
        }//CheckClientChanges
Esempio n. 13
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("ΒΏSeguro que quieres obtener la informaciΓ³n de todas las tablas?", "Aviso", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    _DBManager.ConnectionString  = txtConnection.Text;
                    _FilesSettingInfo.TablesInfo = _DBManager.GetAllTablesInfo();
                    FillSettings();
                    _FileManager = new FilesManager(_FilesSettingInfo);

                    #region View Tables
                    if (_FilesSettingInfo.TablesInfo != null && _FilesSettingInfo.TablesInfo.Count > 0)
                    {
                        lstTables.DataSource    = _FilesSettingInfo.TablesInfo;
                        lstTables.DisplayMember = "Name";
                        lstTables.ValueMember   = "Name";
                        btnGenerateDO.Enabled   = true;
                        btnGenerateSP.Enabled   = true;
                        btnGenerateDA.Enabled   = true;
                        btnGenerateWeb.Enabled  = true;
                        btnGenerateBus.Enabled  = true;
                    }
                    #endregion
                }
            }
            catch (Exception ex)
            {
                Messages.ShowErrorMessage(ex);
            }
        }
Esempio n. 14
0
        private void btnPlay_Clicked(object sender, EventArgs e)
        {
            try
            {
                if (!IsRecording)
                {
                    string sPath = string.Format("{0}/{1}.wav", MicRecord.AudioFilePath, sRecordText);
                    if (!FilesManager.FileExists(sPath))
                    {
                        return;
                    }
                    if (IsPrePlaying)
                    {
                        return;
                    }

                    lblRecord.Text = "λ…ΉμŒλ‚΄μš© 미리 λ“£κΈ° μ€‘μž…λ‹ˆλ‹€.";
                    IsPrePlaying   = true;
                    MicRecord.PlayAudio();

                    totalTime.Text    = MicRecord.GetTotalTimeDisplay();
                    currentTime.Text  = MicRecord.GetCurrentTimeDisplay();
                    progress.Progress = MicRecord.GetCurrentPosition() * 1.0f / MicRecord.GetPosition();

                    UpdatePlayState();
                }
            }
            catch { }
        }
Esempio n. 15
0
        private void btnOneTable_Click(object sender, EventArgs e)
        {
            try
            {
                _DBManager.ConnectionString = txtConnection.Text;
                FillSettings();
                _FilesSettingInfo.TablesInfo = _DBManager.AddOneTableInfo(_FilesSettingInfo.TableName);
                FillSettings();
                _FileManager = new FilesManager(_FilesSettingInfo);

                #region View Tables
                if (_FilesSettingInfo.TablesInfo != null && _FilesSettingInfo.TablesInfo.Count > 0)
                {
                    lstTables.DataSource    = _FilesSettingInfo.TablesInfo;
                    lstTables.DisplayMember = "Name";
                    lstTables.ValueMember   = "Name";
                    btnGenerateDO.Enabled   = true;
                    btnGenerateSP.Enabled   = true;
                    btnGenerateDA.Enabled   = true;
                    btnGenerateWeb.Enabled  = true;
                    btnGenerateBus.Enabled  = true;
                    btnGenerateCode.Enabled = true;
                }
                #endregion
            }
            catch (Exception ex)
            {
                Messages.ShowErrorMessage(ex);
            }
        }
Esempio n. 16
0
        private void reloadTemplates()
        {
            try
            {
                if (chkOriginalTemplates.Checked)
                {
                    TemplateSP  = FilesManager.GetFileData(_TemplateFolder + "SP_Template_" + DBLanguage.SQL.ToString());
                    TemplateDO  = FilesManager.GetFileData(_TemplateFolder + "DO_Template_" + CodeLanguage.CS.ToString());
                    TemplateDA  = FilesManager.GetFileData(_TemplateFolder + "DA_Template_" + CodeLanguage.CS.ToString());
                    TemplateBus = FilesManager.GetFileData(_TemplateFolder + "Bus_Template_" + CodeLanguage.CS.ToString());
                }
                else
                {
                    TemplateSP  = FilesManager.GetFileData(_TemplateFolder + "IB_SP_Template_SQL");
                    TemplateDO  = FilesManager.GetFileData(_TemplateFolder + "IB_DO_Template_" + CodeLanguage.CS.ToString());
                    TemplateDA  = FilesManager.GetFileData(_TemplateFolder + "IB_DA_Template_" + CodeLanguage.CS.ToString());
                    TemplateBus = FilesManager.GetFileData(_TemplateFolder + "IB_Bus_Template_" + CodeLanguage.CS.ToString());
                }

                FillSettings();
            }
            catch (Exception ex)
            {
                Messages.ShowErrorMessage(ex);
            }
        }
Esempio n. 17
0
        public async Task <bool> ExecuteAsync()
        {
            await LogMessageActionAsync(LogLevel.Info, string.Concat("Executing Task with id: ", this.Id.ToString()));
            await LogMessageActionAsync(LogLevel.Debug, string.Concat("Executing Task on ", this.Path.ToString(), " with ", this.Pattern.Pattern, " as patern"));

            FileInfo[] matchingFiles = FilesManager.GetMatchingFiles(Path, Pattern);

            if (matchingFiles == null || matchingFiles.Length == 0)
            {
                await LogMessageActionAsync(LogLevel.Debug, "No matching files found");

                return(matchingFiles == null && matchingFiles.Length == 0);
            }

            await LogMessageActionAsync(LogLevel.Info, string.Format("Found {0} files", matchingFiles.Length));

            bool succeded = true;

            foreach (FileInfo fi in matchingFiles)
            {
                CurrentFile = fi;
                try
                {
                    await executionManager.ExecuteJob(fi, this.JobStepsGroups);
                }
                catch (Exception e)
                {
                    LogMessageActionAsync(LogLevel.Error, string.Format("Error: {0} - Stack {1}", e.Message, e.StackTrace)).RunSynchronously();
                }
            }

            await LogMessageActionAsync(LogLevel.Debug, "All files have been processed");

            return(succeded);
        }
Esempio n. 18
0
        public void Build()
        {
            if (_context.VersionFrom == _context.VersionTo)
            {
                throw new SameVersionsException();
            }

            _context.LogProgress(string.Format(_context.LocalizedMessages.PatchCollectingDefinitions));
            var fromDefinition = GetBuildDefinition(_context.VersionFrom);
            var toDefinition   = GetBuildDefinition(_context.VersionTo);

            _context.LogProgress(string.Format(_context.LocalizedMessages.PatchCollectingPatchData));
            var patchDefinition = BuildPatchDefinition(fromDefinition, toDefinition);

            _context.LogProgress(string.Format(_context.LocalizedMessages.PatchBuildingPatch, _context.VersionFrom, _context.VersionTo));
            BuildPatch(patchDefinition, fromDefinition, toDefinition);
            FilesManager.DeleteMultiple(_context.Settings.GetPatchesTempFolderPath(), "*.signature");

            _context.LogProgress(string.Format(_context.LocalizedMessages.PatchCompressing, _context.VersionFrom, _context.VersionTo));
            CompressPatch();
            _context.ReportProgress(string.Format(_context.LocalizedMessages.PatchCompressed, _context.VersionFrom, _context.VersionTo));

            _context.LogProgress(string.Format(_context.LocalizedMessages.PatchCleaningWorkspace));
            DirectoriesManager.Delete(_context.Settings.GetPatchesTempFolderPath());
            _context.ReportProgress(string.Format(_context.LocalizedMessages.PatchCleanedWorkspace));

            _context.LogProgress(string.Format(_context.LocalizedMessages.PatchBuildingDefinition));
            BuildPatchDefinition(patchDefinition);
            _context.ReportProgress(string.Format(_context.LocalizedMessages.PatchBuiltDefinition));

            _context.LogProgress(string.Format(_context.LocalizedMessages.PatchBuildingIndex));
            BuildPatchIndex();
            _context.ReportProgress(string.Format(_context.LocalizedMessages.PatchBuiltIndex));
        }
Esempio n. 19
0
 private Task GetLocalFiles()
 {
     return(Task.Run(() =>
     {
         ExistingFiles = FilesManager.GetFilesInfo(Settings.RootPath);
         Logger.Info("Collected {ExistingFilesAmount} local files.", ExistingFiles.Length);
     }));
 }
Esempio n. 20
0
        private void HandleChangedAttributesFile(PatchDefinitionEntry entry)
        {
            var path = PathsManager.Combine(_context.Settings.GetGameFolderPath(_context.VersionTo), entry.RelativePath);
            var info = FilesManager.GetFileInfo(path);

            entry.Attributes  = info.Attributes;
            entry.LastWriting = info.LastWriting;
        }
        public void Initialize()
        {
            _progress = new BuilderProgress();

            InitializeDirectories();

            _progress.TotalSteps = 4 + ((FilesManager.GetFiles(Settings.GetApplicationFolderPath()).Length * 2) + 1);
        }
        private void decryptorBGW_DoWork(object sender, DoWorkEventArgs e)
        {
            FileVO       file         = (FileVO)e.Argument;
            FilesManager filesManager = new FilesManager();
            string       path         = filesManager.StoreFileInTempDirectory(file);

            e.Result = path;
        }
        private void AddBtn_Click(object sender, RoutedEventArgs e)
        {
            string      selectedPath = FilesManager.OpenFolderDialog();
            PathElement newPath      = new PathElement {
                FullPath = selectedPath
            };

            Paths.Add(newPath);
        }
        public BingKeywordReportReader(string[] zipPath)
        {
            _zipPathKeywordFile = zipPath[0];
            _zipPathAdFile      = zipPath[1];

            _xmlPathKeywordFile = FilesManager.UnZipFiles(_zipPathKeywordFile, string.Empty, string.Empty, false);
            _xmlPathAdFile      = FilesManager.UnZipFiles(_zipPathAdFile, string.Empty, string.Empty, false);
            GetAdDictionary();
        }
Esempio n. 25
0
        private void HandleAddedFile(PatchDefinition definition, PatchDefinitionEntry entry)
        {
            var sourcePath      = PathsManager.Combine(_context.Settings.GetUncompressedPatchArchivePath(definition.From, definition.To), entry.RelativePath);
            var destinationPath = PathsManager.Combine(_context.Settings.GetGamePath(), entry.RelativePath);

            FilesManager.Delete(destinationPath);
            FilesManager.Move(sourcePath, destinationPath);

            EnsureDefinition(destinationPath, entry);
        }
Esempio n. 26
0
        public void ReadFileThatDoesntExist()
        {
            FilesManager target = new FilesManager();

            String[] actual;

            actual = target.ReadFile("Nieistniejacy Plik.csv");

            Assert.AreEqual(null, actual);
        }
        public IVersion GetLastVersion()
        {
            if (FilesManager.Exists(Settings.GetBuildsIndexPath()))
            {
                var index = Serializer.Deserialize <BuildsIndex>(File.ReadAllText(Settings.GetBuildsIndexPath()));
                return(index.GetLast());
            }

            return(null);
        }
Esempio n. 28
0
 public FileApplication()
 {
     mgr = new FilesManager(ObjectFactory.GetInstance <ICache <FilesManager> >(),
                            ObjectFactory.GetInstance <IEmailSender>(),
                            ObjectFactory.GetInstance <IFilesRepository>(),
                            ObjectFactory.GetInstance <IDirectoryRepository>(),
                            ObjectFactory.GetInstance <IDirectoryObjectRepository>()
                            );
     repository = ObjectFactory.GetInstance <IFilesRepository>();
 }
Esempio n. 29
0
        /// <summary>
        /// Adds "Ticker name" from file to Holdings. If Holding has no name, will be removed.
        /// </summary>
        /// <param name="isDownloadingFromWeb">Should data be downloaded from web or get from local disc.
        /// (You may have to change date in holdingsData URL, because stooq.pl store only few files in this way!)</param>
        private static void AddTickerNameToHoldings(bool isDownloadingFromWeb = true)
        {
            string holdingsData;
            string tickersWithNames;

            if (isDownloadingFromWeb)
            {
                holdingsData     = FilesManager.DownloadRemoteFile("https://stooq.pl/db/d/?d=20200603&t=d");
                tickersWithNames = FilesManager.DownloadRemoteFile("https://stooq.pl/db/l/?g=6", true);
            }
            else
            {
                holdingsData     = File.ReadAllText(@"C:\temp\20200727_d.txt");
                tickersWithNames = File.ReadAllText(@"C:\temp\TickerToName.txt");
            }

            List <Holding>          holdings          = FilesManager.ParseCsvToObject <Holding>(holdingsData);
            List <TickerNameSystem> tickerNameSystems = FilesManager.ParseCsvToObject <TickerNameSystem>(tickersWithNames, ' ', StringSplitOptions.RemoveEmptyEntries);

            string lookingForTicker = "PKN";      //For working check
            string lookingForName   = "PKNORLEN"; //For working check

            Console.WriteLine($"I'm looking for ticker: \"{lookingForTicker}\".");
            Holding holding = holdings.Find(h => h.Ticker == lookingForTicker);

            if (holding == null)
            {
                Console.WriteLine("Ticker was not found");
                return;
            }

            Console.WriteLine($"Now, holding looks like that: \n{holding} \n\nPress any key to start merging.");
            Console.ReadKey();

            FilesManager filesManager = new FilesManager("<TICKER>");

            filesManager.MergeData(holdings, tickerNameSystems);

            holdings.RemoveAll(h => h.Name == null);

            Console.WriteLine($"Now I'm looking for name: \"{lookingForName}\" instead of ticker: \"{lookingForTicker}\".");
            Holding newHolding = holdings.Find(h => h.Name == lookingForName);

            if (newHolding == null)
            {
                Console.WriteLine("Holding by this name, was not found");
            }
            else
            {
                Console.WriteLine($"\n\nAfter merging with ticker , holding looks like that: \n{newHolding}");
            }

            Console.WriteLine("Press any key to continue. (You can set breakpoint here if you want to look at full merging result).");
            Console.ReadKey();
        }
Esempio n. 30
0
        public DataPanel()
        {
            var resources = new Windows.ApplicationModel.Resources.ResourceLoader("setting");

            limit  = Convert.ToInt32(resources.GetString("Limit"));
            offset = Convert.ToInt32(resources.GetString("StartingOffset"));

            this.InitializeComponent();
            DataFetched = FilesManager.getPostsData(offset, limit);
            PageCount   = FilesManager.getPageNumber(limit);
        }
Esempio n. 31
0
        private void BtnPage_Click(object sender, RoutedEventArgs e)
        {
            Button btnPage = (Button)sender;

            offset = Convert.ToInt32(btnPage.Content) * limit;
            Debug.WriteLine(offset);
            mainGridView.ItemsSource = null;
            DataFetched = FilesManager.getPostsData(offset, limit);
            mainGridView.ItemsSource = DataFetched;
            this.mainGridView.UpdateLayout();
        }
        public ProjectClonesManager(
            IHostEnviromentConnection hostEnviroment,
            FilesManager filesManager,
            IFileSystem fs)
        {
            _hostEnviroment = hostEnviroment;
            _filesManager = filesManager;
            _fs = fs;

            List<FilePathAbsolute> originalProjectFiles = _hostEnviroment.GetProjectAssemblyPaths().ToList();
            IEnumerable<FilePathAbsolute> referencedFiles = GetReferencedAssemblyPaths(originalProjectFiles).Select(s => s.ToFilePathAbs());

            FilePathAbsolute tmp = CreateTmpDir("VisualMutator-MainClone-");
            _mainClone = _filesManager.CreateProjectClone(referencedFiles, originalProjectFiles, tmp).Result;
        }