Beispiel #1
0
 public LoginForm(GenericHandler postLoginProc)
 {
     this.m_postLoginProc = postLoginProc;
     base.SuspendLayout();
     this.InitializeComponent();
     this.lbTitle.set_Text(EntryAssembly.GetTitle());
     this.set_Text(this.lbTitle.get_Text());
     if (ApplicationDeployment.get_IsNetworkDeployed())
     {
         this.lbVersion.set_Text("Версия " + ApplicationDeployment.CurrentDeployment.CurrentVersion);
         string configuration = EntryAssembly.GetConfiguration();
         if (!string.IsNullOrEmpty(configuration))
         {
             this.lbVersion.set_Text(this.lbVersion.get_Text() + string.Format(" ({0})", configuration));
         }
     }
     else
     {
         this.lbVersion.set_Text("Версия " + System.Windows.Forms.Application.get_ProductVersion());
     }
     this.lbCopyright.set_Text(EntryAssembly.GetCopyright());
     this.cbSSPI.set_Checked(Settings.Default.LoginFormIntegratedSecurity);
     this.tsDatabase.set_DropDownDirection(System.Windows.Forms.ToolStripDropDownDirection.BelowRight);
     this.RefreshConnectionsList();
     base.ResumeLayout();
 }
        public void performTokenExchangeTest()
        {
            GenericHandler handler = new GenericHandler("D15D6347-E3D6-4BB4-7B5632F470EBC751", "21B00A88-E976-66F2-88EA7F78281AFAE2", "10.0.2.124", "16448");
            bool           pass    = handler.performTokenExchange().Result;

            Assert.Fail();
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            UnityContainer container = new UnityContainer();

            container.EnableDebugDiagnostic();

            //container.RegisterType<INotificationHandler<INotification>, GenericHandler>("GenericHandler");
            container.RegisterType(typeof(INotificationHandler <>), typeof(GenericHandler), "GenericHandler");
            container.RegisterType <INotificationHandler <MyNotification>, MyNotificationHandler>("MyNotificationHandler");

            INotificationHandler <INotification>  genericHandler = new GenericHandler();
            INotificationHandler <MyNotification> myHandler      = new MyNotificationHandler();

            // Contravariance.
            // An object that is instantiated with a less derived type argument
            // is assigned to an object instantiated with a more derived type argument.
            // Assignment compatibility is reversed.
            myHandler = genericHandler;

            IEnumerable <INotificationHandler <MyNotification> > list = container.ResolveAll <INotificationHandler <MyNotification> >();

            Console.WriteLine($"Count should be 2 but is {list.Count()}");
            Console.WriteLine("The following types are resolved:");
            foreach (INotificationHandler <MyNotification> handler in list)
            {
                Console.WriteLine(handler.GetType().FullName);
            }
            Console.ReadLine();
        }
