Esempio n. 1
0
        private void Reset_Values_Button_Click(object sender, RoutedEventArgs e)
        {
            IsAtollExNew = true;
            Datos        = new List <AtollPillaLst>( );
            RowCt        = 2;
            DatOsCt      = 0;
            AirC         = new AirCom( );
            Atoll        = new Atoll
            {
                IsAtollExNew = true,
                Datos        = new List <AtollPillaLst>( ),
                DatOsCt      = 0,
                RowCt        = 2,
            };
            C4    = new Ce4( );
            CelC  = new CelCad( );
            CelP  = new CelPlan( );
            GeoP  = new GeoPlan( );
            GraN  = new Granet( );
            HodX  = new Hodiax( );
            HyD   = new Hydra( );
            LccN  = new LccNet( );
            NetP  = new NetPlan( );
            Ody   = new Odyssey( );
            PathL = new PathLoss( );
            Wiz   = new Wizard( );

            ConvertDep.ErrorLog   = new List <string>( );
            ConvertDep.SuccessLog = new List <string>( );
            CleanIngestDirectory( );
        }
Esempio n. 2
0
        protected void getAdmins_SelectedIndexChanged(object sender, EventArgs e)
        {
            string keydir = serverpath + "Handlers\\bf.kez";

            if (File.Exists(keydir))
            {
                StreamReader streamReader = new StreamReader(keydir, true);
                file_string = streamReader.ReadToEnd();
                streamReader.Close();
                if (file_string != null)
                {
                    string bitStrengthString = file_string.Substring(0, file_string.IndexOf("</BitStrength>") + 14);
                    file_string = file_string.Replace(bitStrengthString, "");
                }
            }
            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
            Odyssey ody = new Odyssey();

            this.ad = this.z.getAdminDetails(this.getAdmins.SelectedValue);
            this.edit_xname.Text           = this.ad.xname;
            this.edit_xpass.Text           = ody.DecryptString(this.ad.xpass, file_len, file_string);
            this.edit_xemail.Text          = ody.DecryptString(this.ad.xemail, file_len, file_string);
            this.edit_telephone1.Text      = this.ad.xtelephone1;
            this.edit_telephone2.Text      = this.ad.xtelephone2;
            this.edit_xrole.SelectedIndex  = Convert.ToInt16(this.ad.xroleID) - 1;
            this.edit_status.SelectedIndex = Convert.ToInt16(this.ad.xvisible);
            this.enable_EditTbl            = "1";
        }
Esempio n. 3
0
        protected void Save_Click(object sender, EventArgs e)
        {
            string keydir = serverpath + "\\Handlers\\bf.pke";

            if (File.Exists(keydir))
            {
                StreamReader streamReader = new StreamReader(keydir, true);
                file_string = streamReader.ReadToEnd();
                streamReader.Close();
                if (file_string != null)
                {
                    string bitStrengthString = file_string.Substring(0, file_string.IndexOf("</BitStrength>") + 14);
                    file_string = file_string.Replace(bitStrengthString, "");
                }
            }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
            Odyssey ody  = new Odyssey();
            string  pass = "******";

            this.regID = this.z.a_regadmin(this.xname.Text, this.xrole.SelectedValue, ody.EncryptString(this.xemail.Text, file_len, file_string), this.xtelephone1.Text, this.xtelephone2.Text, "tm", this.pwalletID, ody.EncryptString(pass, file_len, file_string));
            if (this.regID != "0")
            {
                this.x_add_tbl  = 0;
                this.x_add_succ = 1;
            }
        }
Esempio n. 4
0
    protected void Save_Click(object sender, EventArgs e)
    {
        if (xpassword.Text != "")
        {
            password_text = xpassword.Text;
        }
        Odyssey odyssey = new Odyssey();

        adminID  = z.a_xadminz(xemail.Text, xpassword.Text, serverpath);
        xadminID = z.getRoleByID(adminID);
        if (adminID != "0")
        {
            if (!(z.addAdminLog(adminID, RemoteIP, remote_host, remote_user, server_name, server_url) != ""))
            {
                Response.Redirect("../../login.aspx");
            }
            else
            {
                Session["pwalletID"] = adminID;
                string str3 = xadminID;
                if (str3 != null)
                {
                    if (!(str3 == "1"))
                    {
                        if (str3 == "2")
                        {
                            Response.Redirect("./verification_unit/profile.aspx");
                        }
                        else if (str3 == "3")
                        {
                            Response.Redirect("./search_unit/profile.aspx");
                        }
                        else if (str3 == "4")
                        {
                            Response.Redirect("./examiners_unit/profile.aspx");
                        }
                        else if (str3 == "5")
                        {
                            Response.Redirect("./acceptance_unit/profile.aspx");
                        }
                        else if (str3 == "8")
                        {
                            Response.Redirect("./examiners_unit2/profile.aspx");
                        }
                        else if (str3 == "6")
                        {
                            Response.Redirect("./registrar_unit/profile_index.aspx");
                        }
                    }
                    else
                    {
                        Response.Redirect("./x_unit/profile.aspx");
                    }
                }
            }
        }
    }
