Ejemplo n.º 1
0
 static void HandleNewItem(string path)
 {
     ipfs = new IPFSManager(pathExecutable);
     ipfs.TryInit();
     ipfs.TryStartDaemon();
     ipfs.CopyPathToClipboard(ipfs.AddElement(path));
 }
        static void HandleNewItem(string path)
        {
            ipfs = new IPFSManager(pathExecutable);
            ipfs.TryInit();
            ipfs.TryStartDaemon();

            string hash = ipfs.AddElement(path, makeHardLink, linkOnly);

            if (!ipfs.HasWaiters())
            {
                if (!ipfs.HasWaited)
                {
                    if (hash == null)
                    {
                        ipfs.ShowNotification("Uh-oh, something went wrong with creating the hash!", System.Drawing.SystemIcons.Application, System.Windows.Forms.ToolTipIcon.Warning, 5000);
                    }
                    else if (!hash.Equals("unshared"))
                    {
                        if (hash != null && !hash.Equals(""))
                        {
                            ipfs.CopyPathToClipboard(hash);
                        }
                        else
                        {
                            ipfs.ShowNotification("Uh-oh, something went wrong!", System.Drawing.SystemIcons.Application, System.Windows.Forms.ToolTipIcon.Warning, 5000);
                        }
                    }
                    else
                    {
                        ipfs.ShowNotification("File unshared!", System.Drawing.SystemIcons.Information, System.Windows.Forms.ToolTipIcon.Info, 5000);
                    }
                }
                else
                {
                    ipfs.ShowNotification("Multiple Files Shared!", System.Drawing.SystemIcons.Information, System.Windows.Forms.ToolTipIcon.Info, 5000);
                }
            }
        }