public PageInfo(string pstrFilePathAndName) { // mstrPageName = Strings.LCase(RemovePath(pstrFilePathAndName)); mstrPageName = RemovePath(pstrFilePathAndName); string sstrSource = null; sstrSource = OpenFile(pstrFilePathAndName); int slonProcessLocation = 0; //get control info ControlsInfo sclsControlsInfo = null; sclsControlsInfo = new ControlsInfo(); ControlInfo sclsFormControl = null; //first (top) control should be Begin Form sclsFormControl = sclsControlsInfo.GetControlsInfo(sstrSource, ref slonProcessLocation); mcolControlsByName = sclsControlsInfo.ControlsByName;//not used? mcolAllControls = sclsControlsInfo.AllControls; //GetControlsInfo above should leave slonProcessLocation at the end of Control area of file and just before Function area of file //get function info mclsFunctionsInfo = new FunctionsInfo(sstrSource, ref slonProcessLocation); mlstFunctions = mclsFunctionsInfo.Functions; //used in WritePHPPage function below mlstOpenFormNames = mclsFunctionsInfo.OpenFormNames; //used in WritePHPPage function below }
public void Load(Collection[,] StaticMap, string iFilename) { XmlDocument xmlDocument = new XmlDocument(); try { xmlDocument.Load(iFilename); XmlElement xmlElement1 = (XmlElement) xmlDocument.SelectSingleNode("//Static_Tiles"); try { foreach (XmlElement xmlElement2 in xmlElement1.SelectNodes("Tile")) { short iTileID = XmlConvert.ToInt16(xmlElement2.GetAttribute("TileID")); short num1 = XmlConvert.ToInt16(xmlElement2.GetAttribute("X")); short num2 = XmlConvert.ToInt16(xmlElement2.GetAttribute("Y")); short iZ = XmlConvert.ToInt16(xmlElement2.GetAttribute("Z")); short iHue = XmlConvert.ToInt16(xmlElement2.GetAttribute("Hue")); StaticCell staticCell = new StaticCell(iTileID, checked ((byte) unchecked ((int) num1 % 8)), checked ((byte) unchecked ((int) num2 % 8)), iZ, iHue); StaticMap[(int) (short) ((int) num1 >> 3), (int) (short) ((int) num2 >> 3)].Add((object) staticCell, (string) null, (object) null, (object) null); } } finally { IEnumerator enumerator; if (enumerator is IDisposable) ((IDisposable) enumerator).Dispose(); } } catch (Exception ex) { ProjectData.SetProjectError(ex); int num = (int) Interaction.MsgBox((object) ("Can not find:" + iFilename), MsgBoxStyle.OKOnly, (object) null); ProjectData.ClearProjectError(); } }
public override void Start() { try { if (base.m_ItemsSelecteds.Count > 0) { using (ISession Sesion = m_SessionFactory.OpenSession()) { Collection ObjectsFlow = new Collection(); foreach (String ID in base.m_ItemsSelecteds) { Parent Entity = (Parent)Sesion.Get(base.m_EntidadSF.NombreClase, ID); Entity.NewInstance = false; ObjectsFlow.Add(Entity); } base.m_ObjectFlow = ObjectsFlow; base.m_ResultProcess = EnumResult.SUCESS; } } } catch (Exception ex) { base.m_ResultProcess = EnumResult.ERROR; SoftException.Control(ex); } base.Start(); }
public Fleet(byte[] Data) { this.xShips = new Collection(); this.Waypoints = new Collection(); this.WaypointTasks = new Collection(); this.IncompleteInfo = true; this.FleetData = Data; }
public ImportTiles(Collection[,] StaticMap, string iPath) { iPath = iPath + "\\Import Files\\"; if (!Directory.Exists(iPath)) { int num = (int) Interaction.MsgBox((object) "No Import Tiles directory was found.", MsgBoxStyle.OKOnly, (object) null); } else this.ProcessDirectory(StaticMap, iPath); }
public long Load(string Filename) { long num2; this.xPlanets = new Collection(); Decryptor decryptor = new Decryptor(); int num4 = Strings.InStrRev(Filename, ".m", -1, CompareMethod.Text); if (num4 > 0) { this.PlayerNo = Conversions.ToInteger(Filename.Substring(num4 + 1)); Filename = Filename.Substring(0, num4 - 1); } else { Interaction.MsgBox("A valid .m file must be entered", MsgBoxStyle.ApplicationModal, null); return num2; } this.xyFile = decryptor.OpenFile(Filename + ".xy"); this.xPlayerCount = this.xyFile[0x1c]; this.xPlanetCount = this.xyFile[30] + (this.xyFile[0x1f] * 0x100); this.xGameName = ""; int index = 0x34; do { if (this.xyFile[index] == 0) { break; } this.xGameName = this.xGameName + Conversions.ToString(Strings.Chr(this.xyFile[index])); index++; } while (index <= 0x53); int x = 0x3e8; int num9 = this.PlanetCount - 1; for (int i = 0; i <= num9; i++) { Planet item = new Planet(i); item.X = (this.xyFile[(0x54 + (i * 4)) + 0] + ((this.xyFile[(0x54 + (i * 4)) + 1] & 3) * 0x100)) + x; x = item.X; item.Y = (int) Math.Round((double) (Conversion.Int((double) (((double) this.xyFile[(0x54 + (i * 4)) + 1]) / 4.0)) + ((this.xyFile[(0x54 + (i * 4)) + 2] & 0x3f) * 0x40))); item.NameID = (int) Math.Round((double) (Conversion.Int((double) (((double) this.xyFile[(0x54 + (i * 4)) + 2]) / 64.0)) + (this.xyFile[(0x54 + (i * 4)) + 3] * 4))); this.Planets().Add(item, "ID" + Conversions.ToString(i), null, null); } this.mFile = decryptor.OpenFile(Filename + ".m" + Conversions.ToString(this.PlayerNo)); this.hstLoaded = true; int hstPosition = 0; do { int num7; int num8; byte[] data = new byte[0x401]; this.ReadBlock(this.mFile, ref hstPosition, ref data, ref num8, ref num7); } while (hstPosition != this.mFile.Length); return num2; }
public Fleet() { this.xShips = new Collection(); this.Waypoints = new Collection(); this.WaypointTasks = new Collection(); this.IncompleteInfo = true; this.FleetData = new byte[] { 1, 0, 0, 0, 3, 0x29, 0xff, 0xff, 0xec, 4, 6, 4, 0, 1, 1, 0, 0, 0x10, 0, 0, 0 }; }
public ImportTiles(Collection[,] StaticMap, string iPath) { iPath = string.Concat(iPath, "\\Import Files\\"); if (Directory.Exists(iPath)) { this.ProcessDirectory(StaticMap, iPath); } else { Interaction.MsgBox("No Import Tiles directory was found.", MsgBoxStyle.OKOnly, null); } }
public void ProcessDirectory(Collection[,] StaticMap, string targetDirectory) { string[] files = Directory.GetFiles(targetDirectory, "*.xml"); for (int i = 0; i < (int)files.Length; i++) { this.Load(StaticMap, files[i]); } string[] directories = Directory.GetDirectories(targetDirectory); for (int j = 0; j < (int)directories.Length; j++) { this.ProcessDirectory(StaticMap, directories[j]); } }
/// <summary> /// /// <remarks></remarks> /// </summary> /// <returns></returns> public static IEnumerable<String> DatabasesToIgnore() { Collection<String> dbNames = new Collection<String>(); dbNames.Add("ReportServer"); dbNames.Add("ReportServerTempDB"); dbNames.Add("master"); dbNames.Add("msdb"); dbNames.Add("model"); dbNames.Add("tempdb"); return dbNames; }
public void AddAfterNoKey() { Collection c; c = new Collection (); c.Add (typeof (int), null, null, 0); c.Add (typeof (double), null, null, 1); c.Add (typeof (string), null, null, 1); c.Add (typeof (object), null, null, 3); Assert.AreEqual (4, c.Count, "#AANK01"); Assert.AreEqual (typeof (object), c[4], "#AANK02"); Assert.AreEqual (typeof (int), c[1], "#AANK03"); Assert.AreEqual (typeof (string), c[2], "#AANK04"); }
public void AddAfterKey() { Collection c; c = new Collection (); c.Add ("Baseball", "Base", null, 0); c.Add ("Football", "Foot", null, 1); c.Add ("Basketball", "Basket", null, 1); c.Add ("Volleyball", "Volley", null, 2); Assert.AreEqual (4, c.Count, "#AAK01"); Assert.AreEqual ("Baseball", c[1], "#AAK02"); Assert.AreEqual ("Football", c[4], "#AAK03"); Assert.AreEqual ("Basketball", c["Basket"], "#AAK04"); Assert.AreEqual ("Volleyball", c["Volley"], "#AAK05"); }
public RandomStatics(string iFileName) { this.m_Random = new Collection(); XmlDocument xmlDocument = new XmlDocument(); try { string filename = string.Format("{0}Data\\Statics\\{1}", AppDomain.CurrentDomain.BaseDirectory, iFileName); xmlDocument.Load(filename); XmlElement xmlElement = (XmlElement)xmlDocument.SelectSingleNode("//RandomStatics"); this.m_Freq = (int)XmlConvert.ToInt16(xmlElement.GetAttribute("Chance")); IEnumerator enumerator = xmlElement.SelectNodes("Statics").GetEnumerator(); try { while (enumerator.MoveNext()) { XmlElement xmlInfo = (XmlElement)enumerator.Current; RandomStaticCollection randomStaticCollection = new RandomStaticCollection(xmlInfo); this.InnerList.Add(randomStaticCollection); if (randomStaticCollection.Freq > 0) { byte arg_AC_0 = 1; byte b = checked((byte)randomStaticCollection.Freq); for (byte b2 = arg_AC_0; b2 <= b; b2 += 1) { this.m_Random.Add(randomStaticCollection, null, null, null); } } } } finally { if (enumerator is IDisposable) { ((IDisposable)enumerator).Dispose(); } } } catch (Exception expr_F8) { ProjectData.SetProjectError(expr_F8); Interaction.MsgBox("Can not find:" + iFileName, MsgBoxStyle.OkOnly, null); ProjectData.ClearProjectError(); } }
/// <summary> /// Initializes a new instance of the <see cref="T:ProxyGenerator"/> class. /// </summary> /// <param name="options">The options.</param> public ContractGenerator(ContractGenerationOptions options) { if (!string.IsNullOrEmpty(options.OutputConfigurationFile)) { System.Configuration.Configuration machineConfiguration = ConfigurationManager.OpenMachineConfiguration(); ExeConfigurationFileMap configurationMap = new ExeConfigurationFileMap(); configurationMap.ExeConfigFilename = options.OutputConfigurationFile; configurationMap.MachineConfigFilename = machineConfiguration.FilePath; this.configuration = ConfigurationManager.OpenMappedExeConfiguration(configurationMap, ConfigurationUserLevel.None); } else if (options.OutputConfiguration != null) { this.configuration = options.OutputConfiguration; } this.codeCompileUnit = new CodeCompileUnit(); this.options = options; this.generatedChannelElements = new Collection<ChannelEndpointElement>(); }
public RandomStatics(string iFileName) { IEnumerator enumerator = null; this.m_Random = new Collection(); XmlDocument xmlDocument = new XmlDocument(); try { string str = string.Format("{0}Data\\Statics\\{1}", AppDomain.CurrentDomain.BaseDirectory, iFileName); xmlDocument.Load(str); XmlElement xmlElement = (XmlElement)xmlDocument.SelectSingleNode("//RandomStatics"); this.m_Freq = XmlConvert.ToInt16(xmlElement.GetAttribute("Chance")); try { enumerator = xmlElement.SelectNodes("Statics").GetEnumerator(); while (enumerator.MoveNext()) { RandomStaticCollection randomStaticCollection = new RandomStaticCollection((XmlElement)enumerator.Current); this.InnerList.Add(randomStaticCollection); if (randomStaticCollection.Freq > 0) { byte freq = checked((byte)randomStaticCollection.Freq); for (byte i = 1; i <= freq; i = checked((byte)(i + 1))) { this.m_Random.Add(randomStaticCollection, null, null, null); } } } } finally { if (enumerator is IDisposable) { ((IDisposable)enumerator).Dispose(); } } } catch (Exception exception) { ProjectData.SetProjectError(exception); Interaction.MsgBox(string.Concat("Can not find:", iFileName), MsgBoxStyle.OKOnly, null); ProjectData.ClearProjectError(); } }
public void ProcessDirectory(Collection[,] StaticMap, string targetDirectory) { string[] files = Directory.GetFiles(targetDirectory, "*.xml"); int index1 = 0; while (index1 < files.Length) { string iFilename = files[index1]; this.Load(StaticMap, iFilename); checked { ++index1; } } string[] directories = Directory.GetDirectories(targetDirectory); int index2 = 0; while (index2 < directories.Length) { string targetDirectory1 = directories[index2]; this.ProcessDirectory(StaticMap, targetDirectory1); checked { ++index2; } } }
public void ProcessDirectory(Collection[,] StaticMap, string targetDirectory) { string[] files = Directory.GetFiles(targetDirectory, "*.xml"); string[] array = files; checked { for (int i = 0; i < array.Length; i++) { string iFilename = array[i]; this.Load(StaticMap, iFilename); } string[] directories = Directory.GetDirectories(targetDirectory); string[] array2 = directories; for (int j = 0; j < array2.Length; j++) { string targetDirectory2 = array2[j]; this.ProcessDirectory(StaticMap, targetDirectory2); } } }
public void Load(Collection[,] StaticMap, string iFilename) { XmlDocument xmlDocument = new XmlDocument(); try { xmlDocument.Load(iFilename); XmlElement xmlElement = (XmlElement)xmlDocument.SelectSingleNode("//Static_Tiles"); IEnumerator enumerator = xmlElement.SelectNodes("Tile").GetEnumerator(); try { while (enumerator.MoveNext()) { XmlElement xmlElement2 = (XmlElement)enumerator.Current; short iTileID = XmlConvert.ToInt16(xmlElement2.GetAttribute("TileID")); short num = XmlConvert.ToInt16(xmlElement2.GetAttribute("X")); short num2 = XmlConvert.ToInt16(xmlElement2.GetAttribute("Y")); short iZ = XmlConvert.ToInt16(xmlElement2.GetAttribute("Z")); short iHue = XmlConvert.ToInt16(xmlElement2.GetAttribute("Hue")); StaticCell item = checked(new StaticCell(iTileID, (byte)(num % 8), (byte)(num2 % 8), iZ, iHue)); StaticMap[(int)((short)(num >> 3)), (int)((short)(num2 >> 3))].Add(item, null, null, null); } } finally { if (enumerator is IDisposable) { ((IDisposable)enumerator).Dispose(); } } } catch (Exception expr_FB) { ProjectData.SetProjectError(expr_FB); Interaction.MsgBox("Can not find:" + iFilename, MsgBoxStyle.OkOnly, null); ProjectData.ClearProjectError(); } }
public void Adjust(Collection.Node Node, AdjustIndexType Type) { if ((Node != null) && !this.mDisposed) { switch (Type) { case AdjustIndexType.Insert: if ((this.mCurrent != null) && (Node == this.mCurrent.m_Next)) { this.mNext = Node; } break; case AdjustIndexType.Remove: if ((Node != this.mCurrent) && (Node == this.mNext)) { this.mNext = this.mNext.m_Next; } break; } } }
public RandomStatics(string iFileName) { this.m_Random = new Collection(); XmlDocument xmlDocument = new XmlDocument(); try { string filename = string.Format("{0}Data\\Statics\\{1}", (object) AppDomain.CurrentDomain.BaseDirectory, (object) iFileName); xmlDocument.Load(filename); XmlElement xmlElement = (XmlElement) xmlDocument.SelectSingleNode("//RandomStatics"); this.m_Freq = (int) XmlConvert.ToInt16(xmlElement.GetAttribute("Chance")); try { foreach (XmlElement xmlInfo in xmlElement.SelectNodes("Statics")) { RandomStaticCollection staticCollection = new RandomStaticCollection(xmlInfo); this.InnerList.Add((object) staticCollection); if (staticCollection.Freq > 0) { int num1 = 1; byte num2 = checked ((byte) staticCollection.Freq); for (byte index = (byte) num1; (int) index <= (int) num2; ++index) this.m_Random.Add((object) staticCollection, (string) null, (object) null, (object) null); } } } finally { IEnumerator enumerator; if (enumerator is IDisposable) ((IDisposable) enumerator).Dispose(); } } catch (Exception ex) { ProjectData.SetProjectError(ex); int num = (int) Interaction.MsgBox((object) ("Can not find:" + iFileName), MsgBoxStyle.OKOnly, (object) null); ProjectData.ClearProjectError(); } }
public void Load(Collection[,] StaticMap, string iFilename) { IEnumerator enumerator = null; XmlDocument xmlDocument = new XmlDocument(); try { xmlDocument.Load(iFilename); XmlElement xmlElement = (XmlElement)xmlDocument.SelectSingleNode("//Static_Tiles"); try { enumerator = xmlElement.SelectNodes("Tile").GetEnumerator(); while (enumerator.MoveNext()) { XmlElement current = (XmlElement)enumerator.Current; short num = XmlConvert.ToInt16(current.GetAttribute("TileID")); short num1 = XmlConvert.ToInt16(current.GetAttribute("X")); short num2 = XmlConvert.ToInt16(current.GetAttribute("Y")); short num3 = XmlConvert.ToInt16(current.GetAttribute("Z")); short num4 = XmlConvert.ToInt16(current.GetAttribute("Hue")); StaticCell staticCell = new StaticCell(num, checked((byte)(num1 % 8)), checked((byte)(num2 % 8)), num3, num4); StaticMap[(short)(num1 >> 3), (short)(num2 >> 3)].Add(staticCell, null, null, null); } } finally { if (enumerator is IDisposable) { ((IDisposable)enumerator).Dispose(); } } } catch (Exception exception) { ProjectData.SetProjectError(exception); Interaction.MsgBox(string.Concat("Can not find:", iFilename), MsgBoxStyle.OKOnly, null); ProjectData.ClearProjectError(); } }
public static string GetDCNData(Collection DocCollection) { StringBuilder DCNInfo = new StringBuilder(); TSDocument BeginDoc = (TSDocument)DocCollection[1]; TSDocument EndDoc = (TSDocument)DocCollection[DocCollection.Count]; Int32 PageCount = 0; DCNInfo.AppendLine("[BatchHdr]"); DCNInfo.AppendLine("CustomerId=NEAT"); DCNInfo.AppendLine("ProjectId=NEAT"); DCNInfo.AppendLine("ScanVendor=Rantoul"); DCNInfo.AppendLine("ScanDate=" + BeginDoc.ScanDate.ToString("MM/dd/yyyy")); DCNInfo.AppendLine("FolderId=" + BeginDoc.ExportFolder); DCNInfo.AppendLine("ParentBatchId=" + BeginDoc.BatchName); DCNInfo.AppendLine("DOCTYPE="); DCNInfo.AppendLine("BatchId=" + BeginDoc.BatchName); DCNInfo.AppendLine("StartDCN=" + BeginDoc.DCN); DCNInfo.AppendLine("EndDCN=" + EndDoc.DCN); DCNInfo.AppendLine("TotDoc=" + DocCollection.Count); DCNInfo.AppendLine("POBOX=999999"); DCNInfo.AppendLine("RecvDate="); DCNInfo.AppendLine(); DCNInfo.AppendLine("[Detail]"); // Iterate through the documents foreach (TSDocument DocInfo in DocCollection) { DCNInfo.AppendLine("DCN=" + DocInfo.DCN); for (Int32 i = 1; i <= DocInfo.NumPages; i++) { DCNInfo.AppendLine("File=" + DocInfo.DCN + "_" + i + DocInfo.FileExt); } PageCount += DocInfo.NumPages; } DCNInfo.AppendLine(); DCNInfo.AppendLine("[BatchTrlr]"); DCNInfo.AppendLine("NumberClaims=" + DocCollection.Count); DCNInfo.AppendLine("NumberFiles=" + PageCount); return DCNInfo.ToString(); }
public static Collection GetUserGroups(string _persalnumber) { string usr = FTPUser.GetMasterUser(); string pwd = FTPUser.GetMasterPwd(); string get_ldap_string = FTPUser.GetAppOUContext(); string ldapstring = "LDAP://" + FTPUser.GetIPaddressString() + "/CN=FTP_ACCESS," + get_ldap_string; DirectoryEntry dsDirectoryEntry = new DirectoryEntry(ldapstring, usr, pwd); int bytCounter = 0; string strGroups = null; Microsoft.VisualBasic.Collection UserGroups = new Microsoft.VisualBasic.Collection(); StringBuilder sbUserGroups = new StringBuilder(); DirectorySearcher dsSearcher = new DirectorySearcher(dsDirectoryEntry); dsSearcher.PropertiesToLoad.Add("memberOf"); try { SearchResult dsResult = dsSearcher.FindOne(); if (dsResult == null) { return(null); } for (bytCounter = 0; bytCounter <= (dsResult.Properties["memberOf"].Count - 1); bytCounter++) { strGroups = dsResult.Properties["memberOf"][0].ToString(); UserGroups.Add(strGroups); } } catch (Exception) { } return(UserGroups); }
private void RemoveExtension(Type extensionType, Collection<IWsdlImportExtension> wsdlImportExtensions) { for (int index = 0; index < wsdlImportExtensions.Count; index++) { if (wsdlImportExtensions[index].GetType() == extensionType) { wsdlImportExtensions.RemoveAt(index); } } }
private void RemoveUnneededSerializers(Collection<IWsdlImportExtension> wsdlImportExtensions) { if (this.options.SchemaImporterType == ContractGenerationOptions.ImporterType.XmlSerializerImporter) { if (wsdlImportExtensions == null) { ClientSection clientSection = (ClientSection)ConfigurationManager.GetSection("system.serviceModel/client"); if (clientSection == null) { return; } wsdlImportExtensions = clientSection.Metadata.LoadWsdlImportExtensions(); } RemoveExtension(typeof(DataContractSerializerMessageContractImporter), wsdlImportExtensions); } }
private void ImportMetadata(WsdlImporter wsdlImporter, out ServiceEndpointCollection endpoints, out Collection<System.ServiceModel.Channels.Binding> bindings, out Collection<ContractDescription> contracts) { endpoints = wsdlImporter.ImportAllEndpoints(); bindings = wsdlImporter.ImportAllBindings(); contracts = wsdlImporter.ImportAllContracts(); ThrowOnMetadataConversionErrors(wsdlImporter.Errors); }
/// <summary> /// Throws the on metadata conversion errors. /// </summary> /// <param name="errors">The errors.</param> /// <exception cref="InvalidOperationException">Will throw on metadata conversion errors.</exception> public static void ThrowOnMetadataConversionErrors(Collection<MetadataConversionError> errors) { InvalidOperationException exception = null; foreach (MetadataConversionError error in errors) { if (!error.IsWarning) { exception = new InvalidOperationException(error.Message, exception); } Trace.TraceWarning(error.Message); } if (exception != null) { throw exception; } }
/// <summary> /// Get the both collection and menu collection to the folder the current item is in. /// If no such menu exists, return 0. /// </summary> public static Dictionary<string, long> getAssignedMenuNCollectionId(long folderId) { Dictionary<string, long> menuCollection = new Dictionary<string, long>(); ApplicationAPI AppUI = new ApplicationAPI(); AppUI.RequestInformationRef.CallerId = (int)Ektron.Cms.Common.EkEnumeration.UserGroups.InternalAdmin; Microsoft.VisualBasic.Collection gtNavs = new Microsoft.VisualBasic.Collection(); gtNavs = AppUI.EkContentRef.GetAllCollectionsInfo(folderId, "title"); string mainCollectionId = string.Empty; if (gtNavs.Count > 0) { // gtNavs["CollectionID"].ToString(); foreach (Microsoft.VisualBasic.Collection gtNav in gtNavs) { // if (gtNav["MenuTitle"].ToString() == menuTitle) // { mainCollectionId = mainCollectionId + gtNav["CollectionID"]; // return long.Parse(mainCollectionId); // } try { menuCollection.Add("CollectionID", long.Parse(mainCollectionId)); } catch { } } } return menuCollection; }
/// <summary> /// Get the menu assigned to the folder the current item is in. /// If no such menu exists, return 0. /// </summary> public static long getAssignedMenuId(long folderId) { ApplicationAPI AppUI = new ApplicationAPI(); AppUI.RequestInformationRef.CallerId = (int)Ektron.Cms.Common.EkEnumeration.UserGroups.InternalAdmin; Microsoft.VisualBasic.Collection gtNavs = new Microsoft.VisualBasic.Collection(); gtNavs = AppUI.EkContentRef.GetAllMenusInfo(folderId, "title"); string mainMenuId = string.Empty; if (gtNavs.Count > 0) { foreach (Microsoft.VisualBasic.Collection gtNav in gtNavs) { // if (gtNav["MenuTitle"].ToString() == menuTitle) // { mainMenuId = mainMenuId + gtNav["MenuID"]; return long.Parse(mainMenuId); // } } } return 0; }
public void GetEnumerator_13() { Collection col = new Collection(); string s1 = "e"; string s2 = "g"; string s3 = "a"; string s4 = "f"; string s5 = "q"; col.Add(s1,null,null,null); col.Add(s2,null,null,null); IEnumerator en = col.GetEnumerator(); Assert.IsTrue(en.MoveNext()); Assert.AreEqual(s1,en.Current); Assert.IsTrue(en.MoveNext()); Assert.AreEqual(s2,en.Current); Assert.IsFalse(en.MoveNext()); Assert.AreEqual(null,en.Current); col.Add(s3,null,null,null); Assert.AreEqual(null,en.Current); col.Add(s4,null,null,null); col.Add(s5,null,null,null); Assert.IsFalse(en.MoveNext()); }
public static string ParseFileAspTags(string TemplateFilePath, Collection FieldAndValues) { TextReader t = null; int i = 0; int j = 0; string[] a = null; string fil = null; MailMessage EmailMessage = new MailMessage(); Microsoft.VisualBasic.Collection fc = new Microsoft.VisualBasic.Collection(); string thisusername = null; if (frmEnvironment.ChildFormPRD.Visible) { thisusername = Get_ValidUsername(frmEnvironment.ChildFormPRD.txtPersalNumber.Text.Trim.ToUpper); } else { thisusername = Get_ValidUsername(frmEnvironment.childformQA.txtPersalNumber.Text.Trim.ToUpper); } // This portion is used to merge the HTT file into HTML format t = new StreamReader(TemplateFilePath); fil = t.ReadToEnd(); t.Close(); t.Dispose(); for (i = 1; i <= FieldAndValues.Count; i++) { a = Strings.Split(FieldAndValues[i], "="); for (j = 0; j <= Information.UBound(a); j++) { if (j % 2 == 0) { fil = Strings.Replace(fil, "<%" + a[j] + "%>", a[j + 1]); } } } // This portion is used to merge the [1.email.addresses] file // to be used in a collection for the addresses TextReader k = new StreamReader(modFunctions.AppPath() + "Vulindlela User Account Reset.email.addresses"); //Posistion the pointer after the first line in the file k.ReadLine(); // Gets the value from FieldAndValues that gets passed here EmailMessage.To.Add(Strings.Replace(FieldAndValues[3], "EMail_Address=", "")); //b2 is the Carbon Copy string[] b2 = null; b2 = Strings.Split(k.ReadLine(), ";"); for (i = 0; i <= Information.UBound(b2); i++) { EmailMessage.CC.Add(b2[i]); } //b3 ReturnMailAddress string b3 = null; b3 = k.ReadLine(); EmailMessage.From = new MailAddress(b3); //b4 is the Subject line string b4 = null; b4 = k.ReadLine(); EmailMessage.Subject = b4 + " : " + thisusername.Trim(); EmailMessage.Body = fil; EmailMessage.Priority = MailPriority.High; EmailMessage.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(My.Settings.SMPTServerIPAddress.Trim); if (Interaction.MsgBox("Force a Password change as well?", MsgBoxStyle.YesNo + MsgBoxStyle.Information, "System Message") == MsgBoxResult.Yes) { Do_ExpirePasswordNow(thisusername); } smtp.Send(EmailMessage); smtp = null; k.Dispose(); }
public static void Create_Snapshot() { object authenticate = null; object mvarsError = null; object memberOF = null; object mstr = null; object f = null; //oCont) string appstr = null; string govstr = null; string strc = null; string strDepartment = null; ActiveDs.IADsUser oUser = default(ActiveDs.IADsUser); ActiveDs.IADsContainer oContainer = default(ActiveDs.IADsContainer); ActiveDs.IADsOpenDSObject dso = default(ActiveDs.IADsOpenDSObject); string xas = null; string appl = null; string[] a = null; string[] temparray = null; string tempstr = null; string[] aGovernment = null; object entry = null; int temporaryDate2 = 0; int date2 = 0; int i = 0; int y = 0; int mcount = 0; object mmax = null; string strApps = null; string strGovt = null; int UCount = 0; Microsoft.VisualBasic.Collection colGovernment = new Microsoft.VisualBasic.Collection(); Microsoft.VisualBasic.Collection colApplications = new Microsoft.VisualBasic.Collection(); string memberOFS = ""; SqlConnection cnVIP_EXP = new SqlConnection(); cnVIP_EXP.ConnectionString = My.Settings.VIP_EXPANDEDConnectionString; SqlConnection cnADS2 = new SqlConnection(); SqlConnection cnADS = new SqlConnection(); cnADS.ConnectionString = My.Settings.AdsConnectionString; cnADS2.ConnectionString = My.Settings.AdsConnectionString; SqlCommand cmdADS2 = new SqlCommand("AD_SNAPSHOT_ALL_INSERT", cnADS); SqlCommand cmdADS3 = new SqlCommand("AD_SNAPSHOT_ALL_DELETE_ALL", cnADS); SqlCommand cmdADS4 = new SqlCommand("GetPROVDescription", cnADS2); SqlCommand cmdADS5 = new SqlCommand("GetSNAMEDept", cnADS2); cmdADS2.CommandType = CommandType.StoredProcedure; cmdADS3.CommandType = CommandType.StoredProcedure; cmdADS4.CommandType = CommandType.StoredProcedure; cmdADS5.CommandType = CommandType.StoredProcedure; SqlParameter pUCount = new SqlParameter("@UCount", SqlDbType.BigInt); SqlParameter pPersalnr = new SqlParameter("@PersalNr", SqlDbType.VarChar, 8); SqlParameter pAccountNr = new SqlParameter("@AccountNr", SqlDbType.VarChar, 9); SqlParameter pNatProv = new SqlParameter("@NatProv ", SqlDbType.VarChar, 20); SqlParameter pVote = new SqlParameter("@Vote", SqlDbType.VarChar, 55); SqlParameter pDeptCode = new SqlParameter("@DeptCode", SqlDbType.VarChar, 9); SqlParameter pEMail = new SqlParameter("@EMail", SqlDbType.VarChar, 150); SqlParameter pCell = new SqlParameter("@Cell", SqlDbType.VarChar, 20); SqlParameter pPhone = new SqlParameter("@Phone", SqlDbType.VarChar, 20); SqlParameter pFirstName = new SqlParameter("@FirstName", SqlDbType.VarChar, 20); SqlParameter pLastname = new SqlParameter("@Lastname", SqlDbType.VarChar, 40); SqlParameter pApplMember = new SqlParameter("@ApplMember", SqlDbType.VarChar, 500); SqlParameter pDeptMember = new SqlParameter("@DeptMember", SqlDbType.VarChar, 4000); SqlParameter pDepartment = new SqlParameter("@Department", SqlDbType.VarChar, 10); SqlParameter pAccountDisabled = new SqlParameter("@AccountDisabled", SqlDbType.SmallInt); SqlParameter pLOGIS = new SqlParameter("@LOGIS", SqlDbType.SmallInt); SqlParameter pHR = new SqlParameter("@HR", SqlDbType.SmallInt); SqlParameter pFINANCIALS = new SqlParameter("@FINANCIALS", SqlDbType.SmallInt); SqlParameter pGFS = new SqlParameter("@GFS", SqlDbType.SmallInt); SqlParameter pDPSA = new SqlParameter("@DPSA", SqlDbType.SmallInt); SqlParameter pSNAME = new SqlParameter("@SNAME", SqlDbType.VarChar, 9); ClsCrypto enc = new ClsCrypto(); dso = Interaction.GetObject("LDAP:"); oContainer = dso.OpenDSObject("LDAP://" + My.Settings.IP_ADDRESS_PRD + "/" + My.Settings.AD_USERS_PRD, My.Settings.ADSMasterUsername_PRD, enc.Dekodeer128(My.Settings.ADSMasterPassword_PRD.ToString), 0); cnADS.Open(); cmdADS3.ExecuteNonQuery(); foreach (oUser in oContainer) { UCount += 1; pUCount.Value = UCount; mcount = mcount + 1; switch (Strings.LCase(oUser.Class)) { case "user": if ((Strings.Trim(oUser.SAMaccountname) != null)) { frmMain.tsADPosition.Text = oUser.samaccountname; pSNAME.Value = oUser.Department.ToLower.ToString.Trim + ""; cmdADS5.Parameters.Add(pSNAME); cnADS2.Open(); pVote.Value = cmdADS5.ExecuteScalar().ToString() + ""; cnADS2.Close(); cmdADS5.Parameters.Remove(pSNAME); // ERROR: Not supported in C#: OnErrorStatement pAccountNr.Value = oUser.SAMaccountname.ToString.Trim + ""; cmdADS4.Parameters.Add(pSNAME); cnADS2.Open(); pNatProv.Value = cmdADS4.ExecuteScalar().ToString() + ""; cnADS2.Close(); cmdADS4.Parameters.Remove(pSNAME); pDeptCode.Value = pSNAME.Value + ""; if (Information.IsDBNull(Strings.Trim(oUser.EmailAddress))) { pEMail.Value = "No Email"; } else { pEMail.Value = oUser.EmailAddress.ToLower.Trim + ""; } if (Information.IsDBNull(Convert.ToString(oUser.TelephoneMobile)) | (oUser.TelephoneMobile == null)) { pCell.Value = "No Mobile"; } else { pCell.Value = Strings.Replace(Strings.Replace(Convert.ToString(oUser.TelephoneMobile), "(", ""), ")", ""); } if (Information.IsDBNull(Convert.ToString(oUser.TelephoneNumber))) { pPhone.Value = "No TelephoneNumber"; } else { pPhone.Value = Strings.Replace(Strings.Replace(oUser.TelephoneNumber.ToString, "(", ""), ")", "") + ""; } if (Information.IsDBNull(oUser.FirstName)) { pFirstName.Value = "No Firstname"; } else { pFirstName.Value = oUser.FirstName.Trim + ""; } if (Information.IsDBNull(oUser.LastName)) { pLastname.Value = "No LastName"; } else { pLastname.Value = oUser.LastName.Trim + ""; } memberOF = oUser.GetEx("MemberOf"); if (Err().Number == -2147463155) { colApplications.Add("INVALID USER"); colGovernment.Add("INVALID USER"); pLOGIS.Value = 0; pDPSA.Value = 0; pGFS.Value = 0; pHR.Value = 0; pFINANCIALS.Value = 0; } else { // Start with the new structure. memberOFS = ""; foreach (object entry_loopVariable in memberOF) { entry = entry_loopVariable; //Clear collections if ((Strings.InStr(1, Strings.UCase(entry), "GOVERNMENT") > 0 | Strings.InStr(1, Strings.UCase(entry), "VUL TS USERS") > 0 | Strings.InStr(1, Strings.UCase(entry), "APPLICATION") > 0) & Strings.InStr(1, Strings.UCase(entry), "CN=") > 0) { entry = Strings.Replace(Strings.Replace(entry, "OU=", ""), "CN=", ""); temparray = Strings.Split(entry, ","); tempstr = Strings.Replace(temparray[0], "_ACCESS_ALL", ""); tempstr = Strings.Replace(tempstr, "_ALL_ACCESS", ""); tempstr = Strings.Replace(tempstr, "_SEC32", ""); if (Strings.InStr(1, Strings.UCase(entry), "GOVERNMENT") > 0) { colGovernment.Add(tempstr); } else if (Strings.InStr(1, Strings.UCase(entry), "APPLICATION") > 0 | Strings.InStr(1, Strings.UCase(entry), "VUL TS USERS") > 0) { memberOFS = memberOFS + " " + tempstr + ""; colApplications.Add(tempstr); } } } pLOGIS.Value = (Strings.InStr(1, memberOFS, "LOGIS.") > 0 ? 1 : 0); pDPSA.Value = (Strings.InStr(1, memberOFS, "DPSA.") > 0 ? 1 : 0); pGFS.Value = (Strings.InStr(1, memberOFS, "GFS.") > 0 ? 1 : 0); pHR.Value = (Strings.InStr(1, memberOFS, "HR.") > 0 ? 1 : 0); pFINANCIALS.Value = (Strings.InStr(1, memberOFS, "FINANCIALS.") > 0 ? 1 : 0); } strApps = ""; for (y = 1; y <= colApplications.Count(); y++) { if (Strings.Len(strApps) == 0) { strApps = colApplications[y]; } else { strApps = strApps + "," + colApplications[y] + ""; } } if (Strings.Len(Strings.Trim(strApps)) == 0) { strApps = "INVALID USER"; } pApplMember.Value = strApps; strGovt = ""; for (y = 1; y <= colGovernment.Count(); y++) { if (Strings.Len(strGovt) == 0) { strGovt = colGovernment[y]; } else { strGovt = strGovt + "," + colGovernment[y] + ""; } } pDeptMember.Value = strGovt; strDepartment = ""; strDepartment = oUser.Department + ""; if (Strings.Len(Strings.Trim(strDepartment)) == 0) { pDepartment.Value = "No Department"; } else { pDepartment.Value = oUser.Department + ""; } if ((Convert.ToString(oUser.AccountDisabled)).ToUpper().Trim() == "TRUE") { pAccountDisabled.Value = 1; } else { pAccountDisabled.Value = 0; } //pAccountDisabled.Value = CStr(oUser.AccountDisabled) cmdADS2.Parameters.Add(pAccountNr); cmdADS2.Parameters.Add(pNatProv); cmdADS2.Parameters.Add(pVote); cmdADS2.Parameters.Add(pDeptCode); cmdADS2.Parameters.Add(pEMail); cmdADS2.Parameters.Add(pCell); cmdADS2.Parameters.Add(pPhone); cmdADS2.Parameters.Add(pFirstName); cmdADS2.Parameters.Add(pLastname); cmdADS2.Parameters.Add(pApplMember); cmdADS2.Parameters.Add(pDeptMember); cmdADS2.Parameters.Add(pDepartment); cmdADS2.Parameters.Add(pAccountDisabled); cmdADS2.Parameters.Add(pLOGIS); cmdADS2.Parameters.Add(pHR); cmdADS2.Parameters.Add(pFINANCIALS); cmdADS2.Parameters.Add(pGFS); cmdADS2.Parameters.Add(pDPSA); cmdADS2.Parameters.Add(pUCount); //cmdADS2.Parameters.Add(pAccCreated) //cmdADS2.Parameters.Add(pAccModified) //************************** cmdADS2.ExecuteNonQuery(); //************************** cmdADS2.Parameters.Remove(pAccountNr); cmdADS2.Parameters.Remove(pNatProv); cmdADS2.Parameters.Remove(pVote); cmdADS2.Parameters.Remove(pDeptCode); cmdADS2.Parameters.Remove(pEMail); cmdADS2.Parameters.Remove(pCell); cmdADS2.Parameters.Remove(pPhone); cmdADS2.Parameters.Remove(pFirstName); cmdADS2.Parameters.Remove(pLastname); cmdADS2.Parameters.Remove(pApplMember); cmdADS2.Parameters.Remove(pDeptMember); cmdADS2.Parameters.Remove(pDepartment); cmdADS2.Parameters.Remove(pAccountDisabled); cmdADS2.Parameters.Remove(pLOGIS); cmdADS2.Parameters.Remove(pHR); cmdADS2.Parameters.Remove(pFINANCIALS); cmdADS2.Parameters.Remove(pGFS); cmdADS2.Parameters.Remove(pDPSA); colGovernment.Clear(); colApplications.Clear(); } break; } Err().Clear(); } frmMain.tsADPosition.Text = ""; CloseMe: goto cleanup; err_handler: mvarsError = "{ADS4.authenticate} authenticate: (" + Err().Number + ") " + Err().Description; Err().Clear(); authenticate = false; cleanup: oUser = null; memberOF = null; oContainer = null; oUser = null; dso = null; colGovernment = null; colApplications = null; cnADS.Close(); cnADS = null; }
private void Class_Terminate() { mCol = null; }
private void Class_Initialize() { mCol = new VBCollection(); }
public LineKitEnum(VBCollection col) { mCol = col; }
protected virtual void Page_Load(object sender, EventArgs e) { this.mCurrentUser = this.mMaster.pCurrentUser; this.mSessionPageObj = (Collection)this.Session[this.mMaster.pObjID + CnsSessionPageObj]; if (!this.IsPostBack) { this.ViewState[CnsSystem_ModulesID] = this.mSystem_ModulesID; } else { this.mSystem_ModulesID = (Int64)this.ViewState[CnsSystem_ModulesID]; } }
/// <summary> /// Sorts the collection. /// </summary> /// <param name="col">The col.</param> /// <param name="psSortPropertyName">Name of the ps sort property.</param> /// <param name="pbAscending">if set to <c>true</c> [pb ascending].</param> /// <param name="psKeyPropertyName">Name of the ps key property.</param> private void SortCollection(Microsoft.VisualBasic.Collection col, string psSortPropertyName, bool pbAscending, string psKeyPropertyName = "") { object obj = null; int i = 0; int j = 0; int iMinMaxIndex = 0; object vMinMax = null; object vValue = null; bool bSortCondition = false; bool bUseKey = false; string sKey = null; bUseKey = (!string.IsNullOrEmpty(psKeyPropertyName)); //INSTANT C# NOTE: The ending condition of VB 'For' loops is tested only on entry to the loop. Instant C# has created a temporary variable in order to use the initial value of col.Count for every iteration: int tempVar = col.Count; for (i = 1; i < tempVar; i++) { obj = col[i]; vMinMax = Interaction.CallByName(obj, psSortPropertyName, Microsoft.VisualBasic.Constants.vbGet); iMinMaxIndex = i; for (j = i + 1; j <= col.Count; j++) { obj = col[j]; vValue = Interaction.CallByName(obj, psSortPropertyName, Microsoft.VisualBasic.Constants.vbGet); if (pbAscending) { bSortCondition = (Convert.ToSingle(vValue) < Convert.ToSingle(vMinMax)); } else { bSortCondition = (Convert.ToSingle(vValue) > Convert.ToSingle(vMinMax)); } if (bSortCondition) { vMinMax = vValue; iMinMaxIndex = j; } obj = null; } if (iMinMaxIndex != i) { obj = col[iMinMaxIndex]; col.Remove(iMinMaxIndex); if (bUseKey) { sKey = Convert.ToString(Interaction.CallByName(obj, psKeyPropertyName, Microsoft.VisualBasic.Constants.vbGet)); col.Add(obj, sKey, i, null); } else { col.Add(obj, null, i, null); } obj = null; } obj = null; } }