Beispiel #4
0
 public static void MainMethod(GenericHandler postLoginProc, GenericHandler runCoreProc)
 {
     System.Windows.Forms.Application.SetUnhandledExceptionMode(System.Windows.Forms.UnhandledExceptionMode.CatchException);
     System.Windows.Forms.Application.add_ThreadException(new ThreadExceptionEventHandler(ProgramImpl.Application_ThreadException));
     System.AppDomain.CurrentDomain.add_UnhandledException(new System.UnhandledExceptionEventHandler(ProgramImpl.CurrentDomain_UnhandledException));
     if (ApplicationDeployment.get_IsNetworkDeployed() && ApplicationDeployment.CurrentDeployment.get_IsFirstRun())
     {
         Settings.Default.Upgrade();
         Manager.UpgradeSettings();
         System.Windows.Forms.Application.Restart();
     }
     else
     {
         System.Windows.Forms.Application.EnableVisualStyles();
         System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false);
         Manager.Init();
         if (System.Windows.Forms.DialogResult.OK == new LoginForm(postLoginProc).ShowDialog())
         {
             if (runCoreProc != null)
             {
                 runCoreProc();
             }
             Manager.SaveSettings();
         }
     }
 }
        public void setPortTest()
        {
            GenericHandler handler = new GenericHandler("D15D6347-E3D6-4BB4-7B5632F470EBC751", "21B00A88-E976-66F2-88EA7F78281AFAE2");

            handler.setPort("16448");
            Assert.IsNotNull(handler.getPort());
        }
        public void setIPAddressTest()
        {
            GenericHandler handler = new GenericHandler("D15D6347-E3D6-4BB4-7B5632F470EBC751", "21B00A88-E976-66F2-88EA7F78281AFAE2");

            handler.setIPAddress("10.0.2.124");
            Assert.IsNotNull(handler.getIPAddress());
        }
        public void getMerchantTypeTest()
        {
            GenericHandler handler = new GenericHandler();

            Assert.IsNotNull(handler.getMerchantType());
            Assert.AreEqual("MoToEcom", handler.getMerchantType());
        }
        public void setMerchantTypeTest()
        {
            GenericHandler handler = new GenericHandler();

            Assert.IsNotNull(handler.getMerchantType());
            handler.setMerchantType("Retail");
            Assert.IsNotNull(handler.getMerchantType());
        }
        public void setAccessTokenTest()
        {
            GenericHandler handler = new GenericHandler();

            Assert.IsNull(handler.getAccessToken());
            handler.setAccessToken("390B2B95-E74C-4774-A88B-C07E5B020488");
            Assert.IsNotNull(handler.getAccessToken());
        }
        public void setAuthTokenTest()
        {
            GenericHandler handler = new GenericHandler();

            Assert.IsNull(handler.getAuthToken());
            handler.setAuthToken("D15D6347-E3D6-4BB4-7B5632F470EBC751");
            Assert.IsNotNull(handler.getAuthToken());
        }
        public void setClientGUIDTest()
        {
            GenericHandler handler = new GenericHandler();

            Assert.IsNull(handler.getClientGUID());
            handler.setClientGUID("21B00A88-E976-66F2-88EA7F78281AFAE2");
            Assert.IsNotNull(handler.getClientGUID());
        }
        public void sendRawTest()
        {
            GenericHandler handler = new GenericHandler("D15D6347-E3D6-4BB4-7B5632F470EBC751", "21B00A88-E976-66F2-88EA7F78281AFAE2", "10.0.2.124", "16448");
            Task <Dictionary <string, string> > go  = handler.sendRaw("AnyRandomString=Home+WhoKnows=IDon't");
            Dictionary <string, string>         res = go.Result;

            Assert.Fail();
        }
Beispiel #13
0
        public PacketHandlers()
        {
            PacketHandler temp = new GenericHandler();

            handlers.Add("0.0", temp);

            Console.WriteLine("Binded packetHandlers");
        }
        public void GenericHandlerTest()
        {
            GenericHandler handler = new GenericHandler();

            Assert.IsNull(handler.getPort());
            Assert.IsNull(handler.getIPAddress());
            Assert.IsNull(handler.getClientGUID());
            Assert.IsNull(handler.getAuthToken());
            Assert.IsNull(handler.getAccessToken());
        }
        public void GenericHandlerTest2()
        {
            GenericHandler handler = new GenericHandler("D15D6347-E3D6-4BB4-7B5632F470EBC751", "21B00A88-E976-66F2-88EA7F78281AFAE2", "10.0.2.124", "16448");

            Assert.IsNotNull(handler.getClientGUID());
            Assert.IsNotNull(handler.getAuthToken());
            Assert.IsNotNull(handler.getIPAddress());
            Assert.IsNotNull(handler.getPort());
            Assert.IsNull(handler.getAccessToken());
        }
Beispiel #16
0
        public void GenericHandlerBranchTest(string url, string repoUrl, string commitId)
        {
            // Act
            var deploymentInfo = new DeploymentInfo();

            GenericHandler.SetRepositoryUrl(deploymentInfo, url);

            // Assert
            Assert.Equal(repoUrl, deploymentInfo.RepositoryUrl);
            Assert.Equal(commitId, deploymentInfo.CommitId);
        }
        public void startTest()
        {
            GenericHandler handler = new GenericHandler("D15D6347-E3D6-4BB4-7B5632F470EBC751", "21B00A88-E976-66F2-88EA7F78281AFAE2", "10.0.2.124", "16448");
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("Sure", "Why Not");
            Task <Dictionary <string, string> > go  = handler.start(parameters);
            Dictionary <string, string>         res = go.Result;

            Assert.Fail();
        }
Beispiel #18
0
        private static void Main(string[] args)
        {
            GenericHandler <RootObject> rootObject = new GenericHandler <RootObject>();
            LogicHandler logic = new LogicHandler();

            rootObject.GetObject = rootObject.WeatherApi(Variables.SetUrl().UrlApi).Result;
            logic.WeahterResultsFromApi(rootObject.GetObject);
            rootObject.GetObject = rootObject.WeatherApi(Variables.SetUrl().UrlDays).Result;
            logic.WeahterResultsFromApi(rootObject.GetObject);

            Console.ReadKey();
        }
