示例#1
0
        internal static void CacheWebDirectories(WebDirectory web, PatchHandler handler)
        {
            string temp_error_data = string.Empty;

            try
            {
                for (int i = 0; i < web.AddressIndex.Count; i++)
                {
                    temp_error_data += web.AddressIndex[i] + " : " + web.SizeIndex[i].ToString() + " | ";

                    if (!WebCache.ContainsKey(web.AddressIndex[i])) /// Not sure why there's duplicates.. TBE
                    {
                        WebCache.Add(web.AddressIndex[i], web.SizeIndex[i]);
                    }

                    handler.UI.UpdatePatchNotes
                        (string.Format("Caching Web Bytes: [{1}] {0}", web.AddressIndex[i], web.SizeIndex[i]));

                    handler.UI.UpdateProgressBar();
                }

                for (int n = 0; n < web.SubDirectories.Count; n++)
                {
                    CacheWebDirectories(web.SubDirectories[n], handler);
                }
            }

            catch (Exception e)
            {
                LogHandler.LogErrors(e.ToString(), handler);
                LogHandler.LogErrors(temp_error_data, handler);
            }
        }
示例#2
0
        internal static void CacheLocalDirectories(LocalDirectory local, PatchHandler handler)
        {
            try
            {
                for (int i = 0; i < local.FileIndex.Count; i++)
                {
                    string name = local.FileIndex[i].
                                  FullName.Substring(local.DirectoryPath.Length);

                    if (!LocalCache.ContainsKey(name.Replace("\\", string.Empty)))
                    {
                        LocalCache.Add
                            (name.Replace("\\", string.Empty), local.FileIndex[i].Length);
                    }

                    handler.UI.UpdatePatchNotes
                        (string.Format("Caching Local Bytes: [{1}] {0}",
                                       name.Replace("\\", string.Empty), local.FileIndex[i].Length));

                    handler.UI.UpdateProgressBar();
                }

                for (int n = 0; n < local.subDirectories.Count; n++)
                {
                    CacheLocalDirectories(local.subDirectories[n], handler);
                }
            }

            catch (Exception e)
            {
                LogHandler.LogErrors(e.ToString(), handler);
            }
        }
示例#3
0
        public LocalDirectory(string path, PatchHandler handler)
        {
            Handler       = handler;
            DirectoryPath = path;

            directoryInfo = new DirectoryInfo(path);
            BuildFileIndex(directoryInfo);
        }
示例#4
0
        private static void ParseLocalDirectory
            (LocalDirectory directory, PatchHandler handler, XmlTextWriter xml)
        {
            IterateFileSizeIndex
                (directory.FileIndex, directory.DirectoryPath, xml);

            for (int i = 0; i < directory.subDirectories.Count; i++)
            {
                ParseLocalDirectory(directory.subDirectories[i], handler, xml);
            }
        }
示例#5
0
        public PatcherInterface()
        {
            InitializeComponent();

            handler = new PatchHandler(this);

            progressBar.Style   = ProgressBarStyle.Blocks;
            progressBar.Maximum = 100;

            try
            {
                Background.Load(PatchData.BackgroundURL);
            }
            catch { } /// Incase background can't load from url.
                      ///
            Main_Action();
        }
示例#6
0
        public PatcherInterface()
        {
            InitializeComponent();

            Main_action_btn.Enabled = false;
            Main_action_btn.Text    = "Please Wait..";

            handler = new PatchHandler(this);

            progressBar.Style   = ProgressBarStyle.Blocks;
            progressBar.Maximum = 100;

            try
            {
                Background.Load(PatchData.BackgroundURL);
                UpdateText.Text = handler.UpdateNotes();
            }
            catch { } /// Incase background can't load from url.
            UpdateText.SelectionStart = UpdateText.Text.Length;
            UpdateText.ScrollToCaret();
        }
示例#7
0
        internal static void PopulatePatchDirectories(PatchHandler handler)
        {
            try
            {
                for (int i = 0; i < PatchData.Versions.Count; i++)
                {
                    List <PatchFile> temp = PatchData.Versions[PatchData.Versions.Keys.ElementAt(i)];

                    for (int n = 0; n < temp.Count; n++)
                    {
                        string[] segments   = temp[n].filePath.Split('/');
                        int      tempLength = 0;

                        for (int z = 0; z < segments.Length - 1; z++)
                        {
                            tempLength += segments[z].Length;
                        }

                        string master = temp[n].filePath.Substring
                                            (0, tempLength + segments.Length - 1);

                        WebDirectory tempDir = new WebDirectory(master, handler);

                        tempDir.AddressIndex.Add(temp[n].filePath);
                        tempDir.NameIndex.Add(temp[n].fileName);

                        PatchData.PatchDirectories.Add(tempDir);
                    }
                }
            }

            catch (Exception e)
            {
                LogHandler.LogErrors(e.ToString());
            }
        }
示例#8
0
 public WebDirectory(string url, PatchHandler handler)
 {
     URL     = url;
     Handler = handler;
     CurrentDirectories++;
 }
示例#9
0
 internal static void LogErrors(string text, PatchHandler handler)
 {
     handler.UI.UpdatePatchNotes(text); LogErrors(text);
 }