Пример #1
0
        public void should_return_file_version()
        {
            var          version = versionChecker.Check("C:\\Program Files\\Internet Explorer\\iexplore.exe");
            const string pattern = @"(\d+\.){3}\d+";

            Assert.That(Regex.Match(version, pattern).Success, Is.True);
        }
Пример #2
0
        public static void Patch()
        {
            try
            {
                QuickLogger.Info($"Started patching. Version: {QuickLogger.GetAssemblyVersion(Assembly.GetExecutingAssembly())}");

#if DEBUG
                QuickLogger.DebugLogsEnabled = true;
                QuickLogger.Debug("Debug logs enabled");
#endif

                GlobalBundle = FcAssetBundlesService.PublicAPI.GetAssetBundleByName(FcAssetBundlesService.PublicAPI.GlobalBundleName);

                Configuration = Mod.LoadConfiguration();

                OptionsPanelHandler.RegisterModOptions(new Options());

                AddTechFabricatorItems();

                var harmony = HarmonyInstance.Create("com.hydroponicharvestor.fcstudios");
                harmony.PatchAll(Assembly.GetExecutingAssembly());

                VersionChecker.Check <ModConfiguration>("https://github.com/ccgould/FCStudios_SubnauticaMods/raw/master/FCS_HydroponicHarvesters/mod.json");

                QuickLogger.Info("Finished patching");
            }
            catch (Exception ex)
            {
                QuickLogger.Error(ex);
            }
        }
Пример #3
0
        public override void Logon(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.authentication.LogonRequest request, Action <bnet.protocol.NoData> done)
        {
            Logger.Trace("LogonRequest(): Email={0}", request.Email);

            if (!VersionChecker.Check(this.Client, request)) // if the client trying to connect doesn't match required version, disconnect him.
            {
                Logger.Error("Client [{0}] doesn't match required version {1}, disconnecting..", request.Email, VersionInfo.MooNet.RequiredClientVersion);

                // create the disconnection reason.
                var reason = bnet.protocol.connection.DisconnectNotification.CreateBuilder()
                             .SetErrorCode(3018).Build();

                // Error 3018 => A new patch for Diablo III is available. The game will now close and apply the patch automatically. You will be able to continue playing after the patch has been applied.

                // FIXME: D3 client somehow doesn't show the correct error message yet, and in debug output we only miss a message like [ Recv ] service_id: 254 token: 6 status: 28
                // when I compare mooege's output. That could be the reason. /raist.

                // force disconnect the client as it does not satisfy required version. /raist.
                this.Client.MakeRPC(() => bnet.protocol.connection.ConnectionService.CreateStub(this.Client).ForceDisconnect(null, reason, callback => { }));
                this.Client.Connection.Disconnect();

                return;
            }

            done(bnet.protocol.NoData.CreateBuilder().Build());

            AuthManager.StartAuthentication(this.Client, request);
        }
 public void OnLoaded()
 {
     if (loaded)
     {
         return;
     }
     loaded = true;
     versionChecker.Check();
 }
        public static void Initialise()
        {
            Config.Load();
            OptionsPanelHandler.RegisterModOptions(new Options());

            VersionChecker.Check <ModJson>(
                "https://github.com/tobeyStraitjacket/Straitjacket.Subnautica.Mods.CustomTunes/raw/master/CustomTunes/mod.json",
                displayName: "CustomTunes ♫"
                );
        }
Пример #6
0
        public override void Logon(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.authentication.LogonRequest request, Action <bnet.protocol.NoData> done)
        {
            Logger.Trace("LogonRequest(): Email={0}", request.Email);

            if (!VersionChecker.Check(this.Client, request)) // if the client trying to connect doesn't match required version, disconnect him.
            {
                Logger.Error("Client [{0}] doesn't match required version {1}, disconnecting..", request.Email, VersionInfo.MooNet.RequiredClientVersion);
                this.Client.Connection.Disconnect(); // TODO: We should be actually notifying the client with wrong version message. /raist.
                return;
            }

            done(bnet.protocol.NoData.CreateBuilder().Build());

            AuthManager.StartAuthentication(this.Client, request);
        }