Beispiel #19
0
 public static void RegisterDefaultEventHandlers()
 {
     GenericHandler.Register();
     GateHandler.Register();
     ExchangeHandler.Register();
     TimedFurnitureHandler.Register();
     RandomizerHandler.Register();
     TeleporterHandler.Register();
     DispenserItemHandler.Register();
     FireworksHandler.Register();
     JukeboxHandler.Register();
     RollerHandler.Register();
 }
Beispiel #20
0
        public void GenericHandlerDeployerTest(string url, string expected)
        {
            // Arrange
            var handler = new GenericHandler();
            var payload = new JObject();

            payload["url"]    = url;
            payload["format"] = "basic";

            // Act
            DeploymentInfo deploymentInfo;
            DeployAction   result = handler.TryParseDeploymentInfo(request: null, payload: payload, targetBranch: null, deploymentInfo: out deploymentInfo);

            // Assert
            Assert.Equal(DeployAction.ProcessDeployment, result);
            Assert.NotNull(deploymentInfo);
            Assert.Equal(expected, deploymentInfo.Deployer);
        }
Beispiel #21
0
        public void GenericHandlerSimpleTest(DeployAction expected, IDictionary <string, object> values)
        {
            // Arrange
            var handler = new GenericHandler();
            var payload = new JObject();

            foreach (var pair in values)
            {
                payload[pair.Key] = JToken.FromObject(pair.Value);
            }

            // Act
            DeploymentInfo deploymentInfo;
            DeployAction   result = handler.TryParseDeploymentInfo(request: null, payload: payload, targetBranch: null, deploymentInfo: out deploymentInfo);

            // Assert
            Assert.Equal(expected, result);
        }
Beispiel #22
0
        public void GenericHandlerInvalidUrl(string url)
        {
            // Arrange
            var handler = new GenericHandler();
            var payload = new JObject();

            payload["url"]    = url;
            payload["format"] = "basic";

            // Act
            DeploymentInfo deploymentInfo;

            // Assert
            Assert.Throws <InvalidOperationException>(() =>
            {
                handler.TryParseDeploymentInfo(request: null, payload: payload, targetBranch: null, deploymentInfo: out deploymentInfo);
            });
        }
Beispiel #23
0
        /// <summary>
        /// Constructor
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            // Handlers used to callbacks in the UI thread
            mDisconnectedHandler            += new GenericHandler(OnDisconnected);
            mAcquisitionModeChangedHandler  += new GenericHandler(OnAcquisitionModeChanged);
            mAcquisitionStateChangedHandler += new GenericHandler(OnAcquisitionStateChanged);

            // Set browser form owners
            mCommBrowser.Owner   = this;
            mDeviceBrowser.Owner = this;
            mStreamBrowser.Owner = this;

            // Create display thread, hook display event
            mDisplayThread = new PvDisplayThread();
            mDisplayThread.OnBufferDisplay += new OnBufferDisplay(OnBufferDisplay);
        }
Beispiel #24
0
        public void GenericHandlerRepositoryTypeTest(string url, bool?is_hg, RepositoryType expected)
        {
            // Arrange
            var handler = new GenericHandler();
            var payload = new JObject();

            payload["url"]    = url;
            payload["format"] = "basic";
            if (is_hg != null)
            {
                payload["scm"] = is_hg.Value ? "hg" : "git";
            }

            // Act
            DeploymentInfo deploymentInfo;
            DeployAction   result = handler.TryParseDeploymentInfo(request: null, payload: payload, targetBranch: null, deploymentInfo: out deploymentInfo);

            // Assert
            Assert.Equal(DeployAction.ProcessDeployment, result);
            Assert.NotNull(deploymentInfo);
            Assert.Equal(expected, deploymentInfo.RepositoryType);
        }
