Exemple #1
0
 public static UIStrings GetInstance()
 {
     if (_singleInstance == null)
     {
         _singleInstance = new UIStrings();
     }
     return(_singleInstance);
 }
Exemple #2
0
        public async static Task UpdateUiForFile(SharedCacheFile file)
        {
            UIStrings.GetInstance().IsCurrentFileValid = null;
            UIStrings.GetInstance().IsCurrentNodeFile  = true;
            // Use predefined description, or system description if file is unknown
            var systemDesc  = FileHelper.GetFileTypeDescription(file.DisplayName);
            var builtInDesc = file.TypeDesc;

            UIStrings.GetInstance().CurrentNodeType = (String.IsNullOrEmpty(builtInDesc) ? systemDesc : builtInDesc);

            UIStrings.GetInstance().CurrentFileSize           = file.Info.RawSize.ToString();
            UIStrings.GetInstance().CurrentFileCompressedSize = file.Info.CompressedSize.ToString();

            UIStrings.GetInstance().CurrentFileName = file.Info.FilePath;
            UIStrings.GetInstance().CurrentFileHash = file.Info.Md5;

            var fileLocation = Path.Combine(Settings.Default.SCPath, "ResFiles",
                                            file.Info.FilePath).Replace('/', '\\');

            UIStrings.GetInstance().IsCurrentFileValid = await FileHelper.CompareMd5(fileLocation, file.Info.Md5);
        }
Exemple #3
0
 public static void UpdateUiForDir(SharedCacheDirectory dir)
 {
     UIStrings.GetInstance().IsCurrentFileValid = null;
     UIStrings.GetInstance().IsCurrentNodeFile  = false;
     UIStrings.GetInstance().CurrentNodeType    = "Shared Resource Path";
 }
Exemple #4
0
        /// <summary>
        /// Prepare shared cache file tree and ask for valid path when necessary.
        /// </summary>
        /// <returns></returns>
        private async Task PrepareSharedCache(bool forced = false)
        {
            // Call once to use registry value if avail, or force set invalid
            if (!forced)
            {
                SharedCacheReader.ValidateSCPath();
            }
            else
            {
                Settings.Default.IsSCPathValid = false;
            }

            // If called by button, choosing path is a must
            while (!Settings.Default.IsSCPathValid)
            {
                using (var dialog = new FolderBrowserDialog())
                {
                    dialog.Description = "Please select a valid Shared Cache path.\n" +
                                         "You can get this info from EVE Launcher settings.";
                    var dialogResult = dialog.ShowDialog();
                    if (dialogResult ==
                        System.Windows.Forms.DialogResult.OK &&
                        !String.IsNullOrWhiteSpace(dialog.SelectedPath))
                    {
                        SharedCacheReader.ValidateSCPath(dialog.SelectedPath);
                    }
                    if (dialogResult == System.Windows.Forms.DialogResult.Cancel)
                    {
                        if (forced)
                        {
                            return;                                    // no need to quit if user was specifying another path
                        }
                        System.Windows.Application.Current.Shutdown(); // only quit when cancelled on app launch
                    }
                }
            }

            StatusBar.DataContext      = UIStrings.GetInstance();
            InfoStackPanel.DataContext = UIStrings.GetInstance();

            _currentNode = null;
            // Read raw from resfileindex.txt
            // Disable path selector until loading is complete
            UIStrings.GetInstance().IsPathBtnEnabled = false;
            Debug.WriteLine("Creating SC list...");
            UIStrings.GetInstance().LoadingProgValue = 0;
            UIStrings.GetInstance().LoadingText      = "Reading Shared Cache index from " + Settings.Default.SCPath + "...";
            var scIndex = await SharedCacheReader.ReadSCIndex(Settings.Default.SCPath);

            // Parse raw into inherited structure
            Debug.WriteLine("SC list created. Creating SC tree..");
            UIStrings.GetInstance().LoadingText    = "Organizing " + scIndex.Count + " entries...";
            UIStrings.GetInstance().LoadingProgMax = scIndex.Count;
            var scTree = await SharedCacheParser.PopulateItemTree(scIndex);

            // Loading finished, bind DataContext and re-enable path chooser
            UIStrings.GetInstance().LoadingText = "Successfully parsed " + scIndex.Count + " entries.";
            TreeView.DataContext = new
            {
                SharedCacheTree = scTree
            };
            UIStrings.GetInstance().IsPathBtnEnabled = true;
        }