Ejemplo n.º 1
0
        private void Parser_OnNewData(object arg1, string arg2)
        {
            try
            {
                if (string.IsNullOrEmpty(arg2))
                {
                    InfoMessage.ShowInfo("ERROR", "Checking updates has been not correct!");
                    Logs.WriteLog("ERROR-Checking updates has been not correct!");
                    Progress = 0;
                    Message  = "ERROR, Click at 'Cancel' button to continue...";
                }
                else
                {
                    if (arg2.Contains(App.Version.Replace("v", "")))
                    {
                        Progress = 0;
                        Message  = "Your application has the current version. Click at 'Cancel' button to continue...";
                        Logs.WriteLog("A new version of app not found. Your application has the current version.");
                    }
                    else
                    {
                        Logs.WriteLog("Update file has been finded!");
                        Progress = 0;

                        CheckSize();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorWriter.WriteError(ex);
                Progress = 0;
                Message  = "ERROR, Click at 'Cancel' button to continue...";
            }
        }
Ejemplo n.º 2
0
        private void Continue(object sender, RoutedEventArgs e)
        {
            try
            {
                string arrarar = settings.ASSKOP();

                if (Password.Password != null)
                {
                    exehs = Convert.ToBase64String(App.md5.ComputeHash(Encoding.UTF8.GetBytes(Password.Password)));
                }

                if (exehs == arrarar)
                {
                    Logs.WriteLog("Password was entered correctly!");
                    this.Close();
                }
                else
                {
                    SystemSounds.Hand.Play();

                    InfoMessage.ShowInfo("ERROR!", "Password was entered incorrectly!");
                    Logs.WriteLog("ERROR-Password was entered incorrectly!");

                    return;
                }
            }
            catch (Exception ex)
            {
                ErrorWriter.WriteError(ex);
            }
        }
Ejemplo n.º 3
0
 public static void UpdateSettings(Settings settings)
 {
     try
     {
         Settings = settings;
     }
     catch (Exception ex)
     {
         ErrorWriter.WriteError(ex);
     }
 }
Ejemplo n.º 4
0
 public Main()
 {
     try
     {
         InitializeComponent();
     }
     catch (Exception ex)
     {
         ErrorWriter.WriteError(ex);
     }
 }
Ejemplo n.º 5
0
 public MainWindow()
 {
     try
     {
         InitializeComponent();
         DataContext = new ViewModel.MainViewModel();
     }
     catch (Exception ex)
     {
         ErrorWriter.WriteError(ex);
     }
 }
Ejemplo n.º 6
0
 private void Cancel(object sender, RoutedEventArgs e)
 {
     try
     {
         Logs.WriteLog("The app has been turned off");
         Application.Current.Shutdown();
     }
     catch (Exception ex)
     {
         ErrorWriter.WriteError(ex);
     }
 }
Ejemplo n.º 7
0
 public string Parse(IHtmlDocument document)
 {
     try
     {
         var pItem = document.QuerySelectorAll("p").Where(item => item.ClassName != null && item.Id != null && item.ClassName.Contains("app_current_version") && item.Id.Contains("file_protect")).FirstOrDefault();
         return(pItem.TextContent);
     }
     catch (Exception ex)
     {
         ErrorWriter.WriteError(ex);
         return(string.Empty);
     }
 }
Ejemplo n.º 8
0
 private void Parser_OnCompleted(object obj)
 {
     try
     {
         Logs.WriteLog("COMPLETED-Checking updates has been completed!");
         Progress = 0;
         parser.Abort();
     }
     catch (Exception ex)
     {
         ErrorWriter.WriteError(ex);
     }
 }
Ejemplo n.º 9
0
        public DecryptViewModel()
        {
            try
            {
                if (SettingsManipulator.Read($@"{App.MainPath}\File protect\appsettings.json") is Settings json)
                {
                    settings = json;
                    Logs.WriteLog("Crypt settings has been readed!");
                }

                this.OldDataDel     = settings.DelDataBefOperation;
                this.WriteLogs      = settings.WriteLogs;
                this.OperationWrite = settings.SaveCache;
                Logs.WriteLog("Settings has been applied!");
            }
            catch (Exception ex)
            {
                ErrorWriter.WriteError(ex);
            }
        }
Ejemplo n.º 10
0
        public PasswordReq()
        {
            try
            {
                InitializeComponent();

                if (SettingsManipulator.Read($@"{App.MainPath}\File Protect\appsettings.json") is Settings json)
                {
                    settings = json;
                    App.UpdateSettings(settings);

                    Logs.WriteLog($"\"{App.MainPath}\\File Protect\\appsettings.json\" has been readed");
                    Logs.WriteLog("Global application's settings has been updated");
                }
            }
            catch (Exception ex)
            {
                ErrorWriter.WriteError(ex);
            }
        }
Ejemplo n.º 11
0
        public UpdateCheckerViewModel()
        {
            try
            {
                parser              = new ParserWorker <string>(new AppParser(), new AppSettings());
                parser.OnNewData   += Parser_OnNewData;
                parser.OnCompleted += Parser_OnCompleted;

                Message     = "Checking updates...";
                MaxProgress = 2;
                Progress    = 1;

                Parsing();
            }
            catch (Exception ex)
            {
                ErrorWriter.WriteError(ex);
                Progress = 0;
                Message  = "ERROR, Click at 'Cancel' button to continue...";
            }
        }
Ejemplo n.º 12
0
        private async Task DecryptAsync()
        {
            await Task.Factory.StartNew(() =>
            {
                try
                {
                    if (writeLogs)
                    {
                        Logs.WriteLog("Decrypting has been started!");
                    }

                    ButtonEnabled = false;

                    string output = $@"{yPath}\{Path.GetFileNameWithoutExtension(xPath)}";

                    Progress     = 1;
                    TextProgress = "1/7 part - data reading...(slow)";
                    if (writeLogs)
                    {
                        Logs.WriteLog("1/7 part - data reading...");
                    }

                    string data = File.ReadAllText(xPath);

                    Progress     = 2;
                    TextProgress = "2/7 part - decrypting...(slow)";
                    if (writeLogs)
                    {
                        Logs.WriteLog("2/7 part - decrypting...");
                    }

                    string newData = new string(data.ToCharArray().Reverse().ToArray());
                    byte[] bytes   = Encoding.Default.GetBytes(newData);

                    Progress     = 3;
                    TextProgress = "3/7 part - cache creating...(slow)";
                    if (writeLogs)
                    {
                        Logs.WriteLog("3/7 part - cache creating...");
                    }

                    File.WriteAllBytes($"{output}.zip", bytes);
                    File.SetAttributes($"{output}.zip", FileAttributes.Hidden);

                    try
                    {
                        using (ZipFile zip = ZipFile.Read($"{output}.zip"))
                        {
                            Directory.CreateDirectory(output);

                            Progress     = 4;
                            TextProgress = "4/7 part - decrypting...(not fast)";
                            if (writeLogs)
                            {
                                Logs.WriteLog("4/7 part - decrypting...");
                            }

                            foreach (ZipEntry e in zip)
                            {
                                e.Extract(output, ExtractExistingFileAction.OverwriteSilently);
                            }
                        }

                        Progress     = 5;
                        TextProgress = "5/7 part - cache deleting...(very fast)";
                        if (writeLogs)
                        {
                            Logs.WriteLog("5/7 part - cache deleting...");
                        }

                        File.Delete($"{output}.zip");
                    }
                    catch (Exception ex)
                    {
                        SystemSounds.Hand.Play();

                        Progress     = 0;
                        TextProgress = "ERROR-Decrypt uncknown file format!";

                        ButtonEnabled = true;

                        if (writeLogs)
                        {
                            Logs.WriteLog("ERROR-Decrypt uncknown file format!");
                        }

                        ErrorWriter.WriteError(ex);

                        File.Delete($"{output}.zip");
                        return;
                    }

                    Progress     = 6;
                    TextProgress = "6/7 part - deleting old files if you need...(very fast)";
                    if (writeLogs)
                    {
                        Logs.WriteLog("6/7 part - deleting old files if you need...");
                    }
                    if (oldDataDel)
                    {
                        File.Delete(xPath);
                        if (writeLogs)
                        {
                            Logs.WriteLog("Old directory has been deleted!");
                        }
                    }

                    Progress     = 7;
                    TextProgress = "7/7 part - decrypting complete!";
                    if (writeLogs)
                    {
                        Logs.WriteLog("7/7 part - decrypting complete!");
                    }

                    if (operationWrite)
                    {
                        string guid = Guid.NewGuid().ToString();
                        List <Operation> list;
                        if (File.Exists($@"{App.MainPath}\File Protect\appcache.json"))
                        {
                            list = OperationManipulator.Read($@"{App.MainPath}\File Protect\appcache.json");
                            Logs.WriteLog($"\"{App.MainPath}\\File Protect\\appcache.json\" has been readed!");
                        }
                        else
                        {
                            list = new List <Operation>();
                        }
                        Operation operation = new Operation(guid, OperationType.Decrypt, DateTime.Now, xPath, output);
                        list.Add(operation);

                        OperationManipulator.Write($@"{App.MainPath}\File Protect\appcache.json", list);
                        Logs.WriteLog($"\"{App.MainPath}\\File Protect\\appcache.json\" has been writed!");
                    }

                    ButtonEnabled = true;

                    if (writeLogs)
                    {
                        Logs.WriteLog("Decoding complete!");
                    }
                }
                catch (FileNotFoundException)
                {
                    ButtonEnabled = true;

                    Progress     = 0;
                    TextProgress = "This file don't exist!";
                }
                catch (Exception ex)
                {
                    ButtonEnabled = true;

                    Progress     = 0;
                    TextProgress = "Unknown error. Send files to email in settings page to help fix bugs! thx";

                    ErrorWriter.WriteError(ex);
                }
            });
        }
Ejemplo n.º 13
0
        public Result Execute(ExternalCommandData revit, ref string message, ElementSet elements)
        {
            ErrorWriter.SetWriter();
            ErrorWriter errorWriter = ErrorWriter.GetWriter();

            //FireProtectionColl fireProColl = new FireProtectionColl();
            try
            {
                //Get Doc
                UIDocument uidoc = revit.Application.ActiveUIDocument;
                Document   doc   = uidoc.Document;
                //Set Level
                FilteredElementCollector LevelCollector = new FilteredElementCollector(doc);
                ElementFilter            LevelFilter    = new ElementClassFilter(typeof(Level));
                LevelCollector.WherePasses(LevelFilter);
                MyLevel.SetMyLevel(LevelCollector);
                //IO
                DoOutput(doc);
                //fireProColl.OutputIN2(doc);
                Process process = Process.Start(PGPath.exeDirectory + "PGCreator.exe", PGPath.exeDirectory);
                process.WaitForExit();
                char[] outFile = IOHelper.Input("PGCTF.OUT");
                IOHelper.Output("1", "PGCTF.OUT");
                IOHelper.TryHideFile("PGCTF.OUT");
                //Process
                if (outFile[0] == '0')
                {
                    MEPHelper.ReadBinFile();
                    AdditionalInfo addiInfo = new AdditionalInfo(outFile);
                    MyLevel.AdjustLevels(addiInfo);
                    PGWriter.SetWriter(addiInfo);
                    AbandonmentWriter.SetWriter(addiInfo);
                    PGWriter pgWriter = PGWriter.GetWriter();

                    if (addiInfo.requiredComp[(byte)PGComponents.BeamColumnJoint])
                    {
                        pgWriter.UpdatePGs(PBeamColumnJoints.GetPG(doc, addiInfo));
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.ShearWall])
                    {
                        pgWriter.UpdatePGs(PShearWall.GetPG(doc, addiInfo));
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.GypWall] ||
                        addiInfo.requiredComp[(byte)PGComponents.WallFinish])
                    {
                        pgWriter.UpdatePGs(PGypWall.GetPG(doc, addiInfo));
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.CurtainWall])
                    {
                        pgWriter.UpdatePGs(PCurtainWall.GetPG(doc, addiInfo));
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.Storefront])
                    {
                        pgWriter.UpdatePGs(PStorefront.GetPG(doc, addiInfo));
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.Ceiling] ||
                        addiInfo.requiredComp[(byte)PGComponents.CeilingLighting])
                    {
                        pgWriter.UpdatePGs(PCeiling.GetPG(doc, addiInfo));
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.MasonryWall])
                    {
                        pgWriter.UpdatePGs(PMasonryWall.GetPG(doc, addiInfo));
                    }

                    if (addiInfo.requiredComp[(byte)PGComponents.Duct])
                    {
                        pgWriter.UpdatePGs(PDuct.GetPG(doc, addiInfo));
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.Pipe])
                    {
                        pgWriter.UpdatePGs(PPipe.GetPG(doc, addiInfo));
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.Chiller])
                    {
                        pgWriter.UpdatePGs((new PChiller(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.CoolingTower])
                    {
                        pgWriter.UpdatePGs((new PCoolingTower(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.Compressor])
                    {
                        pgWriter.UpdatePGs((new PCompressor(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.HVACFan_InLine])
                    {
                        pgWriter.UpdatePGs((new PHVACFan_InLine(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.Diffuser])
                    {
                        pgWriter.UpdatePGs((new PDiffuser(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.VAV])
                    {
                        pgWriter.UpdatePGs((new PVAV(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.HVACFan])
                    {
                        pgWriter.UpdatePGs((new PHVACFan(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.AHU])
                    {
                        pgWriter.UpdatePGs((new PAHU(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.ControlPanel])
                    {
                        pgWriter.UpdatePGs((new PControlPanel(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.FireSprinkler])
                    {
                        pgWriter.UpdatePGs((new PFireSprinkler(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.Transformer])
                    {
                        pgWriter.UpdatePGs((new PTransformer(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.MCC])
                    {
                        pgWriter.UpdatePGs((new PMCC(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.LVS])
                    {
                        pgWriter.UpdatePGs((new PLVS(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.DistPanel])
                    {
                        pgWriter.UpdatePGs((new PDistPanel(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.BatteryRack])
                    {
                        pgWriter.UpdatePGs((new PBatteryRack(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.BatteryCharger])
                    {
                        pgWriter.UpdatePGs((new PBatteryCharger(doc, addiInfo)).GetPG());
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.DieselGen])
                    {
                        pgWriter.UpdatePGs((new PDieselGen(doc, addiInfo)).GetPG());
                    }

                    if (addiInfo.requiredComp[(byte)PGComponents.BracedFrame])
                    {
                        pgWriter.UpdatePGs(PBracedFrame.GetPG(doc, addiInfo));
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.SteelBCJoint])
                    {
                        pgWriter.UpdatePGs(PStealBCJoints.GetPG(doc, addiInfo));
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.FlatSlab])
                    {
                        pgWriter.UpdatePGs(PFlatSlab.GetPG(doc, addiInfo));
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.LinkBeam])
                    {
                        pgWriter.UpdatePGs(PLinkBeam.GetPG(doc, addiInfo));
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.Stair])
                    {
                        pgWriter.UpdatePGs(PStair.GetPG(doc, addiInfo));
                    }
                    if (addiInfo.requiredComp[(byte)PGComponents.Roof])
                    {
                        pgWriter.UpdatePGs(PRoof.GetPG(doc, addiInfo));
                    }
                    normalExit = true;
                }
            }
            catch (Exception e)
            {
                errorWriter.WriteError(e);
                normalExit = false;
                TaskDialog.Show("PGCreator", "未能正确导出性能组,请与软件提供者联系");
            }
            finally
            {
                ErrorWriter.Output();
                if (normalExit)
                {
                    AbandonmentWriter.Output();
                    PGWriter.Output();
                    TaskDialog.Show("PGCreator", "性能组导出成功!");
                }
            }
            return(Result.Succeeded);
        }
Ejemplo n.º 14
0
        public MainViewModel()
        {
            try
            {
                if (!Directory.Exists($"{App.MainPath}"))
                {
                    Directory.CreateDirectory($"{App.MainPath}");
                    CreateMainFolder();
                }
                else
                {
                    if (!Directory.Exists($@"{App.MainPath}\File Protect"))
                    {
                        CreateMainFolder();
                    }
                    else
                    {
                        if (!File.Exists($@"{App.MainPath}\File Protect\.log"))
                        {
                            File.Create($@"{App.MainPath}\File Protect\.log").Close();
                            Logs.WriteLog($"\"{App.MainPath}\\File Protect\\.log\" has been created!");
                        }
                        if (!File.Exists($@"{App.MainPath}\File Protect\appsettings.json"))
                        {
                            Logs.WriteLog("Application starts working!");

                            View.CreatePass createPass = new View.CreatePass();

                            Logs.WriteLog("Creating password window has been opened!");
                            createPass.ShowDialog();
                        }
                        else
                        {
                            Logs.WriteLog("Application starts working!");

                            View.PasswordReq passwordReq = new View.PasswordReq();

                            Logs.WriteLog("Password request window has been opened!");
                            passwordReq.ShowDialog();
                        }
                    }
                }

                mainPage     = new Pages.Main();
                cryptPage    = new Pages.Crypt();
                decryptPage  = new Pages.Decrypt();
                settingsPage = new Pages.Settings();

                Logs.WriteLog("Pages has been initialized");

                FrameOpacity = 1;
                currentPage  = mainPage;

                if (Directory.Exists($"{Environment.CurrentDirectory}\\UPDATE"))
                {
                    string[] files = Directory.GetFiles($"{Environment.CurrentDirectory}\\UPDATE");
                    foreach (string file in files)
                    {
                        if (File.Exists($"{Environment.CurrentDirectory}\\{Path.GetFileName(file)}"))
                        {
                            File.Delete($"{Environment.CurrentDirectory}\\{Path.GetFileName(file)}");
                        }
                        File.Move(file, $"{Environment.CurrentDirectory}\\{Path.GetFileName(file)}");
                    }

                    Directory.Delete($"{Environment.CurrentDirectory}\\UPDATE");
                }

                if (App.Settings == null || App.Settings.CheckUpdates)
                {
                    UpdateChecker uc = new UpdateChecker();
                    uc.ShowDialog();
                }

                Logs.WriteLog("Main page has been selected");
            }
            catch (Exception ex)
            {
                ErrorWriter.WriteError(ex);
            }
        }
Ejemplo n.º 15
0
        private async Task EncryptAsync(string path)
        {
            try
            {
                await Task.Factory.StartNew(() =>
                {
                    try
                    {
                        ZipFile zip = new ZipFile();
                        zip.AddDirectory(path);
                        zip.Save($"{path}.zip");

                        File.SetAttributes($"{path}.zip", FileAttributes.Hidden);

                        if (writeLogs)
                        {
                            Logs.WriteLog("Cache of encrypt procces has been created");
                        }

                        Progress     = 3;
                        TextProgress = "3/10 part - rate cache size(fast)";
                        if (writeLogs)
                        {
                            Logs.WriteLog("3/10 part - rate cache size");
                        }

                        FileInfo info = new FileInfo($"{ path }.zip");
                        long size     = info.Length;

                        if (size > 2000000000)
                        {
                            ButtonEnabled = true;
                            if (writeLogs)
                            {
                                Logs.WriteLog("ERROR-Folder should not be more than 2 GB!");
                            }

                            Progress     = 0;
                            TextProgress = "Encoding error... Try again with smaller file(not be more 2 GB).";
                            File.Delete($"{path}.zip");
                            return;
                        }

                        Progress     = 4;
                        TextProgress = "4/10 part - reading...(fast)";
                        if (writeLogs)
                        {
                            Logs.WriteLog("4/10 part - reading...");
                        }

                        byte[] data = File.ReadAllBytes($"{path}.zip");

                        Progress     = 5;
                        TextProgress = "5/10 part - encoding...(not fast)";
                        if (writeLogs)
                        {
                            Logs.WriteLog("5/10 part - encoding...");
                        }

                        string zipData = Encoding.Default.GetString(data);

                        Progress     = 6;
                        TextProgress = "6/10 part - encoding...(not fast)";
                        if (writeLogs)
                        {
                            Logs.WriteLog("6/10 part - encoding...");
                        }

                        string newData = new string(zipData.ToCharArray().Reverse().ToArray());

                        Progress     = 7;
                        TextProgress = "7/10 part - writing...(slow)";
                        if (writeLogs)
                        {
                            Logs.WriteLog("7/10 part - writing...");
                        }

                        File.Create($"{path}.{extencion}").Close();
                        File.WriteAllText($"{path}.{extencion}", newData);

                        Progress     = 8;
                        TextProgress = "8/10 part - deleting cache(fast)";
                        if (writeLogs)
                        {
                            Logs.WriteLog("8/10 part - deleting cache");
                        }

                        File.Delete($"{path}.zip");

                        if (writeLogs)
                        {
                            Logs.WriteLog("Cache of encrypt procces has been deleted!");
                        }

                        Progress     = 9;
                        TextProgress = "9/10 part - deleting old file if you want(fast)";
                        if (writeLogs)
                        {
                            Logs.WriteLog("9/10 part - deleting old file if you want");
                        }

                        if (oldDataDel)
                        {
                            Directory.Delete(xPath);
                            if (writeLogs)
                            {
                                Logs.WriteLog("Old directory has been deleted!");
                            }
                        }

                        zip.Dispose();


                        if (operationWrite)
                        {
                            string guid = Guid.NewGuid().ToString();
                            List <Operation> list;
                            if (File.Exists($@"{App.MainPath}\File Protect\appcache.json"))
                            {
                                list = OperationManipulator.Read($@"{App.MainPath}\File Protect\appcache.json");
                                Logs.WriteLog($"\"{App.MainPath}\\File Protect\\appcache.json\" has been readed!");
                            }
                            else
                            {
                                list = new List <Operation>();
                            }
                            Operation operation = new Operation(guid, OperationType.Encrypt, DateTime.Now, xPath, $"{path}.{extencion}");
                            list.Add(operation);

                            OperationManipulator.Write($@"{App.MainPath}\File Protect\appcache.json", list);
                            Logs.WriteLog($"\"{App.MainPath}\\File Protect\\appcache.json\" has been writed!");
                        }

                        Progress      = 10;
                        TextProgress  = "10/10 part - encoding complete!";
                        ButtonEnabled = true;

                        if (writeLogs)
                        {
                            Logs.WriteLog("Encoding complete!");
                        }
                    }
                    catch (FileNotFoundException)
                    {
                        ButtonEnabled = true;

                        Progress     = 0;
                        TextProgress = "This file don't exist!";
                    }
                    catch (Exception ex)
                    {
                        Progress      = 0;
                        TextProgress  = "Unknown error. Send files to email in settings page to help fix bugs! thx";
                        ButtonEnabled = true;
                        ErrorWriter.WriteError(ex);
                    }
                });
            }
            catch (Exception ex)
            {
                ButtonEnabled = true;
                ErrorWriter.WriteError(ex);
            }
        }