Ejemplo n.º 1
0
        private static void RestoreDriverAccount()
        {
            string oldDriver = (string)StationRegistry.GetValue("olddriver", null);

            if (oldDriver != null)
            {
                StationRegistry.SetValue("driver", oldDriver);
            }
            StationRegistry.DeleteValue("olddriver");
        }
Ejemplo n.º 2
0
        private static void RestoreStationId()
        {
            string oldStationId = (string)StationRegistry.GetValue("oldStationId", null);

            if (oldStationId != null)
            {
                StationRegistry.SetValue("stationId", oldStationId);
            }
            StationRegistry.DeleteValue("oldStationId");
        }
Ejemplo n.º 3
0
        protected override void HandleRequest()
        {
            string path = Parameters["path"];

            if (path == null || !Path.IsPathRooted(path))
            {
                throw new FormatException("path is null or not a full path");
            }

            StationRegistry.SetValue("resourceBasePath", path);

            RespondSuccess();
        }
Ejemplo n.º 4
0
        public static ActionResult SetRegistry(Session session)
        {
            try
            {
                string        myPath = Assembly.GetExecutingAssembly().Location;
                Configuration config = ConfigurationManager.OpenExeConfiguration(myPath);

                StationRegistry.SetValue("cloudBaseURL", config.AppSettings.Settings["cloudBaseURL"].Value);
            }
            catch (Exception e)
            {
                Logger.Warn("Unable to set cloudBaseURL to registry", e);
            }

            return(ActionResult.Success);
        }
Ejemplo n.º 5
0
        private PublicPortMapping()
        {
            this.hasDriver = (Model.DriverCollection.Instance.FindOne() != null);

            TCMPortMapper.PortMapper.SharedInstance.DidChangeMappingStatus     += new PortMapper.PMDidChangeMappingStatus(PortMappingChanged);
            TCMPortMapper.PortMapper.SharedInstance.ExternalIPAddressDidChange += new PortMapper.PMExternalIPAddressDidChange(ExternalIPChanged);
            TCMPortMapper.PortMapper.SharedInstance.WillStartSearchForRouter   += new PortMapper.PMWillStartSearchForRouter(WillStartSearchForRouter);
            TCMPortMapper.PortMapper.SharedInstance.DidStartWork += new PortMapper.PMDidStartWork(DidStartWork);
            TCMPortMapper.PortMapper.SharedInstance.AllowMultithreadedCallbacks = true;
            TCMPortMapper.PortMapper.SharedInstance.Start();


            this.state = new NoUPnPDeviceFoundState();
            int checkIntervalSec = (int)StationRegistry.GetValue("UPnPCheckInterval", 120);

            this.checkTimer = new Timer(this.CheckState, null, 30 * 1000, checkIntervalSec * 1000);
        }
Ejemplo n.º 6
0
        private static void RemoveBackupData(string dumpFolder)
        {
            try
            {
                RemoveDirectory(dumpFolder);

                if (StationRegistry.GetValue("oldStationId", null) != null)
                {
                    StationRegistry.DeleteValue("oldStattionId");
                }
                if (StationRegistry.GetValue("olddriver", null) != null)
                {
                    StationRegistry.DeleteValue("olddriver");
                }
            }
            catch (Exception e)
            {
                Logger.Warn("Unable to clean up backup data", e);
            }
        }
Ejemplo n.º 7
0
        public static ActionResult CleanStationInfo(Session session)
        {
            string wavefaceDir = session["INSTALLLOCATION"];

            if (wavefaceDir == null)
            {
                return(ActionResult.Failure);
            }

            try
            {
                StationRegistry.DeleteValue("stationId");
            }
            catch (Exception e)
            {
                Logger.Warn("Unable to delete station id in registry", e);
            }

            try
            {
                StationRegistry.DeleteValue("driver");
            }
            catch (Exception e)
            {
                Logger.Warn("Unable to delete driver account in registry", e);
            }

            try
            {
                DriverCollection.Instance.RemoveAll();
            }
            catch (Exception e)
            {
                Logger.Warn("Unable to delete station driver from MongoDB", e);
            }

            try
            {
                StationCollection.Instance.RemoveAll();
            }
            catch (Exception e)
            {
                Logger.Warn("Unable to delete station info from MongoDB", e);
            }

            try
            {
                CloudStorageCollection.Instance.RemoveAll();
            }
            catch (Exception e)
            {
                Logger.Warn("Unable to delete cloud storage from MongoDB", e);
            }

            try
            {
                ServiceCollection.Instance.RemoveAll();
            }
            catch (Exception e)
            {
                Logger.Warn("Unable to delete service collection from MongoDB", e);
            }

            RemoveDirectory(Path.Combine(
                                Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                                "waveface"));

            RemoveDirectory(Path.Combine(
                                Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                "waveface"));

            return(ActionResult.Success);
        }