Esempio n. 5
0
        private void decompressFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                saveFileDialog.Filter = "Decompressed Data|*.dec|All files|*.*";
                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    using (Stream stream = new FileStream(openFileDialog.FileName, FileMode.Open, FileAccess.Read, FileShare.Read))
                    {
                        using (BinaryReader reader = new BinaryReader(stream))
                        {
                            if (Helpers.LocateRawDataIdentifier(reader).Length < 2)
                            {
                                MessageBox.Show("Operation failed.", "Failure");
                                return;
                            }

                            BeginMarquee();

                            long secondRawData = Helpers.LocateRawDataIdentifier(reader)[1];
                            reader.BaseStream.Seek(10, SeekOrigin.Current); // ignore everything until the compression byte
                            byte compression = reader.ReadByte();

                            bool success = false;

                            Helpers.DoBackgroundWork(() =>
                            {
                                if (secondRawData > 0)
                                {
                                    if (compression == 0x08)
                                    {
                                        success = Odyssey.ReadFile(openFileDialog.FileName, false, saveFileDialog.FileName);
                                    }
                                    else if (compression == 0x05)
                                    {
                                        success = Steep.ReadFile(openFileDialog.FileName, false, saveFileDialog.FileName);
                                    }
                                }
                            }, () =>
                            {
                                EndMarquee();
                                if (success)
                                {
                                    MessageBox.Show("Decompressed file successfully. Check the folder where the compressed file is located.", "Success");
                                }
                                else
                                {
                                    MessageBox.Show("Unknown compression type.", "Failure");
                                }
                            });
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        private void saveDecompressedDataAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeView.SelectedNode == null)
            {
                return;
            }

            EntryTreeNode node  = (EntryTreeNode)treeView.SelectedNode;
            Forge         forge = node.GetForge();
            string        text  = node.Text;

            byte[] decompressedData = null;

            BeginMarquee();

            Helpers.DoBackgroundWork(() =>
            {
                Forge.FileEntry entry = forge.GetFileEntry(text);
                byte[] rawData        = forge.GetRawData(entry);
                decompressedData      = Odyssey.ReadFile(rawData);
            }, () =>
            {
                EndMarquee();

                // failure
                if (decompressedData.Length == 0 || decompressedData == null)
                {
                    MessageBox.Show("Could not decompress data.", "Failure");
                    return;
                }

                saveFileDialog.FileName = string.Concat(node.Text, ".", Helpers.ExtensionForGame(node.Game));
                saveFileDialog.Filter   = $"{Helpers.NameOfGame(node.Game)} Data|*.{Helpers.ExtensionForGame(node.Game)}|All Files|*.*";
                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        File.WriteAllBytes(saveFileDialog.FileName, decompressedData);
                    }
                    catch (IOException ee)
                    {
                        Console.WriteLine(ee);
                    }
                    finally
                    {
                        MessageBox.Show("Done");
                    }
                }
            });
        }
