Пример #1
0
 public SoilSampleProcessor(List <string> filePaths)
 {
     foreach (var path in filePaths)
     {
         FilePaths.Add(Path.GetFullPath(path));
     }
 }
Пример #2
0
        public override void GetContainer(TransactionContainerAbstract container, string filePath)
        {
            if (!FilePaths.Contains(filePath))
            {
                FilePaths.Add(filePath);
            }
            else
            {
                throw new Exception("This file has already been loaded");
            }

            container.Clear();

            foreach (var currentPath in FilePaths)
            {
                var lines = File.ReadLines(currentPath);

                foreach (string s in lines)
                {
                    string[] split = s.Split(',');

                    if (split.Length != AttributeNumber)
                    {
                        throw new Exception("Column number mismatch");
                    }

                    container.AddTransaction(long.Parse(split[0]),
                                             DateTime.ParseExact(split[1], "HH:mm:ss", CultureInfo.InvariantCulture),
                                             split[4],
                                             double.Parse(split[5], CultureInfo.InvariantCulture),
                                             double.Parse(split[7], CultureInfo.InvariantCulture),
                                             split[15] == "B" ? true : false);
                }
            }
        }
Пример #3
0
 private void TryAddFilePathToList(string filePath)
 {
     if (!string.IsNullOrWhiteSpace(filePath))
     {
         FilePaths.Add(filePath);
     }
 }
Пример #4
0
 private DefaultFileCacheDependency(params string[] paths) : this()
 {
     foreach (var path in paths)
     {
         FilePaths.Add(path);
     }
 }
Пример #5
0
        public void AddNewSample(string filepath)
        {
            SampleSource newSample = SampleSource.CreateFromWaveFile(filepath);

            sampleSources.Add(newSample);
            FilePaths.Add(filepath);
            Channels++;
        }
Пример #6
0
        private DefaultFileCacheDependency(string path) : this()
        {
            FilePaths.Add(path);
            Id = Guid.NewGuid().ToString();
            var fi = new FileInfo(path);

            LastModified = fi.LastWriteTime;
        }
Пример #7
0
 private AspNetFileCacheDependency(string[] filenames) : this()
 {
     foreach (var filename in filenames)
     {
         FilePaths.Add(filename);
     }
     Internal = new CacheDependency(filenames);
 }
Пример #8
0
 private async Task TryAddFilePathToList(IEnumerable <string> filePaths)
 {
     await Task.Run(() =>
     {
         foreach (var path in filePaths)
         {
             if (!string.IsNullOrWhiteSpace(path))
             {
                 FilePaths.Add(path);
             }
         }
     });
 }
 private void SetImagePaths(IStorageService storageService, string paths)
 {
     this.FilePaths = new List <string>();
     if (paths != null)
     {
         var arr = paths.Split(",");
         for (int i = 0; i < arr.Length; i++)
         {
             arr[i] = arr[i].Replace(" ", "");
             arr[i] = storageService.GetFileUrl(arr[i]);
             FilePaths.Add(arr[i]);
         }
     }
 }
Пример #10
0
        void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            if (FilePaths == null)
            {
                return;
            }
            var dialog = new OpenFileDialog();

            if (dialog.ShowDialog() ?? false)
            {
                FilePaths.Add(dialog.FileName);
                int timestamp = File.GetLastWriteTime(dialog.FileName).ToUnixTimestamp();
                ContentList.Add(dialog.FileName, timestamp, removed: false);
            }
        }
Пример #11
0
        public void Paste(FileSelectorModel fileselectormodel)
        {
            DisabledMessages();
            MessageAddress = fileselectormodel.MessageAddress;
            FilePaths.Clear();
            foreach (var item in fileselectormodel.FilePaths)
            {
                FileNameItem filenameitem = new FileNameItem(Mementor);
                filenameitem.Paste(item);
                FilePaths.Add(filenameitem);
            }

            EnabledMessages();
            send = false;
        }
        private void AddToFiles(string filePath)
        {
            if (string.IsNullOrWhiteSpace(filePath))
            {
                return;
            }

            filePath = filePath.Trim();

            if (!File.Exists(filePath))
            {
                return;
            }

            if (!FolderAlreadyAdded(filePath))
            {
                FilePaths.Add(filePath);
            }
        }
