예제 #1
0
 /// <summary>
 /// get assembly info
 /// </summary>
 /// <returns></returns>
 public static AssemblyValues GetEntryAssemblyInfo()
 {
     var assembly = Assembly.GetEntryAssembly();
     var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
     var v = Version.Parse(fvi.FileVersion);
     var ret = new AssemblyValues() { CurrentVersion = v, AppName = fvi.FileDescription, RepoName = fvi.InternalName.Substring(0, fvi.InternalName.IndexOf(".", StringComparison.Ordinal)) };
     return ret;
 }
예제 #2
0
        /// <summary>
        /// get assembly info
        /// </summary>
        /// <returns></returns>
        public static AssemblyValues GetEntryAssemblyInfo()
        {
            var assembly = Assembly.GetEntryAssembly();
            var fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
            var v        = Version.Parse(fvi.FileVersion);
            var ret      = new AssemblyValues()
            {
                CurrentVersion = v, AppName = fvi.FileDescription, RepoName = fvi.InternalName.Substring(0, fvi.InternalName.IndexOf(".", StringComparison.Ordinal))
            };

            return(ret);
        }
예제 #3
0
        public static async Task Run(string[] args)
        {
            v = AssemblyExtras.GetCallingAssemblyInfo();
            var n = v.GetAppString();
            Console.Title = n;

            hWnd = FindWindow(null, n); //put your console window caption here
            ShowWindow(hWnd, (int)Controller.Operation.Hide);

            if (args.Length < 2 || args.Length > 4 || (args.Length == 1 && args[0].Equals("/?")))
            {
                printInstructions(true);
                await Licensing.UpdateConsole(HelpString, OtherText);
                KeyboardAndClose();
            }
            else
            {

                int num = 0;
                String path = "";
                var op = Operation.None;

                bool quote = false;
                foreach (var s in args)
                {
                    if (num == 0)
                    {
                        path = s;
                        var count = path.Count(ss => ss == '\"');
                        if (count == 1)
                            quote = true;
                    }
                    else
                    {
                        if (quote)
                        {
                            path += s;
                            if (path.Contains("\""))
                                quote = false;
                            continue;
                        }

                        var sl = s.ToLower();

                        switch (sl)
                        {
                            case "/min":
                                op = Operation.Min;
                                break;

                            case "/max":
                                op = Operation.Max;
                                break;

                            case "/normal":
                                op = Operation.Normal;
                                break;

                            case "/close":
                                op = Operation.Close;
                                break;
                        }
                    }

                    num++;
                }

                if (path.Length == 0)
                {
                    printErrorMessage("No Path Supplied");
                }
                if (op == Operation.None)
                {
                    printErrorMessage("Provide either min or max flag");
                }
                //get file to run
                //String sss = "start " + '"' + path + '"';
                String sss = " " + path;
                var proc = ExecuteCommandSync(sss);
                bool performed = false;
                const int maxtimeouts = 10000;
                int timeout = 0;
                const int timeoutinterval = 1000;

                //Thread.Sleep(4000);

                while (performed == false)
                {
                    if (op == Operation.Close)
                    {
                        CloseWindow(proc.MainWindowHandle);
                        performed = true;
                        continue;
                    }
                    //min
                    var a = ShowWindow(proc.MainWindowHandle, (int)Operation.Min);
                    // Console.WriteLine("a="+a.ToString());
                    //max
                    var b = ShowWindow(proc.MainWindowHandle, (int)Operation.Max);
                    //Console.WriteLine("b=" + b.ToString());
                    //then perform user sizing
                    var c = ShowWindow(proc.MainWindowHandle, (int)op);
                    //Console.WriteLine("c=" + c.ToString());

                    if (c)
                        performed = true;
                    Thread.Sleep(timeoutinterval);
                    timeout += timeoutinterval;
                    if (timeout >= maxtimeouts)
                        return;
                }
            }

        }