Esempio n. 7
0
        private List <EntryTreeNode> PopulateEntry(EntryTreeNode node)
        {
            // extract the contents from the forge
            Forge forge = node.GetForge();

            byte[] data = forge.GetRawData(node.Offset, node.Size);

            // decompress
            string file = $"{node.Text}.{Helpers.ExtensionForGame(node.Game)}";

            if (node.Game == Game.ODYSSEY)
            {
                Helpers.WriteToFile(file, Odyssey.ReadFile(data), true);
            }
            else if (node.Game == Game.ORIGINS)
            {
                Helpers.WriteToFile(file, Odyssey.ReadFile(data), true);
            }
            else if (node.Game == Game.STEEP)
            {
                Helpers.WriteToFile(file, Steep.ReadFile(data), true);
            }

            // path will hold the file name
            node.Path = file;

            // get resource locations and create nodes
            List <EntryTreeNode> nodes = new List <EntryTreeNode>();

            using (Stream stream = new FileStream(Helpers.GetTempPath(file), FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    Helpers.ResourceLocation[] locations = Helpers.LocateResourceIdentifiers(reader);
                    foreach (Helpers.ResourceLocation location in locations)
                    {
                        nodes.Add(new EntryTreeNode {
                            Game         = node.Game,
                            Path         = file,
                            ResourceType = location.Type,
                            Text         = location.Type.ToString(),
                            Type         = EntryTreeNodeType.SUBENTRY
                        });
                    }
                }
            }

            return(nodes);
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.serverpath = base.Server.MapPath("~/");
            string keydir = serverpath + "Handlers\\bf.kez";

            if (File.Exists(keydir))
            {
                StreamReader streamReader = new StreamReader(keydir, true);
                file_string = streamReader.ReadToEnd();
                streamReader.Close();
                if (file_string != null)
                {
                    string bitStrengthString = file_string.Substring(0, file_string.IndexOf("</BitStrength>") + 14);
                    file_string = file_string.Replace(bitStrengthString, "");
                }
            }
            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
            Odyssey ody = new Odyssey();

            if (this.Session["pwalletID"] != null)
            {
                if (this.Session["pwalletID"].ToString() != "")
                {
                    this.admin = this.Session["pwalletID"].ToString();
                }
                else
                {
                    base.Response.Redirect("./xcontrol.aspx");
                }
            }
            else
            {
                base.Response.Redirect("./xcontrol.aspx");
            }
            if (!base.IsPostBack)
            {
                this.ad = this.z.getTopAdminDetails();
                this.edit_xname.Text           = this.ad.xname;
                this.edit_xpass.Text           = ody.DecryptString(this.ad.xpass, file_len, file_string);
                this.edit_xemail.Text          = ody.DecryptString(this.ad.xemail, file_len, file_string);
                this.edit_telephone1.Text      = this.ad.xtelephone1;
                this.edit_telephone2.Text      = this.ad.xtelephone2;
                this.edit_xrole.SelectedIndex  = Convert.ToInt16(this.ad.xroleID) - 1;
                this.edit_status.SelectedIndex = Convert.ToInt16(this.ad.xvisible);
            }
        }
Esempio n. 9
0
 private void HandleSubentryNode(EntryTreeNode node)
 {
     if (node.ResourceType == ResourceType.MESH) // meshes/models
     {
         if (node.Game == Game.ODYSSEY)
         {
             // to be implemented
         }
         else if (node.Game == Game.ORIGINS)
         {
             /*Origins.Submesh[] submeshes = Origins.ExtractModel(Helpers.GetTempPath(node.Path), node, () =>
              * {
              *  Console.WriteLine("EXTRACTED MODEL");
              * });
              * foreach (Origins.Submesh submesh in submeshes)
              * {
              *  gl.Meshes.Add(new DynamicMesh(submesh));
              * }*/
         }
         else if (node.Game == Game.STEEP)
         {
             // to be implemented
         }
     }
     else if (node.ResourceType == ResourceType.TEXTURE_MAP) // texture maps
     {
         if (node.Game == Game.ODYSSEY || node.Game == Game.ORIGINS)
         {
             Odyssey.ExtractTextureMap(Helpers.GetTempPath(node.Path), node, (string path) =>
             {
                 HandleTextureMap(path);
             });
         }
         else if (node.Game == Game.STEEP) // Needs string path too
         {
             Steep.ExtractTextureMap(Helpers.GetTempPath(node.Path), node, (string path) =>
             {
                 HandleTextureMap(path);
             });
         }
     }
 }
Esempio n. 10
0
        private void saveDecompressedDataAsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (treeView.SelectedNode == null)
            {
                return;
            }

            EntryTreeNode node  = (EntryTreeNode)treeView.SelectedNode;
            Forge         forge = node.Forge;
            string        text  = node.Text;

            byte[] decompressedData = null;

            BeginMarquee();

            Helpers.DoBackgroundWork(() =>
            {
                Forge.FileEntry entry = forge.GetFileEntry(text);
                byte[] rawData        = forge.GetRawData(entry);
                decompressedData      = Odyssey.ReadFile(rawData);
            }, () =>
            {
                EndMarquee();

                saveFileDialog.FileName = $"{node.Text}.dec";
                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        File.WriteAllBytes(saveFileDialog.FileName, decompressedData);
                    }
                    catch (IOException ee)
                    {
                        Console.WriteLine(ee);
                    }
                    finally
                    {
                        MessageBox.Show("Done");
                    }
                }
            });
        }
