示例#1
0
        private static int Main(string[] args)
        {
            if (args.Length == 0)
            {
                return((int)ReturnValue.InvalidArgumentCode);
            }

            HelperTools.SetupEncoding();

            if (args.Length == 1 && string.Equals(args[0], @"/query", StringComparison.OrdinalIgnoreCase))
            {
                try
                {
                    var result = OculusManager.QueryOculusApps();
                    foreach (var app in result)
                    {
                        Console.WriteLine(HelperTools.ObjectToConsoleOutput(app));
                    }
                    return((int)ReturnValue.OkCode);
                }
                catch (IOException ex)
                {
                    LogWriter.WriteExceptionToLog(ex);
                    return(HelperTools.HandleHrefMessage(ex));
                }
            }
示例#2
0
        private static int Main(string[] args)
        {
            if (args.Length != 0)
            {
                return((int)ReturnValue.InvalidArgumentCode);
            }

            HelperTools.SetupEncoding();

            try
            {
                foreach (var result in ScriptManager.GetScripts())
                {
                    var converted = result.Select(x => new KeyValuePair <string, object>(x.Key, x.Value)).ToList();
                    Console.WriteLine(HelperTools.KeyValueListToConsoleOutput(converted));
                }

                return((int)ReturnValue.OkCode);
            }
            catch (IOException ex)
            {
                LogWriter.WriteExceptionToLog(ex);
                return(HelperTools.HandleHrefMessage(ex));
            }
            catch (Exception ex)
            {
                LogWriter.WriteExceptionToLog(ex);
                return((int)ReturnValue.FunctionFailedCode);
            }
        }
示例#3
0
        private static int Main(string[] args)
        {
            HelperTools.SetupEncoding();

            try
            {
                ProcessCommandlineArguments(args);

                switch (_queryType)
                {
                case QueryType.Uninstall:
                    Console.WriteLine("Uninstalling " + _appId);
                    var tweakEntry = Tweaks.GetEntry(_appId);
                    if (tweakEntry == null)
                    {
                        throw new ArgumentException("Could not find a tweak with this name to uninstall");
                    }
                    tweakEntry.OnUninstall(true);
                    break;

                case QueryType.List:
                    foreach (var result in Tweaks.GetConsoleOutput())
                    {
                        var converted = result.Select(x => new KeyValuePair <string, object>(x.Key, x.Value)).ToList();
                        Console.WriteLine(HelperTools.KeyValueListToConsoleOutput(converted));
                    }
                    break;

                default:
                    Console.WriteLine("Accepted commands:\nlist\nuninstall <id>");
                    break;
                }
            }
            catch (OperationCanceledException)
            {
                return((int)ReturnValue.CancelledByUserCode);
            }
            catch (FormatException ex)
            {
                LogWriter.WriteExceptionToLog(ex);
                return((int)ReturnValue.InvalidArgumentCode);
            }
            catch (Exception ex)
            {
                LogWriter.WriteExceptionToLog(ex);
                return((int)ReturnValue.UnexpectedNetworkErrorCode);
            }
            return((int)ReturnValue.OkCode);
        }