public static void Save(SaveOptions saveOptions = null) { try { if (saveOptions == null) { saveOptions = new SaveOptions(); } string path = saveOptions.path; Directory.CreateDirectory(saveOptions.directory); string saveJson = BuildSaveJson(saveOptions); string tempFilePath = path + ".tmp"; File.WriteAllText(tempFilePath, saveJson); if (File.Exists(path)) { File.Replace(tempFilePath, path, null); } else { File.Move(tempFilePath, path); } ProfileLoader.Save(); #if UNITY_WEBGL && !UNITY_EDITOR #pragma warning disable CS0618 // Type or member is obsolete // Required to flush the WebGL file cache to IndexedDB. This will annoyingly log the command Application.ExternalEval("_JS_FileSystem_Sync();"); #pragma warning restore CS0618 // Type or member is obsolete #endif } catch (Exception ex) { Debug.LogException(ex); } }
public StringBuilder CreateProfile(Stream fs, string namespc, string fileName, string productName, bool createCore, string AssemblyVersion) { sb = new StringBuilder(); ////LOAD RDFS AND MAKE A PROFILE ProfileLoader rdfParser = new ProfileLoader(); Profile profile = rdfParser.LoadProfileDocument(fs, namespc, createCore); ////GENERATE CLASSES AND ENUMERATIONS CodeDOMUtil cdom = new CodeDOMUtil(namespc); cdom.Message += new CodeDOMUtil.MessageEventHandler(cdom_Message); cdom.GenerateCode(profile); ////WRITE FILES cdom.WriteFiles(AssemblyVersion); ////COMPILE if (productName.Equals(string.Empty)) { cdom.CompileCode(fileName + "CIMProfile"); } else { cdom.CompileCode(fileName + "CIMProfile_" + productName); } return(sb); }
protected void Page_Load(object sender, EventArgs e) { var spContext = SharePointContextProvider.Current.GetSharePointContext(Context); using (ClientContext clientContext = spContext.CreateUserClientContextForSPHost()) { // Get user profile ProfileLoader loader = Microsoft.SharePoint.Client.UserProfiles.ProfileLoader.GetProfileLoader(clientContext); UserProfile profile = loader.GetUserProfile(); Microsoft.SharePoint.Client.Site personalSite = profile.PersonalSite; clientContext.Load(personalSite); clientContext.ExecuteQuery(); // Let's check if the site already exists The following code uses a timer job-based approach to schedule the creation of a OneDrive for Business site if it has not yet been created for a particular user. if (personalSite.ServerObjectIsNull.Value) { // Let's queue the personal site creation using an approach based on the out-of-the-box timer job. // Using async mode, since end user could go away from browser, you also could do this using an out-of-the-box web part. profile.CreatePersonalSiteEnque(true); clientContext.ExecuteQuery(); } else { Web rootWeb = personalSite.RootWeb; clientContext.Load(rootWeb); clientContext.ExecuteQuery(); // Setting the custom theme to host web SetThemeBasedOnName(clientContext, rootWeb, "Orange"); } } }
void OnLoginChanged(LoginState loginState) { if (loginState.playfabLoginState == PlayfabLoginState.LoggedIn) { ProfileLoader.Save(); } }
private void LoadCIMRDFSFile() { ////LOAD RDFS AND MAKE A PROFILE int cntClasses = -1; int cntProps = -1; int cntComments = -1; try { profile = null; using (FileStream fs = File.Open(textBoxCIMProfile.Text, FileMode.Open)) { ProfileLoader rdfParser = new ProfileLoader(); profile = rdfParser.LoadProfileDocument(fs, textBoxCIMProfile.Text); cntClasses = rdfParser.cntClasses; cntProps = rdfParser.cntProps; cntComments = rdfParser.cntComments; } } catch (Exception e) { MessageBox.Show(string.Format("An error occurred.\n\n{0}", e.Message), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } PrintProfile(cntClasses, cntProps, cntComments); RefreshControls(); }
public MainWindow() { Width = 0; Height = 0; WindowStyle = WindowStyle.None; ShowInTaskbar = false; ShowActivated = false; Visibility = Visibility.Hidden; InitializeComponent(); _loader = new ProfileLoader( ConfigurationManager.AppSettings["configFileFolder"], ConfigurationManager.AppSettings["configFileName"]); _loader.Init(); foreach (var hostsProfile in _loader.Profiles) { var item = new MenuItem { Header = hostsProfile.Name }; item.Click += (s, e) => OnItemClick(hostsProfile); ContextMenu.Items.Add(item); } var closeItem = new MenuItem { Header = "Close" }; closeItem.Click += (s, e) => Close(); ContextMenu.Items.Add(closeItem); }
protected override void ExecuteCmdlet() { ProfileLoader profileLoader = ProfileLoader.GetProfileLoader(ClientContext); profileLoader.CreatePersonalSiteEnqueueBulk(Email); ClientContext.ExecuteQueryRetry(); }
protected void Page_Load(object sender, EventArgs e) { var spContext = SharePointContextProvider.Current.GetSharePointContext(Context); using (ClientContext clientContext = spContext.CreateUserClientContextForSPHost()) { // Get user profile ProfileLoader loader = Microsoft.SharePoint.Client.UserProfiles.ProfileLoader.GetProfileLoader(clientContext); UserProfile profile = loader.GetUserProfile(); Microsoft.SharePoint.Client.Site personalSite = profile.PersonalSite; clientContext.Load(personalSite); clientContext.ExecuteQuery(); // Let's check if the site already exists if (personalSite.ServerObjectIsNull.Value) { profile.CreatePersonalSiteEnque(true); clientContext.ExecuteQuery(); } else { Web rootWeb = personalSite.RootWeb; clientContext.Load(rootWeb); clientContext.ExecuteQuery(); // Setting the custom theme to host web SetThemeBasedOnName(clientContext, rootWeb, "Orange"); } } }
public Manager(Controller controller, ObjectManager objectManager, ProfileLoader profileLoader) { Controller = controller; ObjectManager = objectManager; ProfileLoader = profileLoader; pulse = new MainThread.Updater(Pulse, 100); master = new object(); }
public void Initialization_Twice_Exception() { var path = GetFileFolder(_correctFilesFolderName); var loader = new ProfileLoader(path, _profileFileName); loader.Init(); loader.Init(); }
public void Initialization_WithWrongConfigFile_Exception() { Assert.Throws(Is.InstanceOf <IOException>(), () => { var path = GetFileFolder("Initialization_WithWrongConfigFile_Exceptions"); var loader = new ProfileLoader(path, _profileFileName); loader.Init(); }); }
public Manager(CCLoader ccLoader, Controller controller, ObjectManager objectManager, ProfileLoader profileLoader) { CCLoader = ccLoader; Controller = controller; ObjectManager = objectManager; ProfileLoader = profileLoader; MainThread = new MainThread.Updater(Pulse, 250); obj = new object(); }
public void Initialization_WithCorrectData_Success() { var path = GetFileFolder(_correctFilesFolderName); var loader = new ProfileLoader(path, _profileFileName); loader.Init(); Assert.AreEqual(2, loader.Profiles.Count); Assert.AreEqual(3, loader.Profiles.First().Entries.Count); Assert.AreEqual(2, loader.Profiles.Last().Entries.Count); }
public NPCScanModule( ObjectManager objectManager, PathModule pathModule, ProfileLoader profileLoader, Skills skills) { ObjectManager = objectManager; PathModule = pathModule; ProfileLoader = profileLoader; Skills = skills; }
/// <summary> /// Populate the map from the members of a profile/tag. /// </summary> private void PopulateByProfile() { if (Request.Params["populateProfileID"] != null) { foreach (String profileString in Request.Params["populateProfileID"].Split(',')) { PlacemarkLoader loader = new ProfileLoader(Convert.ToInt32(profileString)); loader.PopulateWith = (PopulationType)Convert.ToInt32(ddlPopulateWith.SelectedValue); map.Loaders.Add(loader); } } }
protected void Page_Load(object sender, EventArgs e) { Uri hostWeb = new Uri(Request.QueryString["SPHostUrl"]); // Notice that we use direct client context, not using SP App auth pattern. This is so that we execute the code // only in the context of the particular user and ignoring app permissions completely. using (ClientContext clientContext = new ClientContext(hostWeb)) { // Get user profile ProfileLoader loader = Microsoft.SharePoint.Client.UserProfiles.ProfileLoader.GetProfileLoader(clientContext); UserProfile profile = loader.GetUserProfile();; Microsoft.SharePoint.Client.Site personalSite = profile.PersonalSite; clientContext.Load(personalSite); clientContext.ExecuteQuery(); // Let's check if the site already exists if (personalSite.ServerObjectIsNull.Value) { // Let's queue the personal site creation using oob timer job based approach // Using async mode, since end user could go away from browser, you could do this using oob web part as well profile.CreatePersonalSiteEnque(true); clientContext.ExecuteQuery(); Response.Write("No my site exists. Currently provisioning..."); } else { // Site already exists, let's modify the branding by applyign a theme... just as well you could upload // master page and set that to be shown. Notice that you can also modify this code to change the branding // later and updates would be reflected whenever user visits my site host... or any other location where this // app part is located. You could place this also to front page of the intranet for ensuring that it's applied. using (ClientContext subContext = new ClientContext(personalSite.Url)) { // Let's update the theme colors of the my site Microsoft.SharePoint.Client.Web rootWeb = subContext.Web; subContext.Load(rootWeb); subContext.ExecuteQuery(); rootWeb.ApplyTheme(URLCombine(rootWeb.ServerRelativeUrl, "/_catalogs/theme/15/palette008.spcolor"), URLCombine(rootWeb.ServerRelativeUrl, "/_catalogs/theme/15/fontscheme003.spfont"), null, false); subContext.ExecuteQuery(); // Just to output status Response.Write("My site exists: " + personalSite.Url + " - web title - " + subContext.Web.Title); } } } }
void LoadProfile() { //Debug.Log("Clicked!"); if (Profile != null) { ProfileCopier copier = FindObjectOfType <ProfileCopier>(); ProfileLoader loader = FindObjectOfType <ProfileLoader>(); ProfileSetter setter = FindObjectOfType <ProfileSetter>(); ProfileUI ui = FindObjectOfType <ProfileUI>(); setter.CurrentProfile = copier.CopyProfile(Profile); loader.LoadProfile(setter.CurrentProfile); ui.Close(ProfileUI.CloseType.loadPanelLoad); } }
public void BlankProfileDoesntLoadProfiles() { var _runnerContextMock = new Mock <IRunnerContext>(); var _runnerMock = new Mock <IMigrationRunner>(); var _conventionsMock = new Mock <IMigrationConventions>(); _runnerContextMock.SetupGet(x => x.Profile).Returns(string.Empty); _runnerMock.SetupGet(x => x.MigrationAssembly).Returns(typeof(MigrationRunnerTests).Assembly); var profileLoader = new ProfileLoader(_runnerContextMock.Object, _runnerMock.Object, _conventionsMock.Object); profileLoader.ApplyProfiles(); profileLoader.Profiles.Count().ShouldBe(0); }
public void BlankProfileDoesntLoadProfiles() { var runnerContextMock = new Mock <IRunnerContext>(); var runnerMock = new Mock <IMigrationRunner>(); var conventionsMock = new Mock <IMigrationRunnerConventions>(); runnerContextMock.Setup(x => x.Profile).Returns(string.Empty); //_runnerContextMock.VerifyGet(x => x.Profile).Returns(string.Empty); runnerMock.SetupGet(x => x.MigrationAssemblies).Returns(new SingleAssembly(typeof(MigrationRunnerTests).Assembly)); var profileLoader = new ProfileLoader(runnerContextMock.Object, runnerMock.Object, conventionsMock.Object); profileLoader.ApplyProfiles(); profileLoader.Profiles.Count().ShouldBe(0); }
private void BtnSave_Click(object sender, EventArgs e) { Profile p = new Profile(); p.MAC = "2C:4D:54:EA:22:75"; p.Description = "DHCP"; p.DHCP = true; // p.DNS.Add(new DomainNameServer("8.8.8.8")); //p.DefaultGateway.Add(new Gateway("192.168.0.1")); // p.IP.Add(new IPAddress("192.168.0.25", "255.255.255.0")); // p.IP.Add(new IPAddress("172.16.20.1", "255.255.255.0")); ProfileLoader pl = new ProfileLoader(); pl.Save(p); }
public void Initialization_WithCorrectDataByAbsolutePath_Success() { var path = GetFileFolder("Initialization_WithCorrectDataByAbsolutePath_Success"); File.WriteAllLines(Path.Combine(path, _profileFileName), new [] { Path.Combine(path, "folder1", "a.txt"), Path.Combine(path, "folder2", "b.txt") }); var loader = new ProfileLoader(path, _profileFileName); loader.Init(); Assert.AreEqual(2, loader.Profiles.Count); Assert.AreEqual(3, loader.Profiles.First().Entries.Count); Assert.AreEqual(2, loader.Profiles.Last().Entries.Count); }
public string LoadCIMRDFSFile(string location) { try { profile = null; using (fs = File.Open(location, FileMode.Open)) { ProfileLoader rdfParser = new ProfileLoader(); profile = rdfParser.LoadProfileDocument(fs, location); } } catch (Exception e) { return("An error occurred.\n\n{0}" + e.Message); } return(profile.ToString()); }
void OnBnEditMajorations(object sender, EventArgs e) { try { if (null != ProfileLoader) { ProfileLoader.EditMajorations(); } SetParametersDirty(); FitView(); } catch (Exception ex) { log.Error(ex.ToString()); MessageBox.Show(ex.Message); } }
public void Initialization_WithWrongPathByAbsolutePath_Exception() { Assert.Throws(Is.InstanceOf <IOException>(), () => { var path = GetFileFolder("Initialization_WithCorrectDataByAbsolutePath_Success"); File.WriteAllLines(Path.Combine(path, _profileFileName), new[] { Path.Combine(path, "folder1", "ObviouslyWrongPath", "a.txt"), Path.Combine(path, "folder2", "ObviouslyWrongPath", "b.txt") }); var loader = new ProfileLoader(path, _profileFileName); loader.Init(); Assert.AreEqual(2, loader.Profiles.Count); Assert.AreEqual(3, loader.Profiles.First().Entries.Count); Assert.AreEqual(2, loader.Profiles.Last().Entries.Count); }); }
protected void Page_Load(object sender, EventArgs e) { // Check if we should skip this check. We do this only once per hour to avoid // perf issues and there's really no point even hitting the user profile // in every request. if (CookieCheckSkip()) { return; } var spContext = SharePointContextProvider.Current.GetSharePointContext(Context); using (ClientContext clientContext = spContext.CreateUserClientContextForSPHost()) { // Get user profile ProfileLoader loader = ProfileLoader.GetProfileLoader(clientContext); UserProfile profile = loader.GetUserProfile(); Microsoft.SharePoint.Client.Site personalSite = profile.PersonalSite; clientContext.Load(profile, prof => prof.AccountName); clientContext.Load(personalSite); clientContext.ExecuteQuery(); // Let's check if the site already exists if (personalSite.ServerObjectIsNull.Value) { // Let's queue the personal site creation using oob timer job based // approach using async mode, since end user could go away from // browser, you could do this using oob web part as well profile.CreatePersonalSiteEnque(true); clientContext.ExecuteQuery(); WriteDebugInformationIfNeeded("OneDrive for Business site was not present, queued for provisioning now."); } else { // Site already exists, let's create a task to the Azure queue for web job to start processing these requests... // Notice that we bypass the site collection URL as the parameter to the queue, so that web job knows which site collection to process AddConfigurationRequestToQueue(profile.AccountName, profile.PersonalSite.Url); // Let's add taks to the queueu for configuration check up. WriteDebugInformationIfNeeded(string.Format("OneDrive for Business site existed at {0}. Configuration check up task created.", personalSite.Url)); } } }
public void LoadProfile() { Debug.Log("Attempting to Load the original profile."); GameManager instance = FindObjectOfType <GameManager>(); ProfileSaver saver = FindObjectOfType <ProfileSaver>(); ProfileCopier copier = FindObjectOfType <ProfileCopier>(); ProfileLoader loader = FindObjectOfType <ProfileLoader>(); ProfileSetter setter = FindObjectOfType <ProfileSetter>(); ProfileMessager messager = FindObjectOfType <ProfileMessager>(); Debug.Log("Loading profile named " + instance.Profiles[saver.profileToLoad].Name + "."); setter.CurrentProfile = copier.CopyProfile(instance.Profiles[saver.profileToLoad]); loader.LoadProfile(setter.CurrentProfile); ui.Close(ProfileUI.CloseType.nameCheckLoad); }
public async Task SamplePrivateServerProfile() { var fs = new MockFileSystem(); fs.WriteSampleProfile( "C:\\Users\\TestUser\\AppData\\Local\\BnSLauncher\\Profiles\\PrivateServer", "PrivateServer"); var profileLoader = new ProfileLoader(fs, _logger, new NullSampleProfileWriter()); var profiles = await profileLoader.LoadProfiles( "C:\\Users\\TestUser\\AppData\\Local\\BnSLauncher\\Profiles"); Assert.AreEqual(1, profiles.Count, "Must only load 1 profile"); var profile = profiles.First(); Assert.AreEqual( "C:\\Users\\TestUser\\AppData\\Local\\BnSLauncher\\Profiles\\PrivateServer", profile.ProfilePath, "Profile paths must be equal"); Assert.AreEqual( "C:\\Users\\TestUser\\AppData\\Local\\BnSLauncher\\Profiles\\PrivateServer\\bnspatch.xml", profile.BnsPatchPath, "Bns patch paths must be equal"); Assert.AreEqual("Private Server", profile.Name, "Names must be equal"); Assert.AreEqual('P', profile.Initial, "Initials must be equal"); Assert.AreEqual("red", profile.Background, "Backgrounds must be equal"); Assert.AreEqual("white", profile.Foreground, "Foregrounds must be equal"); Assert.AreEqual(".\\bin\\Client.exe", profile.ClientPath, "Client paths must be equal"); Assert.AreEqual("/LaunchByLauncher /LoginMode 2", profile.Arguments, "Arguments must be equal"); Assert.AreEqual("127.0.0.1", profile.Ip, "Ips must be equal"); Assert.AreEqual(10900, profile.Port, "Ports must be equal"); Assert.IsNull(profile.BinPath, "Bin path must be null"); Assert.IsNull(profile.LocalBinPath, "Local bin path must be null"); Assert.IsTrue(profile.AllowAccounts, "This profile must allow accounts"); Assert.IsFalse(profile.AllowPin, "This profile must not require pin"); Assert.IsFalse(profile.AutopinOnRelog, "This profile must not auto pin on relog"); }
/// <summary> /// Sample Member that provisions personal sites leveraging CSOM /// You dont want to do provision more than 200 users during a single request. If you have a large amount of users consider // waiting for the last users site to be provisioned. The reason behind this is not to bombard the service with requests. /// </summary> /// <param name="tenantAdminUrl">The Tenanat Admin URL for your SharePoint Online Subscription</param> /// <param name="spoCredentials">The Credentials of the user who has tenant admin permission.</param> /// <param name="emailIDs">The email ids for users whos personal site you want to create.</param> public static void CreatePersonalSiteUsingCSOM(SharePointOnlineCredentials spoCredentials, string tenantAdminUrl, string[] emailIDs) { using (ClientContext _context = new ClientContext(tenantAdminUrl)) { try { _context.AuthenticationMode = ClientAuthenticationMode.Default; _context.Credentials = spoCredentials; ProfileLoader _profileLoader = ProfileLoader.GetProfileLoader(_context); _profileLoader.CreatePersonalSiteEnqueueBulk(emailIDs); _profileLoader.Context.ExecuteQuery(); } catch (Exception _ex) { Console.WriteLine(string.Format("Opps, something went wrong and we need to work on it. The error message is {0}", _ex.Message)); } } }
public async Task SampleLiveEU32Profile() { var fs = new MockFileSystem(); fs.WriteSampleProfile( "C:\\Users\\TestUser\\AppData\\Local\\BnSLauncher\\Profiles\\LiveEU32", "LiveEU32"); var profileLoader = new ProfileLoader(fs, _logger, new NullSampleProfileWriter()); var profiles = await profileLoader.LoadProfiles( "C:\\Users\\TestUser\\AppData\\Local\\BnSLauncher\\Profiles"); Assert.AreEqual(1, profiles.Count, "Must only load 1 profile"); var profile = profiles.First(); Assert.AreEqual( "C:\\Users\\TestUser\\AppData\\Local\\BnSLauncher\\Profiles\\LiveEU32", profile.ProfilePath, "Profile paths must be equal"); Assert.AreEqual( "C:\\Users\\TestUser\\AppData\\Local\\BnSLauncher\\Profiles\\LiveEU32\\bnspatch.xml", profile.BnsPatchPath, "Bns patch paths must be equal"); Assert.AreEqual("Live EU 32-bit", profile.Name, "Names must be equal"); Assert.AreEqual('L', profile.Initial, "Initials must be equal"); Assert.AreEqual("green", profile.Background, "Backgrounds must be equal"); Assert.AreEqual("white", profile.Foreground, "Foregrounds must be equal"); Assert.AreEqual("C:\\Program Files (x86)\\NCSOFT\\BnS\\bin\\Client.exe", profile.ClientPath, "Client paths must be equal"); Assert.AreEqual("/sesskey /launchbylauncher -lang:English -region:1", profile.Arguments, "Arguments must be equal"); Assert.IsNull(profile.Ip, "Ip must be null"); Assert.AreEqual(0, profile.Port, "Ports must be 0"); Assert.IsNull(profile.BinPath, "Bin path must be null"); Assert.IsNull(profile.LocalBinPath, "Local bin path must be null"); Assert.IsTrue(profile.AllowAccounts, "This profile must allow accounts"); Assert.IsTrue(profile.AllowPin, "This profile must require pin"); Assert.IsFalse(profile.AutopinOnRelog, "This profile must not auto pin on relog"); }
public CMD( Common common, ProfileLoader profileLoader) { Common = common; ProfileLoader = profileLoader; InitializeComponent(); FormClosing += new FormClosingEventHandler(OnFormClosing); InitialiseRestingValues(); CorpseLoot.Checked = GrinderDefault.CorpseLoot; CorpseSkin.Checked = GrinderDefault.CorpseSkin; KeepGreens.Checked = GrinderDefault.KeepGreens; KeepBlues.Checked = GrinderDefault.KeepBlues; KeepPurples.Checked = GrinderDefault.KeepPurples; NinjaSkin.Checked = GrinderDefault.NinjaSkin; ProtectedItems.Text = GetProtectedItems(); SearchRadiusInput.Value = GrinderDefault.SearchRadius; }