Esempio n. 11
0
        protected void EditSave_Click(object sender, EventArgs e)
        {
            string keydir = serverpath + "\\Handlers\\bf.pke";

            if (File.Exists(keydir))
            {
                StreamReader streamReader = new StreamReader(keydir, true);
                file_string = streamReader.ReadToEnd();
                streamReader.Close();
                if (file_string != null)
                {
                    string bitStrengthString = file_string.Substring(0, file_string.IndexOf("</BitStrength>") + 14);
                    file_string = file_string.Replace(bitStrengthString, "");
                }
            }
            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
            Odyssey ody = new Odyssey();

            if (this.z.e_regadmin(this.edit_xname.Text, ody.EncryptString(this.edit_xpass.Text, file_len, file_string), this.edit_xrole.SelectedValue, ody.EncryptString(this.edit_xemail.Text, file_len, file_string), this.edit_telephone1.Text, this.edit_telephone2.Text, "tm", this.pwalletID, this.getAdmins.SelectedValue, this.edit_status.SelectedValue) > 0)
            {
                this.x_edit_tbl  = 0;
                this.x_edit_succ = 1;
            }
        }
Esempio n. 12
0
        private void treeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node == null || e.Node.Tag == null)
            {
                return;
            }

            EntryTreeNode node   = (EntryTreeNode)e.Node;
            Forge         forge  = node.Forge;
            TreeNode      parent = (EntryTreeNode)node.Parent;
            string        text   = node.Text;
            string        tag    = (string)node.Tag;
            long          size   = node.Size;
            ResourceType  type   = node.ResourceType;

            // reset the picture box and rich text box
            // ToDo: empty 3D viewer
            pictureBox.ImageLocation = "";
            richTextBox.Text         = "";

            if (tag.Contains(".forge"))
            {
                if (text.EndsWith(".forge")) // forge file
                {
                    // dump resources used by currentForge
                    if (currentForge != null)
                    {
                        currentForge.Dump();
                    }

                    currentForge = new Forge(tag);
                    node.Forge   = currentForge;
                }
                else // forge entry/subentry
                {
                    // forge subentry
                    if (tag.Contains(FORGE_ENTRY_IDENTIFIER) && tag.Contains(FORGE_SUBENTRY_IDENTIFIER))
                    {
                        if (type == ResourceType.TEXTURE_MAP)
                        {
                            string parentText = Helpers.GetTempPath(parent.Text);
                            if (node.Game == Game.ODYSSEY || node.Game == Game.ORIGINS)
                            {
                                Odyssey.ExtractTextureMap(parentText, forge, () =>
                                {
                                    if (File.Exists($"{Helpers.GetTempPath(parent.Text)}.png"))
                                    {
                                        currentImgPath = $"{Helpers.GetTempPath(parent.Text)}.png";
                                    }
                                    else if (File.Exists($"{Helpers.GetTempPath(parent.Text)}_TopMip_0.png"))
                                    {
                                        currentImgPath = $"{Helpers.GetTempPath(parent.Text)}_TopMip_0.png";
                                    }

                                    Invoke(new Action(() =>
                                    {
                                        if (!string.IsNullOrEmpty(currentImgPath))
                                        {
                                            UpdatePictureBox(Image.FromFile(currentImgPath));
                                        }

                                        zoomDropDownButton.Text  = "Zoom Level: 100%";
                                        tabControl.SelectedIndex = 1;
                                    }));
                                });
                            }
                            else
                            {
                                Steep.ExtractTextureMap(parentText, forge, () =>
                                {
                                    if (File.Exists($"{Helpers.GetTempPath(parent.Text)}.png"))
                                    {
                                        currentImgPath = $"{Helpers.GetTempPath(parent.Text)}.png";
                                    }
                                    else if (File.Exists($"{Helpers.GetTempPath(parent.Text)}_Mip0.png"))
                                    {
                                        currentImgPath = $"{Helpers.GetTempPath(parent.Text)}_Mip0.png";
                                    }

                                    Invoke(new Action(() =>
                                    {
                                        if (!string.IsNullOrEmpty(currentImgPath))
                                        {
                                            UpdatePictureBox(Image.FromFile(currentImgPath));
                                        }

                                        zoomDropDownButton.Text  = "Zoom Level: 100%";
                                        tabControl.SelectedIndex = 1;
                                    }));
                                });
                            }
                        }
                    }
                }
            }
            else if (text.EndsWith(".png"))
            {
                pictureBox.Image = Image.FromFile(tag);
                pictureBox.Refresh();

                if (pictureBox.Image != null)
                {
                    imageDimensStatusLabel.Text = $"Dimensions: {pictureBox.Image.Width}x{pictureBox.Image.Height}";
                }

                tabControl.SelectedIndex = 1;
            }
            else if (text.EndsWith(".ini") || text.EndsWith(".txt") || text.EndsWith(".log"))
            {
                richTextBox.Text         = string.Join("\n", File.ReadAllLines(tag));
                tabControl.SelectedIndex = 2;
            }
            else if (text.EndsWith(".pck"))
            {
                SoundpackBrowser browser = new SoundpackBrowser();
                browser.LoadPack(tag);
                browser.Show();
            }

            // update path status label
            if (!tag.Contains(FORGE_ENTRY_IDENTIFIER))
            {
                pathStatusLabel.Text = tag;
            }

            // update size status label
            if (size > -1)
            {
                sizeStatusLabel.Text = $"Size: {Helpers.BytesToString(size)}";
            }
        }