Пример #13
0
        public void Drop(IDropInfo dropInfo)
        {
            var dataObject = dropInfo.Data as DataObject;

            if (dataObject != null)
            {
                if (dataObject.ContainsFileDropList())
                {
                    Mementor.BeginBatch();
                    var filedrop = dataObject.GetFileDropList();
                    foreach (string str in filedrop)
                    {
                        foreach (string fm in FileMask)
                        {
                            if (System.IO.Path.GetExtension(str).ToUpperInvariant() == fm)
                            {
                                FileNameItem lbfn = new FileNameItem(Mementor)
                                {
                                    FileName = str, FileIsSelected = false
                                };
                                FilePaths.Add(lbfn);
                                Mementor.ElementAdd(FilePaths, lbfn);
                            }
                        }
                    }
                    Mementor.EndBatch();
                }
            }


            if (dropInfo.DragInfo != null)
            {
                if (dropInfo.DragInfo.VisualSource != dropInfo.VisualTarget && dropInfo.Data.GetType() == typeof(FileNameItem))
                {
                    FileNameItem filenameitem    = dropInfo.Data as FileNameItem;
                    FileNameItem newfilenameitem = filenameitem.Clone() as FileNameItem;
                    FilePaths.Insert(dropInfo.InsertIndex, newfilenameitem);
                    Mementor.ElementAdd(FilePaths, newfilenameitem);
                }
            }
        }
Пример #14
0
        public void DoWork()
        {
            foreach (TileInfo info in infos)
            {
                try
                {
                    string filename = string.Format("{0}{1}", info.Index.Col, extension);

                    string filepath     = Path.Combine(path, string.Format(@"{0}\{1}\{2}\{3}\", hostname, layername, info.Index.Level, info.Index.Row));
                    string fullfilename = Path.Combine(filepath, filename);
                    if (!Directory.Exists(filepath))
                    {
                        Directory.CreateDirectory(filepath);
                    }
                    if (!File.Exists(fullfilename) || !useCache)
                    {
                        try
                        {
                            Byte[] bytes = source.Provider.GetTile(info);
                            System.IO.FileStream stream = new System.IO.FileStream(fullfilename, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);
                            stream.Write(bytes, 0, bytes.Length);
                            stream.Close();
                        }
                        catch (System.IO.IOException ex)
                        {
                            //if the file is currently donwloaded by a different user it should be available for this package as well
                            ILog log = LogManager.GetLogger("ApplicationLogger");
                            log.Warn(string.Format("Tile on Path {0} is is being used by another process", fullfilename), ex);
                        }
                    }
                    FilePaths.Add(fullfilename);
                }
                catch (Exception ex)
                {
                    ILog log = LogManager.GetLogger("ApplicationLogger");
                    log.Error(string.Format("Unknown Error while downloading Tile: Level: {0}; Row: {1}; Column: {2} of Layer: {3}", info.Index.Level, info.Index.Row, info.Index.Col, this.layername), ex);
                    this.Errors.Add(new LoadError(ex, info));
                }
            }
        }
Пример #15
0
 public void Analyze(FilePath scriptPath)
 {
     FilePaths.Add(scriptPath);
 }
Пример #16
0
 private AspNetFileCacheDependency(string filename, DateTime start) : this()
 {
     FilePaths.Add(filename);
     Internal = new CacheDependency(filename, start);
 }
        private void AddInputFilesHandler()
        {
            List <string>        files          = new List <string>();
            CommonOpenFileDialog openFileDialog = new CommonOpenFileDialog();

            openFileDialog.IsFolderPicker          = true;
            openFileDialog.Multiselect             = true;
            openFileDialog.RestoreDirectory        = true;
            openFileDialog.AllowNonFileSystemItems = true;



            //ileDialog.Filter = "*.d";

            if (openFileDialog.ShowDialog() == CommonFileDialogResult.Ok)
            {
                var iter = openFileDialog.FileNames.GetEnumerator();
                while (iter.MoveNext())
                {
                    if (iter.Current.EndsWith(".d"))
                    {
                        files.Add(iter.Current);
                    }
                    else
                    {
                        throw new Exception("Selecter is not a \".d\" folder.");
                    }
                }
            }

            if (files.Count != 0)
            {
                if (FilePaths.Count == 0)
                {
                    int i = FilePaths.Count + 1;
                    FilePaths = files;


                    foreach (string file in files)
                    {
                        var source = GetFilePolarity(file);
                        Samples.Add(new Sample
                        {
                            HideOrShow = true,
                            ExpOrder   = i,
                            FileName   = file,
                            Source     = source,
                            SampleType = null,
                            Group      = null
                        });
                        i++;
                    }
                }
                else
                {
                    int i = FilePaths.Count + 1;
                    foreach (string filename in files)
                    {
                        if (!FilePaths.Contains(filename))
                        {
                            FilePaths.Add(filename);
                            var source = GetFilePolarity(filename);
                            Samples.Add(new Sample
                            {
                                HideOrShow = true,
                                ExpOrder   = i,
                                FileName   = filename,
                                Source     = source,
                                SampleType = null,
                                Group      = null
                            });
                        }
                    }
                }
            }
        }