Beispiel #25
0
        public HandlerItem[] GetResultsFor(string search)
        {
            ThreadGroup        searchGroup = new ThreadGroup();
            List <HandlerItem> ret         = new List <HandlerItem>();

            foreach (GenericHandler handlerx in handlers)
            {
                GenericHandler handler = handlerx;
                searchGroup.AddAndRun(delegate()
                {
                    HandlerItem[]  tmp = handler.GetResultsFor(search);
                    if (tmp == null)
                    {
                        return;
                    }
                    lock (ret)
                    {
                        ret.AddRange(tmp);
                    }
                });
            }
            searchGroup.WaitForCompletion();
            return(ret.ToArray());
        }
        private static IHttpHandler GetHandlerForPathParts(string servicePath, string[] pathParts)
        {
            var pathController = string.Intern(pathParts[0].ToLower());

            if (pathParts.Length == 1)
            {
                return(null);
            }

            var requestName = string.Intern(pathParts[1]).ToLower(); // aka. operation name

            if (string.IsNullOrWhiteSpace(requestName))
            {
                return(null);
                //throw new ArgumentNullException("No operation name was provided");
            }
            if (requestName == "metadata")
            {
                return(null);                            // leave for metadata handler
            }
            EndpointHandlerBase rpcHandler = null;

            switch (pathController)
            {
            case "json":
                rpcHandler = new JsonSyncReplyHandler(servicePath)
                {
                    RequestName = requestName
                };
                break;

            case "xml":
                rpcHandler = new XmlSyncReplyHandler(servicePath)
                {
                    RequestName = requestName
                };
                break;

            case "jsv":
                rpcHandler = new JsvSyncReplyHandler(servicePath)
                {
                    RequestName = requestName
                };
                break;

            case "soap":
            case "soap11":
                rpcHandler = new Soap11Handler(servicePath)
                {
                    RequestName = requestName
                };
                break;

            default:
                string contentType;
                if (EndpointHost.ContentTypeFilter.ContentTypeFormats.TryGetValue(pathController, out contentType))
                {
                    var feature = Common.Web.ContentType.ToFeature(contentType);
                    if (feature == Feature.None)
                    {
                        feature = Feature.CustomFormat;
                    }

                    rpcHandler = new GenericHandler(servicePath, contentType, EndpointAttributes.Reply, feature)
                    {
                        RequestName = requestName
                    };
                }
                break;
            }

            // Centralized operation name validation
            if (rpcHandler != null)
            {
                if (!EndpointHost.Config.MetadataMap[servicePath].HasOperation(requestName))
                {
                    return(null);
                }
            }

            return(rpcHandler);
        }
        private static void Main(string[] args)
        {
            string message = "TinyNvidiaUpdateChecker v" + offlineVer;

            LogManager.Log(message, LogManager.Level.INFO);
            Console.Title = message;

            CheckArgs(args);

            RunIntro(); // will run intro if no args needs to output stuff

            if (showUI)
            {
                AllocConsole();

                if (!debug)
                {
                    GenericHandler.DisableQuickEdit();
                }
            }

            SettingManager.ConfigInit();

            CheckDependencies();

            CheckWinVer();

            GetLanguage();

            if (SettingManager.ReadSettingBool("Check for Updates"))
            {
                SearchForUpdates();
            }

            GpuInfo();

            bool hasSelected = false;
            int  iOffline    = 0;

            try {
                iOffline = Convert.ToInt32(OfflineGPUVersion.Replace(".", string.Empty));
            } catch (Exception ex) {
                OfflineGPUVersion = "Unknown";
                Console.WriteLine("Could not retrive OfflineGPUVersion!");
                Console.WriteLine(ex.ToString());
            }

            int iOnline = Convert.ToInt32(OnlineGPUVersion.Replace(".", string.Empty));

            if (iOnline == iOffline)
            {
                Console.WriteLine("Your GPU drivers are up-to-date!");
            }
            else
            {
                if (iOffline > iOnline)
                {
                    Console.WriteLine("Your current GPU driver is newer than remote!");
                }
                if (iOnline < iOffline)
                {
                    Console.WriteLine("Your GPU drivers are up-to-date!");
                }
                else
                {
                    Console.WriteLine("There are new drivers available to download!");
                    hasSelected = true;

                    if (confirmDL)
                    {
                        DownloadDriverQuiet(true);
                    }
                    else
                    {
                        DownloadDriver();
                    }
                }
            }

            if (!hasSelected && forceDL)
            {
                if (confirmDL)
                {
                    DownloadDriverQuiet(true);
                }
                else
                {
                    DownloadDriver();
                }
            }

            Console.WriteLine();
            Console.WriteLine("Finished! Press any key to exit.");
            if (showUI)
            {
                Console.ReadKey();
            }
            LogManager.Log("BYE!", LogManager.Level.INFO);
            Environment.Exit(0);
        }
Beispiel #28
0
 public HandlerItem(string txt, GenericHandler handl)
 {
     text    = txt;
     handler = handl;
 }
Beispiel #29
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="innerEvent">The inner event</param>
 /// <param name="responseHandler">The method in the sending object that will handle the response</param>
 public RespondableEvent(T1 innerEvent, GenericHandler <T3, T2> responseHandler)
 {
     InnerEvent       = innerEvent;
     _ResponseHandler = responseHandler;
 }