Esempio n. 13
0
        private void treeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node == null || e.Node.Tag == null)
            {
                return;
            }

            EntryTreeNode node   = (EntryTreeNode)e.Node;
            TreeNode      parent = (EntryTreeNode)node.Parent;
            string        text   = node.Text;
            string        tag    = (string)node.Tag;
            long          size   = node.Size;
            ResourceType  type   = node.ResourceType;

            Console.WriteLine(tag);

            // reset the picture box and rich text box
            // ToDo: empty 3D viewer
            pictureBox.ImageLocation = "";
            richTextBox.Text         = "";

            // retrieve the file names the forge
            if (tag.Contains(".forge"))
            {
                if (text.EndsWith(".forge")) // forge file
                {
                    // dump resources used by currentForge
                    if (currentForge != null)
                    {
                        currentForge.Dump();
                    }

                    currentForge = new Forge(tag);
                }
                else // forge entry/subentry
                {
                    // forge subentry
                    if (tag.Contains(FORGE_ENTRY_IDENTIFIER) && tag.Contains(FORGE_SUBENTRY_IDENTIFIER))
                    {
                        /*if (type == ResourceType.MIPMAP)
                         * {
                         *  string parentText = Helpers.GetTempPath(parent.Text);
                         *  string dds = Odyssey.ExtractMipMap(parentText);
                         *  tabControl.SelectedIndex = 1;
                         *
                         *  //scene.DisplayTexture(dds);
                         * }
                         * else*/if (type == ResourceType.TEXTURE_MAP)
                        {
                            string parentText = Helpers.GetTempPath(parent.Text);
                            Odyssey.ExtractTextureMap(parentText, currentForge);
                        }
                        tabControl.SelectedIndex = 1;
                    }
                }
            }
            else if (node.Text.EndsWith(".png"))
            {
                pictureBox.ImageLocation = tag;
                tabControl.SelectedIndex = 1;
            }
            else if (node.Text.EndsWith(".ini") || node.Text.EndsWith(".txt"))
            {
                richTextBox.Text         = string.Join("\n", File.ReadAllLines(tag));
                tabControl.SelectedIndex = 2;
            }

            // update path status label
            pathStatusLabel.Text = tag;

            // update size status label
            if (size > -1)
            {
                sizeStatusLabel.Text = "Size: " + Helpers.BytesToString(size);
            }

            // update the status labels for the picture box
            if (pictureBox.Image != null)
            {
                imageDimensStatusLabel.Text = string.Format("Dimensions: {0}x{1}", pictureBox.Image.Width, pictureBox.Image.Height);
            }
        }
