farzinmonsef / tk1

0 stars 0 forks source link

spinner #18

Open farzinmonsef opened 7 months ago

farzinmonsef commented 7 months ago

spinner

farzinmonsef commented 7 months ago

spinner

/====================================== Spinner =======================================================/

btnSpinnerOpenGlobal {

display: block;
margin: 20px auto;
padding: 10px 30px;
background-color: #eee;
border: solid #ccc 1px;
cursor: pointer;

}

btnSpinnerCloseGlobal {

float: right;

}

spinnerOverlayGlobal {

position: fixed;
left: 0;
top: 0;
z-index: 2000000;
width: 100%;
height: 100%;
display: none;
background: rgba(0,0,0,0.6);

}

.spinnerDivGlobal { height: 100%; display: flex; justify-content: center; align-items: center; }

.spinnerGlobal { width: 80px; height: 80px; border: 8px #ddd solid; border-top: 8px #007DB9 solid; border-radius: 50%; animation: sp-anime 0.9s infinite linear; }

@keyframes sp-anime { 100% { transform: rotate(360deg); } } /---------------------------------------------------------------------------------------------------/

@*
*@

//Spinner ====================================================================== function spinnerCloseGlobal() { $("#spinnerOverlayGlobal").fadeOut(300); } function spinnerOpenGlobal() { $("#spinnerOverlayGlobal").fadeIn(300); } //==============================================================================

farzinmonsef commented 6 months ago

Timeout

var idleTime = 0; var idleInterval = null; // #region LOGOUT INACTIVITY function timerIncrement() { idleTime = idleTime + 1; if (idleTime > 14) { // 15 minutes setSession('Authenticated', "false"); if (window.location.href.toLowerCase().indexOf('home') == -1) { setTimeout(window.location.href = "home", 2000); } else { setTimeout(loginmodalstart(), 2000); } } } // #end region LOGOUT INACTIVITY // #region LOGOUT INACTIVITY idleInterval = setInterval(timerIncrement, 60000); // 1 minute $(this).mousemove(function (e) { idleTime = 0; }); $(this).keypress(function (e) { idleTime = 0; }); // #end region LOGOUT INACTIVITY

farzinmonsef commented 6 months ago

Check File Content for File Extension

private void btnCheckFileClick(object sender, EventArgs e) { string dir = txtDir.Text; string fileRead_ = txtStartFileRead.Text; string fileName = txtDir.Text + "\" + txtStartFileRead.Text; string lastFileName = ""; string checkString = "@#$==============================="; string outputpath = txtDir.Text + "\" + "Check_Other_001.txt"; StreamWriter sw = File.AppendText(outputpath); bool findNewFile = true; using (StreamReader sr = File.OpenText(fileName)) { string s = String.Empty; while ((s = sr.ReadLine()) != null) { if(s.IndexOf(checkString) != -1) { lastFileName = s; findNewFile = false; } if (!findNewFile) { for (int i = 0; i < s.Length; i++) { int c = (int)s[i]; if ((c < 32) && (c != 9) && (c != 11) && (c != 13)) { sw.WriteLine(lastFileName); findNewFile = true; i = s.Length; } } } } } sw.Close(); }

string[] exceptionFiles = { ".dll", ".exe", ".pdb", ".suo", ".cache", ".idx", ".pack", ".wsuo", ".dtbcache", ".vsidx", ".lock",
    ".futdcache", ".bin", ".metadata", ".projects", ".dbmdl", ".database", ".nupkg",
    ".signature", "Thumbs.db", ".so", ".lib", ".dylib", ".zip",
    ".bmp", ".gif", ".png", ".ico", ".jpg", ".pfx", ".snk", ".ttf", ".woff2", ".pdf", ".ctf", ".db", ".swf", ".otf"   };
farzinmonsef commented 5 months ago

Good Spinner Samples

https://designmodo.com/css3-jquery-loading-animations/ https://projects.lukehaas.me/css-loaders/ https://www.jqueryscript.net/tags.php?/loading%20spinner/ https://www.jqueryscript.net/loading/circle-indicator-spinner.html https://hugeicons.com/icons https://dev.to/peboy/creating-an-animated-loading-spinner-with-pure-css-24h0 https://www.orioniconlibrary.com/all-icons https://codepen.io/Keyon/pen/PjEqgL https://cssloaders.github.io/ https://loading.io/css/ https://css-loaders.com/spinner/ https://flowbite.com/docs/components/spinner/ https://loading.io/ https://www.figma.com/community/file/1041612950980412711/loader-spinner-animation https://getbootstrap.com/docs/5.0/components/spinners/ https://blog.hubspot.com/website/css-loading-animation https://lottiefiles.com/free-animations/loading https://lottiefiles.com/free-animations/spinner https://stephanwagner.me/only-css-loading-spinner https://www.figma.com/community/file/1183111865001388870/loading-spinner-bars-animated https://10015.io/tools/css-loader-generator https://ionicframework.com/docs/api/spinner https://tobiasahlin.com/spinkit/ https://icons8.com/preloaders/ https://codepen.io/tag/spinner https://iconscout.com/lottie-animations/spinner-loading https://speckyboy.com/css-loading-spinner-snippets/ https://digitalsynopsis.com/design/loading-animations-preloader-gifs-ui-ux-effects/ https://www.svgator.com/css-loader https://kintone.dev/en/tutorials/miscellaneous/display-an-animated-loading-spinner/ https://dribbble.com/tags/loading-spinner# https://designmodo.com/free-preloaders-spinners/ https://spin.js.org/#! https://www.svgbackgrounds.com/elements/animated-svg-preloaders/ https://github.com/daattali/shinycssloaders https://mobiforge.com/design-development/how-to-build-an-animated-loading-spinner https://codemyui.com/tag/loading-animation/ https://pub.dev/packages/loading_animation_widget https://codeburst.io/how-to-create-a-simple-css-loading-spinner-make-it-accessible-e5c83c2e464c https://discuss.wxpython.org/t/loading-spinner-animation/35657/2 https://docs.fontawesome.com/web/style/animate https://codepen.io/ruffiem/pen/kabxMg
https://tailwindflex.com/tag/loading https://www.pinterest.com/pin/loading-animation--500321839865239529/ https://iconscout.com/lottie-animations/loading-circle https://medium.muz.li/top-30-most-captivating-preloaders-for-your-website-95ed1beff99d https://ilovepreloaders.tumblr.com/ https://codeburst.io/how-to-create-a-beautiful-animated-loader-with-nothing-but-css-d1962fc5a66c https://www.toptal.com/designers/product-design/how-to-create-custom-loading-animations-to-decrease-bounce-rates https://icons8.com/preloaders/ https://naldzgraphics.net/free-preloaders-and-spinners/ https://codepen.io/vineethtrv/pen/GJpxoQ https://www.shutterstock.com/video/search/spinner-loading?page=1

https://www.google.com/search?spinner+animation

https://docs.telerik.com/blazor-ui/components/grid/loading-animation

farzinmonsef commented 4 months ago

MouseMove

MouseMove.new.zip

farzinmonsef commented 4 months ago

MouseMove.cs

using System; using System.Collections.Generic; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Runtime.InteropServices;

namespace MouseMove { static public class myMouseMove {

static Random random = new Random();
static public int mouseSpeed = 15;

static public void MoveSlip(int slipX)
{
  Point c = new Point();
  GetCursorPos(out c);
  MoveMouse(c.X - slipX, c.Y, 0, 0);
  //MoveMouse(0, 0, 0, 0);
}

static void MoveMouse(int x, int y, int rx, int ry)
{
  Point c = new Point();
  GetCursorPos(out c);

  x += random.Next(rx);
  y += random.Next(ry);

  double randomSpeed = Math.Max((random.Next(mouseSpeed) / 2.0 + mouseSpeed) / 10.0, 0.1);

  WindMouse(c.X, c.Y, x, y, 9.0, 3.0, 10.0 / randomSpeed,
      15.0 / randomSpeed, 10.0 * randomSpeed, 10.0 * randomSpeed);
}

static void WindMouse(double xs, double ys, double xe, double ye,
    double gravity, double wind, double minWait, double maxWait,
    double maxStep, double targetArea)
{

  double dist, windX = 0, windY = 0, veloX = 0, veloY = 0, randomDist, veloMag, step;
  int oldX, oldY, newX = (int)Math.Round(xs), newY = (int)Math.Round(ys);

  double waitDiff = maxWait - minWait;
  double sqrt2 = Math.Sqrt(2.0);
  double sqrt3 = Math.Sqrt(3.0);
  double sqrt5 = Math.Sqrt(5.0);

  dist = Hypot(xe - xs, ye - ys);

  while (dist > 1.0)
  {

    wind = Math.Min(wind, dist);

    if (dist >= targetArea)
    {
      int w = random.Next((int)Math.Round(wind) * 2 + 1);
      windX = windX / sqrt3 + (w - wind) / sqrt5;
      windY = windY / sqrt3 + (w - wind) / sqrt5;
    }
    else
    {
      windX = windX / sqrt2;
      windY = windY / sqrt2;
      if (maxStep < 3)
        maxStep = random.Next(3) + 3.0;
      else
        maxStep = maxStep / sqrt5;
    }

    veloX += windX;
    veloY += windY;
    veloX = veloX + gravity * (xe - xs) / dist;
    veloY = veloY + gravity * (ye - ys) / dist;

    if (Hypot(veloX, veloY) > maxStep)
    {
      randomDist = maxStep / 2.0 + random.Next((int)Math.Round(maxStep) / 2);
      veloMag = Hypot(veloX, veloY);
      veloX = (veloX / veloMag) * randomDist;
      veloY = (veloY / veloMag) * randomDist;
    }

    oldX = (int)Math.Round(xs);
    oldY = (int)Math.Round(ys);
    xs += veloX;
    ys += veloY;
    dist = Hypot(xe - xs, ye - ys);
    newX = (int)Math.Round(xs);
    newY = (int)Math.Round(ys);

    if (oldX != newX || oldY != newY)
      SetCursorPos(newX, newY);

    step = Hypot(xs - oldX, ys - oldY);
    int wait = (int)Math.Round(waitDiff * (step / maxStep) + minWait);
    Thread.Sleep(wait);
  }

  int endX = (int)Math.Round(xe);
  int endY = (int)Math.Round(ye);
  if (endX != newX || endY != newY)
    SetCursorPos(endX, endY);
}

static double Hypot(double dx, double dy)
{
  return Math.Sqrt(dx * dx + dy * dy);
}

[DllImport("user32.dll")]
static extern bool SetCursorPos(int X, int Y);

[DllImport("user32.dll")]
public static extern bool GetCursorPos(out Point p);

} }

farzinmonsef commented 4 months ago

Form1.cs

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Timers; using System.Windows.Forms;

namespace MouseMove { public partial class Form1 : Form { public static System.Timers.Timer idleTimer; public static System.Timers.Timer autoMoveTimer; static int idleTimeToStartMove; static int idleCheckTimeToStartMove; static int timeForMouseMove; static int pixelToMouseMove;

static Boolean swDirection;
public Form1()
{
  InitializeComponent();
}
private void btnStart_Click(object sender, EventArgs e)
{
  initTimers();
}
private void AutoMouseMove(object source, ElapsedEventArgs e)
{
  swDirection = !swDirection;
  myMouseMove.MoveSlip(pixelToMouseMove * (swDirection ? 1 : -1));
}
private int convertInt(string buf)
{
  try
  { return Convert.ToInt16(buf); }
  catch (FormatException e)
  { return 0; }
}

private void getValues()
{
  var tmp = convertInt(txtIdleTimeToStartMove.Text);
  idleTimeToStartMove = tmp > 0 ? tmp : 30;
  tmp = convertInt(txtIdleCheckTimeToStartMove.Text);
  idleCheckTimeToStartMove = tmp > 0 ? tmp : 3;
  tmp = convertInt(txtTimeForMouseMove.Text);
  timeForMouseMove = tmp > 0 ? tmp : 5;
  tmp = convertInt(txtPixelToMouseMove.Text);
  pixelToMouseMove = tmp > 0 ? tmp : 5;
}
private void initTimers()
{
  getValues();

  idleTimer = new System.Timers.Timer(idleCheckTimeToStartMove * 1000);
  idleTimer.Elapsed += new ElapsedEventHandler(RunThis);
  idleTimer.AutoReset = true;
  idleTimer.Enabled = true;

  autoMoveTimer = new System.Timers.Timer(timeForMouseMove * 1000);
  autoMoveTimer.Elapsed += new ElapsedEventHandler(AutoMouseMove);
  autoMoveTimer.AutoReset = true;
  autoMoveTimer.Enabled = true;
}
private void RunThis(object source, ElapsedEventArgs e)
{
  //Console.WriteLine("Print this in every 10 seconds");
  //Console.WriteLine($"Current time: {DateTimeOffset.Now}");
  //Console.WriteLine($"Last input time: {InputTimer.GetLastInputTime()}");

  Console.WriteLine($"Idle time: {InputTimer.GetInputIdleTimeString()}");
  string[] s = InputTimer.GetInputIdleTimeString().Split(':');
  if ((Convert.ToInt16(s[0]) > 0) || (Convert.ToInt16(s[1]) > 0) || (Convert.ToInt16(s[2]) > idleTimeToStartMove))
  {
    autoMoveTimer.Start();
  }
  else
  {
    autoMoveTimer.Stop();
  }

}

private void btnReset_Click(object sender, EventArgs e)
{
  txtIdleTimeToStartMove.Text = "30";
  txtIdleCheckTimeToStartMove.Text = "3";
  txtTimeForMouseMove.Text = "5";
  txtPixelToMouseMove.Text = "5";
}

} }

farzinmonsef commented 4 months ago

InputTimer.cs

using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks;

namespace MouseMove { public static class InputTimer { public static TimeSpan GetInputIdleTime() { var plii = new NativeMethods.LastInputInfo(); plii.cbSize = (UInt32)Marshal.SizeOf(plii);

  if (NativeMethods.GetLastInputInfo(ref plii))
  {
    return TimeSpan.FromMilliseconds(Environment.TickCount - plii.dwTime);
  }
  else
  {
    throw new Win32Exception(Marshal.GetLastWin32Error());
  }
}
public static string GetInputIdleTimeString()
{
  TimeSpan t = GetInputIdleTime();
  return $"{t.Hours}:{t.Minutes}:{t.Seconds}";
  //if (t.Hours > 0) return $"{t.Hours}h:{t.Minutes}m:{t.Seconds}s";
  //else if (t.Minutes > 0) return $"{t.Minutes}m:{t.Seconds}s";
  //else if (t.Seconds > 0) return $"{t.Seconds}s:{t.Milliseconds}ms";
  //else return $"{t.Milliseconds}ms";
}

public static DateTimeOffset GetLastInputTime()
{
  return DateTimeOffset.Now.Subtract(GetInputIdleTime());
}

private static class NativeMethods
{
  public struct LastInputInfo
  {
    public UInt32 cbSize;
    public UInt32 dwTime;
  }

  [DllImport("user32.dll")]
  public static extern bool GetLastInputInfo(ref LastInputInfo plii);
}

} }

farzinmonsef commented 4 months ago

Program.cs

using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms;

namespace MouseMove { static class Program { ///

/// The main entry point for the application. /// [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } }

farzinmonsef commented 4 months ago

Exe

MouseMove - Copy.docx