Exemplo n.º 1
0
        /// <summary>Set up UI elements</summary>
        private void SetupUI()
        {
            // Files grid
            m_grid.AllowDrop           = true;
            m_grid.AutoGenerateColumns = false;
            m_grid.Columns.Add(new DataGridViewTextBoxColumn {
                HeaderText = "File Path", DataPropertyName = nameof(FileInfo.FullName)
            });
            m_grid.DataSource = FileInfos;
            m_grid.MouseDown += DataGridView_.DragDrop_DragRow;

            // Add files
            m_btn_add_files.ToolTip(m_tt, "Browse for files to add");
            m_btn_add_files.Click += (s, a) =>
            {
                var dlg = new OpenFileDialog {
                    Filter = Constants.LogFileFilter, Multiselect = true
                };
                if (dlg.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                FileInfos.AddRange(dlg.FileNames.Select(x => new FileInfo(x)));
            };

            // Disable OK till there are files
            m_btn_ok.Enabled = false;
        }
Exemplo n.º 2
0
        private void OnDeleted(object source, FileSystemEventArgs e)
        {
            int index = FileInfos.FindIndex(x => x == CurrentFileInfo); // Get the index of the current file being displayed (-1 if not found [no files])

            // Try and find the item in the list, if it's there, remote it, if not, continue
            FileInfo fi = FileInfos.Find(x => x.FullName == e.FullPath);

            FileInfos.Remove(fi);

            if (!FileInfos.Contains(CurrentFileInfo)) // is the selected file removed? If not, just continue the day
            {
                if (index >= FileInfos.Count())       // is the index above what's suppose to be?
                {
                    index = FileInfos.Count() - 1;    // Move it down a Markus Persson (Notch)
                }

                if (FileInfos.Count() > 0)              // Is there still items in the list?
                {
                    CurrentFileInfo = FileInfos[index]; // Select that file
                }
                else // No items in the list
                {
                    CurrentFileInfo = null; // Select nothing for the current file info
                }

                UpdateImage(); // update only if it's a new file
            }

            Changed(); // Something changed! (Removed a file!)
        }
Exemplo n.º 3
0
 //单例模式
 public static SystemConfig SystemConfigInstance()
 {
     if (languageChoose == null)
     {
         languageChoose = FileInfos.Instance().SystemConfigCreat(true);//读取language配置文件
     }
     return(languageChoose);
 }
Exemplo n.º 4
0
 public Commit(string author, DateTime date, IEnumerable <FileChanged> changes)
 {
     Date   = date;
     Author = author;
     foreach (var item in changes)
     {
         FileInfos.AddLast(item);
     }
 }
Exemplo n.º 5
0
        public async Task UpdateLastDownloaded()
        {
            var svcFileEntity = await FileInfos.FirstOrDefaultAsync(f => f.Name == "Svc");

            if (svcFileEntity != null)
            {
                svcFileEntity.LastDownloaded = DateTime.Now;
                await SaveChangesAsync();
            }
        }
Exemplo n.º 6
0
        private static void Server()
        {
            while (true)
            {
                HttpListenerContext context;
                try {
                    context = httpListener.GetContext();
                } catch { break; }

                var req = context.Request;
                var res = context.Response;
                try {
                    if (urlFile.IsMatch(req.RawUrl))
                    {
                        var result    = urlFile.Match(req.RawUrl);
                        var filename  = result.Groups["filename"].Value;
                        var format    = result.Groups["format"].Value;
                        var fileBytes = File.ReadAllBytes(Environment.CurrentDirectory + @"\library\" + filename + '.' + format);
                        res.OutputStream.Write(fileBytes, 0, fileBytes.Length);
                        res.StatusCode = 200;
                    }
                    else if (urlTagInfos.IsMatch(req.RawUrl))
                    {
                        var json      = JsonConvert.SerializeObject(TagInfos.ToArray());
                        var jsonBytes = Encoding.UTF8.GetBytes(json);
                        res.OutputStream.Write(jsonBytes, 0, jsonBytes.Length);
                        res.StatusCode = 200;
                    }
                    else if (urlFileInfos.IsMatch(req.RawUrl))
                    {
                        var json      = JsonConvert.SerializeObject(FileInfos.ToArray());
                        var jsonBytes = Encoding.UTF8.GetBytes(json);
                        res.OutputStream.Write(jsonBytes, 0, jsonBytes.Length);
                        res.StatusCode = 200;
                    }
                    else if (urlFileTagMappers.IsMatch(req.RawUrl))
                    {
                        var json      = JsonConvert.SerializeObject(FileTagMappers.ToArray());
                        var jsonBytes = Encoding.UTF8.GetBytes(json);
                        res.OutputStream.Write(jsonBytes, 0, jsonBytes.Length);
                        res.StatusCode = 200;
                    }
                    else
                    {
                        res.StatusCode = 404;
                    }
                } catch {
                    res.StatusCode = 500;
                } finally {
                    res.Close();
                }
            }
        }
Exemplo n.º 7
0
        private void button9_Click(object sender, EventArgs e)
        {
            try
            {
                FileInfos prv    = null;
                long      length = 0;

                int pagesize = 0;
                if (cfg.PageSize != 0)
                {
                    pagesize = cfg.PageSize * 1024;
                }

                foreach (FileInfos b in bindingSource1)
                {
                    if (prv != null)
                    {
                        b.Offset = length;
                    }

                    if (b.fi == null || !b.fi.Exists)
                    {
                    }


                    if (prv == null)
                    {
                        // 처음건 오프셋 더하기
                        length += b.Offset;
                    }


                    length += b.fi.Length;

                    if (pagesize != 0)
                    {
                        var rem = length % pagesize;
                        length += rem;
                    }

                    prv = b;
                }

                dataGridView1.Refresh();

                prv = null;
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
                MessageBox.Show($"오프셋 정렬 실패 : {exception.Message}");
            }
        }
Exemplo n.º 8
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var openfileDialog = new OpenFileDialog();

            openfileDialog.Multiselect = true;
            if (openfileDialog.ShowDialog().GetValueOrDefault(false))
            {
                foreach (var fileName in openfileDialog.FileNames)
                {
                    FileInfos.Add(new FileInfo(fileName));
                }
            }
        }
Exemplo n.º 9
0
        public IAudioStream CreateAudioStream()
        {
            IAudioStream stream = null;

            if (MultiFile)
            {
                stream = new ConcatenationStream(FileInfos.Select(fi => AudioStreamFactory.FromFileInfoIeee32(fi)).ToArray());
            }
            else
            {
                stream = AudioStreamFactory.FromFileInfoIeee32(FileInfo);
            }
            return(new TimeWarpStream(stream, timeWarps));
        }
Exemplo n.º 10
0
        public void UpdateImage()
        {
            // Clear canvas
            Target.Dispatcher.Invoke(() =>
            {
                ImageBehavior.SetAnimatedSource(Target, null);
                Target.Source = null;
            });

            if (FileInfos.Count() > 0 && CurrentFileInfo != null) // Is there even an image?
            {
                // Display the image
                Target.Dispatcher.Invoke(() =>
                {
                    while (true)
                    {
                        try
                        {
                            MemoryStream memory = new MemoryStream();
                            using (FileStream file = File.OpenRead(CurrentFileInfo.FullName))
                            {
                                file.CopyTo(memory);
                            }

                            memory.Seek(0, SeekOrigin.Begin);

                            var imageSource = new BitmapImage();
                            imageSource.BeginInit();
                            imageSource.StreamSource = memory;
                            imageSource.EndInit();

                            if (Path.GetExtension(CurrentFileInfo.Name).ToLower() == ".gif")
                            {
                                ImageBehavior.SetAnimatedSource(Target, imageSource);
                            }
                            else
                            {
                                Target.Source = imageSource;
                            }

                            break;
                        }
                        catch
                        {
                            break;
                        }
                    }
                });
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Verifies the files of the local build. Returns a list of files that
        /// have different hashes from specified.
        /// </summary>
        /// <returns>A list of files that have different hashes from specified.</returns>
        public List <LocalFileInfo> Verify()
        {
            var differentFiles = new List <LocalFileInfo>();

            FileInfos.ForEach(fi =>
            {
                if (!fi.MatchesActualFile(BuildPath))
                {
                    differentFiles.Add(fi);
                }
            });

            return(differentFiles);
        }
Exemplo n.º 12
0
        public ServerControl(Server server, Style style, FileInfos fileInfos)
        {
            this.server    = server;
            this.style     = style;
            this.fileInfos = fileInfos;

            Visible = false;

            InitializeComponent();
            InitializeSize();
            InitializeTimer();
            RegisterEvents();
            DownloadPatchFileInfo();
            DownloadServerstatus();
        }
Exemplo n.º 13
0
 private void SortFileInfos()
 {
     // Sort current List
     if (Randomize)
     {
         FileInfos.Shuffle(Seed);
     }
     else
     {
         // Sort it naturally
         NaturalFileInfoNameComparer comparer = new NaturalFileInfoNameComparer();
         FileInfos.Sort(comparer);
         //fileInfos.Sort(SafeNativeMethods.StrCmpLogicalW);
     }
 }
Exemplo n.º 14
0
        public void RemoveFilesFromTOC(string[] filesToRemove)
        {
            Dictionary <string, FileEntryKey> tocFiles = GetAllRegisteredFileMap();

            foreach (var file in filesToRemove)
            {
                if (tocFiles.TryGetValue(file, out FileEntryKey fileEntry))
                {
                    Program.Log($"[:] Pack: Removing file from TOC: {file}");
                    if (!TryRemoveFile(FileInfos.GetByFileIndex(fileEntry.EntryIndex)))
                    {
                        Program.Log($"[X] Pack: Attempted to remove file {file}, but did not exist in volume");
                    }
                }
            }
        }
Exemplo n.º 15
0
        public void PrevImage()
        {
            if (FileInfos.Count() > 0) // Is there even an image?
            {
                int index = FileInfos.FindIndex(x => x == CurrentFileInfo);
                index--;
                while (index < 0)
                {
                    index += FileInfos.Count();
                }
                CurrentFileInfo = FileInfos[index];

                UpdateImage();
                Changed();
            }
        }
Exemplo n.º 16
0
        private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            ButonsEnable = false;

            var selectedPath       = string.Empty;
            var folderBowserDialog = new FolderBrowserDialog();

            if (folderBowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                selectedPath = folderBowserDialog.SelectedPath;
            }

            Stopwatch stopWatch = new Stopwatch();

            stopWatch.Start();
            int directionaryCounter = 0;

            await Task.Run(() =>
            {
                FileInfos.Select(x => new
                {
                    x.LastWriteTime.Year,
                    x.LastWriteTime.Month
                }).Distinct().OrderBy(x => x.Month).ToList().ForEach(y =>
                {
                    var filesFromSpecificTimeRange = FileInfos.Where(f => f.CreationTime.Year.Equals(y.Year) && f.CreationTime.Month.Equals(y.Month)).ToList();

                    var createdDirectionary = Directory.CreateDirectory(String.Format(@"{0}\{1:yyyy MMMM}", selectedPath, new DateTime(y.Year, y.Month, 1)));

                    directionaryCounter++;
                    filesFromSpecificTimeRange.ForEach(ftr =>
                    {
                        File.Copy(ftr.FullName, string.Format(@"{0}\{1}", createdDirectionary.FullName, ftr.Name));
                    });
                });
            }).ConfigureAwait(false);

            stopWatch.Stop();
            TimeSpan ts          = stopWatch.Elapsed;
            string   elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", ts.Hours, ts.Minutes, ts.Seconds, ts.Milliseconds / 10);

            System.Windows.MessageBox.Show(string.Format("Zakończono kopiowanie. Utworzono: {0} katalogów{1} Czas Twania to: {2}", directionaryCounter, Environment.NewLine, elapsedTime), "Info",
                                           MessageBoxButton.OK, MessageBoxImage.Information);

            ButonsEnable = true;
            Process.Start("explorer.exe", selectedPath);
        }
Exemplo n.º 17
0
    public static List <FileInfos> FilterDirectory(string path, string[] extNames, bool includeChilrenDir = true)
    {
        List <FileInfos> result = new List <FileInfos>();

        if (!Directory.Exists(path))
        {
            return(null);
        }

        Queue <DirectoryInfo> dirQueue = new Queue <DirectoryInfo>();
        DirectoryInfo         dirInfo  = new DirectoryInfo(path);

        dirQueue.Enqueue(dirInfo);
        while (dirQueue.Count > 0)
        {
            dirInfo = dirQueue.Dequeue();

            if (includeChilrenDir)
            {
                foreach (var di in dirInfo.GetDirectories())
                {
                    dirQueue.Enqueue(di);
                }
            }

            foreach (var fi in dirInfo.GetFiles())
            {
                if ((fi.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden)
                {
                    continue;
                }
                foreach (var extName in extNames)
                {
                    if (extName.ToLower() == fi.Extension.ToLower())
                    {
                        FileInfos efi = new FileInfos();
                        efi.FullName = fi.FullName;
                        efi.Name     = fi.Name;
                        result.Add(efi);
                        break;
                    }
                }
            }
        }
        return(result);
    }
Exemplo n.º 18
0
        /// <summary>
        /// 下载单个文件
        /// </summary>
        /// <param name="item"></param>
        private void WriteFile(FileInfos item)
        {
            if (item == null)
            {
                CurView.ShowMessage("没有需要更新的文件");
                return;
            }

            ServiceRequest request = new  ServiceRequest();

            request.ServiceName = "FileUpdate";
            request.MethodName  = "CurReadFile";
            request.Parameters  = new object[] { item.FilePath };
            base.ServiceProxy.RequestService <byte[]>(request, DataType.Binary, (message) =>
            {
                byte[] curbyte = message;
                //本地临时临时文件夹,用于存储文件
                WorkPath = Path.Combine(TempFolder, item.FilePath);
                CurWriteFile(curbyte, WorkPath);

                DateTime date;
                if (DateTime.TryParseExact(item.FileModifyTime, "yyyy-MM-dd HH:mm:ss", new System.Globalization.CultureInfo("zh-CN"), System.Globalization.DateTimeStyles.None, out date))
                {
                    System.IO.File.SetLastWriteTime(WorkPath, date);
                }

                //循环下载文件
                FileInfos curInfos = GetfilePath();
                if (curInfos != null)
                {
                    WriteFile(curInfos);
                }
                else
                {
                    //用于标注下载完成
                    if (IsMustRestart)
                    {
                        CurView.ShowMessage("_S200File_Completed");
                    }
                    else
                    {
                        CurView.ShowMessage("_S200File_Completed_Hidden");
                    }
                }
            });
        }
Exemplo n.º 19
0
    public void GetFilesAndFolders(UserInfos userinfos, int year)  
    {  
        DirectoryInfo dirInfo = new DirectoryInfo(ConfigurationManager.AppSettings["filepath"] + userinfos.AsocId +"\\" + year +"\\");  
        FileInfo[] fileInfo = dirInfo.GetFiles("*.xls*", SearchOption.AllDirectories);
        List<FileInfos> fileInfos = new List<FileInfos>();
        foreach (FileInfo fi in fileInfo)
        {
            FileInfos f = new FileInfos();
            f.Name = fi.Name;
            f.DownloadLink = "~/Download.ashx?file="+ f.Name;
           
            fileInfos.Add(f);

        }
     
        xlsLinks.DataSource = fileInfos;
        xlsLinks.DataBind();
    }
Exemplo n.º 20
0
        private void OnRenamed(object source, RenamedEventArgs e)
        {
            FileInfo fi = FileInfos.Find(x => x.FullName == e.OldFullPath); // Get the file being renamed

            if (fi != null)                                                 // Is the file being enamed is part of the list?
            {
            }

            // check to see if it's the current file being re-named
            if (CurrentFileInfo.FullName == e.OldFullPath)
            {
                UpdateImagePathFiles();
                // Move pointer to the new file location (in the array)
                CurrentFileInfo = FileInfos.Find(x => x.FullName == e.FullPath);
            }
            UpdateImage();
            Changed(); // call event changed
        }
Exemplo n.º 21
0
        /// <summary>
        /// Serializes the table of contents and its B-Trees.
        /// </summary>
        public byte[] Serialize()
        {
            using var ms = new MemoryStream();
            using var bs = new BinaryStream(ms, ByteConverter.Big);

            bs.Write(SEGMENT_MAGIC);
            bs.Position = 16;
            bs.WriteUInt32((uint)Files.Count);
            bs.Position += sizeof(uint) * Files.Count;

            uint fileNamesOffset = (uint)bs.Position;

            FileNames.Serialize(bs);

            uint extOffset = (uint)bs.Position;

            Extensions.Serialize(bs);

            uint fileInfoOffset = (uint)bs.Position;

            FileInfos.Serialize(bs);

            // The list of file entry btrees mostly consist of the relation between files, folder, extensions and data
            // Thus it is writen at the end
            // Each tree is a seperate general subdir
            const int baseListPos = 20;

            for (int i = 0; i < Files.Count; i++)
            {
                FileEntryBTree f          = Files[i];
                uint           treeOffset = (uint)bs.Position;
                bs.Position = baseListPos + (i * sizeof(uint));
                bs.WriteUInt32(treeOffset);
                bs.Position = treeOffset;
                f.Serialize(bs, (uint)FileNames.Entries.Count, (uint)Extensions.Entries.Count);
            }

            // Go back to write the meta data
            bs.Position = 4;
            bs.WriteUInt32(fileNamesOffset);
            bs.WriteUInt32(extOffset);
            bs.WriteUInt32(fileInfoOffset);
            return(ms.ToArray());
        }
Exemplo n.º 22
0
        /// <summary>Drop file paths into the grid</summary>
        private bool DropFiles(object sender, DragEventArgs args, DragDrop.EDrop mode)
        {
            args.Effect = DragDropEffects.None;
            if (!args.Data.GetDataPresent(DataFormats.FileDrop))
            {
                return(false);
            }

            args.Effect = DragDropEffects.Copy;
            if (mode != Rylogic.Gui.WinForms.DragDrop.EDrop.Drop)
            {
                return(true);
            }

            var filepaths = (string[])args.Data.GetData(DataFormats.FileDrop);

            FileInfos.AddRange(filepaths.Select(x => new FileInfo(x)));
            return(true);
        }
Exemplo n.º 23
0
    public void GetFilesAndFolders(UserInfos userinfos, int year)
    {
        DirectoryInfo dirInfo = new DirectoryInfo(ConfigurationManager.AppSettings["filepath"] + userinfos.AsocId + "\\" + year + "\\");

        FileInfo[]       fileInfo  = dirInfo.GetFiles("*.xls*", SearchOption.AllDirectories);
        List <FileInfos> fileInfos = new List <FileInfos>();

        foreach (FileInfo fi in fileInfo)
        {
            FileInfos f = new FileInfos();
            f.Name         = fi.Name;
            f.DownloadLink = "~/Download.ashx?file=" + f.Name;

            fileInfos.Add(f);
        }

        xlsLinks.DataSource = fileInfos;
        xlsLinks.DataBind();
    }
Exemplo n.º 24
0
        public async Task <string> uploadFile([FromBody] FileInfos fileInfos)
        {
            try
            {
                //var fileName = HttpContext.Current.Server.MapPath(fileInfos.FilePath);
                var fileName = fileInfos.FilePath;

                var uploadFileModel = new UploadMediaRequestModel()
                {
                    FileName  = fileName,
                    MediaType = UploadMediaType.File
                };
                string uploadModel = await dtManager.UploadFile(uploadFileModel);

                FileSendModel fileSendModel = JsonConvert.DeserializeObject <FileSendModel>(uploadModel);

                //绑定路径信息
                fileInfos.MediaId         = fileSendModel.Media_Id;
                fileInfos.LastModifyState = "0";
                fileInfos.LastModifyTime  = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                using (DDContext context = new DDContext())
                {
                    fileInfos.FilePath = @"\" + fileInfos.FilePath.Replace(AppDomain.CurrentDomain.BaseDirectory, "");
                    context.FileInfos.Add(fileInfos);
                    context.SaveChanges();
                }

                return(JsonConvert.SerializeObject(new ErrorModel
                {
                    errorCode = 0,
                    errorMessage = "上传盯盘成功"
                }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new ErrorModel
                {
                    errorCode = 1,
                    errorMessage = ex.Message
                }));
            }
        }
Exemplo n.º 25
0
        public FileInfos Read(XDocument document)
        {
            XElement launcherProfilesJson = document.XPathSelectElement("root/launcher/launcherProfilesJson");
            XElement optionsTxt           = document.XPathSelectElement("root/launcher/optionsTxt");
            XElement minecraftExecutable  = document.XPathSelectElement("root/launcher/minecraftExecutable");

            FileInfos result = new FileInfos()
            {
                DefaultLauncherProfilesFile  = XElementExtender.ReadUri(launcherProfilesJson),
                LauncherProfilesFilename     = XElementExtender.ReadPath(launcherProfilesJson),
                DefaultOptionsFile           = XElementExtender.ReadUri(optionsTxt),
                OptionsFilename              = XElementExtender.ReadRelativePath(optionsTxt),
                DefaultMinecraftLauncherFile = XElementExtender.ReadUri(minecraftExecutable),
                MinecraftLauncherFilename    = XElementExtender.ReadPath(minecraftExecutable),
                MinecraftLauncherHash        = XElementExtender.ReadHash(minecraftExecutable)
            };

            OutputConsole.PrintVerbose(result, 1);
            return(result);
        }
Exemplo n.º 26
0
        protected string GeneratePeakFileName()
        {
            string name = GenerateName();

            if (MultiFile)
            {
                // When the track consists of multiple files, we take the default track name and append a hash
                // value calculated from all files belonging to this track. This results in a short name while
                // avoiding file name collisions when different sets of concatenated files start with the same file (name).
                string concatenatedNames = FileInfos.Select(fi => fi.Name).Aggregate((s1, s2) => s1 + "+" + s2);
                using (var sha = SHA1.Create()) {
                    byte[] hash       = sha.ComputeHash(Encoding.UTF8.GetBytes(concatenatedNames));
                    string hashString = BitConverter.ToString(hash).Replace("-", "").ToLower();

                    // append Git-style shorted hash
                    name += "[" + hashString.Substring(0, 6) + "]";
                }
            }
            return(name);
        }
Exemplo n.º 27
0
        public async Task UpdateSvcLastModified(DateTime lastModified)
        {
            var existingEntity = await FileInfos.FirstOrDefaultAsync(f => f.Name == "Svc");

            if (existingEntity != null)
            {
                existingEntity.LastModified = lastModified;
                existingEntity.LastUpdated  = DateTime.Now;
            }
            else
            {
                FileInfos.Add(new FileInfo()
                {
                    Name         = "Svc",
                    LastModified = lastModified,
                    LastUpdated  = DateTime.Now
                });
            }
            await SaveChangesAsync();
        }
Exemplo n.º 28
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request["type"] != null && Request["type"].ToString() != "")
         {
             foreach (var item in tbs.Tabs)
             {
                 if (((RadTab)item).Value == Request["type"].ToString())
                 {
                     ((RadTab)item).Selected = true;
                 }
             }
         }
         CurrentFileInfos = new FileInfos();
         yaodianSearch3 _yaodianSearch3 = new yaodianSearch3();
         _yaodianSearch3.GetTreeView(new TreeView());
         CurrentFileInfos = yaodianSearch3.CurrentFileInfos;
     }
     //cbxClientCode.Focus();
 }
