- 
        
        
                +133        
        
                            - 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 - 21
 - 22
 - 23
 - 24
 - 25
 - 26
 - 27
 - 28
 - 29
 - 30
 - 31
 - 32
 - 33
 - 34
 - 35
 - 36
 - 37
 - 38
 - 39
 - 40
 - 41
 - 42
 - 43
 - 44
 - 45
 - 46
 - 47
 - 48
 - 49
 - 50
 - 51
 - 52
 - 53
 - 54
 - 55
 - 56
 - 57
 - 58
 - 59
 - 60
 - 61
 - 62
 - 63
 - 64
 - 65
 - 66
 - 67
 - 68
 - 69
 - 70
 
                        [Serializable]
public class CSScriptCompiler
{
	//file name of script  including full path
	string sFileNameWithPath;
	System.Reflection.Assembly m_assembly = null;
	public CSScriptCompiler(string ScriptFileName)
	{
		this.sFileNameWithPath = Path.GetFullPath(ScriptFileName);
		try
		{
			//load Assembly of *.cs file
			m_assembly = CSScript.Load(sFileNameWithPath, null, true);
		}
		catch (Exception ex)
		{
			m_assembly = null;
			MessageBox.Show(ex.Message);
			
			throw (ex);
		}
	}
	public bool Initialize(params object[] InitArgs)
	{
		if (m_assembly == null)
		{
			return false;
		}
		try
		{
			var InitFuntion = m_assembly.GetStaticMethod("*.Initialize", InitArgs);
			//call initialize function
			InitFuntion(InitArgs);
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
			return false;
		}
		return true;
	}
	public object CallFunction(String sFunctionName, params object[] args)
	{
		object result = null;
		sFunctionName = "*." + sFunctionName;
		try
		{
			var theFunction = m_assembly.GetStaticMethod(sFunctionName, args);
		   
			//call the method with your own arguements
			result = theFunction(args);
		}
		catch (Exception ex)
		{
			MessageBox.Show(ex.Message);
		}
		return result;
	}
}
                                     
        
            Ну что тут скажешь... 
