mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-23 02:12:14 +00:00
Fix the file skimmer pins.
This commit is contained in:
parent
57277a01d6
commit
e131f72a9b
4 changed files with 97 additions and 8 deletions
|
@ -70,9 +70,9 @@ namespace ShiftOS.WinForms.Applications
|
|||
// lvitems
|
||||
//
|
||||
this.lvitems.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.lvitems.Location = new System.Drawing.Point(0, 0);
|
||||
this.lvitems.Location = new System.Drawing.Point(149, 0);
|
||||
this.lvitems.Name = "lvitems";
|
||||
this.lvitems.Size = new System.Drawing.Size(634, 332);
|
||||
this.lvitems.Size = new System.Drawing.Size(485, 332);
|
||||
this.lvitems.TabIndex = 0;
|
||||
this.lvitems.UseCompatibleStateImageBehavior = false;
|
||||
this.lvitems.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lvitems_ItemSelectionChanged);
|
||||
|
@ -81,8 +81,8 @@ namespace ShiftOS.WinForms.Applications
|
|||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.Controls.Add(this.pinnedItems);
|
||||
this.panel1.Controls.Add(this.lvitems);
|
||||
this.panel1.Controls.Add(this.pinnedItems);
|
||||
this.panel1.Controls.Add(this.lbcurrentfolder);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 24);
|
||||
|
@ -92,10 +92,12 @@ namespace ShiftOS.WinForms.Applications
|
|||
//
|
||||
// pinnedItems
|
||||
//
|
||||
this.pinnedItems.Location = new System.Drawing.Point(437, 208);
|
||||
this.pinnedItems.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.pinnedItems.Location = new System.Drawing.Point(0, 0);
|
||||
this.pinnedItems.Name = "pinnedItems";
|
||||
this.pinnedItems.Size = new System.Drawing.Size(197, 124);
|
||||
this.pinnedItems.Size = new System.Drawing.Size(149, 332);
|
||||
this.pinnedItems.TabIndex = 3;
|
||||
this.pinnedItems.Click += new System.EventHandler(this.pinnedItems_Click);
|
||||
//
|
||||
// lbcurrentfolder
|
||||
//
|
||||
|
|
|
@ -35,6 +35,7 @@ using System.Windows.Forms;
|
|||
|
||||
using static ShiftOS.Objects.ShiftFS.Utils;
|
||||
using ShiftOS.Engine;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
|
@ -128,8 +129,14 @@ namespace ShiftOS.WinForms.Applications
|
|||
{
|
||||
int amountsCalled = -1;
|
||||
amountsCalled = amountsCalled + 1;
|
||||
pinnedItems.Nodes.Add(path);
|
||||
pinnedItems.Nodes[amountsCalled].Nodes.Add("test");
|
||||
List<string> Pinned = new List<string>();
|
||||
if(FileExists(Paths.GetPath("data") + "/pinned_items.dat"))
|
||||
{
|
||||
Pinned = JsonConvert.DeserializeObject<List<string>>(ReadAllText(Paths.GetPath("data") + "/pinned_items.dat"));
|
||||
}
|
||||
Pinned.Add(path);
|
||||
WriteAllText(Paths.GetPath("data") + "/pinned_items.dat", JsonConvert.SerializeObject(Pinned));
|
||||
ResetList();
|
||||
}
|
||||
|
||||
public void ChangeDirectory(string path)
|
||||
|
@ -152,8 +159,40 @@ namespace ShiftOS.WinForms.Applications
|
|||
}
|
||||
}
|
||||
|
||||
public void PopulatePinned(TreeNode node, string[] items)
|
||||
{
|
||||
foreach(var dir in items)
|
||||
{
|
||||
var treenode = new TreeNode();
|
||||
if (DirectoryExists(dir))
|
||||
{
|
||||
var dinf = GetDirectoryInfo(dir);
|
||||
treenode.Text = dinf.Name;
|
||||
}
|
||||
else if (FileExists(dir))
|
||||
{
|
||||
var finf = GetFileInfo(dir);
|
||||
treenode.Text = finf.Name;
|
||||
}
|
||||
treenode.Tag = dir;
|
||||
node.Nodes.Add(treenode);
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetList()
|
||||
{
|
||||
pinnedItems.Nodes.Clear();
|
||||
List<string> Pinned = new List<string>();
|
||||
if(FileExists(Paths.GetPath("data") + "/pinned_items.dat"))
|
||||
{
|
||||
Pinned = JsonConvert.DeserializeObject<List<string>>(ReadAllText(Paths.GetPath("data") + "/pinned_items.dat"));
|
||||
}
|
||||
var node = new TreeNode();
|
||||
node.Text = "Pinned";
|
||||
PopulatePinned(node, Pinned.ToArray());
|
||||
pinnedItems.Nodes.Add(node);
|
||||
node.ExpandAll();
|
||||
|
||||
if(lvitems.LargeImageList == null)
|
||||
{
|
||||
lvitems.LargeImageList = new ImageList();
|
||||
|
@ -437,5 +476,26 @@ namespace ShiftOS.WinForms.Applications
|
|||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void pinnedItems_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (pinnedItems.SelectedNode != null)
|
||||
{
|
||||
string path = pinnedItems.SelectedNode.Tag.ToString();
|
||||
if (DirectoryExists(path))
|
||||
{
|
||||
currentdir = path;
|
||||
ResetList();
|
||||
}
|
||||
else if (FileExists(path))
|
||||
{
|
||||
FileSkimmerBackend.OpenFile(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1095,8 +1095,8 @@ namespace ShiftOS.WinForms.Applications
|
|||
{
|
||||
if(!string.IsNullOrWhiteSpace(OpponentGUID))
|
||||
ServerManager.Forward(OpponentGUID, "pong_mp_left", null);
|
||||
LeaveMatchmake();
|
||||
}
|
||||
LeaveMatchmake();
|
||||
ServerManager.MessageReceived -= this.ServerMessageReceivedHandler;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -53,6 +53,9 @@ namespace ShiftOS.Engine
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
[Command("set_acl")]
|
||||
[RequiresArgument("user")]
|
||||
[RequiresArgument("val")]
|
||||
|
@ -122,7 +125,31 @@ namespace ShiftOS.Engine
|
|||
[RequiresUpgrade("mud_fundamentals")]
|
||||
public static class UserManagementCommands
|
||||
{
|
||||
[Command("login", description = "Log in as another user.")]
|
||||
[RequiresArgument("user")]
|
||||
[RequiresArgument("pass")]
|
||||
public static bool Login(Dictionary<string, object> args)
|
||||
{
|
||||
string user = args["user"].ToString();
|
||||
string pass = args["pass"].ToString();
|
||||
|
||||
var usr = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == user);
|
||||
if(usr==null)
|
||||
{
|
||||
Console.WriteLine("Error: No such user.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (usr.Password != pass)
|
||||
{
|
||||
Console.WriteLine("Access denied.");
|
||||
return true;
|
||||
}
|
||||
|
||||
SaveSystem.CurrentUser = usr;
|
||||
Console.WriteLine("Access granted.");
|
||||
return true;
|
||||
}
|
||||
|
||||
[Command("setpass", description ="Allows you to set your password to a new value.", usage ="old:,new:")]
|
||||
[RequiresArgument("old")]
|
||||
|
|
Loading…
Reference in a new issue