Ejemplo n.º 1
0
        static public Area.StashInfo LookupStash(Area ws, string name, out bool ambiguous, bool expectNone = false)
        {
            var stashes = ws.FindStash(name);

            Area.StashInfo stash = null;
            if (stashes.Count == 1)
            {
                stash = stashes[0];
            }

            ambiguous = false;

            if (stashes.Count == 0 && !expectNone)
            {
                Printer.PrintMessage("#e#Error:## Couldn't find a stash matching a name/key/ID of \"{0}\".", name);
            }
            else if (stashes.Count > 1)
            {
                ambiguous = true;
                Printer.PrintMessage("#e#Error:## Ambiguous stash \"{0}\", could be:", name);
                foreach (var x in stashes)
                {
                    Printer.PrintMessage(" #b#{0}##: {5} - #q#{4}##\n    {1} - by {2} on #q#{3}##", x.Author + "-" + x.Key, string.IsNullOrEmpty(x.Name) ? "(no name)" : ("\"" + x.Name + "\""), x.Author, x.Time.ToLocalTime(), x.GUID, Versionr.Utilities.Misc.FormatSizeFriendly(x.File.Length));
                }
            }

            return(stash);
        }
Ejemplo n.º 2
0
        public void RecordStash(Area.StashInfo info)
        {
            SavedStash ss = new SavedStash();

            ss.Author    = info.Author;
            ss.Filename  = info.File.Name;
            ss.GUID      = info.GUID;
            ss.StashCode = info.Key;
            ss.Name      = info.Name;
            ss.Timestamp = info.Time;
            Insert(ss);
        }