Exemplo n.º 29
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         List <FileInfos> src = new List <FileInfos>();
         FileInfos        s   = new FileInfos();
         for (int i = 0; i < 3; i++)
         {
             s          = new FileInfos();
             s.filePath = "../File/image/Temp/20160804/20160804_6141.jpg";
             s.IsCopy   = 1;
             src.Add(s);
         }
         MyFile ff = new MyFile();
         ff.image1  = src;
         ff.image2  = src;
         ff.fujian1 = src;
         ff.fujian2 = src;
         old.Value  = JsonConvert.SerializeObject(ff);
     }
 }
        public FileInfos[] getFileList([FromBody] Params param)
        {
            UtilFunction uf   = new UtilFunction();
            string       path = AppDomain.CurrentDomain.BaseDirectory + "OtherData";

            string[]         filenames = Directory.GetFiles(path);
            List <FileInfos> list      = new List <FileInfos>();
            int total = 0;

            foreach (String fn in filenames)
            {
                total++;
                FileInfos obj = new FileInfos();
                obj.id       = total;
                obj.fileName = Path.GetFileName(fn);
                list.Add(obj);
            }
            //Dictionary<string, object> map = new Dictionary<string, object>();
            //map.Add("rows", list);
            //string myjson = uf.ToJson(map);
            return(list.ToArray());
        }
Exemplo n.º 31
0
        private void OnCreated(object source, FileSystemEventArgs e)
        {
            UpdateImagePathFiles();
            if (FileInfos.Count() > 0)
            {
                UpdateImagePathFiles();

                // check to see if the current file is still there
                if (FileInfos.Find(x => x.FullName == e.FullPath) != null)
                {
                    // Move pointer to the new file location (in the array)
                    CurrentFileInfo = FileInfos.Find(x => x.FullName == e.FullPath);
                }
            }
            else
            {
                UpdateImagePathFiles();
                CurrentFileInfo = FileInfos.FirstOrDefault();
            }
            UpdateImage();
            Changed();
        }