aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Utilities/Tango.DispenserAnalyzer.UI/FileHelper.cs
blob: 7172a4ff1be02f2c510ba602192e38ba8833318e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.DispenserAnalyzer.UI
{
    public static class FileHelper
    {
        private const string FILE_EXTENSION = ".pdf";
        private const string FILE_EXEL_EXTENSION = ".xlsx";

        public static string OpenFilePath{ get; set; }

        public static string GetResultFilePath()
        {
            if (File.Exists(OpenFilePath))
            {
                var ext = Path.GetExtension(OpenFilePath);
                var dir = Path.GetDirectoryName(OpenFilePath);
                var resultFile = Path.Combine(dir, string.Format("{0}-result{1}", Path.GetFileNameWithoutExtension(OpenFilePath), FILE_EXTENSION));
                return resultFile;
            }
            return "";
        }

        public static string GetFileToSaveFlowRangeToTimeData( int extNumber)
        {
            if (File.Exists(OpenFilePath))
            {
                var ext = Path.GetExtension(OpenFilePath);
                var dir = Path.GetDirectoryName(OpenFilePath);
                var resultFile = Path.Combine(dir, string.Format("{0}_rangeToTime{1}{2}", Path.GetFileNameWithoutExtension(OpenFilePath), extNumber.ToString(), FILE_EXEL_EXTENSION));
                return resultFile;
            }
            return "";
        }


    }
}