Пример #7
0
        public override void Logon(Google.ProtocolBuffers.IRpcController controller, bnet.protocol.authentication.LogonRequest request, Action <bnet.protocol.authentication.LogonResponse> done)
        {
            Logger.Trace("LogonRequest(): Email={0}", request.Email);

            if (!VersionChecker.Check(this.Client, request)) // if the client trying to connect doesn't match required version, disconnect him.
            {
                Logger.Error("Client [{0}] doesn't match required version {1}, disconnecting..", request.Email, VersionInfo.MooNet.RequiredClientVersion);
                this.Client.Connection.Disconnect(); // TODO: We should be actually notifying the client with wrong version message. /raist.
                return;
            }

            AuthManager.StartAuthentication(this.Client, request);

            var authenticationThread = new Thread(() =>
            {
                this.Client.AuthenticationCompleteSignal.WaitOne(); // wait the signal;

                if (this.Client.AuthenticationErrorCode != AuthManager.AuthenticationErrorCodes.None)
                {
                    Logger.Info("Authentication failed for {0} because of invalid credentals.", request.Email);
                    done(bnet.protocol.authentication.LogonResponse.DefaultInstance);
                    return;
                }

                Logger.Info("User {0} authenticated successfuly.", request.Email);
                var logonResponseBuilder = bnet.protocol.authentication.LogonResponse.CreateBuilder()
                                           .SetAccount(this.Client.Account.BnetEntityId);

                foreach (var gameAccount in this.Client.Account.GameAccounts.Values)
                {
                    logonResponseBuilder.AddGameAccount(gameAccount.BnetEntityId);
                }

                done(logonResponseBuilder.Build());

                this.Client.EnableEncryption();

                PlayerManager.PlayerConnected(this.Client);
            })
            {
                IsBackground = true, CurrentCulture = CultureInfo.InvariantCulture
            };;

            authenticationThread.Start();
        }
Пример #8
0
 public static void CheckVersion(Dispatcher dispatcher)
 {
     try {
         if (VersionChecker.NeedToCheck())
         {
             VersionChecker checker = new VersionChecker();
             checker.Check((version, error) => {
                 if (error == null && version != null && DialogAbout.CurrentVersion() < version)
                 {
                     dispatcher.BeginInvoke(
                         new Action(() => DialogAbout.ShowNewVersionAvailable(version)),
                         DispatcherPriority.ApplicationIdle
                         );
                 }
             });
         }
     } catch (Exception exception) {
         App.Mainframe.ReportException(exception);
     }
 }
Пример #9
0
    void Awake()
    {
        var domainLogic = FindObjectOfType <DomainLogic>();

        if (domainLogic != null)
        {
            Destroy(domainLogic.gameObject);
        }

        GameObject go;
        var        settings = FindObjectOfType <HiddenSettings>();

        if (settings == null)
        {
            go       = Instantiate(HiddenSettingsPrefab, new Vector3(0, 0, 0), Quaternion.identity);
            settings = go.GetComponent <HiddenSettings>();
        }

        var prefabBank = FindObjectOfType <PrefabBank>();

        if (prefabBank == null)
        {
            go         = Instantiate(settings.PrefabBankPrefab, new Vector3(0, 0, 0), Quaternion.identity);
            prefabBank = go.GetComponent <PrefabBank>();
        }

        _game = FindObjectOfType <Game>();
        if (_game == null)
        {
            go    = Instantiate(prefabBank.GamePrefab, new Vector3(0, 0, 0), Quaternion.identity);
            _game = go.GetComponent <Game>();
        }

        if (FindObjectOfType <Timer>() == null)
        {
            go = Instantiate(prefabBank.TimerPrefab, new Vector3(0, 0, 0), Quaternion.identity);
        }

        if (FindObjectOfType <MusicManager>() == null)
        {
            go = Instantiate(prefabBank.MusicManagerPrefab, new Vector3(0, 0, 0), Quaternion.identity);
            MusicManager._.Init();
        }

        if (IsThisTheLoadingScene == false)
        {
            if (_game.LevelController == null)
            {
                _game.LevelController = LevelController;
            }

            var player = FindObjectOfType <Player>();
            if (player == null)
            {
                Debug.LogError("No Player");
            }
            else
            {
                if (_game.Player == null)
                {
                    _game.Player = player;
                }
            }
        }
        go = null;

#if UNITY_EDITOR
        VersionChecker versionChecker = gameObject.AddComponent <VersionChecker>();
        versionChecker.Check();
#endif
    }
 private void OnUpdateCheck()
 {
     versionChecker.Check();
     SendPropertyChanged("UpdateCheckCommand");
 }
Пример #11
0
 public static void ApplyPatches()
 {
     VersionChecker.Check <ModJson>(
         "https://github.com/tobeyStraitjacket/VersionChecker/raw/master/VersionChecker/mod.json"
         );
 }