Esempio n. 14
0
        private void treeView_BeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            if (e.Node == null || e.Node.Tag == null)
            {
                return;
            }

            EntryTreeNode curNode = (EntryTreeNode)e.Node;
            string        text    = curNode.Text;
            string        tag     = (string)curNode.Tag;

            // a forge file
            if (tag.EndsWith(".forge"))
            {
                // dump resources used by currentForge
                if (currentForge != null)
                {
                    currentForge.Dump();
                }

                currentForge = new Forge(tag);

                Helpers.DoBackgroundWork(() =>
                {
                    currentForge.Read();
                }, () =>
                {
                    // show message if there are over 10000 files in the forge
                    if (currentForge.FileEntries.Length > 10000 && MessageBox.Show("This forge file contains more " +
                                                                                   "than 10000 entries (" + currentForge.FileEntries.Length + " exactly). Loading all these " +
                                                                                   "entries will take a while and Blacksmith will freeze.\n\nContinue?", "Large forge file!",
                                                                                   MessageBoxButtons.YesNo) != DialogResult.Yes)
                    {
                        return;
                    }

                    // delete the empty tree node
                    e.Node.Nodes.RemoveAt(0);

                    // show and update the progress bar
                    toolStripProgressBar.Visible = true;
                    toolStripProgressBar.Value   = 0;
                    toolStripProgressBar.Maximum = currentForge.FileEntries.Length;

                    // load entries into this forge's tree node
                    for (int i = 0; i < currentForge.FileEntries.Length; i++)
                    {
                        string name        = currentForge.FileEntries[i].NameTable.Name;
                        EntryTreeNode node = new EntryTreeNode
                        {
                            Text = name,
                            Tag  = string.Format("{0}{1}{2}", curNode.Tag, FORGE_ENTRY_IDENTIFIER, name), // set the tag of this file's tree node
                            Size = currentForge.FileEntries[i].IndexTable.RawDataSize
                        };
                        node.Nodes.Add(new EntryTreeNode()); // add empty node (for entry's contents)
                        curNode.Nodes.Add(node);
                        toolStripProgressBar.Value++;
                    }

                    // reset and hide the progress bar
                    toolStripProgressBar.Value   = toolStripProgressBar.Maximum = 0;
                    toolStripProgressBar.Visible = false;
                });
            }
            // forge entry
            else if (tag.Contains(FORGE_ENTRY_IDENTIFIER) && !tag.Contains(FORGE_SUBENTRY_IDENTIFIER))
            {
                // extract, if the entry has an empty node or if data as a file does not exist
                if (curNode.Nodes.Count == 1 && curNode.Nodes[0].Text == "" &&
                    !File.Exists(Helpers.GetTempPath(text)))
                {
                    BeginMarquee();

                    Helpers.DoBackgroundWork(() =>
                    {
                        Forge.FileEntry entry = currentForge.GetFileEntry(text);
                        byte[] rawData        = currentForge.GetRawData(entry);
                        Helpers.WriteToTempFile(text, rawData);

                        Odyssey.ReadFile(Helpers.GetTempPath(text));
                    }, () =>
                    {
                        EndMarquee();

                        // remove nodes
                        curNode.Nodes.Clear();

                        string combined = $"{Helpers.GetTempPath(text)}-combined";

                        // look for supported resource types
                        using (Stream stream = new FileStream(combined, FileMode.Open, FileAccess.Read, FileShare.Read))
                        {
                            using (BinaryReader reader = new BinaryReader(stream))
                            {
                                // create nodes based on located resource types
                                foreach (Helpers.ResourceLocation loc in Helpers.LocateResourceIdentifiers(reader))
                                {
                                    curNode.Nodes.Add(new EntryTreeNode
                                    {
                                        Text         = loc.Type.ToString(),
                                        Tag          = string.Format("{0}{1}{2}", tag, FORGE_SUBENTRY_IDENTIFIER, loc.Type.ToString()),
                                        ResourceType = loc.Type
                                    });
                                }
                            }
                        }
                    });
                }
            }
        }
