private void Save_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(MyHost.Text)) { var dialogWindow = new DialogWindow( DialogWindow.DialogIcon.Warning, "Error", $"Please enter a valid host name.", "OK", false); dialogWindow.Owner = this; dialogWindow.ShowDialog(); MyHost.Focus(); MyHost.SelectAll(); return; } if (string.IsNullOrWhiteSpace(MyAlias.Text)) { var dialogWindow = new DialogWindow( DialogWindow.DialogIcon.Warning, "Error", $"Please enter a valid alias.", "OK", false); dialogWindow.Owner = this; dialogWindow.ShowDialog(); MyAlias.Focus(); MyAlias.SelectAll(); return; } Alias.AddAlias(MyHost.Text.ToUpper(), MyAlias.Text); DialogResult = true; }
static void Main(string[] args) { var me = new Program(); var myHost = new MyHost(me); using (var rs = RunspaceFactory.CreateRunspace(myHost)) { // Open the runspace. rs.Open(); // Create a PowerShell object to run the script. using (var ps = PowerShell.Create()) { ps.Runspace = rs; var script = "exit (2+2)"; ps.AddScript(script); ps.Invoke(script); } // Check the flags and see if they were set propertly. Console.WriteLine( "ShouldExit={0} (should be True); ExitCode={1} (should be 4)", me.ShouldExit, me.ExitCode); // close the runspace to free resources. rs.Close(); } Console.ReadKey(); }
private void Save_Click(object sender, RoutedEventArgs e) { // Validate hostname. if (Alias.IsHostInvalid(MyHost.Text)) { var errorWindow = DialogWindow.ErrorWindow($"Please enter a valid host name."); errorWindow.Owner = this; errorWindow.ShowDialog(); MyHost.Focus(); MyHost.SelectAll(); return; } // Validate alias name. if (Alias.IsNameInvalid(MyAlias.Text)) { var errorWindow = DialogWindow.ErrorWindow($"Please enter a valid alias."); errorWindow.Owner = this; errorWindow.ShowDialog(); MyAlias.Focus(); MyAlias.SelectAll(); return; } // Checks passed. Add alias entry. Alias.AddAlias(MyHost.Text.ToUpper(), MyAlias.Text); DialogResult = true; }
public MyItem this[int i] { get { return(MyHost.GetItemFromID(i)); } }
static void Main(string[] args) { Console.SetWindowSize(Console.LargestWindowWidth - 30, Console.LargestWindowHeight - 30); Console.Title = ".NET StockTrader Business Services Host"; MyHost myHost = new MyHost(); myHost.startUp(); }
public void Ctor() { MyHost host = new MyHost(typeof(Foo), new Uri("http://localhost")); Assert.IsNotNull(host.Description, "#1"); Assert.AreEqual(typeof(Foo), host.Description.ServiceType, "#1-2"); Assert.IsNotNull(host.BaseAddresses, "#2"); Assert.AreEqual(1, host.BaseAddresses.Count, "#3"); Assert.IsNotNull(host.ChannelDispatchers, "#4"); Assert.AreEqual(0, host.ChannelDispatchers.Count, "#5"); Assert.IsNotNull(host.Authorization, "#6"); Assert.IsNotNull(host.ExposedContracts, "#7"); // Foo is already in the contracts. Assert.AreEqual(1, host.ExposedContracts.Count, "#8"); // this loop iterates only once. foreach (KeyValuePair <string, ContractDescription> e in host.ExposedContracts) { // hmm... so, seems like the key is just the full name of the contract type. Assert.AreEqual("MonoTests.System.ServiceModel.ServiceHostTest+Foo", e.Key, "#9"); ContractDescription cd = e.Value; Assert.AreEqual("Foo", cd.Name, "#10"); Assert.AreEqual("http://tempuri.org/", cd.Namespace, "#11"); } }
public static int InvokePowerShell(string path, string param) { int code = ResultCode.RESULT_ERROR; Host01 me = new Host01(); MyHost myHost = new MyHost(me); using (Runspace myRunSpace = RunspaceFactory.CreateRunspace(myHost)) { myRunSpace.Open(); using (PowerShell powershell = PowerShell.Create()) { powershell.Runspace = myRunSpace; string script = File.ReadAllText(path); powershell.AddScript(script); try { powershell.Invoke(); code = me.ExitCode; } catch { code = ResultCode.RESULT_ERROR; } } myRunSpace.Close(); } return(code); }
private void Sumbit_Click(object sender, RoutedEventArgs e) { if ((IDFill.Text == "207590225" || IDFill.Text == "318795093") && PasswordFill.Text == "111111111")//if it is the admin,efrat or talya { Admin_Window ad = new Admin_Window(); ad.Show(); this.Close(); return; } try { if (((ComboBoxItem)ComboBox_of_HostOrGuest.SelectedItem) != null) { switch (((ComboBoxItem)ComboBox_of_HostOrGuest.SelectedItem).Content.ToString()) { case " אורח ": { MyGuest temp = bl.getMyGuest(bl.FindMyGuest(IDFill.Text)); if (temp.Password != PasswordFill.Text) { MessageBox_Project x = new MessageBox_Project(":שִׂים לֵב ", "סיסמתך אינה נכונה"); x.ShowDialog(); } Guest_Window(temp); break; } case " מארח ": { MyHost temp = bl.getMyHost(bl.FindMyHost(IDFill.Text)); if (temp.Password_host != PasswordFill.Text) { MessageBox_Project x = new MessageBox_Project(":שִׂים לֵב ", "סיסמתך אינה נכונה אנא נסה שוב"); x.ShowDialog(); } else { MyHostWindow hostWindow = new MyHostWindow(temp); hostWindow.Show(); Close(); } break; } } } else { MessageBox_Project x = new MessageBox_Project(":שִׂים לֵב ", "לא מילאת את כל הפרטים " + "\n" + "אנא מלא שוב את כל הפרטים"); x.ShowDialog(); Window_Password window = new Window_Password(); window.Show(); } } catch (ArgumentException exp) { MessageBox.Show(exp.Message); } }
public async Task TestSetupDatabaseAsyncOnlyOneUpdateOfCosmosOk() { //SETUP var booksOption = this.CreateUniqueClassOptions <BookDbContext>(); var orderOption = this.CreateUniqueClassOptions <OrderDbContext>(); var services = new ServiceCollection(); services.AddSingleton(booksOption); services.AddScoped <BookDbContext>(); services.AddSingleton(orderOption); services.AddScoped <OrderDbContext>(); services.AddSingleton <IWebHostEnvironment>(new MyWebHostEnvironment { WebRootPath = TestData.GetTestDataDir() }); services.AddLogging(); var serviceProvider = services.BuildServiceProvider(); var host = new MyHost { Services = serviceProvider }; using (var bookContext = new BookDbContext(booksOption)) { bookContext.Database.EnsureDeleted(); } //ATTEMPT await host.SetupDatabaseAsync(); //VERIFY using (var bookContext = new BookDbContext(booksOption)) { bookContext.Books.Count().ShouldEqual(6); } }
/// <summary> /// Create this instance of the console listener. /// </summary> private PSListenerConsoleSample() { // Create the host and runspace instances for this interpreter. // Note that this application does not support console files so // only the default snapins will be available. this.myHost = new MyHost(this); this.myRunSpace = RunspaceFactory.CreateRunspace(this.myHost); this.myRunSpace.Open(); }
public static void Main () { ServiceHost host = new MyHost (typeof (Foo)); Binding binding = new BasicHttpBinding (); binding.ReceiveTimeout = TimeSpan.FromSeconds (5); ServiceEndpoint se = host.AddServiceEndpoint ("IFoo", binding, new Uri ("http://localhost:8080")); host.Open (); Console.WriteLine ("Hit [CR] key to close ..."); Console.ReadLine (); host.Close (); }
public void ItPropagatesExceptionsToCallersViaTraps() { var host = new MyHost(); using var instance = Fixture.Module.Instantiate(host); var throw_func = instance.Externs.Functions.Where(f => f.Name == "do_throw_wrapper").Single(); Action action = () => throw_func.Invoke(); action .Should() .Throw <TrapException>() .WithMessage(THROW_MESSAGE); }
public static void Main () { ServiceHost host = new MyHost (typeof (Foo)); host.Description.Behaviors.Find<ServiceDebugBehavior> () .IncludeExceptionDetailInFaults = true; Binding binding = new BasicHttpBinding (); binding.ReceiveTimeout = TimeSpan.FromSeconds (5); ServiceEndpoint se = host.AddServiceEndpoint ("IFoo", binding, new Uri ("http://localhost:8080")); host.Open (); Console.WriteLine ("Hit [CR] key to close ..."); Console.ReadLine (); host.Close (); }
public static void Main() { ServiceHost host = new MyHost(typeof(Foo)); Binding binding = new BasicHttpBinding(); binding.ReceiveTimeout = TimeSpan.FromSeconds(5); ServiceEndpoint se = host.AddServiceEndpoint("IFoo", binding, new Uri("http://localhost:8080")); host.Open(); Console.WriteLine("Hit [CR] key to close ..."); Console.ReadLine(); host.Close(); }
public static IHost CreateHost(string[] args) { var hostBuilder = MyHost.CreateHostBuilder(args); hostBuilder.ConfigureServices(services => { services.AddSingleton <BiliBiliToolConsoleService>(); }); IHost host = hostBuilder .UseConsoleLifetime() .Build(); return(host); }
public static void Main () { ServiceHost host = new MyHost (typeof (Foo)); var smb = new ServiceMetadataBehavior (); smb.HttpGetEnabled = true; smb.HttpGetUrl = new Uri ("http://localhost:8080/wsdl"); host.Description.Behaviors.Add (smb); Binding binding = new BasicHttpBinding (); binding.ReceiveTimeout = TimeSpan.FromSeconds (5); ServiceEndpoint se = host.AddServiceEndpoint ("IFoo", binding, new Uri ("http://localhost:8080")); host.Open (); Console.WriteLine ("Hit [CR] key to close ..."); Console.ReadLine (); host.Close (); }
private async Task ContainTargetWindow(HostedWindowItem item) { var target = item.WindowHandle; MyHost host; if ((App.Current as App).TargetWindowHosts.ContainsKey(target)) { host = (App.Current as App).TargetWindowHosts[target]; } else { host = new MyHost(target); (App.Current as App).TargetWindowHosts[target] = host; } if (host.Parent == null) { WindowContainer.Child = host; } else if (host.Parent != null && host.Parent != WindowContainer) { MessageBox.Show("ContainTargetWindow failed. The host has another parent."); return; } // TODO: Try to make it faster on console launch. But how? var dpi = VisualTreeHelper.GetDpi(this); if (item.Dpi != dpi.PixelsPerInchX) { ConsoleFunctions.SendDpiChangedMessage(target, (int)dpi.PixelsPerInchX); item.Dpi = dpi.PixelsPerInchX; } await Task.Delay(10); int style = Win32Functions.GetWindowLongPtr(target, Win32Functions.GWL_STYLE).ToInt32(); int newStyle = style & ~(Win32Functions.WS_CHILD); Win32Functions.SetWindowLongPtr(new HandleRef(this, target), Win32Functions.GWL_STYLE, new IntPtr(newStyle)); await Task.Delay(10); MaximizeWindow(target, Win32.Enums.ShowWindowCommands.Normal); Win32Functions.SetForegroundWindow(target); }
public static void Main() { ServiceHost host = new MyHost(typeof(Foo)); host.Description.Behaviors.Find <ServiceDebugBehavior> () .IncludeExceptionDetailInFaults = true; Binding binding = new BasicHttpBinding(); binding.ReceiveTimeout = TimeSpan.FromSeconds(5); ServiceEndpoint se = host.AddServiceEndpoint("IFoo", binding, new Uri("http://localhost:8080")); host.Open(); Console.WriteLine("Hit [CR] key to close ..."); Console.ReadLine(); host.Close(); }
public static MyHost Clone(this MyHost original) { MyHost t = new MyHost { BankAccuont = original.BankAccuont.Clone(), FirstName_host = original.FirstName_host, LastName_host = original.LastName_host, Id_host = original.Id_host, Password_host = original.Password_host, FhoneNumber = original.FhoneNumber, MailAddress = original.MailAddress, BankAccountNumber = original.BankAccountNumber, CollectionClearance = original.CollectionClearance, }; return(t); }
public async Task TestSetupDatabaseAsyncOnlyOneUpdateOfCosmosOk() { //SETUP var booksOption = this.CreateUniqueClassOptions <BookDbContext>(); var orderOption = this.CreateUniqueClassOptions <OrderDbContext>(); var cosmosOption = this.GetCosmosDbOptions <CosmosDbContext>(); var services = new ServiceCollection(); services.RegisterGenericEventRunner(Assembly.GetAssembly(typeof(BookChangeHandlerAsync))); services.AddTransient <IBookToCosmosBookService, BookToCosmosBookService>(); services.AddSingleton(booksOption); services.AddScoped <BookDbContext>(); services.AddSingleton(orderOption); services.AddScoped <OrderDbContext>(); services.AddSingleton(cosmosOption); services.AddScoped <CosmosDbContext>(); services.AddSingleton <IWebHostEnvironment>(new MyWebHostEnvironment { WebRootPath = TestData.GetTestDataDir() }); services.AddLogging(); var serviceProvider = services.BuildServiceProvider(); var host = new MyHost { Services = serviceProvider }; using (var bookContext = new BookDbContext(booksOption)) { bookContext.Database.EnsureDeleted(); } using (var cosmosContext = new CosmosDbContext(cosmosOption)) { await cosmosContext.Database.EnsureDeletedAsync(); } //ATTEMPT await host.SetupDatabaseAsync(); //VERIFY using (var bookContext = new BookDbContext(booksOption)) { bookContext.Books.Count().ShouldEqual(6); } }
public void ItBindsImportMethodsAndCallsThemCorrectly() { var host = new MyHost(); using var instance = Fixture.Module.Instantiate(host); var add_func = instance.Externs.Functions.Where(f => f.Name == "add_wrapper").Single(); int invoke_add(int x, int y) => (int)add_func.Invoke(new object[] { x, y }); invoke_add(40, 2).Should().Be(42); invoke_add(22, 5).Should().Be(27); //Collect garbage to make sure delegate function pointers pasted to wasmtime are rooted. GC.Collect(); GC.WaitForPendingFinalizers(); invoke_add(1970, 50).Should().Be(2020); }
public static void Main () { ServiceHost host = new MyHost (typeof (Foo)); var sc = new ServiceCredentials (); sc.UserNameAuthentication.UserNamePasswordValidationMode = UserNamePasswordValidationMode.Custom; sc.UserNameAuthentication.CustomUserNamePasswordValidator = UserNamePasswordValidator.None; host.Description.Behaviors.Add (sc); var binding = new BasicHttpBinding (); binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; binding.ReceiveTimeout = TimeSpan.FromSeconds (5); host.AddServiceEndpoint ("IFoo", binding, new Uri ("http://localhost:8080")); host.Open (); Console.WriteLine ("Hit [CR] key to close ..."); Console.ReadLine (); host.Close (); }
public static void Main() { ServiceHost host = new MyHost(typeof(Foo)); var smb = new ServiceMetadataBehavior(); smb.HttpGetEnabled = true; smb.HttpGetUrl = new Uri("http://localhost:8080"); host.Description.Behaviors.Add(smb); Binding binding = new BasicHttpBinding(); binding.ReceiveTimeout = TimeSpan.FromSeconds(5); ServiceEndpoint se = host.AddServiceEndpoint("IFoo", binding, new Uri("http://localhost:8080")); host.Open(); Console.WriteLine("Hit [CR] key to close ..."); Console.ReadLine(); host.Close(); }
public void AddHost(MyHost My_Host) { bool ezer = false; foreach (var item in Dal_XML_imp.GetMyHostFromXml()) { if (item.Id_host == My_Host.Id_host) { ezer = true; } } if (ezer == false) //אין את הלקוח ברשימה { Dal_XML_imp.AddMyHostToXml(My_Host.Clone()); } else { throw new NotImplementedException("המארח כבר רשום במערכת"); } }
public static void Main() { ServiceHost host = new MyHost(typeof(Foo)); var sc = new ServiceCredentials(); sc.UserNameAuthentication.UserNamePasswordValidationMode = UserNamePasswordValidationMode.Custom; sc.UserNameAuthentication.CustomUserNamePasswordValidator = UserNamePasswordValidator.None; host.Description.Behaviors.Add(sc); var binding = new BasicHttpBinding(); binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly; binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; binding.ReceiveTimeout = TimeSpan.FromSeconds(5); host.AddServiceEndpoint("IFoo", binding, new Uri("http://localhost:8080")); host.Open(); Console.WriteLine("Hit [CR] key to close ..."); Console.ReadLine(); host.Close(); }
public static BE.MyGuest GetGuestFromXml(int i) { try { XElement MyGuest = XElement.Load(Path + "guest.xml"); var AllMyHost = (from MyHost in MyGuest.Elements() select new BE.MyGuest() { FirstName = MyHost.Element("FirstName").Value, LastName = MyHost.Element("LastName").Value, Id = MyHost.Element("Id").Value, Password = MyHost.Element("Password").Value, }).ToList(); return(AllMyHost[i]); } catch { throw new Exception("האורח לא קיים "); } }
public void Ctor () { MyHost host = new MyHost (typeof (Foo), new Uri ("http://localhost")); Assert.IsNotNull (host.Description, "#1"); Assert.AreEqual (typeof (Foo), host.Description.ServiceType, "#1-2"); Assert.IsNotNull (host.BaseAddresses, "#2"); Assert.AreEqual (1, host.BaseAddresses.Count, "#3"); Assert.IsNotNull (host.ChannelDispatchers, "#4"); Assert.AreEqual (0, host.ChannelDispatchers.Count, "#5"); Assert.IsNotNull (host.Authorization, "#6"); Assert.IsNotNull (host.ExposedContracts, "#7"); // Foo is already in the contracts. Assert.AreEqual (1, host.ExposedContracts.Count, "#8"); // this loop iterates only once. foreach (KeyValuePair<string,ContractDescription> e in host.ExposedContracts) { // hmm... so, seems like the key is just the full name of the contract type. Assert.AreEqual ("MonoTests.System.ServiceModel.ServiceHostTest+Foo", e.Key, "#9"); ContractDescription cd = e.Value; Assert.AreEqual ("Foo", cd.Name, "#10"); Assert.AreEqual ("http://tempuri.org/", cd.Namespace, "#11"); } }
public static BE.MyHost GetMyHostFromXml(int i) // קבלה על ידי מיקום { try { XElement MyHosts = XElement.Load(Path + "hosts.xml"); var AllMyHost = (from MyHost in MyHosts.Elements() select new BE.MyHost() { FirstName_host = MyHost.Element("FirstName_host").Value, LastName_host = MyHost.Element("LastName_host").Value, Id_host = MyHost.Element("Id_host").Value, Password_host = MyHost.Element("Password_host").Value, FhoneNumber = MyHost.Element("FhoneNumber").Value, MailAddress = MyHost.Element("MailAddress").Value, BankAccountNumber = int.Parse(MyHost.Element("BankAccountNumber").Value), CollectionClearance = (BE.My_enum.Yes_Or_No)Enum.Parse(typeof(BE.My_enum.Yes_Or_No), MyHost.Element("CollectionClearance").Value), //(from MyHost in MyHosts.Elements() select MyHost).ToList()[0].Element("BankAccuont").Element("BankName").Value BankAccuont = new BE.BankBranch() { BankNumber = int.Parse(MyHost.Element("BankAccuont").Element("BankNumber").Value), BankName = MyHost.Element("BankAccuont").Element("BankName").Value, BranchNumber = int.Parse(MyHost.Element("BankAccuont").Element("BranchNumber").Value), BranchAddress = MyHost.Element("BankAccuont").Element("BranchAddress").Value, BranchCity = MyHost.Element("BankAccuont").Element("BranchCity").Value } }).ToList(); return(AllMyHost[i]); } catch { return(null); } }
public AddHostingUnit(MyHost h) { InitializeComponent(); host = h; }
public override bool OnStart() { // Set the maximum number of concurrent connections ServicePointManager.DefaultConnectionLimit = 64; //Wire up our key event handlers, to ensure proper lifecycle management. RoleEnvironment.Stopping += RoleInstanceShutdown; RoleEnvironment.Changing += RoleEnvironmentChanging; // For information on handling configuration changes // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357. myHost = new MyHost(); myHost.startUp(); return base.OnStart(); }
public static IHostBuilder CreateHostBuilder(string[] args) => MyHost.CreateHostBuilder(args) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup <Startup>(); });
public Delete_Hosting_Unit(MyHost h) { InitializeComponent(); host = h; }
private void send_email_Click(object sender, RoutedEventArgs e) { e.Handled = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$").IsMatch(email.Text); //check if email and id valid: if ((e.Handled == false) || IDFill.Text.Count() < 9) { MessageBox_Project x = new MessageBox_Project(":שִׂים לֵב ", "אימייל לא יכול להישלח ללא כתובת מייל או מספר זיהוי חוקי"); x.ShowDialog(); return; } // if everything is ok, send the mail: System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage(); mail.To.Add(email.Text); mail.From = new System.Net.Mail.MailAddress("*****@*****.**"); //Subject of the messege mail.Subject = "שיחזור סיסמא"; mail.Body = "סיסמתך היא: "; //mail.Body = ""; if (IDFill.Text == "207590225" || IDFill.Text == "318795093")//if it is the admin,efrat or talya { MessageBox_Project x = new MessageBox_Project(":שִׂים לֵב", " סיסמתך היא: 111111111"); x.ShowDialog(); return; } try { if (((ComboBoxItem)ComboBox_of_HostOrGuest.SelectedItem) != null) { switch (((ComboBoxItem)ComboBox_of_HostOrGuest.SelectedItem).Content.ToString()) { case " אורח ": { MyGuest temp = bl.getMyGuest(bl.FindMyGuest(IDFill.Text)); mail.Body = mail.Body + temp.Password; break; } case " מארח ": { MyHost temp = bl.getMyHost(bl.FindMyHost(IDFill.Text)); mail.Body = mail.Body + temp.Password_host; break; } } } } catch (ArgumentException exp) { MessageBox.Show(exp.Message); } //the body of message mail.IsBodyHtml = false; SmtpClient smtp = new SmtpClient("smtp.gmail.com"); NetworkCredential basicCredential = new NetworkCredential("*****@*****.**", "tel1234*"); smtp.EnableSsl = true; smtp.UseDefaultCredentials = true; smtp.Credentials = basicCredential; try { smtp.Send(mail); MessageBox_Project sendMassege = new MessageBox_Project(":שִׂים לֵב", "המייל נשלח בהצלחה"); sendMassege.ShowDialog(); Close(); } catch (Exception eo) { MessageBox.Show(eo.ToString()); //MessageBox_Project sendMassege = new MessageBox_Project(":שִׂים לֵב", "המייל לא נשלח"); // sendMassege.ShowDialog(); } }
public void AddHost(MyHost My_Host) { dal.AddHost(My_Host); }
public static SarifLog AnalyzeDll(string inputPath, ScopeMethodKind kind, bool useScopeFactory = true, bool interProc = false, StreamWriter outputStream = null) { // Determine whether to use Interproc analysis AnalysisOptions.DoInterProcAnalysis = interProc; AnalysisStats.TotalNumberFolders++; var host = new MyHost(); PlatformTypes.Resolve(host); var loader = new MyLoader(host); host.Loader = loader; var scopeGenAssembly = loader.LoadMainAssembly(inputPath); AnalysisStats.TotalDllsFound++; loader.LoadCoreAssembly(); var program = new ScopeProgramAnalysis(host, loader); // program.interprocAnalysisManager = new InterproceduralManager(host); program.ScopeGenAssembly = scopeGenAssembly; //program.ReferenceFiles = referenceFiles; program.ClassFilters = new HashSet <string>(); program.ClousureFilters = new HashSet <string>(); program.EntryMethods = new HashSet <string>(); if (kind == ScopeMethodKind.Reducer || kind == ScopeMethodKind.All) { program.ClassFilters.Add("Reducer"); program.ClousureFilters.Add("<Reduce>d__"); program.EntryMethods.Add("Reduce"); } if (kind == ScopeMethodKind.Producer || kind == ScopeMethodKind.All) { program.ClassFilters.Add("Processor"); program.ClousureFilters.Add("<Process>d__"); program.EntryMethods.Add("Process"); //program.ClassFilter = "Producer"; //program.ClousureFilter = "<Produce>d__"; //program.EntryMethod = "Produce"; } program.MethodUnderAnalysisName = "MoveNext"; IEnumerable <Tuple <MethodDefinition, MethodDefinition, MethodDefinition> > scopeMethodPairs; if (useScopeFactory) { scopeMethodPairs = program.ObtainScopeMethodsToAnalyze(); if (!scopeMethodPairs.Any()) { if (outputStream != null) { outputStream.WriteLine("Failed to obtain methods from the ScopeFactory. "); } System.Console.WriteLine("Failed to obtain methods from the ScopeFactory."); //System.Console.WriteLine("Now trying to find methods in the the assembly"); //scopeMethodPairs = program.ObtainScopeMethodsToAnalyzeFromAssemblies(); } } else { scopeMethodPairs = program.ObtainScopeMethodsToAnalyzeFromAssemblies(); } if (scopeMethodPairs.Any()) { var log = CreateSarifOutput(); IReadOnlyDictionary <string, Tuple <Schema, Schema> > allSchemas; if (useScopeFactory) { allSchemas = program.ReadSchemasFromXML(inputPath); } else { allSchemas = program.ReadSchemasFromXML2(inputPath); } foreach (var methodPair in scopeMethodPairs) { AnalysisStats.TotalMethods++; var entryMethodDef = methodPair.Item1; var moveNextMethod = methodPair.Item2; var getEnumMethod = methodPair.Item3; System.Console.WriteLine("Method {0} on class {1}", moveNextMethod.Name, moveNextMethod.ContainingType.FullPathName()); Schema inputSchema = null; Schema outputSchema = null; Tuple <Schema, Schema> schemas; if (allSchemas.TryGetValue(moveNextMethod.ContainingType.ContainingType.Name, out schemas)) { inputSchema = schemas.Item1; outputSchema = schemas.Item2; } try { InputSchema = inputSchema; OutputSchema = outputSchema; var dependencyAnalysis = new SongTaoDependencyAnalysis(host, program.interprocAnalysisManager, moveNextMethod, entryMethodDef, getEnumMethod); var depAnalysisResult = dependencyAnalysis.AnalyzeMoveNextMethod(); WriteResultToSarifLog(inputPath, outputStream, log, moveNextMethod, depAnalysisResult, dependencyAnalysis, program.factoryReducerMap); InputSchema = null; OutputSchema = null; } catch (Exception e) { System.Console.WriteLine("Could not analyze {0}", inputPath); System.Console.WriteLine("Exception {0}\n{1}", e.Message, e.StackTrace); AnalysisStats.TotalofDepAnalysisErrors++; AnalysisStats.AddAnalysisReason(new AnalysisReason(moveNextMethod, moveNextMethod.Body.Instructions[0], String.Format(CultureInfo.InvariantCulture, "Throw exception {0}\n{1}", e.Message, e.StackTrace.ToString()))); } } return(log); } else { System.Console.WriteLine("No method {0} of type {1} in {2}", program.MethodUnderAnalysisName, program.ClassFilters, inputPath); return(null); } }
public MyHostWindow(MyHost h) { InitializeComponent(); host = h; }