Велосипедист...
        
        
            
 blackhearted,
            16 Июня 2014
        
        
        
         
        - 
        
        
                +138        
        
                            - 1
 - 2
 - 3
 - 4
 - 5
 - 6
 - 7
 - 8
 
                        public string GetStringOfEnum(object myEnum)
{
	string sValue = "";
	sValue = Enum.GetName(myEnum.GetType(), myEnum);
	return sValue;
}
                                     
        
            Nuff said...
        
        
            
 blackhearted,
            16 Июня 2014
        
        
        
         
        - 
        
        
                +131        
        
                            - 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 
                        public int stream;
        public override string ToString()
        {
            return group_name + teacher_name + " " + discipline_name + " " + discipline_type + " " + stream.ToString();
        }
        public override int GetHashCode()
        {
            return stream;
        }
        public override bool Equals(object obj)
        {
            try
            {
                stream = Convert.ToInt32(obj.ToString());
            }
            catch { }
            return false;
        }
                                     
        
            Есть класс, который принимает список производных только от object классов. Необходимо было запихнуть в него мой класс и пошаманить над переменной stream. Дальше я думаю комментарии не требуются.
        
        
            
 GreatMASTERcpp,
            09 Июня 2014
        
        
        
         
        - 
        
        
                +103        
        
                            - 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 - 21
 - 22
 - 23
 - 24
 - 25
 - 26
 - 27
 - 28
 
                        public bool Enabled(string elementId)
        {
            bool flag = false;
            bool flagFalse = false;
            bool flagTrue = false;
            bool mainFlag = false;
            IWebElement input = Driver.FindElement(By.Id(elementId));
            if (input.Enabled == true)
            {
                flagTrue = true;                
            }
            else
                if (input.Enabled == false)
                {
                    flagFalse = false;                    
                }
            if (flagTrue = true)
            {
                mainFlag = flagTrue;
            }
            else if (flagFalse == false)
            {
                mainFlag = flagFalse;
            }
            return mainFlag;
        }
                                     
        
            Астрологи объявили неделю флагов. Их количество увеличивается вдвое.
        
        
            
 alexCoder2007,
            07 Июня 2014
        
        
        
         
        - 
        
        
                +104        
        
                            - 1
 - 2
 - 3
 - 4
 - 5
 - 6
 - 7
 - 8
 - 9
 
                        public bool EqualsToZero(int a){
 try {
  var b=100/a;
  return false;
 }
 catch{
  return true;
 }
}
                                     
        
            Why not?
        
        
            
 alexCoder2007,
            06 Июня 2014
        
        
        
         
        - 
        
        
                +110        
        
                            - 1
 
                        private string _guin = Convert.ToString(Convert.ToString(Convert.ToString((string)Guid.NewGuid().ToString()).ToString() as string).ToString() as string).ToString() as string;
                                     
        
            
        
        
            
 alexCoder2007,
            05 Июня 2014
        
        
        
         
        - 
        
        
                +133        
        
                            - 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 
                        try
            {
                DirectoryInfo dir = new DirectoryInfo(Path.GetDirectoryName(filePath));
                if (!dir.Exists)
                {
                    dir.Create();
                }
            }
            catch (IOException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            catch
            {
                throw new Exception("Системная ошибка при создании директории");
            }
                                     
        
            
        
        
            
 EADG,
            05 Июня 2014
        
        
        
         
        - 
        
        
                +143        
        
                            - 1
 - 2
 - 3
 - 4
 - 5
 - 6
 
                        public bool IsValidDirectoryPath(string directoryPath)
{
    bool isValid = true;
    if (directoryPath == "") { isValid = false; }
    return isValid;
}
                                     
        
            Nuff said.
        
        
            
 Dryxxxa,
            04 Июня 2014
        
        
        
         
        - 
        
        
                +134        
        
                            - 1
 - 2
 - 3
 - 4
 - 5
 
                        //костыль так как 1бф у нас не как все
                if (mod.ModulType == null)
                {
                    if (Inlist[0].Contains("1BF01")) mod.ModulType = "DO";
                }
                                     
        
            Решил допилить свою прогу, наткнулся на вот такой кусок)) замудренный алгоритм работал как часы, но все же без подпорок не обошлось.
        
        
            
 HeinzTockler,
            03 Июня 2014
        
        
        
         
        - 
        
        
                +133        
        
                            - 01
 - 02
 - 03
 - 04
 - 05
 - 06
 - 07
 - 08
 - 09
 - 10
 - 11
 - 12
 - 13
 - 14
 - 15
 - 16
 - 17
 - 18
 - 19
 - 20
 - 21
 - 22
 - 23
 - 24
 - 25
 - 26
 - 27
 - 28
 - 29
 - 30
 - 31
 - 32
 - 33
 - 34
 - 35
 - 36
 
                        //checks if the string is a hex stream e.g. "31 32 33 6A F8"
        private bool _IsHexStream(string sValue)
        {
            sValue = sValue.Trim();
            
            if (sValue.Length < 2)
            {
                return false;
            }
            for (int i = 0; i < sValue.Length; i++)
            {
                if(_IsHexChar(Convert.ToChar(sValue.Substring(i,1))) == false)
                {
                    return false;
                }
            }
            //every third char must be a space, only possible in case of two bytes
            if (sValue.Length > 3)
            {
                for (int i = 2; i < sValue.Length; i += 3)
                {
                    string sBuffer = sValue.Substring(i, 1);
                    if (sBuffer.Equals(" ") == false)
                    {
                        return false;
                    }
                }
            }
            //string is a hex stream 
            return true;
        }
                                     
        
            
        
        
            
 blackhearted,
            02 Июня 2014