Esempio n. 15
0
        private void treeView_BeforeExpand(object sender, TreeViewCancelEventArgs e)
        {
            if (e.Node == null || e.Node.Tag == null)
            {
                return;
            }

            EntryTreeNode node = (EntryTreeNode)e.Node;

            int   levels = LevelsDeep(node.FullPath);
            Forge forge  = levels == 1 ?
                           node.Forge :
                           levels == 2 ?
                           ((EntryTreeNode)node.Parent).Forge:
                           ((EntryTreeNode)node.Parent.Parent).Forge;

            Console.WriteLine(levels + " deep");

            string text = node.Text;
            string tag  = (string)node.Tag;

            if (string.IsNullOrEmpty(text))
            {
                return;
            }

            // a forge file
            if (tag.EndsWith(".forge"))
            {
                // dump resources used by currentForge
                if (currentForge != null)
                {
                    currentForge.Dump();
                }

                currentForge = new Forge(tag);

                Helpers.DoBackgroundWork(() =>
                {
                    currentForge.Read();
                }, () =>
                {
                    // show message if there are over 10000 files in the forge
                    if (forge.FileEntries.Length > 10000 && MessageBox.Show("This forge file contains more " +
                                                                            "than 10000 entries (" + forge.FileEntries.Length + " exactly). Loading all these " +
                                                                            "entries will take a while and Blacksmith will freeze.\n\nContinue?", "Large forge file!",
                                                                            MessageBoxButtons.YesNo) != DialogResult.Yes)
                    {
                        return;
                    }

                    // delete the empty tree node
                    e.Node.Nodes.RemoveAt(0);

                    // show and update the progress bar
                    toolStripProgressBar.Visible = true;
                    toolStripProgressBar.Value   = 0;
                    toolStripProgressBar.Maximum = forge.FileEntries.Length;

                    Helpers.DoBackgroundWork(() =>
                    {
                        // load entries into this forge's tree node
                        if (!forge.IsFullyRead())
                        {
                            return;
                        }

                        for (int i = 0; i < forge.FileEntries.Length; i++)
                        {
                            if (forge.FileEntries[i].NameTable == null)
                            {
                                continue;
                            }

                            string name     = forge.FileEntries[i].NameTable.Name;
                            EntryTreeNode n = new EntryTreeNode
                            {
                                Text   = name,
                                Forge  = forge,
                                Tag    = $"{node.Tag}{FORGE_ENTRY_IDENTIFIER}{name}", // set the tag of this file's tree node
                                Offset = forge.FileEntries[i].IndexTable.OffsetToRawDataTable,
                                Size   = forge.FileEntries[i].IndexTable.RawDataSize,
                                Game   = node.Game
                            };
                            n.Nodes.Add(new EntryTreeNode()); // add empty node (for entry's contents)
                            Invoke(new Action(() =>
                            {
                                if (this != null && toolStripProgressBar.Value < 3001) // I recieved an error stating that the progress bar cannot go above 3001
                                {
                                    node.Nodes.Add(n);
                                    toolStripProgressBar.Value++;
                                }
                            }));
                        }
                    }, () =>
                    {
                        // reset and hide the progress bar
                        toolStripProgressBar.Value   = toolStripProgressBar.Maximum = 0;
                        toolStripProgressBar.Visible = false;
                    });
                });
            }
            // forge entry
            else if (tag.Contains(FORGE_ENTRY_IDENTIFIER) && !tag.Contains(FORGE_SUBENTRY_IDENTIFIER))
            {
                // extract, if the entry has an empty node
                if (node.Nodes.Count == 1 && node.Nodes[0].Text == "")
                {
                    BeginMarquee();

                    Helpers.DoBackgroundWork(() =>
                    {
                        byte[] rawData = forge.GetRawData(node.Offset, (int)node.Size);
                        Helpers.WriteToFile($"{text}.ext", rawData, true);

                        if (node.Game == Game.ODYSSEY || node.Game == Game.ORIGINS) // temporary, until this Origins no longer works like Odyssey
                        {
                            Odyssey.ReadFile(Helpers.GetTempPath($"{text}.ext"));
                        }
                        else
                        {
                            Steep.ReadFile(Helpers.GetTempPath($"{text}.ext"));
                        }
                    }, () =>
                    {
                        EndMarquee();

                        // remove nodes
                        node.Nodes.Clear();

                        // look for supported resource types. steep stays out, for now (because it causes crashes).
                        string combined = $"{Helpers.GetTempPath(text)}.dec";
                        if (File.Exists(combined))
                        {
                            using (Stream stream = new FileStream(combined, FileMode.Open, FileAccess.Read, FileShare.Read))
                            {
                                using (BinaryReader reader = new BinaryReader(stream))
                                {
                                    // create nodes based on located resource types
                                    foreach (Helpers.ResourceLocation loc in Helpers.LocateResourceIdentifiers(reader))
                                    {
                                        node.Nodes.Add(new EntryTreeNode
                                        {
                                            Text         = loc.Type.ToString(),
                                            Tag          = $"{tag}{FORGE_SUBENTRY_IDENTIFIER}{loc.Type.ToString()}",
                                            ResourceType = loc.Type,
                                            Game         = node.Game
                                        });
                                    }
                                }
                            }
                        }
                    });
                }
            }
        }
