public Inject Load() { if (R.isSessionLost() == true) { return lostInject(); } Inject response = new Inject(); //setup response response.element = ".winDashboardInterface > .content"; //setup scaffolding variables Scaffold scaffold = new Scaffold(R, "/app/dashboard/interface.html", "", new string[] { "website-title", "apps-list", "menu-pages", "menu-photos", "menu-analytics", "menu-users", "menu-apps", "menu-settings"}); scaffold.Data["website-title"] = R.Page.websiteTitle; //check security //if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == true) { } scaffold.Data["menu-pages"] = "true"; scaffold.Data["menu-photos"] = "true"; scaffold.Data["menu-analytics"] = "true"; scaffold.Data["menu-users"] = "true"; scaffold.Data["menu-apps"] = "true"; scaffold.Data["menu-settings"] = "true"; //load list of apps into dashboard menu scaffold.Data["apps-list"] = ""; //finally, scaffold Rennder platform HTML response.html = scaffold.Render(); response.js = CompileJs(); return response; }
public Inject ForgotPassword() { //this feature is very vulnerable to attack and should //require 2-way authentication (via cell phone) var response = new Inject(); if (S.isSessionLost()) { return lostInject(); } return response; }
public string Authenticate(string authId) { //authenticate login info from parent window Inject result = new Inject(); if (R.User.LogIn(authId) == true) { return "dashboard"; } return ""; }
public Inject LoadSubPages(int parentId) { if (R.isSessionLost() == true) { return lostInject(); } Inject response = new Inject(); //check security if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false) { return response; } //setup response response.element = ".winWebPages > .content .pages-list"; response.html = LoadPagesList(parentId,false); response.js = CompileJs(); return response; }
public Inject LoadPhotoList(int start, string folder, string search, int orderby) { if (R.isSessionLost() == true) { return lostInject(); } Inject response = new Inject(); //check security if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/photos", 0) == false) { return response; } //setup response response.element = ".winPhotos .photo-list"; //finally, scaffold Rennder platform HTML response.html = GetPhotos(start, 100, folder, search, orderby); response.js = CompileJs(); return response; }
public Inject ComponentProperties(string id, string section) { if (R.isSessionLost() == true) { return lostInject(); } Inject response = new Inject(); response.element = ".winProperties .props-content"; //check security if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false) { return response; } //load properties window ComponentView comp = R.Page.GetComponentViewById(id); string cid = comp.ComponentName.Replace(" ", "."); string className = "Rennder.Components.Properties." + cid; Type type = Type.GetType(className, false, true); if (type == null) { return response; } ComponentProperties properties = (ComponentProperties)Activator.CreateInstance(type, new object[] { R, comp }); if (comp == null) { return response; } //load properties.js string js = ""; if (R.Server.Cache.ContainsKey("props-" + cid) == true & R.isLocal == false) { //load from cache js = (string)R.Server.Cache["props-" + cid]; } else { //load from file string jsp = File.ReadAllText(R.Server.MapPath("/app/components/" + cid + "/properties.js")); js = jsp; if (R.isLocal == false) { //save to cache R.Server.Cache.Add("props-" + cid, jsp); } } R.Page.RegisterJS("props", "R.editor.components.properties.loaded('" + comp.ComponentName + "'," + properties.Width + ");" + js); //finally, render properties window response.html = properties.Render(); response.js = CompileJs(); return response; }
public Inject LoadPhotos() { if (R.isSessionLost() == true) { return lostInject(); } Inject response = new Inject(); //check security if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/photos", 0) == false) { return response; } //setup response response.element = ".winPhotos > .content"; //finally, scaffold Rennder platform HTML response.html = GetPhotos(); response.js = CompileJs(); return response; }
public Inject Load() { if (R.isSessionLost() == true) { return lostInject(); } Inject response = new Inject(); //check security if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/timeline", 0) == false) { return response; } //setup response response.element = ".winDashboardTimeline > .content"; //setup scaffolding variables Scaffold scaffold = new Scaffold(R, "/app/dashboard/timeline.html", "", new string[] { "test" }); scaffold.Data["test"] = R.Page.websiteTitle; //finally, scaffold Rennder platform HTML response.html = scaffold.Render(); response.js = CompileJs(); return response; }
public Inject LoadPages() { if (R.isSessionLost() == true) { return lostInject(); } Inject response = new Inject(); //check security if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false) { return response; } //setup scaffold Scaffold scaffold = new Scaffold(R, "/app/dashboard/pages.html", "", new string[] { "page-title", "page-list", "help" }); scaffold.Data["page-title"] = ""; scaffold.Data["page-list"] = LoadPagesList(); scaffold.Data["help"] = RenderHelpColumn("/App/Help/dashboard/pages.html"); //setup response response.element = ".winWebPages > .content"; response.html = scaffold.Render(); response.js = CompileJs(); return response; }
public Inject AddFolder(string name) { if (R.isSessionLost() == true) { return lostInject(); } Inject response = new Inject(); //check security if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/photos", 0) == false) { return response; } //setup response response.element = ".winPhotos .folder-list"; //execute SQL SqlClasses.Dashboard sqlDash = new SqlClasses.Dashboard(R); sqlDash.AddPhotoFolder(R.Page.websiteId, name); R.Page.RegisterJS("addfolder", "R.editor.photos.folders.hideAdd();"); //finally, scaffold Rennder platform HTML response.html = GetFolders(); response.js = CompileJs(); return response; }
public void InjectProtectedField() { // Act Container.RegisterType <DependencyInjectedType>( Inject.Field("ProtectedField", "test")); }
static void Main(string[] args) { // Program is injected by the Inject class to provide UserController new Program(Inject.ProvideUserController()); }
public void attach() { Inject inject = new Inject(); inject.attach(); }
public void InjectProtectedProperty() { // Act Container.RegisterType <DependencyInjectedType>( Inject.Property("ProtectedProperty", "test")); }
public void InjectStaticProperty() { // Act Container.RegisterType <DependencyInjectedType>( Inject.Property(nameof(DependencyInjectedType.StaticProperty), "test")); }
public UnitStartup(IMessageSink messageSink) : base(messageSink) { var services = Inject.Create(); services.Build(); }
public Inject ComponentProperties(string id, string section) { if (R.isSessionLost() == true) { return(lostInject()); } Inject response = new Inject(); response.element = ".winProperties .props-content"; //check security if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false) { return(response); } //load properties window ComponentView comp = R.Page.GetComponentViewById(id); string cid = comp.ComponentName.Replace(" ", "."); string className = "Rennder.Components.Properties." + cid; Type type = Type.GetType(className, false, true); if (type == null) { return(response); } ComponentProperties properties = (ComponentProperties)Activator.CreateInstance(type, new object[] { R, comp }); if (comp == null) { return(response); } //load properties.js string js = ""; if (R.Server.Cache.ContainsKey("props-" + cid) == true & R.isLocal == false) { //load from cache js = (string)R.Server.Cache["props-" + cid]; } else { //load from file string jsp = File.ReadAllText(R.Server.MapPath("/app/components/" + cid + "/properties.js")); js = jsp; if (R.isLocal == false) { //save to cache R.Server.Cache.Add("props-" + cid, jsp); } } R.Page.RegisterJS("props", "R.editor.components.properties.loaded('" + comp.ComponentName + "'," + properties.Width + ");" + js); //finally, render properties window response.html = properties.Render(); response.js = CompileJs(); return(response); }
public void Validation_ReadOnlyProperty() { // Act Container.RegisterType <ObjectWithFourFields>( Inject.Field(nameof(ObjectWithFourFields.ReadOnlyField), "test")); }
public void InjectStaticField() { // Act Container.RegisterType <DependencyInjectedType>( Inject.Field(nameof(DependencyInjectedType.StaticField), "test")); }
// Token: 0x060000FE RID: 254 RVA: 0x00015024 File Offset: 0x00013224 private void metroButton2_Click(object sender, EventArgs e) { ModuleDef moduleDef = ModuleDefMD.Load(this.metroTextBox1.Text); bool numberToString = Settings.NumberToString; if (numberToString) { Constants__numbers_.ObfuscateNumbers(moduleDef); } bool stackUnderflow = Settings.StackUnderflow; if (stackUnderflow) { Stack_Underflow.StackUnderflow(moduleDef); } bool sizeOf = Settings.SizeOf; if (sizeOf) { SizeOf.Sizeof(moduleDef); } bool disConstants = Settings.DisConstants; if (disConstants) { Distant_Constants.DisConstants(moduleDef); } bool refProxy = Settings.RefProxy; if (refProxy) { Method_Wiper.Execute(moduleDef); } bool constants = Settings.Constants; if (constants) { Constants__numbers_.Inject(moduleDef); } bool localToFields = Settings.LocalToFields; if (localToFields) { LocalToFields.Protect(moduleDef); } bool renamer = Settings.Renamer; if (renamer) { Renamer.Execute(moduleDef); } bool controlFlow = Settings.ControlFlow; if (controlFlow) { Control_Flow.Encrypt(moduleDef); Constants__numbers_.Execute(moduleDef); } bool constant_Mutation = Settings.Constant_Mutation; if (constant_Mutation) { Constant_Mutation.Execute(moduleDef); } bool antiDe4dot = Settings.AntiDe4dot; if (antiDe4dot) { Anti_De4dot.RemoveDe4dot(moduleDef); } bool antiILdasm = Settings.AntiILdasm; if (antiILdasm) { Anti_ILDasm.Anti(moduleDef); } bool koiVMFakeSig = Settings.KoiVMFakeSig; if (koiVMFakeSig) { KoiVM_Fake_Watermark.Execute(moduleDef); } bool antiDump = Settings.AntiDump; if (antiDump) { AntiDump.Inject(moduleDef); } bool invalidMetadata = Settings.InvalidMetadata; if (invalidMetadata) { Invalid_Metadata.InvalidMD(moduleDef); } bool calli = Settings.Calli; if (calli) { Calli.Execute(moduleDef); } bool antiHTTPDebugger = Settings.AntiHTTPDebugger; if (antiHTTPDebugger) { Anti_Http_Debugger.Execute(moduleDef); } bool antiFiddler = Settings.AntiFiddler; if (antiFiddler) { Anti_Fiddler.Execute(moduleDef); } bool stringEncryption = Settings.StringEncryption; if (stringEncryption) { String_Encryption.Inject(moduleDef); } Watermark.Execute(moduleDef); ModuleDef manifestModule = moduleDef.Assembly.ManifestModule; moduleDef.EntryPoint.Name = "BlinkRE"; moduleDef.Mvid = new Guid?(Guid.NewGuid()); bool strong = Settings.Strong; if (strong) { Protection.Protect(moduleDef); Inject.ProtectValue(moduleDef); Inject.DoubleProtect(moduleDef); Inject.Triple(moduleDef); Inject.Triple(moduleDef); Method_Wiper.Execute(moduleDef); Assembly.MarkAssembly(moduleDef); Locals.Protect(moduleDef); } Directory.CreateDirectory(".\\AtomicProtected"); moduleDef.Write(".\\AtomicProtected\\" + Path.GetFileName(this.metroTextBox1.Text), new ModuleWriterOptions(moduleDef) { PEHeadersOptions = { NumberOfRvaAndSizes = new uint?(13U) }, MetaDataOptions = { TablesHeapOptions = { ExtraData = new uint?(4919U) } }, Logger = DummyLogger.NoThrowInstance }); Process.Start(".\\AtomicProtected"); MessageBox.Show("Obfuscation complete! Restart to obfuscate again"); Environment.Exit(0); }
// Use this for initialization void Start() { Debug.LogFormat("Normal Max:{0}", Normal.GetMax(6, 9)); Debug.LogFormat("Inject Max:{0}", Inject.GetMax(6, 9)); }
public Entity(Inject inject) { Inject = inject; }
private void Run() { int runCounter = 0; while (Running) { try { if (ObjectManager.isProcessOpen) { if (ObjectManager.IsWowCrashed()) { Process.GetProcessById(BmWrapper.memory.ProcessId).Kill(); continue; } if (ObjectManager.LoginState == "login") { Calls.DoString("DefaultServerLogin('" + Data.AccName + "', '" + Data.AccPw + "');"); int wait = 0; while (!ObjectManager.IsWowCrashed() && ObjectManager.characterCount() == 0) { Thread.Sleep(500); wait++; if (wait >= 120) { Process.GetProcessById(BmWrapper.memory.ProcessId).Kill(); break; } } afterDc = true; } else if (ObjectManager.LoginState == "charselect" && afterDc) { if (!ObjectManager.IsWowCrashed()) { // Enter -> Login SendMessage(BmWrapper.memory.WindowHandle, WM_KEYDOWN, 0x0D, 0); SendMessage(BmWrapper.memory.WindowHandle, WM_KEYUP, 0x0D, 0); } while (!ObjectManager.IsWowCrashed() && ObjectManager.playerPtr == 0 && Running) { Thread.Sleep(100); } while (!ObjectManager.IsWowCrashed() && ObjectManager.PlayerObject.Pos.x == 0 && Running) { Thread.Sleep(100); } if (!ObjectManager.IsWowCrashed()) { Ingame.Tele(Mailbox, 60, true); Calls.SendMovementUpdate(0xEE, (uint)Environment.TickCount); } } if (runCounter < 60) { if (ObjectManager.playerPtr != 0) { while (!ObjectManager.IsWowCrashed() && ObjectManager.PlayerObject.Pos.differenceTo(Mailbox) > 2) { Ingame.Tele(Mailbox, 60, true); } afterDc = false; Calls.AntiAfk(); Objects.GameObject mailbox = new Objects.GameObject(0, 0, 0); while (!ObjectManager.IsWowCrashed() && mailbox.baseAdd == 0 && Running && !(ObjectManager.LoginState == "login")) { mailbox = ObjectManager.GetGameObjectById(mbId); } if (!ObjectManager.IsWowCrashed()) { Calls.OnRightClickObject(mailbox.baseAdd, 0); } while (!ObjectManager.IsWowCrashed() && !(Calls.GetText(mailLua, "troll1", 10).Trim() == "true") && Running && !(ObjectManager.LoginState == "login")) { Thread.Sleep(100); } Thread.Sleep(1500); if (!ObjectManager.IsWowCrashed()) { //Calls.DoString("TakeInboxItem(1, 1) Logout()"); SendMessage(BmWrapper.memory.WindowHandle, WM_KEYDOWN, 0x31, 0); SendMessage(BmWrapper.memory.WindowHandle, WM_KEYUP, 0x31, 0); Calls.PacketZoneChange(); Calls.PacketSendLogout(); } while (!ObjectManager.IsWowCrashed() && ObjectManager.characterCount() == 0 && Running && !(ObjectManager.LoginState == "login")) { Thread.Sleep(100); } Thread.Sleep(250); if (!ObjectManager.IsWowCrashed()) { // Enter -> Login SendMessage(BmWrapper.memory.WindowHandle, WM_KEYDOWN, 0x0D, 0); SendMessage(BmWrapper.memory.WindowHandle, WM_KEYUP, 0x0D, 0); } while (!ObjectManager.IsWowCrashed() && ObjectManager.playerPtr == 0 && Running && !(ObjectManager.LoginState == "login")) { Thread.Sleep(100); } runCounter++; } } else { if (doVendor) { while (!ObjectManager.IsWowCrashed() && ObjectManager.PlayerObject.Pos.differenceTo(Vendor) > 2) { Ingame.Tele(Vendor, 60, true); } if (!ObjectManager.IsWowCrashed()) { Calls.SendMovementUpdate(0xEE, (uint)Environment.TickCount); } Objects.UnitObject vendorObject = new Objects.UnitObject(0, 0, 0); while (!ObjectManager.IsWowCrashed() && vendorObject.baseAdd == 0 && Running) { vendorObject = ObjectManager.GetUnitByName(vendorName); } if (!ObjectManager.IsWowCrashed()) { Calls.OnRightClickUnit(vendorObject.baseAdd, 0); } while (!ObjectManager.IsWowCrashed() && !(Calls.GetText(vendorLua, "troll1", 10).Trim() == "true") && Running) { Thread.Sleep(100); } if (!ObjectManager.IsWowCrashed()) { Ingame.SellAll(); } while (!ObjectManager.IsWowCrashed() && ObjectManager.PlayerObject.Pos.differenceTo(Mailbox) > 2) { Ingame.Tele(Mailbox, 60, true); } if (!ObjectManager.IsWowCrashed()) { Calls.SendMovementUpdate(0xEE, (uint)Environment.TickCount); } runCounter = 0; } else { break; } } } else { if (!ObjectManager.isProcessOpen) { ObjectManager.runThread = false; ChatReader.runThread = false; Inject.Restore(); BmWrapper.memory.Close(); Process WoW = Process.Start(@"C:\Users\Cody\Desktop\WoW 1.12.1\Feenix 1.12 client\WoW.exe"); Thread.Sleep(30000); BmWrapper.memory.OpenProcessAndThread(WoW.Id); Inject.Apply(); Inject.Init(); MoveWindow(BmWrapper.memory.WindowHandle, 0, 0, 153, 119, true); ObjectManager.getObjThread = new Thread(ObjectManager.getObj); ObjectManager.getObjThread.IsBackground = true; ObjectManager.runThread = true; ObjectManager.getObjThread.Start(); ChatReader.readChatThread = new Thread(ChatReader.readChat); ChatReader.readChatThread.IsBackground = true; ChatReader.runThread = true; ChatReader.readChatThread.Start(); } } } catch { } } Exchange.IsEngineRunning = false; Exchange.CurrentEngine = "None"; DupeEngine.engine = null; }
public void InvalidValue() { // Act Container.RegisterType <Specification.Property.Injection.ObjectWithThreeProperties>( Inject.Property(nameof(Specification.Property.Injection.ObjectWithThreeProperties.Container), Name)); }
public void InvalidValue() { // Act Container.RegisterType <Specification.Field.Injection.ObjectWithThreeFields>( Inject.Field(nameof(Specification.Field.Injection.ObjectWithThreeFields.Container), Name)); }
public void InjectReadOnlyField() { // Act Container.RegisterType <DependencyInjectedType>( Inject.Field(nameof(DependencyInjectedType.ReadonlyField), "test")); }
private void OnRequestHandlerInject(object o, WebInjectEventArgs webInjectEventArgs) { Inject?.Invoke(this, webInjectEventArgs); }
private void InjectButton_Click(object sender, EventArgs e) { if (!Inject.GetDll()) { StatusLabel.Text = "NotFound"; StatusLabel.ForeColor = Color.Red; StatusLabel.Left = 0; LegitBotButton.Enabled = false; legitControl1.Enabled = false; RageBotButton.Enabled = false; rageControl1.Enabled = false; SettingsButton.Enabled = false; settingsControl1.Enabled = false; DebugButton.Enabled = true; } else { StatusLabel.Text = "Found"; StatusLabel.ForeColor = Color.Green; StatusLabel.Left = 22; LegitBotButton.Enabled = true; legitControl1.Enabled = true; RageBotButton.Enabled = true; rageControl1.Enabled = true; SettingsButton.Enabled = true; settingsControl1.Enabled = true; DebugButton.Enabled = true; Thread.Sleep(500); //checkcsgo Thread checkcs = new Thread(Inject.Check); Variable.check = true; checkcs.Start(); //уведомление в начале string notif_text = "Press 'Insert' to enable Cheat"; Notifier.Notif(notif_text); //распаковка hazedumper и config.json string temp_hazedumper = Application.StartupPath + "/hazedumper.exe"; if (File.Exists(temp_hazedumper)) { File.Delete(temp_hazedumper); } File.WriteAllBytes(temp_hazedumper, Properties.Resources.hazedumper); string temp_config = Application.StartupPath + "/config.json"; if (File.Exists(temp_config)) { File.Delete(temp_config); } File.WriteAllText(temp_config, Properties.Resources.config); _overlayStatus = false; OffsetsUpdater.DeleteFile(); OffsetsUpdater.GetOffsets(); //проверка оффсетов на их роботоспособность bool isOkay = true; string keyWord = "WARN"; var lines = File.ReadLines(Application.StartupPath + $"/hazedumper.log"); string result = string.Join("\n", lines.Where(s => s.IndexOf(keyWord, StringComparison.InvariantCultureIgnoreCase) >= 0)); if (result.Length != 0) { MessageBox.Show(result, "Offsets are not found", MessageBoxButtons.OK, MessageBoxIcon.Error); isOkay = false; } OffsetsUpdater.Update(); OffsetsUpdater.DeleteFile(); if (File.Exists(temp_hazedumper)) { File.Delete(temp_hazedumper); } if (File.Exists(temp_config)) { File.Delete(temp_config); } if (isOkay == false) { Process[] listprosecc = Process.GetProcesses(); try { foreach (Process proc in Process.GetProcessesByName(Variable.CheatName)) { proc.Kill(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } //отслеживание клавиши Insert gHook = new GlobalKeyboardHook(); gHook.KeyDown += new KeyEventHandler(gHook_KeyDown); foreach (Keys key in Enum.GetValues(typeof(Keys))) { gHook.HookedKeys.Add(key); } gHook.hook(); } }
public void Validation_InvalidValue() { // Act Container.RegisterType <ObjectWithThreeFields>( Inject.Field(nameof(ObjectWithThreeFields.Container), Name)); }
public Inject ComponentsFromCategory(int category) { if (R.isSessionLost() == true) { return lostInject(); } Inject response = new Inject(); response.element = "#component-list"; //check security if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false) { return response; } response.html = GetComponentsList(category); response.js = CompileJs(); return response; }
public Inject NewComponent(string componentId, string panelId, string selector, int x, int y, int panelWidth) { if (R.isSessionLost() == true) { return lostInject(); } Inject response = new Inject(); //check security if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false) { return response; } //setup response response.element = selector; response.inject = enumInjectTypes.append; //setup default properties for component string className = "Rennder.Components." + componentId.Replace("/", ".").Replace("-", "."); Type type = Type.GetType(className, false, true); if (type == null) { return response; } Component comp = (Component)Activator.CreateInstance(type, new object[] { R }); if (comp == null) { return response; } Panel panel = R.Page.GetPanelByName(panelId); //render new component comp = R.Page.LoadComponent(componentId, "", "", "", panel, "/content/websites/" + R.Page.ownerId + "/pages/" + R.Page.pageId, 1, R.Page.pageId, 1, true, "", ""); if(comp == null) { return response; } response.html = comp.Render(); //add JS to align component on page correctly string js = "(function(){var c = $('#c" + comp.itemId + "');" + "var options = {maxWidth:" + comp.defaultWidth + "};" + "c.css(options);" + "})();R.components.add('" + comp.itemId + "','" + componentId + "', '', '');"; R.Page.RegisterJS("newcomp", js); response.js = CompileJs(); return response; }
public void ReadOnlyProperty() { // Act Container.RegisterType <ObjectWithFourProperties>( Inject.Property(nameof(ObjectWithFourProperties.ReadOnlyProperty), "test")); }
public Inject RemoveComponent(string componentId) { if (R.isSessionLost() == true) { return lostInject(); } Inject response = new Inject(); //check security if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/pages", 0) == false) { return response; } for (int x = 0; x <= R.Page.ComponentViews.Count - 1; x++) { if (R.Page.ComponentViews[x].itemId == componentId) { R.Page.ComponentViews.Remove(R.Page.ComponentViews[x]); break; } } return response; }
public Inject MoveTo(string folder, string files) { if (R.isSessionLost() == true) { return lostInject(); } Inject response = new Inject(); //check security if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/photos", 0) == false) { return response; } //setup response response.element = ".winPhotos .photo-list"; //get list of files from database string[] filelist = files.Split(','); SqlClasses.Dashboard sqlDash = new SqlClasses.Dashboard(R); SqlReader reader = sqlDash.GetPhotos(R.Page.websiteId, filelist); //move files on disk into target folder if(reader.Rows.Count > 0) { string oldfolder = ""; string newfolder = folder; string newname = ""; string[] sizes = new string[] { "", "xl", "lg", "med", "sm", "tiny", "icon" }; string path = "/wwwroot/content/websites/" + R.Page.websiteId + "/photos/"; if (newfolder != "") { newfolder += "/"; } if(Directory.Exists(R.Server.MapPath(path + newfolder)) == false) { //create target folder if it doesn't exist Directory.CreateDirectory(R.Server.MapPath(path + newfolder)); } while (reader.Read() == true) { //move each file into the target folder oldfolder = reader.Get("foldername"); newname = reader.Get("filename"); if(oldfolder != "") { oldfolder += "/"; } for(var x = 0; x < sizes.Length; x++) { if(R.Server.MapPath("/wwwroot/content/websites/" + R.Page.websiteId + "/photos/" + oldfolder + sizes[x] + newname) != R.Server.MapPath("/wwwroot/content/websites/" + R.Page.websiteId + "/photos/" + newfolder + sizes[x] + newname)) { if (File.Exists(R.Server.MapPath("/wwwroot/content/websites/" + R.Page.websiteId + "/photos/" + oldfolder + sizes[x] + newname)) == true) { File.Move(R.Server.MapPath("/wwwroot/content/websites/" + R.Page.websiteId + "/photos/" + oldfolder + sizes[x] + newname), R.Server.MapPath("/wwwroot/content/websites/" + R.Page.websiteId + "/photos/" + newfolder + sizes[x] + newname)); } } } } } //execute SQL sqlDash.MovePhotos(R.Page.websiteId, filelist, folder); //finally, get a new list of photos response.html = GetPhotos(1, 100, folder); response.js = CompileJs(); return response; }
public void InvalidValue() { // Act Container.RegisterType <ObjectWithThreeProperties>( Inject.Property(nameof(ObjectWithThreeProperties.Container), Name)); }
public Inject RemoveFolder(string folder) { if (R.isSessionLost() == true) { return lostInject(); } Inject response = new Inject(); //check security if (R.User.Website(R.Page.websiteId).getWebsiteSecurityItem("dashboard/photos", 0) == false) { return response; } //setup response response.element = ".winPhotos .folder-list"; //execute SQL SqlClasses.Dashboard sqlDash = new SqlClasses.Dashboard(R); sqlDash.DeletePhotoFolder(R.Page.websiteId, folder); //finally, scaffold Rennder platform HTML response.html = GetFolders(); response.js = CompileJs(); return response; }