Пример #12
0
    IEnumerator FirstCheck()
    {
        yield return(new WaitForSeconds(0.1f));

        var domainLogic = FindObjectOfType <DomainLogic>();

        if (domainLogic != null)
        {
            Destroy(domainLogic.gameObject);
        }

        GameObject go;
        var        settings = FindObjectOfType <HiddenSettings>();

        if (settings == null)
        {
            go       = Instantiate(HiddenSettingsPrefab, new Vector3(0, 0, 0), Quaternion.identity);
            settings = go.GetComponent <HiddenSettings>();
            settings.ActualScreenSize = new Vector2Int(CameraResolution._.ScreenSizeX, CameraResolution._.ScreenSizeY);
        }

        var prefabBank = FindObjectOfType <PrefabBank>();

        if (prefabBank == null)
        {
            go         = Instantiate(settings.PrefabBankPrefab, new Vector3(0, 0, 0), Quaternion.identity);
            prefabBank = go.GetComponent <PrefabBank>();
        }

        _game = FindObjectOfType <Game>();
        if (_game == null)
        {
            go    = Instantiate(prefabBank.GamePrefab, new Vector3(0, 0, 0), Quaternion.identity);
            _game = go.GetComponent <Game>();
        }

        if (FindObjectOfType <Timer>() == null)
        {
            go = Instantiate(prefabBank.TimerPrefab, new Vector3(0, 0, 0), Quaternion.identity);
        }

        if (FindObjectOfType <MusicManager>() == null)
        {
            go = Instantiate(prefabBank.MusicManagerPrefab, new Vector3(0, 0, 0), Quaternion.identity);
            MusicManager._.Init();
        }

        if (FindObjectOfType <ColorBank>() == null)
        {
            go = Instantiate(prefabBank.ColorBankPrefab, new Vector3(0, 0, 0), Quaternion.identity);
            ColorBank._.CalculateColors();
        }

        if (_game.LevelController == null)
        {
            _game.LevelController = LevelController;
        }

        Debug.Log("_game.AfterLoading: " + _game.AfterLoading);

        if (_game.AfterLoading == AfterLoading.GoToGame || _game.AfterLoading == AfterLoading.Nothing)
        {
            var player = FindObjectOfType <Player>();
            if (player == null)
            {
                Debug.LogError("No Player");
            }
            else
            {
                if (_game.Player == null)
                {
                    _game.Player = player;
                }
            }
        }
        go = null;

#if UNITY_EDITOR
        VersionChecker versionChecker = gameObject.AddComponent <VersionChecker>();
        versionChecker.Check();
        Destroy(gameObject.GetComponent <VersionChecker>());
#endif

        _afterCheck = AfterCheck();
        StartCoroutine(_afterCheck);
    }
Пример #13
0
 protected virtual void CheckConcurrency()
 {
     VersionChecker.Check(ModelObject, DbEntity);
 }
Пример #14
0
        static void Main(string[] args)
        {
            if (Utilities.IsWindowsPlatform())
            {
                Console.Title = "NzbLiteClient v" + Utilities.CurrentVersion().ToString();
            }
            if (args == null || args.Length == 0)
            {
                Console.WriteLine(" _   _     _     _      _ _        _____ _ _            _   ");
                Console.WriteLine("| \\ | |   | |   | |    (_) |      / ____| (_)          | |  ");
                Console.WriteLine("|  \\| |___| |__ | |     _| |_ ___| |    | |_  ___ _ __ | |_ ");
                Console.WriteLine("| . ` |_  / '_ \\| |    | | __/ _ \\ |    | | |/ _ \\ '_ \\| __|");
                Console.WriteLine("| |\\  |/ /| |_) | |____| | ||  __/ |____| | |  __/ | | | |_ ");
                Console.WriteLine("|_| \\_/___|_.__/|______|_|\\__\\___|\\_____|_|_|\\___|_| |_|\\__| (v" + Utilities.CurrentVersion().ToString() + ")");
            }
            Utilities.EnsureDirectories();
            Utilities.InitiateSSLTrust();
            Logger.SetLog4NetConfiguration();
            Console.WriteLine(SEP);
            bool isInitOk = Init();

            Console.WriteLine(SEP);
            if (isInitOk == false)
            {
                return;
            }
            if (args == null || args.Length == 0)
            {
                if (VersionChecker.Check() == true)
                {
                    if (Utilities.IsWindowsPlatform())
                    {
                        Console.Title += " - NEW VERSION AVAILABLE !";
                    }
                }
                Menu();
                Console.ReadLine();
                Process.GetCurrentProcess().Kill();
            }
            else
            {
                string cmd       = args[0];
                string param     = string.Empty;
                string outputDir = Utilities.FolderDownload;
                if (args.Length > 1)
                {
                    param = args[1];
                }
                if (args.Length > 2)
                {
                    if (Directory.Exists(args[2]))
                    {
                        outputDir = args[2];
                    }
                    else
                    {
                        Logger.Error(LOGNAME, "Invalid output directory", null);
                        return;
                    }
                }
                switch (cmd.ToLower())
                {
                case "-b":
                    ModeBackup();
                    break;

                case "-r":
                    if (Settings.Settings.Current.Folders == null)
                    {
                        Logger.Error(LOGNAME, "You have to define at least 1 SettingFolder", null);
                        return;
                    }
                    SettingFolder sf = null;
                    for (int i = 0; i < Settings.Settings.Current.Folders.Count; i++)
                    {
                        if (Settings.Settings.Current.Folders[i].Path == param)
                        {
                            sf = Settings.Settings.Current.Folders[i];
                            break;
                        }
                    }
                    ModeRestore(sf);
                    break;

                case "-u":
                    ModeUpload(param, Crypto.EncryptionMode.NONE, outputDir);
                    break;

                case "-d":
                    ModeDownload(param, outputDir);
                    break;

                case "-s":
                    ModeSync();
                    break;

                case "-c":
                    ModeConvert(param, outputDir);
                    break;

                default:
                    Logger.Error(LOGNAME, "Invalid commandline", null);
                    break;
                }
            }
        }