Esempio n. 16
0
        protected void Save_Click(object sender, EventArgs e)
        {
            string keydir = serverpath + "\\Handlers\\bf.pke";

            if (File.Exists(keydir))
            {
                StreamReader streamReader = new StreamReader(keydir, true);
                file_string = streamReader.ReadToEnd();
                streamReader.Close();
                if (file_string != null)
                {
                    string bitStrengthString = file_string.Substring(0, file_string.IndexOf("</BitStrength>") + 14);
                    file_string = file_string.Replace(bitStrengthString, "");
                }
            }
            ///////////////////////////////////////////////////////////////////////////////////////////////////////////////

            if (this.xpassword.Text != "")
            {
                this.password_text = this.xpassword.Text;
            }
            Odyssey ody = new Odyssey();

            // this.adminID = this.z.a_xadminz(ody.EncryptString(this.xemail.Text, file_len, file_string), ody.EncryptString(this.xpassword.Text, file_len, file_string));
            this.adminID = this.z.a_xadminz(this.xemail.Text, this.xpassword.Text, serverpath);
            string str = this.z.getRoleByID(this.adminID);

            if (this.adminID != "0")
            {
                string succ = z.addAdminLog(str, RemoteIP, remote_host, remote_user, server_name, server_url);
                if (succ != "")
                {
                    Session["pwalletID"] = this.adminID;
                    switch (str)
                    {
                    case "1":
                        base.Response.Redirect("./x_unit/profile.aspx");
                        break;

                    case "2":
                        base.Response.Redirect("./agent_unit/profile.aspx");
                        break;

                    case "3":
                        base.Response.Redirect("./verification_unit/profile.aspx");
                        break;

                    case "4":
                        base.Response.Redirect("./search_unit/profile.aspx");
                        break;

                    case "5":
                        base.Response.Redirect("./examiners_unit/profile.aspx");
                        break;

                    case "6":
                        base.Response.Redirect("./acceptance_unit/profile.aspx");
                        break;

                    case "7":
                        base.Response.Redirect("./publication_unit/profile.aspx");
                        break;

                    case "8":
                        base.Response.Redirect("./opposition_unit/profile.aspx");
                        break;

                    case "9":
                        base.Response.Redirect("./certification_unit/profile.aspx");
                        break;

                    case "10":
                        base.Response.Redirect("./registrar_unit/profile_index.aspx");
                        return;

                    case "11":
                        base.Response.Redirect("./cash_unit/profile.aspx");
                        return;

                    case "12":
                        base.Response.Redirect("./search_unit2/profile.aspx");
                        return;

                    case "15":
                        base.Response.Redirect("./Appeal_Rejection/profile.aspx");
                        return;
                    }
                }
                else
                {
                    base.Response.Redirect("../../control.aspx");
                }
            }
        }
Esempio n. 17
0
 private void bcbc_BreadcrumbItemDropDownClosed(object sender, Odyssey.Controls.BreadcrumbItemEventArgs e) => this._ShellListView.IsFocusAllowed = true;
Esempio n. 18
0
 private void bcbc_BreadcrumbItemDropDownOpened(object sender, Odyssey.Controls.BreadcrumbItemEventArgs e) {
   this._ShellListView.IsFocusAllowed = false;
   this.bcbc.Focus();
 }
Esempio n. 19
0
 void bcbc_OnEditModeToggle(object sender, Odyssey.Controls.EditModeToggleEventArgs e) {
   this._ShellListView.IsFocusAllowed = e.IsExit;
   if (!e.IsExit) this.bcbc.Focus();
 }
Esempio n. 20
0
 /// <summary>
 /// A BreadcrumbItem needs to populate it's Items. This can be due to the fact that a new BreadcrumbItem is selected, and thus
 /// it's Items must be populated to determine whether this BreadcrumbItem show a dropdown button,
 /// or when the Path property of the BreadcrumbBar is changed and therefore the Breadcrumbs must be populated from the new path.
 /// </summary>
 private void BreadcrumbBar_PopulateItems(object sender, Odyssey.Controls.BreadcrumbItemEventArgs e)
 {
     BreadcrumbItem item = e.Item;
     if (item.Items.Count == 0)
     {
         PopulateFolders(item);
         e.Handled = true;
     }
 }